Skip to content

Instantly share code, notes, and snippets.

@anekos
Created January 19, 2010 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/281167 to your computer and use it in GitHub Desktop.
Save anekos/281167 to your computer and use it in GitHub Desktop.
// http://vimperator.g.hatena.ne.jp/voidy21/20100119/1263907211 の改良(?)版
(function () {
let U = liberator.plugins.libly.$U;
function jump (url) {
let index = 0;
let url = util.stringToURLArray(url).toString();
for each ( [,tab] in tabs.browsers ) {
if(url == tab.currentURI.spec){
tabs.select(index);
return true;
}
++index;
}
return false;
}
"open tabopen edit".split(/\s/).forEach(
function (name) {
let command = commands.get(name);
if (!command)
return;
U.around(
command,
"action",
function (next, args) {
let url = args[0].string;
if (!(url && jump(url)))
return next();
},
true
);
}
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment