From 9eed98a471a7beb59e9b9d6e968c06a464a55104 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Tue, 11 Aug 2009 07:29:56 +0000 Subject: Re-fix the flicker during extension docs render. Caused by two things: * The extension docs are self-mutation code which is pretty confusing. The JavaScript mutates the DOM, and the result is then serialized. This result is the basis for the next JavaScript run. Weird things can therefore happen if you try and follow the pattern "set initial style at low priority, override with higher priority later". Because the high priority ends up getting serialized out. Answer: instead of overriding body style with higher priority rule to show, remove low priority rule. This should leave the serialized output in a more consistent state run to run. * The templates are rendered in several asynchronous steps because of the XHR. This means that setting the style after render() exits isn't sufficient, need to wait until entire callback chain is complete. Code was already trying to do this, but had the problem described above. Fixed. Also, did some sprucing of the table of contents. TBR=rafaelw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23014 0039d316-1c4b-4281-b951-d872f2087c98 --- .../extensions/docs/js/api_page_generator.js | 3 +- chrome/common/extensions/docs/js/bootstrap.js | 6 +-- .../common/extensions/docs/static/tool_strips.html | 44 ---------------------- .../common/extensions/docs/static/toolstrip.html | 44 ++++++++++++++++++++++ chrome/common/extensions/docs/static/xhr.html | 16 -------- .../extensions/docs/template/api_template.html | 13 +++---- 6 files changed, 55 insertions(+), 71 deletions(-) delete mode 100755 chrome/common/extensions/docs/static/tool_strips.html create mode 100755 chrome/common/extensions/docs/static/toolstrip.html delete mode 100755 chrome/common/extensions/docs/static/xhr.html (limited to 'chrome/common/extensions/docs') diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js index adee3db..ea0a3f0 100755 --- a/chrome/common/extensions/docs/js/api_page_generator.js +++ b/chrome/common/extensions/docs/js/api_page_generator.js @@ -171,7 +171,8 @@ function renderTemplate(schemaContent) { jstProcess(input, output); // Show. - document.getElementsByTagName("body")[0].style.display = "block"; + var elm = document.getElementById("hider"); + elm.parentNode.removeChild(elm); if (parent && parent.done) parent.done(); diff --git a/chrome/common/extensions/docs/js/bootstrap.js b/chrome/common/extensions/docs/js/bootstrap.js index 28f21ce..e698917 100755 --- a/chrome/common/extensions/docs/js/bootstrap.js +++ b/chrome/common/extensions/docs/js/bootstrap.js @@ -1,6 +1,6 @@ // Hide body content initially to minimize flashing. -document.write(''); window.onload = function() { @@ -11,4 +11,4 @@ window.onload = function() { navigator.userAgent.indexOf("Chrome") > -1) { window.renderPage(); } -} \ No newline at end of file +} diff --git a/chrome/common/extensions/docs/static/tool_strips.html b/chrome/common/extensions/docs/static/tool_strips.html deleted file mode 100755 index fbf2248..0000000 --- a/chrome/common/extensions/docs/static/tool_strips.html +++ /dev/null @@ -1,44 +0,0 @@ - -

Toolstrips allow you to add UI to Chrome's toolbar area. Toolstrips are nothing more than (very small) HTML pages, so anything you can do with HTML/CSS/JavaScript, you can do with toolstrips.

- -

Status

-

Implementation in progress.

- -

Details

-

Register your toolstrips in the extension manifest, like this:

- -
{
-  "name": "My First Extension",
-  "version": "1.0",
-  "description": "The first extension that I made.",
-  "toolstrips": [
-    "one_toolstrip.html",
-    "two_toolstrip.html"
-  ]
-}
- -

You can create buttons that look like the bookmark bar buttons using this template:

- -
<div class="toolstrip-button">
-  <!-- Image is optional and should be a 16x16 icon. -->
-  <img src="path/to/some_icon.png">
-  <span>My Button</span>
-</div>
- -

Debugging Tips

- - - -

Design Tips

- - - diff --git a/chrome/common/extensions/docs/static/toolstrip.html b/chrome/common/extensions/docs/static/toolstrip.html new file mode 100755 index 0000000..fbf2248 --- /dev/null +++ b/chrome/common/extensions/docs/static/toolstrip.html @@ -0,0 +1,44 @@ + +

Toolstrips allow you to add UI to Chrome's toolbar area. Toolstrips are nothing more than (very small) HTML pages, so anything you can do with HTML/CSS/JavaScript, you can do with toolstrips.

+ +

Status

+

Implementation in progress.

+ +

Details

+

Register your toolstrips in the extension manifest, like this:

+ +
{
+  "name": "My First Extension",
+  "version": "1.0",
+  "description": "The first extension that I made.",
+  "toolstrips": [
+    "one_toolstrip.html",
+    "two_toolstrip.html"
+  ]
+}
+ +

You can create buttons that look like the bookmark bar buttons using this template:

+ +
<div class="toolstrip-button">
+  <!-- Image is optional and should be a 16x16 icon. -->
+  <img src="path/to/some_icon.png">
+  <span>My Button</span>
+</div>
+ +

Debugging Tips

+ + + +

Design Tips

+ + + diff --git a/chrome/common/extensions/docs/static/xhr.html b/chrome/common/extensions/docs/static/xhr.html deleted file mode 100755 index 43be3bcc..0000000 --- a/chrome/common/extensions/docs/static/xhr.html +++ /dev/null @@ -1,16 +0,0 @@ - -

The standard XMLHttpRequest object can be used to communicate with multiple origins (ie domains) from an extension. You must pre-register the domains you want to talk to in the manifest, like so:

- -
{
-  "name": "My First Extension",
-  "version": "1.0",
-  "description": "The first extension that I made.",
-  "permissions": [
-    "http://www.blogger.com",
-    "http://*.google.com"
-  ]
-}
- -

Status

-

Implemented, but we don't yet enforce the permissions; all origins are allowed for now.

- diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html index ca95974..b9f54c8 100755 --- a/chrome/common/extensions/docs/template/api_template.html +++ b/chrome/common/extensions/docs/template/api_template.html @@ -40,17 +40,16 @@
  • Overview
  • Reference
  • Samples -- cgit v1.1