diff options
author | seenxu | 2013-04-03 18:26:25 +0300 |
---|---|---|
committer | anekos | 2014-06-21 00:02:33 +0900 |
commit | 8aab6c4290cdca7a0feefbd346b3fc19495c847e (patch) | |
tree | e4211efe087ae73c63a42735e0fa0e7c0ebb3ad2 /maine_coon.js | |
parent | f4af26bd594e06881be52f6cd48562104724977e (diff) | |
download | vimperator-plugins-8aab6c4290cdca7a0feefbd346b3fc19495c847e.tar.bz2 |
remove hover link feature
reasons for the feature removal:
* Firefox has a similar built-in feature
* U.xmlToDom fails to append element to the page bottom
* if there are too many links on page, append to DOM thing hurts performance.
Conflicts:
maine_coon.js
Diffstat (limited to 'maine_coon.js')
-rw-r--r-- | maine_coon.js | 257 |
1 files changed, 62 insertions, 195 deletions
diff --git a/maine_coon.js b/maine_coon.js index af4ff57..b71b059 100644 --- a/maine_coon.js +++ b/maine_coon.js @@ -32,114 +32,65 @@ THE POSSIBILITY OF SUCH DAMAGE. */ -let PLUGIN_INFO = xml` -<VimperatorPlugin> - <name>Maine Coon</name> - <name lang="ja">メインクーン</name> - <description>Make the screen larger</description> - <description lang="ja">なるべくでかい画面で使えるように</description> - <version>2.6.5</version> - <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> - <minVersion>3.0</minVersion> - <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/maine_coon.js</updateURL> - <license>new BSD License (Please read the source code comments of this plugin)</license> - <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license> - <detail><![CDATA[ - == Requires == - _libly.js - == Options == - mainecoon: - Possible values - c: - Hide caption-bar - a: - Hide automatically command-line - f: - Fullscreeen - C: - Hide caption-bar - If window is maximized, then window maximize after window is hid. - m: - Displays the message to command-line. - (e.g. "Yanked http://..." "-- CARET --") - u: - Displays the message of current page URL when page is loaded. - >|| - :set mainecoon=ac - ||< - The default value of this option is "amu". - === note === - The C and c options probably are supported on some OSs only. - == Global Variables == - maine_coon_targets: - Other elements IDs that you want to hide. - let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter" - maine_coon_default: - The default value of 'mainecoon' option. - >|| - let g:maine_coon_default = "ac" - ||< - maine_coon_style: - The Style for message output. - >|| - let g:maine_coon_style = "border: 1px solid pink; padding: 3px; color: pink; background: black; font: 18px/1 sans-serif;" - ||< - == Thanks == - snaka72 (hidechrome part): - http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955 - == Maine Coon == - http://en.wikipedia.org/wiki/Maine_Coon - ]]></detail> - <detail lang="ja"><![CDATA[ - == Requires == - _libly.js - == Options == - mainecoon: - 以下の文字の組み合わせを指定します。 - c: - キャプションバーを隠す - a: - 自動でコマンドラインを隠す - f: - フルスクリーン - C: - キャプションバーを隠す - ウィンドウが最大化されているときは、隠したあとに最大化し直します - m: - コマンドラインへのメッセージを表示します。 - ("Yanked http://..." "-- CARET --" など) - u: - ページが読み込まれたときにURLをポップアップ表示する。 - "c" と "f" の併用は意味がありません。 - >|| - :set mainecoon=ac - ||< - デフォルト値は "amu" - === 備考 === - C c オプションはいくつかの OS でのみ有効です。多分。 - == Global Variables == - maine_coon_targets: - フルスクリーン時にの非表示にしたい要素のIDを空白区切りで指定します。 - >|| +var INFO = xml ` +<plugin name="Maine Conn" version="2.6.6" + href="https://github.com/vimpr/vimperator-plugins/raw/master/maine_coon.js" + summary = "hide the bottom statusbar" + xmlns="http://vimperator.org/namespaces/liberator"> + <author href="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> + <license>BSD</license> + <project name="Vimperator" minVersion="3.6.1"/> + <p> + <code><![CDATA[ + == Requires == + _libly.js + == Options == + mainecoon: + Possible values + c: + Hide caption-bar + a: + Hide automatically command-line + f: + Fullscreeen + C: + Hide caption-bar + If window is maximized, then window maximize after window is hid. + m: + Displays the message to command-line. + (e.g. "Yanked http://..." "-- CARET --") + u: + Displays the message of current page URL when page is loaded. + >|| + :set mainecoon=ac + ||< + The default value of this option is "amu". + === note === + The C and c options probably are supported on some OSs only. + == Global Variables == + maine_coon_targets: + Other elements IDs that you want to hide. let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter" - ||< - maine_coon_default: - オプションのデフォルト値を設定します。 - >|| - let g:maine_coon_default = "ac" - ||< - maine_coon_style: - メッセージ表示のスタイル指定です。 - >|| - let g:maine_coon_style = "border: 1px solid pink; padding: 3px; color: pink; background: black; font: 18px/1 sans-serif;" - ||< - == Thanks == - snaka72 (hidechrome part): - http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955 - == メインクーン == - http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%AF%E3%83%BC%E3%83%B3 - ]]></detail> -</VimperatorPlugin>`; + maine_coon_default: + The default value of 'mainecoon' option. + >|| + let g:maine_coon_default = "ac" + ||< + maine_coon_style: + The Style for message output. + >|| + let g:maine_coon_style = "border: 1px solid pink; padding: 3px; color: pink; background: black; font: 18px/1 sans-serif;" + ||< + == Thanks == + * snaka72 (hidechrome part): + http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955 + * seenxu + make maine_coon.js works with vimperator 3.6.1) + == Maine Coon == + http://en.wikipedia.org/wiki/Maine_Coon + ]]></code> + </p> +</plugin>`; (function () { @@ -168,7 +119,6 @@ let PLUGIN_INFO = xml` }) ); - function s2b (s, d) !!((!/^(\d+|false)$/i.test(s)|parseInt(s)|!!d*2)&1<<!s); function hideTargets (hide) { @@ -246,58 +196,6 @@ let PLUGIN_INFO = xml` function important (style) style.replace(/(!important)?\s*;/g, ' !important;'); - let echo = (function () { - let time = 40; - let remove; - - return function (message) { - if (remove) - remove(); - let doc = window.content.document; - - // XXX 中身なしっぽいときは、あきらめる。代替手段が欲しい - if (!doc.body) - return; - - let style = - 'opacity: 1; ' + - important( - highlight.get('StatusLine').value + - U.toStyleText({ - position: 'fixed', - zIndex: 1000, - left: 0, - bottom: 0, - MozBoxSizing: 'content-box', - }) + - elemStyle - ); - let elem = U.xmlToDom(xml`<div id="liberator_maine_coon" style=${style}>${message}</div>`, doc); - doc.body.appendChild(elem); - let count = time; - let handle = setInterval(function () { - try { - if (count <= 0) { - if (remove) - remove(); - } else { - elem.style.MozOpacity = count / time; - } - count--; - } catch (e) { // XXX ほんとは DOM 関連だけキャッチしたい - remove(true); - liberator.log(e); - } - }, 100); - remove = function (noDOM) { - if (!noDOM) - doc.body.removeChild(elem); - clearInterval(handle); - remove = null; - }; - }; - })(); - let setAutoHideCommandLine = (function () { let hiddenNodes = []; @@ -325,7 +223,8 @@ let PLUGIN_INFO = xml` } } else { bottomBar.collapsed = false; - hiddenNodes.forEach(function ([c, v, d]) [c.collapsed, c.style.display] = [v, d]); + hiddenNodes.forEach( + function ([c, v, d]) [c.collapsed, c.style.display] = [v, d]); } } })(); @@ -343,7 +242,6 @@ let PLUGIN_INFO = xml` function focusToCommandline () commandlineBox.inputField.focus(); - let useEcho = false; let autoHideCommandLine = false; let displayURL = true; @@ -366,27 +264,6 @@ let PLUGIN_INFO = xml` ); } - - { - let last; - messageBox.watch('value', function (name, oldValue, newValue) { - try { - if (autoHideCommandLine - && useEcho - && /\S/.test(newValue) - && messageBox.collapsed - && last != newValue - && newValue != 'Press ENTER or type command to continue') { - echo(newValue); - } - } catch (e) { - liberator.reportError(e); - } - last = newValue; - return newValue; - }); - } - U.around(commandline, 'input', function (next, args) { let result = next(); inputting = true; @@ -410,7 +287,8 @@ let PLUGIN_INFO = xml` U.around(commandline._callbacks.submit, modes.EX, function (next, args) { let r = next(); - if (autoHideCommandLine && !inputting && !(modes.extended & modes.OUTPUT_MULTILINE)) + if (autoHideCommandLine && !inputting && !( + modes.extended & modes.OUTPUT_MULTILINE)) commandline.close(); return r; }, true); @@ -427,17 +305,6 @@ let PLUGIN_INFO = xml` U.around(commandline._callbacks.cancel, modes.PROMPT, callback, true); } - events.addSessionListener( - document.getElementById("appcontent"), - "DOMContentLoaded", - function (event) { - let doc = event.originalTarget; - if (doc instanceof HTMLDocument && !doc.defaultView.frameElement && displayURL) - echo(doc.location.href); - }, - true - ); - options.add( ['mainecoon'], 'Make big screen like a Maine Coon', |