From 50a6606f608cd0ef72b951289463f3bad95243a7 Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 4 Feb 2010 10:04:26 +0000 Subject: ステータスラインに表示を移動できるようにした。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36611 d0d07461-0603-4401-acd4-de1884942a52 --- no-reading.js | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 10 deletions(-) (limited to 'no-reading.js') diff --git a/no-reading.js b/no-reading.js index d2c1f5c..02c8c54 100755 --- a/no-reading.js +++ b/no-reading.js @@ -1,5 +1,5 @@ /* NEW BSD LICENSE {{{ -Copyright (c) 2009, anekos. +Copyright (c) 2009-2010, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -39,7 +39,7 @@ let PLUGIN_INFO = No Reading No reading! ~からデータを転送していますなどの表示を消す(またはecho) - 1.0.0 + 1.1.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -49,33 +49,125 @@ let PLUGIN_INFO = _libly.js ; // }}} +// INFO {{{ +let INFO = +<> + + anekos + New BSD License + +

+ The below text is written in English. Believe! +

+ + g:no_reading_do_echo + let g:no_reading_do_echo + liberator.globalVariables.no_reading_do_echo + +

表示をステータスラインに移動

+
+
+ + g:no_reading_on_statusline + let g:no_reading_on_statusline + liberator.globalVariables.no_reading_on_statusline + +

echo で代用

+
+
+
+ + anekos + New BSD License + +

+ ~からデータを転送していますなどの表示を消したり、ステータスラインに移動したり、echo したり。 +

+ + g:no_reading_do_echo + let g:no_reading_do_echo + liberator.globalVariables.no_reading_do_echo + +

表示をステータスラインに移動

+
+
+ + g:no_reading_on_statusline + let g:no_reading_on_statusline + liberator.globalVariables.no_reading_on_statusline + +

echo で代用

+
+
+
+; +// }}} (function () { - function doEcho () - liberator.globalVariables.no_reading_do_echo; + let label; + let ( + sl = document.getElementById('liberator-statusline'), + slfu = document.getElementById('liberator-statusline-field-inputbuffer') + ) { + label = document.createElement('label'); + label.setAttribute('id', 'vimperator-plugin-no-reading-label'); + sl.insertBefore(label, slfu); + } + + let $ = { + get doEcho () + liberator.globalVariables.no_reading_do_echo, + + get onStatusLine () + !!liberator.globalVariables.no_reading_on_statusline + }; let (doErase = true) liberator.plugins.libly.$U.around( statusline, 'updateUrl', function (next, args) { - let [url] = args; - if (url) { + function updateStatus (status) { doErase = true; - doEcho() && liberator.echo(url, commandline.FORCE_SINGLELINE) - } else { - if (doErase && doEcho()) - liberator.echo('', commandline.FORCE_SINGLELINE) + if ($.onStatusLine) { + label.tooltipText = status; + label.value = status; + } else { + if ($.doEcho) + liberator.echo(status, commandline.FORCE_SINGLELINE) + } + } + + function showURL () { + if ($.onStatusLine) { + label.value = ''; + } else { + if (doErase && $.doEcho) + liberator.echo('', commandline.FORCE_SINGLELINE) + } doErase = false; return next(); } + + let [url] = args; + return (url ? updateStatus : showURL)(url); } ); -- cgit v1.2.3