diff options
author | anekos | 2010-05-28 11:43:12 +0000 |
---|---|---|
committer | anekos | 2010-05-28 11:43:12 +0000 |
commit | 9557b7c783e5689e5ff271e29faa0da60ebb9744 (patch) | |
tree | 12a77bd9b1fcba9ca78b9b2920df9b138b0bb361 /gmail-commando.js | |
parent | 7c59defd64ef8b8466019c7dee3222bb5bd8dd01 (diff) | |
download | vimperator-plugins-9557b7c783e5689e5ff271e29faa0da60ebb9744.tar.bz2 |
Gmail 外からでも飛べるように
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37741 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'gmail-commando.js')
-rwxr-xr-x | gmail-commando.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gmail-commando.js b/gmail-commando.js index 3e24219..e45e3c6 100755 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -253,12 +253,26 @@ let INFO = } }; + function search (args) { + const URL = 'https://mail.google.com/mail/#search/'; + + try { + var inGmail = /^mail\.google\.com$/(Elements.doc.location.hostname) + } catch (e) {} + + if (inGmail) { + Elements.input.value = args; + buffer.followLink(Elements.searchButton); + } else { + liberator.open(URL + encodeURIComponent(args), liberator.NEW_TAB); + } + } + commands.addUserCommand( ['gmail'], 'GMail Commando', function (args) { - Elements.input.value = args.literalArg; - buffer.followLink(Elements.searchButton); + search(args.literalArg); }, { literal: 0, |