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 this._gapFromIndex = 0; | 10 this._gapFromIndex = 0; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 }, | 226 }, |
227 | 227 |
228 /** | 228 /** |
229 * @param {string} itemPath | 229 * @param {string} itemPath |
230 */ | 230 */ |
231 _addDescriptorToList: function(itemPath) | 231 _addDescriptorToList: function(itemPath) |
232 { | 232 { |
233 var lastSlashIndex = itemPath.lastIndexOf("/"); | 233 var lastSlashIndex = itemPath.lastIndexOf("/"); |
234 if (lastSlashIndex === -1) | 234 if (lastSlashIndex === -1) |
235 return; | 235 return; |
236 var sourceName = itemPath.substring(0, lastSlashIndex + 1); | |
237 // There are some properties which have several words in their name. | 236 // There are some properties which have several words in their name. |
238 // In article list they are written through gap, while in URL they are w ritten through underscore. | 237 // In article list they are written through gap, while in URL they are w ritten through underscore. |
239 // We are creating URL for current property, so we have to replace all t he gaps with underscores. | 238 // We are creating URL for current property, so we have to replace all t he gaps with underscores. |
240 var propertyName = itemPath.substring(lastSlashIndex + 1).replace(" ", " _"); | 239 var correctItemPath = itemPath.replace(" ", "_"); |
lushnikov
2014/09/04 12:27:25
correctedItemPath
semeny
2014/09/04 13:20:37
Done.
| |
240 var sourceName = correctItemPath.substring(0, lastSlashIndex + 1); | |
241 var propertyName = correctItemPath.substring(lastSlashIndex + 1); | |
241 var sources = WebInspector.DocumentationURLProvider._sources; | 242 var sources = WebInspector.DocumentationURLProvider._sources; |
242 for (var i = 0; i < sources.length; ++i) { | 243 for (var i = 0; i < sources.length; ++i) { |
243 if (sources[i].url() !== sourceName || !sources[i].source().hasOwnPr operty(propertyName)) | 244 if (sources[i].url() !== sourceName || !sources[i].source().hasOwnPr operty(propertyName)) |
244 continue; | 245 continue; |
245 var descriptors = this._articleList.get(propertyName) || []; | 246 var descriptors = this._articleList.get(propertyName) || []; |
246 descriptors.push(new WebInspector.DocumentationURLProvider.ItemDescr iptor(sources[i], propertyName)); | 247 descriptors.push(new WebInspector.DocumentationURLProvider.ItemDescr iptor(sources[i], propertyName)); |
247 this._articleList.set(propertyName, descriptors); | 248 this._articleList.set(propertyName, descriptors); |
248 } | 249 } |
249 } | 250 } |
250 } | 251 } |
OLD | NEW |