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

Unified Diff: chrome/common/extensions/docs/static/samples.html

Issue 7601024: Extension docs: Adjusting `.../samples.html` to have more readable diffs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
« no previous file with comments | « chrome/common/extensions/docs/samples.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/static/samples.html
diff --git a/chrome/common/extensions/docs/static/samples.html b/chrome/common/extensions/docs/static/samples.html
index 5e0df08e876fa0ea8c7b9054a3d00fb77e76b02c..380db00097000861777aebbe4759be878587c285 100644
--- a/chrome/common/extensions/docs/static/samples.html
+++ b/chrome/common/extensions/docs/static/samples.html
@@ -56,10 +56,30 @@
}
});
+ function stringifyFlatObjectsReadably(obj) {
+ if (typeof(obj) === "object") {
+ var temp = [];
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ if (typeof(key) === "string" && typeof(obj[key]) === "string") {
+ temp.push(" " + JSON.stringify(key) + ": " +
+ JSON.stringify(obj[key]));
+ } else {
Pam (message me for reviews) 2011/08/09 11:52:06 I'm not a JS expert, but should this be out one le
Use mkwst_at_chromium.org plz. 2011/08/09 11:57:32 If it's a property that the object doesn't itself
+ // We hit something strange; it's not a flat object: abort!
+ return JSON.stringify(obj);
+ }
+ }
+ }
+ return "{\n" + temp.join(",\n") + "}";
+ } else {
+ return JSON.stringify(obj);
+ }
+ }
+
// The search data should be injected as executable JavaScript, so assign
// a template value which will store the data as a page global.
pageData.search_data = "var search_data = " +
- JSON.stringify(search_data); + ";";
+ stringifyFlatObjectsReadably(search_data) + ";\n";
</script>
<div id="controls">
« no previous file with comments | « chrome/common/extensions/docs/samples.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698