diff options
author | anekos | 2010-05-20 17:27:02 +0000 |
---|---|---|
committer | anekos | 2010-05-20 17:27:02 +0000 |
commit | 205394f023f47498174974f5e39317b9f8e0e8d7 (patch) | |
tree | 180d0a721eef28b613adcc774bf4f9cc0de58bf7 /lo.js | |
parent | aac87c7476431cb368103972ff836e97b5372098 (diff) | |
download | vimperator-plugins-205394f023f47498174974f5e39317b9f8e0e8d7.tar.bz2 |
リンクに画像が含まれる場合、画像を補完に出すようにした
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37662 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'lo.js')
-rw-r--r-- | lo.js | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -39,7 +39,7 @@ let PLUGIN_INFO = <name lang="ja">Link Opener</name> <description>Link Opener</description> <description lang="ja">リンクを開く</description> - <version>2.1.1</version> + <version>2.2.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> @@ -54,7 +54,7 @@ let PLUGIN_INFO = // INFO {{{ let INFO = <> - <plugin name="link-opener" version="2.1.0" + <plugin name="link-opener" version="2.2.0" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/lo.js" summary="Link Opener" lang="en-US" @@ -103,7 +103,7 @@ let INFO = </description> </item> </plugin> - <plugin name="link-opener" version="2.1.0" + <plugin name="link-opener" version="2.2.0" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/lo.js" summary="Link Opener" lang="ja" @@ -179,6 +179,8 @@ let INFO = (function () { + const CompItemStyle = "margin-right: 0.5em; max-height: 3em !important; max-width 6em !important;" + let migemo = window.XMigemoCore; function isHttpLink (link) @@ -307,12 +309,20 @@ let INFO = context.filters = [CompletionContext.Filter.textDescription]; context.anchored = false; context.title = ['URL', 'Text Content']; + context.keys = { + text: function ({elem, index}) (index + ': ' + (elem.textContent || elem.href)), + description: function ({elem}) (elem.href), + thumbnail: function ({elem}) let (img = elem.querySelector('img')) (img && img.src) + }; context.compare = CompletionContext.Sort.number; - context.completions = - lolinks.map(function (it, i) let (url = it.href, text = it.textContent) ([ - i + ": " + (text || url), - it.href - ])); + let process = Array.slice(context.process); + context.process = [ + process[0], + function (item, text) + (item.thumbnail ? <><img src={item.thumbnail} style={CompItemStyle}/>{text}</> + : process[1].apply(this, arguments)) + ]; + context.completions = lolinks.map(function (it, i) ({elem: it, index: i})); } }, true |