mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 16:44:12 +01:00
Add Bookmark{Change,Remove} autocommands. Fix tags arg of BookmarkAdd, but keyword will still need BookmarkChange.
--HG-- extra : rebase_source : 2a3a37c3bf1743274ca875afbe110d85f70517d7
This commit is contained in:
@@ -12,8 +12,8 @@ const DEFAULT_FAVICON = "chrome://mozapps/skin/places/defaultFavicon.png";
|
||||
const Bookmarks = Module("bookmarks", {
|
||||
init: function () {
|
||||
storage.addObserver("bookmark-cache", function (key, event, arg) {
|
||||
if (event == "add")
|
||||
autocommands.trigger("BookmarkAdd", arg);
|
||||
if (["add", "change", "remove"].indexOf(event) >= 0)
|
||||
autocommands.trigger("Bookmark" + event[0].toUpperCase() + event.substr(1), arg);
|
||||
statusline.updateUrl();
|
||||
}, window);
|
||||
},
|
||||
@@ -43,6 +43,10 @@ const Bookmarks = Module("bookmarks", {
|
||||
break;
|
||||
}
|
||||
|
||||
if (tags) {
|
||||
PlacesUtils.tagging.untagURI(uri, null);
|
||||
PlacesUtils.tagging.tagURI(uri, tags);
|
||||
}
|
||||
if (id == undefined)
|
||||
id = services.get("bookmarks").insertBookmark(
|
||||
services.get("bookmarks")[starOnly ? "unfiledBookmarksFolder" : "bookmarksMenuFolder"],
|
||||
@@ -52,10 +56,6 @@ const Bookmarks = Module("bookmarks", {
|
||||
|
||||
if (keyword)
|
||||
services.get("bookmarks").setKeywordForBookmark(id, keyword);
|
||||
if (tags) {
|
||||
PlacesUtils.tagging.untagURI(uri, null);
|
||||
PlacesUtils.tagging.tagURI(uri, tags);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
dactyl.log(e, 0);
|
||||
|
||||
Reference in New Issue
Block a user