From 8fddd12ed4bcb685a6d209912d2979bb5c99a2f6 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 23 Aug 2009 17:18:36 -0400 Subject: [PATCH] bookmark widget finished --- addons/BookmarkWidget/BookmarkWidget.inc | 88 ++------------ js/bookmark.js | 139 +++++++++++------------ js/cookiejar.js | 2 +- 3 files changed, 72 insertions(+), 157 deletions(-) diff --git a/addons/BookmarkWidget/BookmarkWidget.inc b/addons/BookmarkWidget/BookmarkWidget.inc index aa5eb74..f277495 100644 --- a/addons/BookmarkWidget/BookmarkWidget.inc +++ b/addons/BookmarkWidget/BookmarkWidget.inc @@ -13,88 +13,15 @@ class ComicPressAddonBookmarkWidget extends ComicPressAddon { wp_enqueue_script('prototype'); wp_enqueue_script('cookiejar', get_template_directory_uri() . '/js/cookiejar.js', array('prototype')); + wp_enqueue_script('bookmark', get_template_directory_uri() . '/js/bookmark.js', array('prototype', 'cookiejar')); } - function wp_head() { - $last_comic = $this->comicpress->get_last_comic(); ?> - - + + @@ -102,7 +29,6 @@ class ComicPressAddonBookmarkWidget extends ComicPressAddon { - COMIC BOOKMARK
Click "Tag Page" to bookmark a comic page. When you return to the site, click "Goto Tag" to continue where you left off.'); - if (isHome) { - document.write('
Tag This Page'); - document.write('Goto Tag'); - document.write('Clear Tag'); - document.write(''); - } else if (isSingle) { - document.write('Tag This Page'); - document.write('Goto Tag'); - document.write('Clear Tag'); - document.write(''); - } - } -} \ No newline at end of file + Event.observe(hrefs['tag-page'], 'click', function(e) { + Event.stop(e); + info.permalink = permalink; + bookmark_info.write(info); + }); + + Event.observe(hrefs['clear-tag'], 'click', function(e) { + Event.stop(e); + info.permalink = false; + bookmark_info.write(info); + }); + + Event.observe(hrefs['goto-tag'], 'click', function(e) { + if (hrefs['goto-tag'].href == "#") { Event.stop(e); } + }); +}); diff --git a/js/cookiejar.js b/js/cookiejar.js index 9ddbfdd..a7c4a8d 100644 --- a/js/cookiejar.js +++ b/js/cookiejar.js @@ -107,7 +107,7 @@ CookieJar.prototype = { get: function(name) { name = this.appendString + name; var cookies = document.cookie.match(name + '=(.*?)(;|$)'); - if (cookies) { + if (cookies) { return (unescape(cookies[1])).evalJSON(); } else { return null;