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

Side by Side Diff: doc/res/js/docs.js

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
« no previous file with comments | « doc/Makefile ('k') | doc/templates/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 sk.DomReady.then(function() {
2 prettyPrint();
3
4 // Open the side drawer with the navigation menu.
5 $$$('button').addEventListener('click', function(e) {
6 $$$('#drawer').classList.add('opened');
7 e.stopPropagation();
8 });
9
10 // Close the side drawer.
11 $$$('body').addEventListener('click', function() {
12 $$$('#drawer').classList.remove('opened');
13 });
14
15 // highlightNav highlights where we are in the navigation.
16 var highlightNav = function() {
17 $$('#drawer li a').forEach(function(e) {
18 if (e.dataset.path == window.location.pathname) {
19 e.classList.add('selected');
20 $$$('title').innerText = e.innerText;
21 } else {
22 e.classList.remove('selected');
23 }
24 });
25 }
26
27 // Shortcut the links and handle them via XHR, that way we only
28 // pay the loading time once, yet still retain full URLs.
29 $$('#drawer li a').forEach(function(e) {
30 e.addEventListener('click', function(e) {
31 // Preserve query parameters as we navigate.
32 var q = window.location.search;
33 var url = e.target.dataset.path;
34 if (q != "") {
35 url += q;
36 }
37 sk.get('/_'+url).then(function(content) {
38 window.history.pushState(null, null, url);
39 highlightNav();
40 $$$('html #content').innerHTML = content;
41 $$$('html #page').scrollIntoView();
42 prettyPrint();
43 });
44 e.preventDefault();
45 });
46 });
47
48 highlightNav();
49 });
50
51 (function() {
52 var cx = '009791159600898516779:8-nlv0iznho';
53 var gcse = document.createElement('script');
54 gcse.type = 'text/javascript';
55 gcse.async = true;
56 gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
57 '//cse.google.com/cse.js?cx=' + cx;
58 var s = document.getElementsByTagName('script')[0];
dogben 2016/04/27 17:10:31 Is this referring to the script element that you r
jcgregorio 2016/04/27 17:17:30 No, this is just code that says add this new scrip
59 s.parentNode.insertBefore(gcse, s);
60 })();
OLDNEW
« no previous file with comments | « doc/Makefile ('k') | doc/templates/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698