| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html i18n-values="dir:textdirection"> | 2 <html i18n-values="dir:textdirection"> |
| 3 <!-- | 3 <!-- |
| 4 | 4 |
| 5 Copyright (c) 2010 The Chromium Authors. All rights reserved. | 5 Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. | 7 found in the LICENSE file. |
| 8 | 8 |
| 9 --> | 9 --> |
| 10 <head> | 10 <head> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 <script src="chrome://resources/js/cr/ui/command.js"></script> | 32 <script src="chrome://resources/js/cr/ui/command.js"></script> |
| 33 <script src="chrome://resources/js/cr/ui/menuitem.js"></script> | 33 <script src="chrome://resources/js/cr/ui/menuitem.js"></script> |
| 34 <script src="chrome://resources/js/cr/ui/menu.js"></script> | 34 <script src="chrome://resources/js/cr/ui/menu.js"></script> |
| 35 <script src="chrome://resources/js/cr/ui/menubutton.js"></script> | 35 <script src="chrome://resources/js/cr/ui/menubutton.js"></script> |
| 36 <script src="chrome://resources/js/cr/ui/contextmenuhandler.js"></script> | 36 <script src="chrome://resources/js/cr/ui/contextmenuhandler.js"></script> |
| 37 | 37 |
| 38 <script src="chrome://resources/js/util.js"></script> | 38 <script src="chrome://resources/js/util.js"></script> |
| 39 <script src="chrome://resources/js/localstrings.js"></script> | 39 <script src="chrome://resources/js/localstrings.js"></script> |
| 40 <script src="chrome://resources/js/i18ntemplate.js"></script> | 40 <script src="chrome://resources/js/i18ntemplate.js"></script> |
| 41 | 41 |
| 42 | |
| 43 <script src="js/bmm/treeiterator.js"></script> | 42 <script src="js/bmm/treeiterator.js"></script> |
| 44 <script src="js/bmm.js"></script> | 43 <script src="js/bmm.js"></script> |
| 45 <script src="js/bmm/bookmarklist.js"></script> | 44 <script src="js/bmm/bookmarklist.js"></script> |
| 46 <script src="js/bmm/bookmarktree.js"></script> | 45 <script src="js/bmm/bookmarktree.js"></script> |
| 47 | 46 |
| 48 <script> | 47 <script> |
| 49 | 48 |
| 50 // Sometimes the extension API is not initialized. | 49 // Sometimes the extension API is not initialized. |
| 51 if (!chrome.bookmarks) | 50 if (!chrome.bookmarks) |
| 52 window.location.reload(); | 51 window.location.reload(); |
| 53 | 52 |
| 54 // Allow platform specific CSS rules. | 53 // Allow platform specific CSS rules. |
| 55 if (cr.isMac) | 54 if (cr.isMac) |
| 56 document.documentElement.setAttribute('os', 'mac'); | 55 document.documentElement.setAttribute('os', 'mac'); |
| 57 | 56 |
| 58 </script> | 57 </script> |
| 59 </head> | 58 </head> |
| 60 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> | 59 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
| 61 | 60 |
| 62 <div class="header"> | 61 <div class="header"> |
| 63 <button onclick="resetSearch()" class="logo" tabindex=3></button> | 62 <button class="logo" tabindex=3></button> |
| 64 <form onsubmit="setSearch(this.term.value); return false;" | 63 <form onsubmit="setSearch(this.term.value); return false;" |
| 65 class="form"> | 64 class="form"> |
| 66 <input type="search" id="term" tabindex=1 autofocus | 65 <input type="search" id="term" tabindex=1 autofocus |
| 67 i18n-values="placeholder:search_button"> | 66 i18n-values="placeholder:search_button"> |
| 68 </form> | 67 </form> |
| 69 </div> | 68 </div> |
| 70 | 69 |
| 71 <div class="summary"> | 70 <div class="summary"> |
| 72 <h3 i18n-content="title">Bookmark Manager</h3> | 71 <h3 i18n-content="title">Bookmark Manager</h3> |
| 73 <button menu="#organize-menu" tabindex="-1" i18n-content="organize_menu"></but
ton> | 72 <button menu="#organize-menu" tabindex="-1" i18n-content="organize_menu"></but
ton> |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 inputDelayTimer = setTimeout(function() { | 262 inputDelayTimer = setTimeout(function() { |
| 264 setSearch($('term').value); | 263 setSearch($('term').value); |
| 265 }, 250); | 264 }, 250); |
| 266 }; | 265 }; |
| 267 | 266 |
| 268 /** | 267 /** |
| 269 * Navigates to the search results for the search text. | 268 * Navigates to the search results for the search text. |
| 270 * @para {string} searchText The text to search for. | 269 * @para {string} searchText The text to search for. |
| 271 */ | 270 */ |
| 272 function setSearch(searchText) { | 271 function setSearch(searchText) { |
| 273 delete bmm.treeLookup[searchTreeItem.bookmarkId]; | 272 if (searchText) { |
| 274 var id = searchTreeItem.bookmarkId = 'q=' + searchText; | 273 // Only update search item if we have a search term. We never want the |
| 275 bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem; | 274 // search item to be for an empty search. |
| 275 delete bmm.treeLookup[searchTreeItem.bookmarkId]; |
| 276 var id = searchTreeItem.bookmarkId = 'q=' + searchText; |
| 277 bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem; |
| 278 } |
| 279 |
| 276 $('term').value = searchText; | 280 $('term').value = searchText; |
| 281 |
| 277 if (searchText) { | 282 if (searchText) { |
| 278 tree.add(searchTreeItem); | 283 tree.add(searchTreeItem); |
| 279 tree.selectedItem = searchTreeItem; | 284 tree.selectedItem = searchTreeItem; |
| 280 } else { | 285 } else { |
| 281 tree.remove(searchTreeItem); | 286 // Go "home". |
| 282 tree.selectedItem = tree.items[0]; | 287 tree.selectedItem = tree.items[0]; |
| 288 id = tree.selectedItem.bookmarkId; |
| 283 } | 289 } |
| 290 |
| 284 navigateTo(id); | 291 navigateTo(id); |
| 285 } | 292 } |
| 286 | 293 |
| 287 /** | 294 // Handle the logo button UI. |
| 288 * Clears the search. | 295 // When the user clicks the button we should navigate "home" and focus the list |
| 289 */ | 296 document.querySelector('button.logo').onclick = function(e) { |
| 290 function resetSearch() { | |
| 291 $('term').value = ''; | |
| 292 setSearch(''); | 297 setSearch(''); |
| 293 $('term').focus(); | 298 $('list').focus(); |
| 294 } | 299 }; |
| 295 | 300 |
| 296 /** | 301 /** |
| 297 * Called when the title of a bookmark changes. | 302 * Called when the title of a bookmark changes. |
| 298 * @param {string} id | 303 * @param {string} id |
| 299 * @param {!Object} changeInfo | 304 * @param {!Object} changeInfo |
| 300 */ | 305 */ |
| 301 function handleBookmarkChanged(id, changeInfo) { | 306 function handleBookmarkChanged(id, changeInfo) { |
| 302 // console.log('handleBookmarkChanged', id, changeInfo); | 307 // console.log('handleBookmarkChanged', id, changeInfo); |
| 303 list.handleBookmarkChanged(id, changeInfo); | 308 list.handleBookmarkChanged(id, changeInfo); |
| 304 tree.handleBookmarkChanged(id, changeInfo); | 309 tree.handleBookmarkChanged(id, changeInfo); |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 localStrings.templateData = data; | 1590 localStrings.templateData = data; |
| 1586 i18nTemplate.process(document, data); | 1591 i18nTemplate.process(document, data); |
| 1587 }); | 1592 }); |
| 1588 | 1593 |
| 1589 </script> | 1594 </script> |
| 1590 | 1595 |
| 1591 <div id="drop-overlay"></div> | 1596 <div id="drop-overlay"></div> |
| 1592 | 1597 |
| 1593 </body> | 1598 </body> |
| 1594 </html> | 1599 </html> |
| OLD | NEW |