Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: doc/templates/index.html

Issue 1926683002: docserver: Load JS async defer since it really isn't required and it was blocking the loading of th… (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: consolidate js Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« doc/res/js/docs.js ('K') | « doc/res/js/docs.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Docs</title> 4 <title>Docs</title>
5 <meta charset="utf-8"> 5 <meta charset="utf-8">
6 <meta name="theme-color" content="#526E9C"> 6 <meta name="theme-color" content="#526E9C">
7 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 7 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 8 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9 <meta name="google-site-verification" content="pwqU0tZr1xJubovbW73M6WGA2IIyg CYPBkB6O4kzbYI" /> 9 <meta name="google-site-verification" content="pwqU0tZr1xJubovbW73M6WGA2IIyg CYPBkB6O4kzbYI" />
10 <meta name="google-site-verification" content="pIHubYTE28EzwOWGWmHyNmxRNA6yc lJyxSymw6uX8b8" /> 10 <meta name="google-site-verification" content="pIHubYTE28EzwOWGWmHyNmxRNA6yc lJyxSymw6uX8b8" />
11 <script src="/res/js/core.js"></script> 11 <script async src="/res/js/core.js"></script>
12 <link href="/res/css/docs.css" rel="stylesheet" /> 12 <link href="/res/css/docs.css" rel="stylesheet" />
13 </head> 13 </head>
14 <body> 14 <body>
15 <div id=page> 15 <div id=page>
16 <div id=drawer drawer vertical layout> 16 <div id=drawer drawer vertical layout>
17 <img src="/res/img/logo.png" width=204 height=91> 17 <img src="/res/img/logo.png" width=204 height=91>
18 18
19 <script>
20 (function() {
21 var cx = '009791159600898516779:8-nlv0iznho';
22 var gcse = document.createElement('script');
23 gcse.type = 'text/javascript';
24 gcse.async = true;
25 gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'htt p:') +
26 '//cse.google.com/cse.js?cx=' + cx;
27 var s = document.getElementsByTagName('script')[0];
28 s.parentNode.insertBefore(gcse, s);
29 })();
30 </script>
31 <gcse:searchbox-only></gcse:searchbox-only> 19 <gcse:searchbox-only></gcse:searchbox-only>
32 20
33 {{.Nav}} 21 {{.Nav}}
34 </div> 22 </div>
35 23
36 <div id=body main> 24 <div id=body main>
37 <button id=menu title="Menu"> 25 <button id=menu title="Menu">
38 <svg viewBox="0 0 24 24" height="24px" width="24px"> 26 <svg viewBox="0 0 24 24" height="24px" width="24px">
39 <g> 27 <g>
40 <path d="M3 18h18v-2h-18v2zm0-5h18v-2h-18v2zm0-7v2h18v-2h-18z"></pa th> 28 <path d="M3 18h18v-2h-18v2zm0-5h18v-2h-18v2zm0-7v2h18v-2h-18z"></pa th>
41 </g> 29 </g>
42 </svg> 30 </svg>
43 </button> 31 </button>
44 <div id=content> 32 <div id=content>
45 {{.Body}} 33 {{.Body}}
46 </div> 34 </div>
47 </div> 35 </div>
48 </div> 36 </div>
49
50 <script>
51 sk.DomReady.then(function() {
52 prettyPrint();
53
54 // Open the side drawer with the navigation menu.
55 $$$('button').addEventListener('click', function(e) {
56 $$$('#drawer').classList.add('opened');
57 e.stopPropagation();
58 });
59
60 // Close the side drawer.
61 $$$('body').addEventListener('click', function() {
62 $$$('#drawer').classList.remove('opened');
63 });
64
65 // highlightNav highlights where we are in the navigation.
66 var highlightNav = function() {
67 $$('#drawer li a').forEach(function(e) {
68 if (e.dataset.path == window.location.pathname) {
69 e.classList.add('selected');
70 $$$('title').innerText = e.innerText;
71 } else {
72 e.classList.remove('selected');
73 }
74 });
75 }
76
77 // Shortcut the links and handle them via XHR, that way we only
78 // pay the loading time once, yet still retain full URLs.
79 $$('#drawer li a').forEach(function(e) {
80 e.addEventListener('click', function(e) {
81 // Preserve query parameters as we navigate.
82 var q = window.location.search;
83 var url = e.target.dataset.path;
84 if (q != "") {
85 url += q;
86 }
87 sk.get('/_'+url).then(function(content) {
88 window.history.pushState(null, null, url);
89 highlightNav();
90 $$$('html #content').innerHTML = content;
91 $$$('html #page').scrollIntoView();
92 prettyPrint();
93 });
94 e.preventDefault();
95 });
96 });
97
98 highlightNav();
99 });
100 </script>
101 </body> 37 </body>
102 </html> 38 </html>
OLDNEW
« doc/res/js/docs.js ('K') | « doc/res/js/docs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698