OLD | NEW |
---|---|
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 } |
11 | 11 |
12 /** | 12 /** |
13 * @const | 13 * @const |
14 * @type {!Array.<!Object, string>} | 14 * type {!Array.<{source: !Object, url: string, name: string}>} |
lushnikov
2014/08/12 13:21:06
@type
semeny
2014/08/12 14:27:59
Done.
| |
15 */ | 15 */ |
16 WebInspector.DocumentationURLProvider._sources = [ | 16 WebInspector.DocumentationURLProvider._sources = [ |
17 { source: window, url: "javascript/" }, | 17 { source: window, url: "javascript/", name: "Global" }, |
18 { source: window.Node.prototype, url: "dom/Node/" }, | 18 { source: window.Node.prototype, url: "dom/Node/", name: "Node.prototype" }, |
19 { source: window.Node, url: "dom/Node/" }, | 19 { source: window.Node, url: "dom/Node/", name: "Node" }, |
20 { source: window.Object.prototype, url: "javascript/Object/" }, | 20 { source: window.Object.prototype, url: "javascript/Object/", name: "Object. prototype" }, |
21 { source: window.Object, url: "javascript/Object/" }, | 21 { source: window.Object, url: "javascript/Object/", name: "Object" }, |
22 { source: window.Math, url: "javascript/Math/" }, | 22 { source: window.Math, url: "javascript/Math/", name: "Math" }, |
23 { source: window.Array.prototype, url: "javascript/Array/" }, | 23 { source: window.Array.prototype, url: "javascript/Array/", name: "Array.pro totype" }, |
24 { source: window.Array, url: "javascript/Array/" }, | 24 { source: window.Array, url: "javascript/Array/", name: "Array" }, |
25 { source: window.String.prototype, url: "javascript/String/" }, | 25 { source: window.String.prototype, url: "javascript/String/", name: "String. prototype" }, |
26 { source: window.String, url: "javascript/String/" }, | 26 { source: window.String, url: "javascript/String/", name: "String" }, |
27 { source: window.Date.prototype, url: "javascript/Date/" }, | 27 { source: window.Date.prototype, url: "javascript/Date/", name: "Date.protot ype" }, |
28 { source: window.Date, url: "javascript/Date/" }, | 28 { source: window.Date, url: "javascript/Date/", name: "Date" }, |
29 { source: window.JSON, url: "javascript/JSON/" } | 29 { source: window.JSON, url: "javascript/JSON/", name: "JSON" } |
30 ]; | 30 ]; |
31 | 31 |
32 /** | 32 /** |
33 * @const | 33 * @const |
34 */ | 34 */ |
35 WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&forma t=json" | 35 WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&forma t=json" |
lushnikov
2014/08/12 13:21:06
semicolon
| |
36 | 36 |
37 WebInspector.DocumentationURLProvider.prototype = { | 37 WebInspector.DocumentationURLProvider.prototype = { |
38 /** | 38 /** |
39 * @param {string} searchTerm | 39 * @param {string} searchTerm |
40 * @return {?string} | 40 * @return {!Array.<{url: string, name: string}>} |
41 */ | 41 */ |
42 itemPath: function(searchTerm) | 42 itemDescriptors: function(searchTerm) |
43 { | 43 { |
44 var possibleProperties = []; | |
44 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt h; ++i) { | 45 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt h; ++i) { |
45 var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; | 46 var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; |
46 if (sourceRef.source[searchTerm] instanceof Function) | 47 if (sourceRef.source[searchTerm] instanceof Function) { |
47 return String.sprintf(WebInspector.DocumentationURLProvider._url Format, sourceRef.url, searchTerm); | 48 var property = { |
49 url: String.sprintf(WebInspector.DocumentationURLProvider._u rlFormat, sourceRef.url, searchTerm), | |
50 name: sourceRef.name + "." + searchTerm | |
51 } | |
lushnikov
2014/08/12 13:21:06
semicolon
semeny
2014/08/12 14:27:59
Done.
| |
52 possibleProperties.push(property); | |
53 } | |
48 } | 54 } |
49 return null; | 55 return possibleProperties; |
50 } | 56 } |
51 } | 57 } |
OLD | NEW |