-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report: create faux psi report (#12815)
- Loading branch information
Showing
10 changed files
with
312 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<!-- | ||
* Copyright 2021 The Lighthouse Authors. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
--> | ||
|
||
<!-- | ||
This fake psi page is intended to reproduce the experience of rendering two LHRs within the same DOM, | ||
like in PageSpeed Insights. This helps surface the peculiar behavior around tabs, | ||
expectations of unique IDs, and scoped report containment. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
--> | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> | ||
<title>Faux PageSpeed Report</title> | ||
<style>/*%%LIGHTHOUSE_CSS%%*/</style> | ||
|
||
<style> | ||
/* Inspired by https://codepen.io/markcaron/pen/MvGRYV?editors=1100 but improved. s*/ | ||
/* | ||
The tab visibility basics | ||
*/ | ||
.tabset > input[type="radio"] { | ||
position: absolute; | ||
left: -200vw; | ||
} | ||
|
||
.tabset .tab-panel { | ||
display: none; | ||
} | ||
|
||
.tabset > input:nth-of-type(1):checked ~ .tab-panels > .tab-panel:nth-of-type(1), | ||
.tabset > input:nth-of-type(2):checked ~ .tab-panels > .tab-panel:nth-of-type(2) { | ||
display: block; | ||
} | ||
|
||
/* | ||
Purdy tabs | ||
*/ | ||
.tabset > label { | ||
position: relative; | ||
display: inline-block; | ||
padding: 15px 55px 15px; | ||
border: 1px solid transparent; | ||
border-bottom: 0; | ||
cursor: pointer; | ||
font-weight: 600; | ||
} | ||
|
||
.tabset > label:hover { | ||
background-color: hsl(0deg 0% 100% / 24%); | ||
} | ||
|
||
.tabset > label:hover, | ||
.tabset > input:focus + label { | ||
color: #06c; | ||
} | ||
|
||
.tabset > input:checked + label { | ||
border-color: #ccc; | ||
border-bottom: 1px solid #fff; | ||
margin-bottom: -1px; | ||
background: white; | ||
} | ||
|
||
.tab-panel { | ||
padding: 30px 0; | ||
border-top: 1px solid #ccc; | ||
} | ||
|
||
body { | ||
padding: 30px; | ||
} | ||
|
||
.tabset { | ||
max-width: 65em; | ||
background: #eee; | ||
} | ||
|
||
.tab-panels { | ||
background: white; | ||
} | ||
|
||
/* extra styles */ | ||
body { | ||
background: hsl(217deg 89% 61%); | ||
} | ||
</style> | ||
</head> | ||
<body > | ||
<noscript>PSI requires JavaScript. Please enable.</noscript> | ||
|
||
<div class="element-screenshots-container"></div> | ||
|
||
|
||
<div class="tabset lh-vars lh-root"> | ||
|
||
<input type="radio" name="tabset" id="tab1" aria-controls="mobile" checked> | ||
<label for="tab1">Mobile</label> | ||
|
||
<input type="radio" name="tabset" id="tab2" aria-controls="desktop"> | ||
<label for="tab2">Desktop</label> | ||
|
||
<div class="tab-panels"> | ||
<section id="mobile" class="tab-panel"> | ||
<main></main> | ||
</section> | ||
|
||
<section id="desktop" class="tab-panel"> | ||
<main></main> | ||
</section> | ||
|
||
</div> | ||
</div> | ||
|
||
<script>window.__LIGHTHOUSE_JSON__ = %%LIGHTHOUSE_JSON%%;</script> | ||
<script type="module"> | ||
%%LIGHTHOUSE_JAVASCRIPT%% | ||
//# sourceURL=psi-reportrenderer.js | ||
</script> | ||
<script>console.log('window.__LIGHTHOUSE_JSON__', __LIGHTHOUSE_JSON__);</script> | ||
</body> | ||
</html> |
Oops, something went wrong.
ขอบคุณสำหรับความรู้