aboutsummaryrefslogtreecommitdiffstats
path: root/hatebuCounter.js
blob: df7d0decb7d291c01d0b70f27fe3534e1ad053dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Vimperator plugin: hatena bookmark image counter
// Maintainer: mattn <mattn.jp@gmail.com> - http://mattn.kaoriya.net

(function(){
    const ICON = 'data:image/x-icon;base64,'+
        'AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAA'+
        'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'+
        'AAAAAAAAAAAAAAAAAAAAAOd5Uv/JXyr/yV8q/8lfKv/JXyr/yV8q/8lfKv/JXyr/yV8q/8lfKv/J'+
        'Xyr/yV8q/8lfKv/JXyr/AAAAAAAAAAD6pYX/53lS/+d5Uv/neVL/53lS/+d5Uv/neVL/53lS/+d5'+
        'Uv/neVL/53lS/+d5Uv/neVL/yV8q/wAAAAAAAAAA+qWF/+d5Uv/neVL/53lS/+d5Uv/neVL/53lS'+
        '/+d5Uv/neVL/53lS/+d5Uv/neVL/53lS/8lfKv8AAAAAAAAAAPqlhf/neVL/53lS/+d5Uv//////'+
        '///////////////////////////neVL/53lS/+d5Uv/JXyr/AAAAAAAAAAD6pYX/53lS/+d5Uv/n'+
        'eVL////////////neVL/53lS/+d5Uv///////////+d5Uv/neVL/yV8q/wAAAAAAAAAA+qWF/+d5'+
        'Uv/neVL/53lS////////////53lS/+d5Uv/neVL////////////neVL/53lS/8lfKv8AAAAAAAAA'+
        'APqlhf/neVL/53lS/+d5Uv///////////+d5Uv/neVL/53lS////////////53lS/+d5Uv/JXyr/'+
        'AAAAAAAAAAD6pYX/53lS/+d5Uv/neVL/////////////////////////////////53lS/+d5Uv/n'+
        'eVL/yV8q/wAAAAAAAAAA+qWF/+d5Uv/neVL/53lS////////////53lS/+d5Uv///////////+d5'+
        'Uv/neVL/53lS/8lfKv8AAAAAAAAAAPqlhf/neVL/53lS/+d5Uv///////////+d5Uv/neVL/////'+
        '///////neVL/53lS/+d5Uv/JXyr/AAAAAAAAAAD6pYX/53lS/+d5Uv/neVL/////////////////'+
        '///////////neVL/53lS/+d5Uv/neVL/yV8q/wAAAAAAAAAA+qWF/+d5Uv/neVL/53lS/+d5Uv/n'+
        'eVL/53lS/+d5Uv/neVL/53lS/+d5Uv/neVL/53lS/8lfKv8AAAAAAAAAAPqlhf/neVL/53lS/+d5'+
        'Uv/neVL/53lS/+d5Uv/neVL/53lS/+d5Uv/neVL/53lS/+d5Uv/JXyr/AAAAAAAAAAD6pYX/+qWF'+
        '//qlhf/6pYX/+qWF//qlhf/6pYX/+qWF//qlhf/6pYX/+qWF//qlhf/6pYX/53lS/wAAAAAAAAAA'+
        'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'+
        'AAAA//8AAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIAB'+
        'AACAAQAA//8AAA==';
    var hbCountIcon = document.createElement('statusbarpanel');
    document.getElementById('status-bar').insertBefore(hbCountIcon, 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);
    }, 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()');
})();
// vim:sw=4 ts=4 et: