| 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.<!Object, string>} |
| 15 */ | 15 */ |
| 16 WebInspector.DocumentationURLProvider._sources = [ | 16 WebInspector.DocumentationURLProvider._sources = [ |
| 17 { source: window, url: "javascript/" }, | 17 { source: window, url: "javascript/" }, |
| 18 { source: window.Node.prototype, url: "dom/Node/" }, | 18 { source: window.Node.prototype, url: "dom/Node/" }, |
| 19 { source: window.Node, url: "dom/Node/" }, |
| 20 { source: window.Object.prototype, url: "javascript/Object/" }, |
| 19 { source: window.Object, url: "javascript/Object/" }, | 21 { source: window.Object, url: "javascript/Object/" }, |
| 20 { source: window.Math, url: "javascript/Math/" }, | 22 { source: window.Math, url: "javascript/Math/" }, |
| 23 { source: window.Array.prototype, url: "javascript/Array/" }, |
| 21 { source: window.Array, url: "javascript/Array/" }, | 24 { source: window.Array, url: "javascript/Array/" }, |
| 25 { source: window.String.prototype, url: "javascript/String/" }, |
| 22 { source: window.String, url: "javascript/String/" }, | 26 { source: window.String, url: "javascript/String/" }, |
| 27 { source: window.Date.prototype, url: "javascript/Date/" }, |
| 23 { source: window.Date, url: "javascript/Date/" }, | 28 { source: window.Date, url: "javascript/Date/" }, |
| 24 { source: window.JSON, url: "javascript/JSON/" } | 29 { source: window.JSON, url: "javascript/JSON/" } |
| 25 ]; | 30 ]; |
| 26 | 31 |
| 27 /** | 32 /** |
| 28 * @const | 33 * @const |
| 29 */ | 34 */ |
| 30 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" |
| 31 | 36 |
| 32 WebInspector.DocumentationURLProvider.prototype = { | 37 WebInspector.DocumentationURLProvider.prototype = { |
| 33 /** | 38 /** |
| 34 * @param {string} searchTerm | 39 * @param {string} searchTerm |
| 35 * @return {?string} | 40 * @return {?string} |
| 36 */ | 41 */ |
| 37 itemPath: function(searchTerm) | 42 itemPath: function(searchTerm) |
| 38 { | 43 { |
| 39 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt
h; ++i) { | 44 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt
h; ++i) { |
| 40 var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; | 45 var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; |
| 41 if (sourceRef.source[searchTerm] instanceof Function) | 46 if (sourceRef.source[searchTerm] instanceof Function) |
| 42 return String.sprintf(WebInspector.DocumentationURLProvider._url
Format, sourceRef.url, searchTerm); | 47 return String.sprintf(WebInspector.DocumentationURLProvider._url
Format, sourceRef.url, searchTerm); |
| 43 } | 48 } |
| 44 return null; | 49 return null; |
| 45 } | 50 } |
| 46 } | 51 } |
| OLD | NEW |