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

Side by Side Diff: Source/devtools/front_end/documentation/DocumentationURLProvider.js

Issue 471583003: DevTools: [Documentation] Add property token autodetection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sources-patch
Patch Set: Created descriptor record type Created 6 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
« no previous file with comments | « no previous file | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 */ 7 */
8 WebInspector.DocumentationURLProvider = function() 8 WebInspector.DocumentationURLProvider = function()
9 { 9 {
10 } 10 }
(...skipping 20 matching lines...) Expand all
31 { source: window.Number.prototype, url: "javascript/Number/", name: "Number. prototype"}, 31 { source: window.Number.prototype, url: "javascript/Number/", name: "Number. prototype"},
32 { source: window.Error.prototype, url: "javascript/Error/", name: "Error.pro totype"}, 32 { source: window.Error.prototype, url: "javascript/Error/", name: "Error.pro totype"},
33 { source: window.RegExp.prototype, url: "javascript/RegExp/", name: "RegExp. prototype"} 33 { source: window.RegExp.prototype, url: "javascript/RegExp/", name: "RegExp. prototype"}
34 ]; 34 ];
35 35
36 /** 36 /**
37 * @const 37 * @const
38 */ 38 */
39 WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&forma t=json" 39 WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&forma t=json"
40 40
41 /**
42 * @typedef {{url: string, name: string, searchItem: string}}
43 */
44 WebInspector.DocumentationURLProvider.ItemDescriptor;
45
41 WebInspector.DocumentationURLProvider.prototype = { 46 WebInspector.DocumentationURLProvider.prototype = {
42 /** 47 /**
43 * @param {string} searchTerm 48 * @param {string} searchTerm
44 * @return {!Array.<{url: string, name: string}>} 49 * @return {!Array.<!WebInspector.DocumentationURLProvider.ItemDescriptor>}
45 */ 50 */
46 itemDescriptors: function(searchTerm) 51 itemDescriptors: function(searchTerm)
47 { 52 {
48 var descriptors = []; 53 var descriptors = [];
49 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt h; ++i) { 54 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt h; ++i) {
50 var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; 55 var sourceRef = WebInspector.DocumentationURLProvider._sources[i];
51 if (!sourceRef.source.hasOwnProperty(searchTerm)) 56 if (!sourceRef.source.hasOwnProperty(searchTerm))
52 continue; 57 continue;
53 descriptors.push(createDescriptor(searchTerm.toUpperCase() === searc hTerm ? "constants" : searchTerm)); 58 descriptors.push(createDescriptor(searchTerm.toUpperCase() === searc hTerm ? "constants" : searchTerm));
54 } 59 }
55 return descriptors; 60 return descriptors;
56 61
57 /** 62 /**
58 * @param {string} searchTerm 63 * @param {string} searchTerm
59 * @return {{url: string, name: string}} 64 * @return {!WebInspector.DocumentationURLProvider.ItemDescriptor}
60 */ 65 */
61 function createDescriptor(searchTerm) 66 function createDescriptor(searchTerm)
62 { 67 {
63 return { 68 return {
64 url: String.sprintf(WebInspector.DocumentationURLProvider._urlFo rmat, sourceRef.url, searchTerm), 69 url: String.sprintf(WebInspector.DocumentationURLProvider._urlFo rmat, sourceRef.url, searchTerm),
65 name: sourceRef.name 70 name: sourceRef.name,
71 searchItem: searchTerm
66 }; 72 };
67 } 73 }
68 } 74 }
69 } 75 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698