Chromium Code Reviews| Index: chrome/browser/resources/file_manager/js/file_manager.js |
| =================================================================== |
| --- chrome/browser/resources/file_manager/js/file_manager.js (revision 137095) |
| +++ chrome/browser/resources/file_manager/js/file_manager.js (working copy) |
| @@ -267,6 +267,10 @@ |
| // Instance methods. |
| + FileManager.prototype.$ = function(id) { |
|
dgozman
2012/05/15 13:12:39
Don't like this :(
Vladislav Kaznacheev
2012/05/15 13:38:13
Oh no.
Oleg Eterevsky
2012/05/15 13:55:28
Done.
Oleg Eterevsky
2012/05/15 13:55:28
Done.
|
| + return this.document_.getElementById(id); |
| + }; |
| + |
| /** |
| * Request local file system, resolve roots and init_ after that. |
| * @private |
| @@ -4337,15 +4341,39 @@ |
| }; |
| FileManager.prototype.onSearchBoxUpdate_ = function(event) { |
| - var searchString = this.dialogDom_.querySelector('#search-box').value; |
| + var searchString = this.$('search-box').value; |
| if (searchString) { |
| this.directoryModel_.addFilter( |
| 'searchbox', |
| function(e) { |
| return e.name.substr(0, searchString.length) == searchString; |
| }); |
| + |
| + var self = this; |
| + |
| + this.reportEmptySearchResults_ = function() { |
| + if (self.directoryModel_.getFileList().length === 0) { |
| + var template = str('SEARCH_NO_MATCHING_FILES'); |
| + var index = template.indexOf('$1'); |
|
dgozman
2012/05/15 13:12:39
You can just use <b>$1</b> inside the localized st
Oleg Eterevsky
2012/05/15 13:55:28
Done.
|
| + self.$('no-search-results-prefix').textContent = |
| + template.substring(0, index - 1); |
| + self.$('no-search-results-suffix').textContent = |
| + template.substring(index + 3); |
| + var quotedSearchString = template.substring(index - 1, index + 3); |
| + self.$('no-search-results-query').textContent = |
| + quotedSearchString.replace('$1', searchString); |
| + |
| + self.$('list-container').setAttribute('no-search-results', 'true'); |
| + } |
|
Vladislav Kaznacheev
2012/05/15 13:38:13
add .bind(this) and you do not need var self
Oleg Eterevsky
2012/05/15 13:55:28
Done.
Oleg Eterevsky
2012/05/15 13:55:28
Done.
|
| + }; |
| + |
| + this.directoryModel_.addEventListener( |
| + 'rescan-completed', this.reportEmptySearchResults_); |
| } else { |
| this.directoryModel_.removeFilter('searchbox'); |
| + this.$('list-container').setAttribute('no-search-results', 'false'); |
| + this.directoryModel_.removeEventListener( |
| + 'rescan-completed', this.reportEmptySearchResults_); |
| } |
| }; |