Commit 703664dc authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

[SuperSize] HTML Viewer: Fix indents in .html files.

Changing 4-indent to 2-indent. Also:
- Make <style> and <script> tags indent from start of line.
- Fix several missing ';' in JS.

Bug: 880671
Change-Id: Iddda84bbdcf5040935d27643925aebb1433580c7
Reviewed-on: https://chromium-review.googlesource.com/1237141
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592907}
parent 0d17f44c
...@@ -7,145 +7,145 @@ ...@@ -7,145 +7,145 @@
--> -->
<head> <head>
<title>Super Size Tiger View</title> <title>Super Size Tiger View</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#4285f4"> <meta name="theme-color" content="#4285f4">
<link href="https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,500" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,500" rel="stylesheet">
<link rel="stylesheet" href="main.css"> <link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="options.css"> <link rel="stylesheet" href="options.css">
<style> <style>
body { body {
grid-template-columns: auto; grid-template-columns: auto;
grid-template-areas: "appbar" "select"; grid-template-areas: "appbar" "select";
} }
form { form {
grid-area: 'select'; grid-area: 'select';
margin: auto; margin: auto;
} }
</style> </style>
<link rel="icon" href="favicon.ico" sizes="16x16 32x32 256x256" type="image/x-icon"> <link rel="icon" href="favicon.ico" sizes="16x16 32x32 256x256" type="image/x-icon">
<script> <script>
const DESIRED_CPUS = ['arm', 'arm_64'] const DESIRED_CPUS = ['arm', 'arm_64'];
const DESIRED_APKS = ['Monochrome.apk', 'ChromeModern.apk'] const DESIRED_APKS = ['Monochrome.apk', 'ChromeModern.apk'];
const DESIRED_VERSION = [ const DESIRED_VERSION = [
'60.0.3112.116', '60.0.3112.116',
'61.0.3163.98', '61.0.3163.98',
'62.0.3202.84', '62.0.3202.84',
'63.0.3239.111', '63.0.3239.111',
'64.0.3282.137', '64.0.3282.137',
'65.0.3325.85', '65.0.3325.85',
'66.0.3359.158', '66.0.3359.158',
'67.0.3396.87', '67.0.3396.87',
'68.0.3440.70', '68.0.3440.70',
] ];
/** /**
* @param {string[]} options * @param {string[]} options
*/ */
function buildOptions(options) { function buildOptions(options) {
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
for (const option of options) { for (const option of options) {
const optionEl = document.createElement('option'); const optionEl = document.createElement('option');
optionEl.value = option; optionEl.value = option;
optionEl.textContent = option; optionEl.textContent = option;
fragment.appendChild(optionEl); fragment.appendChild(optionEl);
} }
return fragment; return fragment;
} }
/** /**
* Is `v1` a larger version than `v2`? * Is `v1` a larger version than `v2`?
* @param {string} v1 * @param {string} v1
* @param {string} v2 * @param {string} v2
*/ */
function isGreaterOrEqual(v1, v2) { function isGreaterOrEqual(v1, v2) {
const [version1] = v1.split('.', 1).map(n => parseInt(n, 10)); const [version1] = v1.split('.', 1).map(n => parseInt(n, 10));
const [version2] = v2.split('.', 1).map(n => parseInt(n, 10)); const [version2] = v2.split('.', 1).map(n => parseInt(n, 10));
return version1 >= version2; return version1 >= version2;
} }
(async () => { (async () => {
const response = await fetch('milestones/milestones.json'); const response = await fetch('milestones/milestones.json');
const {pushed} = await response.json(); const {pushed} = await response.json();
if (document.readyState === 'loading') { if (document.readyState === 'loading') {
await new Promise(resolve => { await new Promise(resolve => {
document.onreadystatechange = () => { document.onreadystatechange = () => {
if (document.readyState !== 'loading') { if (document.readyState !== 'loading') {
resolve(); resolve();
document.onreadystatechange = null; document.onreadystatechange = null;
} }
} }
}); });
} }
/** @type {HTMLFormElement} */ /** @type {HTMLFormElement} */
const form = document.getElementById('select-form'); const form = document.getElementById('select-form');
const cpu = form.elements.namedItem('cpu'); const cpu = form.elements.namedItem('cpu');
const apk = form.elements.namedItem('apk'); const apk = form.elements.namedItem('apk');
const version1 = form.elements.namedItem('version1'); const version1 = form.elements.namedItem('version1');
const version2 = form.elements.namedItem('version2'); const version2 = form.elements.namedItem('version2');
cpu.appendChild(buildOptions(pushed.cpu)); cpu.appendChild(buildOptions(pushed.cpu));
apk.appendChild(buildOptions(pushed.apk)); apk.appendChild(buildOptions(pushed.apk));
const versionOptions = buildOptions(pushed.version); const versionOptions = buildOptions(pushed.version);
version1.appendChild(versionOptions.cloneNode(true)); version1.appendChild(versionOptions.cloneNode(true));
version2.appendChild(versionOptions); version2.appendChild(versionOptions);
const version2Options = version2.querySelectorAll('option'); const version2Options = version2.querySelectorAll('option');
if (version2Options.length > 1) { if (version2Options.length > 1) {
version2Options[1].selected = true; version2Options[1].selected = true;
} }
function disableSmallerAfterVersions() { function disableSmallerAfterVersions() {
const newVersion = version1.value; const newVersion = version1.value;
for (const opt of version2Options) { for (const opt of version2Options) {
opt.disabled = isGreaterOrEqual(newVersion, opt.value); opt.disabled = isGreaterOrEqual(newVersion, opt.value);
} }
} }
disableSmallerAfterVersions(); disableSmallerAfterVersions();
version1.addEventListener('change', disableSmallerAfterVersions); version1.addEventListener('change', disableSmallerAfterVersions);
form.addEventListener('submit', event => { form.addEventListener('submit', event => {
event.preventDefault(); event.preventDefault();
const dataUrl = `${cpu.value}/${apk.value}/` + const dataUrl = `${cpu.value}/${apk.value}/` +
`report_${version1.value}_${version2.value}.ndjson`; `report_${version1.value}_${version2.value}.ndjson`;
location.href = `index.html?data_url=milestones/${dataUrl}`; location.href = `index.html?data_url=milestones/${dataUrl}`;
}); });
})() })();
</script> </script>
</head> </head>
<body> <body>
<div class="scrim toggle-options" hidden></div> <div class="scrim toggle-options" hidden></div>
<header class="appbar"> <header class="appbar">
<div class="appbar-inner"> <div class="appbar-inner">
<h1 class="headline">Super Size Tiger View</h1> <h1 class="headline">Super Size Tiger View</h1>
</div> </div>
</header> </header>
<form id="select-form"> <form id="select-form">
<h2 class="subhead">Select milestones to compare</h2> <h2 class="subhead">Select milestones to compare</h2>
<p class="select-wrapper"> <p class="select-wrapper">
<select id="cpu" name="cpu"></select> <select id="cpu" name="cpu"></select>
<label class="select-label" for="cpu">Architecture</label> <label class="select-label" for="cpu">Architecture</label>
</p> </p>
<p class="select-wrapper"> <p class="select-wrapper">
<select id="apk" name="apk"></select> <select id="apk" name="apk"></select>
<label class="select-label" for="apk">APK</label> <label class="select-label" for="apk">APK</label>
</p> </p>
<p class="select-wrapper"> <p class="select-wrapper">
<select id="version1" name="version1"></select> <select id="version1" name="version1"></select>
<label class="select-label" for="version1">Version 1</label> <label class="select-label" for="version1">Version 1</label>
</p> </p>
<p class="select-wrapper"> <p class="select-wrapper">
<select id="version2" name="version2"></select> <select id="version2" name="version2"></select>
<label class="select-label" for="version2">Version 2</label> <label class="select-label" for="version2">Version 2</label>
</p> </p>
<button type="submit" class="text-button filled-button"> <button type="submit" class="text-button filled-button">
Open report Open report
</button> </button>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment