阅读:1450回复:2
请帮忙修改69.0 更新书签为当前页菜单项.uc
如题,在69下失效了,脚本作用为在书签文件夹中右键更新书签为当前页的地址
(function() { if (location != "chrome://browser/content/browser.xul") return; function insertRepBM(aDocument) { var separator = aDocument.getElementById("placesContext_openSeparator"); var repBM = aDocument.createElement("menuitem"); separator.parentNode.insertBefore(repBM, separator); repBM.id = "placesContext_replaceURL"; repBM.setAttribute("label", "更新为当前地址"); repBM.setAttribute("accesskey", "U"); var obs = aDocument.createElement("observes"); obs.setAttribute("element", "placesContext_open"); obs.setAttribute("attribute", "hidden"); repBM.appendChild(obs); if (aDocument.URL == "chrome://browser/content/browser.xul") { repBM.addEventListener("command", function() { let itemGuid = aDocument.popupNode._placesNode.bookmarkGuid; PlacesUtils.bookmarks.update({ guid: itemGuid, url: gBrowser.currentURI, title: gBrowser.contentTitle }); }); } else if (aDocument.URL == "chrome://browser/content/bookmarks/bookmarksPanel.xul") { repBM.addEventListener("command", function() { let itemGuid = aDocument.activeElement.selectedNode.bookmarkGuid; PlacesUtils.bookmarks.update({ guid: itemGuid, url: gBrowser.currentURI, title: gBrowser.contentTitle }); }); }; }; insertRepBM(document); addEventListener("pageshow", function(event) { let doc = event.target; if (doc.URL == "chrome://browser/content/bookmarks/bookmarksPanel.xul") { insertRepBM(doc); }; }); })(); |
|
|
1楼#
发布于:2019-10-15 22:04
建议使用扩展Update Bookmark
|
|
2楼#
发布于:2019-10-15 22:26
|
|
|