diff options
author | anekos | 2010-06-21 16:28:14 +0000 |
---|---|---|
committer | anekos | 2010-06-21 16:28:14 +0000 |
commit | 55261cd431d7ec96e8cd76e49e47539f9a4b355c (patch) | |
tree | 3311c1fe3189a6a187f3b44ec48e2f2f725be965 | |
parent | 8b66fec79c28926404f2e7ec6864c36847949b51 (diff) | |
download | vimperator-plugins-55261cd431d7ec96e8cd76e49e47539f9a4b355c.tar.bz2 |
オプション値 u を追加
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37851 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | forcefocuscontent.js | 33 | ||||
-rwxr-xr-x | gmail-commando.js | 30 | ||||
-rw-r--r-- | maine_coon.js | 26 |
3 files changed, 79 insertions, 10 deletions
diff --git a/forcefocuscontent.js b/forcefocuscontent.js index e8a5d3e..7c97029 100644 --- a/forcefocuscontent.js +++ b/forcefocuscontent.js @@ -11,16 +11,39 @@ var PLUGIN_INFO = </VimperatorPlugin>; //}}} +if (__context__.__addedEventListener) + getBrowser().removeEventListener("load", __context__.__addedEventListener, true); + getBrowser().addEventListener("load", onPageLoad, true); + function onPageLoad(event) { + try { let doc = event.originalTarget; if (doc != getBrowser().contentDocument) return; - setTimeout(function () { - let focused = document.commandDispatcher.focusedElement; - if (focused) - focused.blur(); - }, 100); + + let eproto = doc.defaultView.wrappedJSObject.HTMLInputElement.prototype; + let original = eproto.focus; + + let ignore = function () { return void 0; }; + let remove = function () { + liberator.log('removed'); + eproto.focus = original; + if (handle) + clearTimeout(handle); + }; + + doc.defaultView.wrappedJSObject.HTMLInputElement.prototype.focus = ignore; + + //let handle = setTimeout(remove, 5000); + + liberator.log('injected'); + } catch (e) { + liberator.log(e); + } } + +__context__.__addedEventListener = onPageLoad; + // vim: fdm=marker sw=4 ts=4 et: diff --git a/gmail-commando.js b/gmail-commando.js index 8c457d0..5343bde 100755 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -272,8 +272,31 @@ let INFO = // XXX 毎度 ID が変わるっぽいので、u から選択 get foldButton () this.threadButtons[3], get unfoldButton () this.threadButtons[2], + + get labelButtons () { + function labels () + Elements.doc.querySelectorAll('.J-LC-Jz'); + function show () + Elements.doc.getElementById(':ps'); + + let result = labels(); + if (result) + return A(result); + + buffer.followLink(show()); + result = labels(); + buffer.followLink(show()); + + return A(result); + } }; + //'.J-M-JJ > input' + //let (e = Elements.doc.querySelector('.J-LC-Jz')) { + // liberator.log(e); + // buffer.followLink(e); + // //plugins.feedSomeKeys_3.API.feed('<Cr>', ['keydown'], e) + //} const Commando = { get inGmail () { @@ -305,6 +328,13 @@ let INFO = translateThread: function () buffer.followLink(Elements.translateThreadButton), fold: function () buffer.followLink(Elements.foldButton), unfold: function () buffer.followLink(Elements.unfoldButton), + label: function (names) { + Elements.labelButtons.forEach(function (e) { + if (names.some(function (v) (v == e.textContent))) + buffer.followLink(e); + liberator.log('pressed: ' + e.textContent); + }); + } }; diff --git a/maine_coon.js b/maine_coon.js index 1863271..c6a53c5 100644 --- a/maine_coon.js +++ b/maine_coon.js @@ -38,7 +38,7 @@ let PLUGIN_INFO = <name lang="ja">メインクーン</name> <description>Make the screen larger</description> <description lang="ja">なるべくでかい画面で使えるように</description> - <version>2.4.3</version> + <version>2.5.0</version> <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> <minVersion>2.3</minVersion> <maxVersion>2.3</maxVersion> @@ -65,10 +65,12 @@ let PLUGIN_INFO = (e.g. "Yanked http://..." "-- CARET --") l: Large mode (Hide status line) + u: + Displays the message of current page URL when page is loaded. >|| :set mainecoon=ac ||< - The default value of this option is "am". + The default value of this option is "amu". === note === The C and c options probably are supported on some OSs only. == Global Variables == @@ -116,11 +118,13 @@ let PLUGIN_INFO = ("Yanked http://..." "-- CARET --" など) l: ラージモード (Hide status line) + u: + ページが読み込まれたときにURLをポップアップ表示する。 "c" と "f" の併用は意味がありません。 >|| :set mainecoon=ac ||< - デフォルト値は "am" + デフォルト値は "amu" === 備考 === C c オプションはいくつかの OS でのみ有効です。多分。 == Global Variables == @@ -331,6 +335,7 @@ let elemStyle = let useEcho = false; let autoHideCommandLine = false; + let displayURL = true; let inputting = false; let windowInfo = {}; @@ -339,8 +344,8 @@ let elemStyle = let d = liberator.globalVariables.maine_coon_default; let def = !nothing(d) ? d : - nothing(a) ? 'am' : - s2b(a) ? 'am' : + nothing(a) ? 'amu' : + s2b(a) ? 'amu' : 'm'; autocommands.add( @@ -408,6 +413,15 @@ let elemStyle = U.around(commandline._callbacks.cancel, modes.PROMPT, callback); } + autocommands.add( + 'DOMLoad', + /.*/, + function (args) { + if (displayURL) + echo(args.url); + } + ); + options.add( ['mainecoon'], 'Make big screen like a Maine Coon', @@ -436,6 +450,7 @@ let elemStyle = setAutoHideCommandLine(has('a')); useEcho = has('m'); + displayURL = has('u'); return value; }, @@ -448,6 +463,7 @@ let elemStyle = ['C', 'Hide caption bar (maximize)'], ['m', 'Displays the message to command-line'], ['l', 'Large mode. Hide status-line'], + ['u', 'Displays the message of current page URL when page is loaded.'], ]; }, validater: function (value) /^[cfa]*$/.test(value) |