From 0b9e5305828dc24914c705399cac8c8cbb1bf3c4 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 28 Nov 2009 16:46:45 -0500 Subject: [PATCH] bookmark widget cleanup --- js/bookmark.js | 54 ++++++++++++++++++++------------------ sidebar-right.php | 6 +++-- widgets/BookmarkWidget.inc | 2 -- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/js/bookmark.js b/js/bookmark.js index eea3119..5fd5c2e 100644 --- a/js/bookmark.js +++ b/js/bookmark.js @@ -36,35 +36,37 @@ Event.observe(window, 'load', function() { var bookmark_info = new BookmarkInfo(); var info = bookmark_info.read(); - var hrefs = {}; - $$('#comic-bookmark-holder a').each(function(a) { - var name = $w(a.className).shift(); - hrefs[name] = a; - }); + if ($('comic-bookmark-holder')) { + var hrefs = {}; + $$('#comic-bookmark-holder a').each(function(a) { + var name = $w(a.className).shift(); + hrefs[name] = a; + }); - var set_goto_tag = function(i) { - hrefs['goto-tag'].href = (i.permalink ? i.permalink : "#"); - [ 'goto-tag','clear-tag' ].each(function(which) { - hrefs[which].select('img')[0].src = image_root + button_images[which][i.permalink ? "on" : "off"]; - }); - }; + var set_goto_tag = function(i) { + hrefs['goto-tag'].href = (i.permalink ? i.permalink : "#"); + [ 'goto-tag','clear-tag' ].each(function(which) { + hrefs[which].select('img')[0].src = image_root + button_images[which][i.permalink ? "on" : "off"]; + }); + }; - bookmark_info.onWrite = function(i) { set_goto_tag(i); } - set_goto_tag(info); + bookmark_info.onWrite = function(i) { set_goto_tag(i); } + set_goto_tag(info); - Event.observe(hrefs['tag-page'], 'click', function(e) { - Event.stop(e); - info.permalink = permalink; - bookmark_info.write(info); - }); + 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['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); } - }); + Event.observe(hrefs['goto-tag'], 'click', function(e) { + if (hrefs['goto-tag'].href == "#") { Event.stop(e); } + }); + } }); diff --git a/sidebar-right.php b/sidebar-right.php index f12d23b..f022fe6 100644 --- a/sidebar-right.php +++ b/sidebar-right.php @@ -4,8 +4,10 @@ if (!$comicpress_options['disable_lrsidebars_frontpage']) { ?>