Chromium Code Reviews| Index: Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| diff --git a/Source/devtools/front_end/documentation/DocumentationURLProvider.js b/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8d0300d86429c8fdbbfe63a2cce84f62fc1e988f |
| --- /dev/null |
| +++ b/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @constructor |
| + */ |
| +WebInspector.DocumentationURLProvider = function() {} |
| + |
| +WebInspector.DocumentationURLProvider._Sources = [ |
|
yurys
2014/08/07 08:27:37
Please add type annotation. Also it might make sen
semeny
2014/08/07 09:57:08
Done.
|
| + {source: window, url: "javascript/"}, |
|
lushnikov
2014/08/06 17:27:51
space after "{" and before "}"
semeny
2014/08/07 09:57:08
Done.
|
| + {source: window.Node.prototype, url: "dom/Node/"}, |
| + {source: window.Object, url: "javascript/Object/"}, |
| + {source: window.Math, url: "javascript/Math/"}, |
| + {source: window.Array, url: "javascript/Array/"}, |
| + {source: window.String, url: "javascript/String/"}, |
| + {source: window.Date, url: "javascript/Date/"}, |
| + {source: window.JSON, url: "javascript/JSON/"} |
| +] |
| + |
| +WebInspector.DocumentationURLProvider.prototype = { |
| + /** |
| + * @param {string} searchTerm |
| + * @return {?string} |
| + */ |
| + formItemPath: function(searchTerm) |
|
yurys
2014/08/07 08:27:37
Just itemPath
semeny
2014/08/07 09:57:08
Done.
|
| + { |
| + for (var i = 0; i < WebInspector.DocumentationURLProvider._Sources.length; ++i) { |
| + var sourceRef = WebInspector.DocumentationURLProvider._Sources[i]; |
| + if (sourceRef.source[searchTerm] instanceof Function) |
| + return String.sprintf("http://docs.webplatform.org/w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&format=json", |
|
lushnikov
2014/08/06 17:27:51
extract to constant
semeny
2014/08/07 09:57:08
Done.
|
| + sourceRef.url, searchTerm); |
| + } |
| + return null; |
| + } |
| +} |