Is it possible to increase chrome.bookmarks.MAX_WRITE_OPERATIONS_PER_HOUR? -
i tried setting property higher value doesn't seem work. idea how should go it? (it's extension allows switch between multiple bookmark bars.)
documentation's here: https://developer.chrome.com/extensions/bookmarks.html
edit: below's source code.
(function(){ function f(d) { chrome.bookmarks.max_write_operations_per_hour = 100000000; chrome.bookmarks.max_sustained_write_operations_per_minute = 2000000; chrome.bookmarks.gettree(function(tree) { if (!searchfolder(tree[0], "switchmark")) { chrome.bookmarks.create({"title": "switchmark"}, function(n){ chrome.bookmarks.create({"title": "a", parentid: n.id}); chrome.bookmarks.create({"title": "b", parentid: n.id}); chrome.browseraction.setbadgetext({"text": "a"}); }); } else { (var = 0; < children.length; i++) { if (!children[i].children.length) { chrome.browseraction.setbadgetext({"text": children[i].title}); break; } } } }); } chrome.runtime.oninstalled.addlistener(f); chrome.runtime.onstartup.addlistener(f); }).call(); chrome.browseraction.onclicked.addlistener(function(t) { chrome.bookmarks.gettree(function(tree) { var children = searchfolder(tree[0], "switchmark").children; (var = 0; < children.length; i++) { if (!children[i].children.length) { var barid = searchfolder(tree[0], "bookmarks bar").id; var currentid = children[i].id; var nextnode = children[++i < children.length ? : 0]; var nextid = nextnode.id; var nexttitle = nextnode.title; movefoldercontents(barid, currentid); movefoldercontents(nextid, barid); chrome.browseraction.setbadgetext({"text": nexttitle}); break; } } }); }); function movefoldercontents(fromid, toid) { chrome.bookmarks.getsubtree(fromid, function (subtree) { var c = subtree[0].children; (var = 0; < c.length; i++) chrome.bookmarks.move(c[i].id, {"parentid": toid}); }); } function searchfolder(n, f) { if (array.isarray(n.children)) { (var = 0; < n.children.length; i++) { if (n.children[i].title == f) return n.children[i]; else if (r = searchfolder(n.children[i], f)) return r; } } return null; }
Comments
Post a Comment