Created
January 19, 2010 18:55
-
-
Save anekos/281167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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