vimperator の status bar
id:eclipse-a がなんか面白いことをやっているみたいなので ( http://d.hatena.ne.jp/eclipse-a/20081027/1225115887 ) 便乗。そしてえらくないので添削じゃなくておれしきリライト。statusbar を黒にしているので google の favicon は見づらくてんーってなる。逆にはてなダイアリーは白なので映える。ふつくしい…。
vimp 1.2 の場合は liberator.modules.autocommands.add を liberator.autocommands.add に読み替えてください。あとこれ plugin 化してもいいかも。外に出せるとこは全部出しちゃう方向で。
favicon のほうに liberator.modules.autocommands.add('DOMLoad', ほにゃらら); を追加。ページ遷移したときに読み込めてなかったね。ゴメン
// display favicon liberator.plugins.faviconizeStatusBar = function () { var panelInit = function () { var panel = document.getElementById('page-proxy-favicon-clone'); if (!panel) { panel = document.createElement('statusbarpanel'); panel.setAttribute('id', 'page-proxy-favicon-clone'); } while (panel.childNodes.length > 0) { panel.removeChild(panel.childNodes.item(0)); } return panel; }; var base = document.getElementById('page-proxy-favicon'); var panel = panelInit(); panel.appendChild(base.cloneNode(true)); //base.parentNode.removeChild(base); document.getElementById('status-bar').insertBefore( panel, document.getElementById('liberator-statusline') ); } liberator.modules.autocommands.add( 'LocationChange', '.*', 'js liberator.plugins.faviconizeStatusBar()' ); liberator.modules.autocommands.add( 'DOMLoad', '.*', 'js liberator.plugins.faviconizeStatusBar()' ); // display history navigator // '<' tell you to back history is available // '>' tell you to forward history is available liberator.plugins.historyNavigator = function () { var tabcountInit = function () { var tabcount = document.getElementById('liberator-statusline-field-history'); if (!tabcount) { var panel = document.createElement('statusbarpanel'); var tabcount = document.getElementById('liberator-statusline-field-tabcount') .cloneNode(false); tabcount.setAttribute('id', 'liberator-statusline-field-history'); tabcount.setAttribute('value', ' '); panel.appendChild(tabcount); document.getElementById('status-bar').insertBefore( panel, document.getElementById('liberator-statusline') ); } return tabcount; }; var tabcount = tabcountInit(); var history = getWebNavigation().sessionHistory; history = (history.index > 0 ? '<' : ' ') + (history.index < history.count - 1 ? '>' : ' '); tabcount.setAttribute('value', history); } liberator.modules.autocommands.add( 'LocationChange', '.*', 'js liberator.plugins.historyNavigator()' );
あとちょういまさらなんだけど getBrowser() と getWebNavigation() はじめて知った。なんか面白そうなのであとで調べてみよう。てかいまだにサイ本読めてないちゅーアレ具合なんだけどまぁそれはそれで。あと vimp が振ってる id とかみんなどこから見つけ出してくるんだろうかとちょっと不思議に思った。やっぱりソースから ? おかげでかなり JavaScript 熱が高まったぜ。 id:eclipse-a ++ 。