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 25 matching lines...) Expand all Loading... |
36 <script src="chrome://resources/js/cr/ui/context_menu_handler.js"></script> | 36 <script src="chrome://resources/js/cr/ui/context_menu_handler.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/local_strings.js"></script> | 39 <script src="chrome://resources/js/local_strings.js"></script> |
40 <script src="chrome://resources/js/i18n_template.js"></script> | 40 <script src="chrome://resources/js/i18n_template.js"></script> |
41 | 41 |
42 <script src="js/bmm/tree_iterator.js"></script> | 42 <script src="js/bmm/tree_iterator.js"></script> |
43 <script src="js/bmm.js"></script> | 43 <script src="js/bmm.js"></script> |
44 <script src="js/bmm/bookmark_list.js"></script> | 44 <script src="js/bmm/bookmark_list.js"></script> |
45 <script src="js/bmm/bookmark_tree.js"></script> | 45 <script src="js/bmm/bookmark_tree.js"></script> |
46 | |
47 <script> | |
48 | |
49 // Sometimes the extension API is not initialized. | |
50 if (!chrome.bookmarks) | |
51 console.error('Bookmarks extension API is not avaiable'); | |
52 | |
53 // Allow platform specific CSS rules. | |
54 if (cr.isMac) | |
55 document.documentElement.setAttribute('os', 'mac'); | |
56 | |
57 </script> | |
58 </head> | 46 </head> |
59 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> | 47 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
60 | 48 |
61 <div class="header"> | 49 <div class="header"> |
62 <button class="logo" tabindex=3></button> | 50 <button class="logo" tabindex=3></button> |
63 <form onsubmit="setSearch(this.term.value); return false;" | 51 <form onsubmit="setSearch(this.term.value); return false;" |
64 class="form"> | 52 class="form"> |
65 <input type="search" id="term" tabindex=1 autofocus | 53 <input type="search" id="term" tabindex=1 autofocus |
66 i18n-values="placeholder:search_button"> | 54 i18n-values="placeholder:search_button"> |
67 </form> | 55 </form> |
68 </div> | 56 </div> |
69 | 57 |
70 <div class="summary"> | 58 <div class="summary"> |
71 <h3 i18n-content="title">Bookmark Manager</h3> | 59 <h3 i18n-content="title"></h3> |
72 <button menu="#organize-menu" tabindex="-1" i18n-content="organize_menu"></but
ton> | 60 <button menu="#organize-menu" tabindex="-1" i18n-content="organize_menu"></but
ton> |
73 </div> | 61 </div> |
74 | 62 |
75 <div class=main> | 63 <div class=main> |
76 <div id=tree-container> | 64 <div id=tree-container> |
77 <tree id=tree tabindex=2></tree> | 65 <tree id=tree tabindex=2></tree> |
78 </div> | 66 </div> |
79 <div class=splitter></div> | 67 <div class=splitter></div> |
80 <list id=list tabindex=2></list> | 68 <list id=list tabindex=2></list> |
81 </div> | 69 </div> |
82 | 70 |
| 71 <!-- Organize menu --> |
| 72 <command i18n-values=".label:rename_folder" id="rename-folder-command"></command
> |
| 73 <command i18n-values=".label:edit" id="edit-command"></command> |
| 74 <command i18n-values=".label:show_in_folder" id="show-in-folder-command"></comma
nd> |
| 75 <command i18n-values=".label:cut" id="cut-command"></command> |
| 76 <command i18n-values=".label:copy" id="copy-command"></command> |
| 77 <command i18n-values=".label:paste" id="paste-command"></command> |
| 78 <command i18n-values=".label:delete" id="delete-command"></command> |
| 79 <command i18n-values=".label:sort" id="sort-command"></command> |
| 80 <command i18n-values=".label:add_new_bookmark" id="add-new-bookmark-command"></c
ommand> |
| 81 <command i18n-values=".label:new_folder" id="new-folder-command"></command> |
| 82 |
| 83 <!-- Tools menu --> |
| 84 <command i18n-values=".label:import_menu" id="import-menu-command"></command> |
| 85 <command i18n-values=".label:export_menu" id="export-menu-command"></command> |
| 86 |
| 87 <!-- open * are handled in canExecute handler --> |
| 88 <command id="open-in-new-tab-command"></command> |
| 89 <command id="open-in-background-tab-command"></command> |
| 90 <command id="open-in-new-window-command"></command> |
| 91 <command id="open-incognito-window-command"></command> |
| 92 <command id="open-in-same-window-command"></command> |
| 93 |
| 94 <!-- TODO(arv): I think the commands might be better created in code? --> |
| 95 |
| 96 <menu id="organize-menu"> |
| 97 <button command="#add-new-bookmark-command"></button> |
| 98 <button command="#new-folder-command"></button> |
| 99 <hr> |
| 100 <button command="#rename-folder-command"></button> |
| 101 <button command="#edit-command"></button> |
| 102 <button command="#show-in-folder-command"></button> |
| 103 <hr> |
| 104 <button command="#cut-command"></button> |
| 105 <button command="#copy-command"></button> |
| 106 <button command="#paste-command"></button> |
| 107 <hr> |
| 108 <button command="#delete-command"></button> |
| 109 <hr> |
| 110 <button command="#sort-command"></button> |
| 111 <hr> |
| 112 <button command="#import-menu-command"></button> |
| 113 <button command="#export-menu-command"></button> |
| 114 </menu> |
| 115 |
| 116 <menu id="context-menu"> |
| 117 <button command="#open-in-new-tab-command"></button> |
| 118 <button command="#open-in-new-window-command"></button> |
| 119 <button command="#open-incognito-window-command"></button> |
| 120 <hr> |
| 121 <button command="#rename-folder-command"></button> |
| 122 <button command="#edit-command"></button> |
| 123 <button command="#show-in-folder-command"></button> |
| 124 <hr> |
| 125 <button command="#cut-command"></button> |
| 126 <button command="#copy-command"></button> |
| 127 <button command="#paste-command"></button> |
| 128 <hr> |
| 129 <button command="#delete-command"></button> |
| 130 <hr> |
| 131 <button command="#add-new-bookmark-command"></button> |
| 132 <button command="#new-folder-command"></button> |
| 133 </menu> |
| 134 |
| 135 <div id="drop-overlay"></div> |
83 | 136 |
84 <script> | 137 <script> |
85 | 138 |
86 const BookmarkList = bmm.BookmarkList; | 139 const BookmarkList = bmm.BookmarkList; |
87 const BookmarkTree = bmm.BookmarkTree; | 140 const BookmarkTree = bmm.BookmarkTree; |
88 const ListItem = cr.ui.ListItem; | 141 const ListItem = cr.ui.ListItem; |
89 const TreeItem = cr.ui.TreeItem; | 142 const TreeItem = cr.ui.TreeItem; |
90 const LinkKind = cr.LinkKind; | 143 const LinkKind = cr.LinkKind; |
| 144 const Command = cr.ui.Command; |
| 145 const CommandBinding = cr.ui.CommandBinding; |
| 146 const Menu = cr.ui.Menu; |
| 147 const MenuButton = cr.ui.MenuButton; |
| 148 const Promise = cr.Promise; |
| 149 |
| 150 // Sometimes the extension API is not initialized. |
| 151 if (!chrome.bookmarks) |
| 152 console.error('Bookmarks extension API is not avaiable'); |
| 153 |
| 154 // Allow platform specific CSS rules. |
| 155 if (cr.isMac) |
| 156 document.documentElement.setAttribute('os', 'mac'); |
| 157 |
| 158 /** |
| 159 * The local strings object which is used to do the translation. |
| 160 * @type {!LocalStrings} |
| 161 */ |
| 162 var localStrings = new LocalStrings; |
| 163 |
| 164 // Get the localized strings from the backend. |
| 165 chrome.experimental.bookmarkManager.getStrings(function(data) { |
| 166 // The strings may contain & which we need to strip. |
| 167 for (var key in data) { |
| 168 data[key] = data[key].replace(/&/, ''); |
| 169 } |
| 170 |
| 171 localStrings.templateData = data; |
| 172 i18nTemplate.process(document, data); |
| 173 |
| 174 recentTreeItem.label = localStrings.getString('recent'); |
| 175 searchTreeItem.label = localStrings.getString('search'); |
| 176 }); |
91 | 177 |
92 /** | 178 /** |
93 * The id of the bookmark root. | 179 * The id of the bookmark root. |
94 * @type {number} | 180 * @type {number} |
95 */ | 181 */ |
96 const ROOT_ID = '0'; | 182 const ROOT_ID = '0'; |
97 | 183 |
98 var bookmarkCache = { | 184 var bookmarkCache = { |
99 /** | 185 /** |
100 * This returns a reference to the bookmark node that is cached by the tree | 186 * This returns a reference to the bookmark node that is cached by the tree |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 chrome.experimental.bookmarkManager.onDragEnter.addListener(cr.bind( | 1013 chrome.experimental.bookmarkManager.onDragEnter.addListener(cr.bind( |
928 this.handleChromeDragEnter, this)); | 1014 this.handleChromeDragEnter, this)); |
929 chrome.experimental.bookmarkManager.onDragLeave.addListener( | 1015 chrome.experimental.bookmarkManager.onDragLeave.addListener( |
930 deferredClearData); | 1016 deferredClearData); |
931 chrome.experimental.bookmarkManager.onDrop.addListener(deferredClearData); | 1017 chrome.experimental.bookmarkManager.onDrop.addListener(deferredClearData); |
932 } | 1018 } |
933 }; | 1019 }; |
934 | 1020 |
935 dnd.init(); | 1021 dnd.init(); |
936 | 1022 |
937 </script> | |
938 | |
939 <!-- Organize menu --> | |
940 <command i18n-values=".label:rename_folder" id="rename-folder-command"></command
> | |
941 <command i18n-values=".label:edit" id="edit-command"></command> | |
942 <command i18n-values=".label:show_in_folder" id="show-in-folder-command"></comma
nd> | |
943 <command i18n-values=".label:cut" id="cut-command"></command> | |
944 <command i18n-values=".label:copy" id="copy-command"></command> | |
945 <command i18n-values=".label:paste" id="paste-command"></command> | |
946 <command i18n-values=".label:delete" id="delete-command"></command> | |
947 <command i18n-values=".label:sort" id="sort-command"></command> | |
948 <command i18n-values=".label:add_new_bookmark" id="add-new-bookmark-command"></c
ommand> | |
949 <command i18n-values=".label:new_folder" id="new-folder-command"></command> | |
950 | |
951 <!-- Tools menu --> | |
952 <command i18n-values=".label:import_menu" id="import-menu-command"></command> | |
953 <command i18n-values=".label:export_menu" id="export-menu-command"></command> | |
954 | |
955 <!-- open * are handled in canExecute handler --> | |
956 <command id="open-in-new-tab-command"></command> | |
957 <command id="open-in-background-tab-command"></command> | |
958 <command id="open-in-new-window-command"></command> | |
959 <command id="open-incognito-window-command"></command> | |
960 <command id="open-in-same-window-command"></command> | |
961 | |
962 <!-- TODO(arv): I think the commands might be better created in code? --> | |
963 | |
964 <menu id="organize-menu"> | |
965 <button command="#add-new-bookmark-command"></button> | |
966 <button command="#new-folder-command"></button> | |
967 <hr> | |
968 <button command="#rename-folder-command"></button> | |
969 <button command="#edit-command"></button> | |
970 <button command="#show-in-folder-command"></button> | |
971 <hr> | |
972 <button command="#cut-command"></button> | |
973 <button command="#copy-command"></button> | |
974 <button command="#paste-command"></button> | |
975 <hr> | |
976 <button command="#delete-command"></button> | |
977 <hr> | |
978 <button command="#sort-command"></button> | |
979 <hr> | |
980 <button command="#import-menu-command"></button> | |
981 <button command="#export-menu-command"></button> | |
982 </menu> | |
983 | |
984 <menu id="context-menu"> | |
985 <button command="#open-in-new-tab-command"></button> | |
986 <button command="#open-in-new-window-command"></button> | |
987 <button command="#open-incognito-window-command"></button> | |
988 <hr> | |
989 <button command="#rename-folder-command"></button> | |
990 <button command="#edit-command"></button> | |
991 <button command="#show-in-folder-command"></button> | |
992 <hr> | |
993 <button command="#cut-command"></button> | |
994 <button command="#copy-command"></button> | |
995 <button command="#paste-command"></button> | |
996 <hr> | |
997 <button command="#delete-command"></button> | |
998 <hr> | |
999 <button command="#add-new-bookmark-command"></button> | |
1000 <button command="#new-folder-command"></button> | |
1001 </menu> | |
1002 | |
1003 <script> | |
1004 | |
1005 // Commands | 1023 // Commands |
1006 | 1024 |
1007 const Command = cr.ui.Command; | |
1008 const CommandBinding = cr.ui.CommandBinding; | |
1009 const Menu = cr.ui.Menu; | |
1010 const MenuButton = cr.ui.MenuButton; | |
1011 const Promise = cr.Promise; | |
1012 | |
1013 cr.ui.decorate('menu', Menu); | 1025 cr.ui.decorate('menu', Menu); |
1014 cr.ui.decorate('button[menu]', MenuButton); | 1026 cr.ui.decorate('button[menu]', MenuButton); |
1015 cr.ui.decorate('command', Command); | 1027 cr.ui.decorate('command', Command); |
1016 | 1028 |
1017 cr.ui.contextMenuHandler.addContextMenuProperty(tree); | 1029 cr.ui.contextMenuHandler.addContextMenuProperty(tree); |
1018 list.contextMenu = $('context-menu'); | 1030 list.contextMenu = $('context-menu'); |
1019 tree.contextMenu = $('context-menu'); | 1031 tree.contextMenu = $('context-menu'); |
1020 | 1032 |
1021 // Disable almost all commands at startup. | 1033 // Disable almost all commands at startup. |
1022 var commands = document.querySelectorAll('command'); | 1034 var commands = document.querySelectorAll('command'); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 document.addEventListener('cut', handle('cut-command')); | 1597 document.addEventListener('cut', handle('cut-command')); |
1586 | 1598 |
1587 var pasteHandler = handle('paste-command'); | 1599 var pasteHandler = handle('paste-command'); |
1588 document.addEventListener('paste', function(e) { | 1600 document.addEventListener('paste', function(e) { |
1589 // Paste is a bit special since we need to do an async call to see if we can | 1601 // Paste is a bit special since we need to do an async call to see if we can |
1590 // paste because the paste command might not be up to date. | 1602 // paste because the paste command might not be up to date. |
1591 updatePasteCommand(pasteHandler); | 1603 updatePasteCommand(pasteHandler); |
1592 }); | 1604 }); |
1593 })(); | 1605 })(); |
1594 | 1606 |
1595 /** | |
1596 * The local strings object which is used to do the translation. | |
1597 * @type {!LocalStrings} | |
1598 */ | |
1599 var localStrings = new LocalStrings; | |
1600 | |
1601 // Get the localized strings from the backend. | |
1602 chrome.experimental.bookmarkManager.getStrings(function(data) { | |
1603 // The strings may contain & which we need to strip. | |
1604 for (var key in data) { | |
1605 data[key] = data[key].replace(/&/, ''); | |
1606 } | |
1607 | |
1608 localStrings.templateData = data; | |
1609 i18nTemplate.process(document, data); | |
1610 | |
1611 recentTreeItem.label = localStrings.getString('recent'); | |
1612 searchTreeItem.label = localStrings.getString('search'); | |
1613 }); | |
1614 | |
1615 </script> | 1607 </script> |
1616 | 1608 |
1617 <div id="drop-overlay"></div> | |
1618 | |
1619 </body> | 1609 </body> |
1620 </html> | 1610 </html> |
OLD | NEW |