aboutsummaryrefslogtreecommitdiffstats
path: root/hatebuCounter.js
diff options
context:
space:
mode:
Diffstat (limited to 'hatebuCounter.js')
-rw-r--r--hatebuCounter.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/hatebuCounter.js b/hatebuCounter.js
index df7d0de..891c24f 100644
--- a/hatebuCounter.js
+++ b/hatebuCounter.js
@@ -1,7 +1,7 @@
-// Vimperator plugin: hatena bookmark image counter
+// Vimperator plugin: Hatena Bookmark image counter
// Maintainer: mattn <mattn.jp@gmail.com> - http://mattn.kaoriya.net
-(function(){
+(function() {
const ICON = 'data:image/x-icon;base64,'+
'AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAA'+
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'+
@@ -24,17 +24,24 @@
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'+
'AAAA//8AAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIAB'+
'AACAAQAA//8AAA==';
- var hbCountIcon = document.createElement('statusbarpanel');
- document.getElementById('status-bar').insertBefore(hbCountIcon, document.getElementById('security-button').nextSibling);
+ var hbCountIcon = document.getElementById('status-bar')
+ .insertBefore(document.createElement('statusbarpanel'),
+ document.getElementById('security-button')
+ .nextSibling);
hbCountIcon.setAttribute('id', 'hatena-bookmark-count-icon');
hbCountIcon.setAttribute('src', ICON);
hbCountIcon.setAttribute('class', 'statusbarpanel-iconic');
- hbCountIcon.addEventListener("click", function(e) {
- liberator.open("http://b.hatena.ne.jp/entry/" + liberator.modules.buffer.URL, liberator.NEW_TAB);
+ hbCountIcon.addEventListener('click', function(e) {
+ liberator.open('http://b.hatena.ne.jp/entry/' + liberator.modules.buffer.URL
+ .replace(/#/g, '%23'),
+ liberator.NEW_TAB);
}, false);
liberator.plugins.hbCountUpdate = function() {
- hbCountIcon.setAttribute('src', "http://b.hatena.ne.jp/entry/image/" + liberator.modules.buffer.URL);
- }
- liberator.modules.autocommands.add('LocationChange', '.*', 'js liberator.plugins.hbCountUpdate()');
+ hbCountIcon.setAttribute('src',
+ 'http://b.hatena.ne.jp/entry/image/' +
+ liberator.modules.buffer.URL.replace(/#/g, '%23'));
+ };
+ liberator.modules.autocommands.add('LocationChange', '.*',
+ 'js liberator.plugins.hbCountUpdate()');
})();
// vim:sw=4 ts=4 et: