From de2183edc66798cb9fcde2fa6e0960a062948a2d Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 4 Feb 2010 10:37:53 +0000 Subject: ステータスライン表示のタイムリミット設定を追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36612 d0d07461-0603-4401-acd4-de1884942a52 --- no-reading.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/no-reading.js b/no-reading.js index 02c8c54..9c2d1c9 100755 --- a/no-reading.js +++ b/no-reading.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = No Reading No reading! ~からデータを転送していますなどの表示を消す(またはecho) - 1.1.0 + 1.2.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -50,10 +50,12 @@ let PLUGIN_INFO = ; // }}} @@ -121,6 +123,7 @@ let INFO = (function () { + let eraseTimerHandle; let label; let ( sl = document.getElementById('liberator-statusline'), @@ -136,7 +139,10 @@ let INFO = liberator.globalVariables.no_reading_do_echo, get onStatusLine () - !!liberator.globalVariables.no_reading_on_statusline + !!liberator.globalVariables.no_reading_on_statusline, + + get statuslineLimit () + liberator.globalVariables.no_reading_statusline_limit }; let (doErase = true) @@ -144,11 +150,23 @@ let INFO = statusline, 'updateUrl', function (next, args) { + function setLabel (status) { + label.tooltipText = status; + label.value = status; + } + function updateStatus (status) { doErase = true; if ($.onStatusLine) { - label.tooltipText = status; - label.value = status; + eraseTimerHandle && clearTimeout(eraseTimerHandle); + if ($.statuslineLimit) { + eraseTimerHandle = + setTimeout( + function () (eraseTimerHandle = null, setLabel('')), + $.statuslineLimit + ); + } + setLabel(status); } else { if ($.doEcho) liberator.echo(status, commandline.FORCE_SINGLELINE) @@ -157,7 +175,7 @@ let INFO = function showURL () { if ($.onStatusLine) { - label.value = ''; + setLabel(''); } else { if (doErase && $.doEcho) liberator.echo('', commandline.FORCE_SINGLELINE) -- cgit v1.2.3