diff options
author | drry | 2008-12-16 07:31:18 +0000 |
---|---|---|
committer | drry | 2008-12-16 07:31:18 +0000 |
commit | 96918275e72154361b6d5f059b8d27600972a4a5 (patch) | |
tree | 54ff8079af0404cc82194f1d8c7cab1537ed5f13 /hatebuCounter.js | |
parent | 7f93f78f281d396b76b5da635bc40042bd2b1484 (diff) | |
download | vimperator-plugins-96918275e72154361b6d5f059b8d27600972a4a5.tar.bz2 |
* `#`
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26858 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'hatebuCounter.js')
-rw-r--r-- | hatebuCounter.js | 25 |
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: |