1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-05 07:54:12 +01:00

Added :bmark -id, changed updating semantincs, update URLs in cache, and reported updates as updates rather than additions.

This commit is contained in:
Kris Maglione
2011-08-25 01:21:56 -04:00
parent e70cd8934d
commit 26ac4f3078
6 changed files with 77 additions and 52 deletions

View File

@@ -20,6 +20,12 @@ update(Bookmark.prototype, {
].filter(function (item) item[1]),
get uri() util.newURI(this.url),
set uri(uri) {
let tags = this.tags;
this.tags = null;
services.bookmarks.changeBookmarkURI(this.id, uri);
this.tags = tags;
},
encodeURIComponent: function _encodeURIComponent(str) {
if (!this.charset || this.charset === "UTF-8")
@@ -28,15 +34,9 @@ update(Bookmark.prototype, {
return escape(conv.ConvertFromUnicode(str) + conv.Finish());
}
})
Bookmark.prototype.members.uri = Bookmark.prototype.members.url;
Bookmark.setter = function (key, func) this.prototype.__defineSetter__(key, func);
Bookmark.setter("url", function (val) {
if (isString(val))
val = util.newURI(val);
let tags = this.tags;
this.tags = null;
services.bookmarks.changeBookmarkURI(this.id, val);
this.tags = tags;
});
Bookmark.setter("url", function (val) { this.uri = isString(val) ? util.newURI(val) : val; });
Bookmark.setter("title", function (val) { services.bookmarks.setItemTitle(this.id, val); });
Bookmark.setter("post", function (val) { bookmarkcache.annotate(this.id, bookmarkcache.POST, val); });
Bookmark.setter("charset", function (val) { bookmarkcache.annotate(this.id, bookmarkcache.CHARSET, val); });