| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <script> | 2 <script> |
| 3 var dump = function(obj, indent) { | 3 var dump = function(obj, indent) { |
| 4 if (indent === undefined) | 4 if (indent === undefined) |
| 5 indent = ""; | 5 indent = ""; |
| 6 if (typeof obj == "object") { | 6 if (typeof obj == "object") { |
| 7 var ret = "{<br/>"; | 7 var ret = "{<br/>"; |
| 8 var child_indent = indent + " "; | 8 var child_indent = indent + " "; |
| 9 for (var item in obj) { | 9 for (var item in obj) { |
| 10 var child = null; | 10 var child = null; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 var testMoveBookmarks2 = function(event) { | 28 var testMoveBookmarks2 = function(event) { |
| 29 console.log(testMoveBookmarks2.caller.name); | 29 console.log(testMoveBookmarks2.caller.name); |
| 30 if (event.shiftKey) { | 30 if (event.shiftKey) { |
| 31 // TODO - it would be nice to have a mechanism to do this built-in to a | 31 // TODO - it would be nice to have a mechanism to do this built-in to a |
| 32 // context menu. | 32 // context menu. |
| 33 window.location.reload(); | 33 window.location.reload(); |
| 34 return; | 34 return; |
| 35 } | 35 } |
| 36 console.log("testMoveBookmarks2"); | 36 console.log("testMoveBookmarks2"); |
| 37 chrome.bookmarks.getChildren(0, function(root_children) { | 37 chrome.bookmarks.getChildren('0', function(root_children) { |
| 38 var bookmark_bar = root_children[0]; // bookmarks bar is always first | 38 var bookmark_bar = root_children[0]; // bookmarks bar is always first |
| 39 chrome.bookmarks.getChildren(bookmark_bar.id, function(bar_children) { | 39 chrome.bookmarks.getChildren(bookmark_bar.id, function(bar_children) { |
| 40 var folder_search = []; | 40 var folder_search = []; |
| 41 bar_children.forEach(function(child) { | 41 bar_children.forEach(function(child) { |
| 42 if (child.title == "folder" && child.url == undefined) { | 42 if (child.title == "folder" && child.url == undefined) { |
| 43 folder_search.push(child); | 43 folder_search.push(child); |
| 44 } | 44 } |
| 45 }); | 45 }); |
| 46 if (folder_search.length == 1) { | 46 if (folder_search.length == 1) { |
| 47 console.log('moving children out of "folder"'); | 47 console.log('moving children out of "folder"'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 67 }); | 67 }); |
| 68 }); | 68 }); |
| 69 } else { | 69 } else { |
| 70 console.log("my puny code wasn't written to handle this"); | 70 console.log("my puny code wasn't written to handle this"); |
| 71 } | 71 } |
| 72 }); | 72 }); |
| 73 }); | 73 }); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 var dumpBookmarks = function(event) { | 76 var dumpBookmarks = function(event) { |
| 77 window.open("bookmark_view.html"); | 77 chrome.tabs.create({url:"bookmark_view.html"}); |
| 78 }; | 78 }; |
| 79 </script> | 79 </script> |
| 80 <body> | 80 <body> |
| 81 <div class="toolstrip-button" onclick="dumpBookmarks(window.event);"> | 81 <div class="toolstrip-button" onclick="dumpBookmarks(window.event);"> |
| 82 <span>Dump Bookmarks</span> | 82 <span>Dump Bookmarks</span> |
| 83 </div> | 83 </div> |
| 84 <div class="toolstrip-button" onclick="testMoveBookmarks(window.event);"> | 84 <div class="toolstrip-button" onclick="testMoveBookmarks(window.event);"> |
| 85 <span>Test Move</span> | 85 <span>Test Move</span> |
| 86 </div> | 86 </div> |
| 87 </body> | 87 </body> |
| 88 </html> | 88 </html> |
| OLD | NEW |