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

Unified Diff: chrome/common/extensions/docs/js/bootstrap.js

Issue 179068: Extension Doc Changes (no building or testable changes): minor changes for tab & windows doc (Closed)
Patch Set: touch grd. rendered docs Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/js/bootstrap.js
diff --git a/chrome/common/extensions/docs/js/bootstrap.js b/chrome/common/extensions/docs/js/bootstrap.js
index 24bb89c55a26556cd89ecc0de95ab95a82ef8268..7741df062d465120f993621ae1c96423dd618988 100755
--- a/chrome/common/extensions/docs/js/bootstrap.js
+++ b/chrome/common/extensions/docs/js/bootstrap.js
@@ -1,28 +1,26 @@
-// Hide body content initially to minimize flashing.
-document.write('<style id="hider" type="text/css">');
-document.write('body { display:none!important; }');
-document.write('</style>');
+// Regenerate page if we are passed the "?regenerate" search param
+// or if the user-agent is chrome AND the document is being served
+// from the file:/// scheme.
+if (window.location.search == "?regenerate" ||
+ (navigator.userAgent.indexOf("Chrome") > -1) &&
+ (window.location.href.match("^file:"))) {
+
+ // Hide body content initially to minimize flashing.
+ document.write('<style id="hider" type="text/css">');
+ document.write('body { display:none!important; }');
+ document.write('</style>');
-window.onload = function() {
- // Regenerate page if we are passed the "?regenerate" search param
- // or if the user-agent is chrome AND the document is being served
- // from the file:/// scheme.
- if (window.location.search == "?regenerate" ||
- navigator.userAgent.indexOf("Chrome") > -1) {
- window.renderPage();
- } else {
- postRender();
- }
-}
+ window.onload = window.renderPage;
-function postRender() {
- var elm = document.getElementById("hider");
- elm.parentNode.removeChild(elm);
+ window.postRender = function() {
+ var elm = document.getElementById("hider");
+ elm.parentNode.removeChild(elm);
- // Since populating the page is done asynchronously, the DOM doesn't exist
- // when the browser tries to resolve any #anchors in the URL. So we reset the
- // URL once we're done, which forces the browser to scroll to the anchor as it
- // normally would.
- if (location.hash.length > 1)
- location.href = location.href;
+ // Since populating the page is done asynchronously, the DOM doesn't exist
+ // when the browser tries to resolve any #anchors in the URL. So we reset
+ // the URL once we're done, which forces the browser to scroll to the anchor
+ // as it normally would.
+ if (location.hash.length > 1)
+ location.href = location.href;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698