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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/samples.html ('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 <link rel="stylesheet" href="css/samples.css" /> 1 <link rel="stylesheet" href="css/samples.css" />
2 <script jscontent="search_data"></script> 2 <script jscontent="search_data"></script>
3 <script src="js/sample_search.js"></script> 3 <script src="js/sample_search.js"></script>
4 4
5 <script type="text/prerenderjs"> 5 <script type="text/prerenderjs">
6 /** 6 /**
7 * The following code is executed before the jstemplate in this file is 7 * The following code is executed before the jstemplate in this file is
8 * rendered, meaning it can modify template data by changing the pageData 8 * rendered, meaning it can modify template data by changing the pageData
9 * window variable. See api_page_generator.js for more information. 9 * window variable. See api_page_generator.js for more information.
10 * 10 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 for (var i = 0; i < source_files.length; i++) { 49 for (var i = 0; i < source_files.length; i++) {
50 sample.source_files.push({ 50 sample.source_files.push({
51 'file': source_files[i], 51 'file': source_files[i],
52 'url': 'http://src.chromium.org/viewvc/chrome/trunk' + 52 'url': 'http://src.chromium.org/viewvc/chrome/trunk' +
53 '/src/chrome/common/extensions/docs/' + sample.path + 53 '/src/chrome/common/extensions/docs/' + sample.path +
54 source_files[i] + '?content-type=text/plain' 54 source_files[i] + '?content-type=text/plain'
55 }); 55 });
56 } 56 }
57 }); 57 });
58 58
59 function stringifyFlatObjectsReadably(obj) {
60 if (typeof(obj) === "object") {
61 var temp = [];
62 for (key in obj) {
63 if (obj.hasOwnProperty(key)) {
64 if (typeof(key) === "string" && typeof(obj[key]) === "string") {
65 temp.push(" " + JSON.stringify(key) + ": " +
66 JSON.stringify(obj[key]));
67 } 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
68 // We hit something strange; it's not a flat object: abort!
69 return JSON.stringify(obj);
70 }
71 }
72 }
73 return "{\n" + temp.join(",\n") + "}";
74 } else {
75 return JSON.stringify(obj);
76 }
77 }
78
59 // The search data should be injected as executable JavaScript, so assign 79 // The search data should be injected as executable JavaScript, so assign
60 // a template value which will store the data as a page global. 80 // a template value which will store the data as a page global.
61 pageData.search_data = "var search_data = " + 81 pageData.search_data = "var search_data = " +
62 JSON.stringify(search_data); + ";"; 82 stringifyFlatObjectsReadably(search_data) + ";\n";
63 </script> 83 </script>
64 84
65 <div id="controls"> 85 <div id="controls">
66 <div id="searchbox" class="controlbox"> 86 <div id="searchbox" class="controlbox">
67 <strong>Filter by keyword:</strong> 87 <strong>Filter by keyword:</strong>
68 <input autofocus type="search" type="text" id="searchinput" placeholder="Typ e to search" onkeyup="filterSamples();" /> 88 <input autofocus type="search" type="text" id="searchinput" placeholder="Typ e to search" onkeyup="filterSamples();" />
69 <a id="clearlink" href="javascript:void(0);" onclick="clearFilter();" style= "display: none;">clear</a> 89 <a id="clearlink" href="javascript:void(0);" onclick="clearFilter();" style= "display: none;">clear</a>
70 </div> 90 </div>
71 91
72 <div id="filterbox" class="controlbox"> 92 <div id="filterbox" class="controlbox">
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 </div> 128 </div>
109 <div> 129 <div>
110 <a jsvalues="href:'http://src.chromium.org/viewvc/chrome/trunk/src/chrome/co mmon/extensions/docs/' + path" target="_blank">Browse source</a> 130 <a jsvalues="href:'http://src.chromium.org/viewvc/chrome/trunk/src/chrome/co mmon/extensions/docs/' + path" target="_blank">Browse source</a>
111 - <a jsvalues="href:$this.zip_path">Download source</a> 131 - <a jsvalues="href:$this.zip_path">Download source</a>
112 </div> 132 </div>
113 </div> 133 </div>
114 134
115 <div id="noresults" style="display:none"> 135 <div id="noresults" style="display:none">
116 Sorry, no results were found. 136 Sorry, no results were found.
117 </div> 137 </div>
OLDNEW
« 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