aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-04-10 15:16:40 +0000
committeranekos2010-04-10 15:16:40 +0000
commit5d5e1c32fc054adb323b879da3b4a1874974ea02 (patch)
treea291cd2990534d5619b897934d2614ebf00427de
parent92e4ae2c78ea26188c4c22958bcb34b1b59d9dfa (diff)
downloadvimperator-plugins-5d5e1c32fc054adb323b879da3b4a1874974ea02.tar.bz2
開くべきモノが見つからなかった場合に、候補URLを出すように
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37180 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-xhints-for-embedded.js27
1 files changed, 22 insertions, 5 deletions
diff --git a/hints-for-embedded.js b/hints-for-embedded.js
index bbcd434..f16cebb 100755
--- a/hints-for-embedded.js
+++ b/hints-for-embedded.js
@@ -38,7 +38,7 @@ let PLUGIN_INFO =
<name>Hints For Embedded Objects</name>
<description>Add the hints mode for Embedded objects.</description>
<description lang="ja">埋め込み(embed)オブジェクト用ヒントモード</description>
- <version>1.2.0</version>
+ <version>1.3.0</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
@@ -58,7 +58,7 @@ let PLUGIN_INFO =
// INFO {{{
let INFO =
<>
- <plugin name="HintsForEmbeded" version="1.2.0"
+ <plugin name="HintsForEmbeded" version="1.3.0"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/hints-for-embedded.js"
summary="Add the hints mode for embedded objects."
lang="en-US"
@@ -102,7 +102,7 @@ let INFO =
</description>
</item>
</plugin>
- <plugin name="HintsForEmbeded" version="1.2.0"
+ <plugin name="HintsForEmbeded" version="1.3.0"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/hints-for-embedded.js"
summary="埋め込み(embed)オブジェクト用ヒントモード"
lang="ja"
@@ -192,7 +192,7 @@ let INFO =
getAttrs(elem),
(Array.slice(elem.querySelectorAll('object,embed,param')) || []).map(getInfo));
- function elemToURL (elem) {
+ function open (elem) {
let info = getInfo(elem.wrappedJSObject);
if (elem.tagName === 'IMG' && elem.src) {
@@ -216,13 +216,30 @@ let INFO =
if (m)
return site.url(Array.slice(m, 1));
}
+
+ let urls = info.filter(function ([n, v]) /^https?:\/\//(v));
+ if (!urls.length)
+ return liberator.echoerr('Could not found URL');
+
+ commandline.input(
+ 'Select the link you wish to open: ',
+ function (url) {
+ liberator.open(url, where);
+ },
+ {
+ default: urls[0][1],
+ completer: function (context) {
+ context.completions = [[v, n] for each ([n, v] in urls)];
+ }
+ }
+ );
}
hints.addMode(
modeName,
DESC,
function (elem) {
- liberator.open(elemToURL(elem), where);
+ liberator.open(open(elem), where);
},
function () '//embed | //object | //img'
);