瀏覽代碼

define echoTabInfo and set locationchange hook

pull/1/head
10sr 11 年之前
父節點
當前提交
bcc62e7c25
共有 1 個文件被更改,包括 43 次插入13 次删除
  1. +43
    -13
      _keysnail.js

+ 43
- 13
_keysnail.js 查看文件

@@ -246,7 +246,46 @@ plugins.options["twitter_client.jmp_key"] =
plugins.options["twitter_client.use_jmp"] = true;

////////////////////////////////////////////
// my ext
// my exts and functions

var echoTabInfo = (function(){
var currenttab;
function _display(msg){
display.prettyPrint(msg, {
timeout: 2000,
style: {
"font-size": "18px"
}
});
}

function __display(msg){
display.echoStatusBar(msg);
}

function echo(){
var newtab = getBrowser().mCurrentTab;
if (currenttab === newtab) {
return;
}

currenttab = newtab;
var len = getBrowser().tabs.length;
var idx = currenttab._tPos;
var title = window.content.document.title;
var url = window.content.location.href;
_display(
(idx + 1).toString() + " / " +
len.toString() + " : " +
title + " <" +
url + ">"
);
}

return {
echo: echo
};
})();

ext.add("open-remote-init-file", function(ev, arg){
const URL = "https://raw.github.com/10sr/dotfiles/master/_keysnail.js";
@@ -295,17 +334,6 @@ ext.add("my-index-html", function(ev, arg){
}
}, "open my index.html");

ext.add("echo-tab-info", function(){
var all = getBrowser().tabs.length;
var ix = getBrowser().mCurrentTab._tPos;
var title = window.document.title;
var url = window.content.location.href;
display.echoStatusBar((ix + 1).toString() + " / " +
all.toString() + " : " +
title + " <" +
url + ">");
}, "echo tab info");

ext.add("strong-fullscreen", function(){
var elemids = [
"navigator-toolbox"
@@ -771,7 +799,9 @@ hook.setHook('Unload', function () {
});
});


hook.setHook('LocationChange', function (aNsURI) {
echoTabInfo.echo();
});
// ============================= Key bindings ============================== //

key.setGlobalKey('C-<up>', function () {


Loading…
取消
儲存