root/lang/javascript/vimperator-plugins/trunk/no-reading.js

Revision 36757, 7.0 kB (checked in by anekos, 7 months ago)

説明が入れ替わっていたのを修正

  • Property svn:executable set to *
Line 
1/* NEW BSD LICENSE {{{
2Copyright (c) 2009-2010, anekos.
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without modification,
6are permitted provided that the following conditions are met:
7
8    1. Redistributions of source code must retain the above copyright notice,
9       this list of conditions and the following disclaimer.
10    2. Redistributions in binary form must reproduce the above copyright notice,
11       this list of conditions and the following disclaimer in the documentation
12       and/or other materials provided with the distribution.
13    3. The names of the authors may not be used to endorse or promote products
14       derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25THE POSSIBILITY OF SUCH DAMAGE.
26
27
28###################################################################################
29# http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license       #
30# に参考になる日本語訳がありますが、有効なのは上記英文となります。                #
31###################################################################################
32
33}}} */
34
35// PLUGIN_INFO {{{
36let PLUGIN_INFO =
37<VimperatorPlugin>
38  <name>No Reading</name>
39  <name lang="ja">No Reading</name>
40  <description>No reading!</description>
41  <description lang="ja">~からデータを転送していますなどの表示を消す(またはecho)</description>
42  <version>1.2.2</version>
43  <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
44  <license>new BSD License (Please read the source code comments of this plugin)</license>
45  <license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
46  <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/no-reading.js</updateURL>
47  <minVersion>2.2</minVersion>
48  <maxVersion>2.3pre</maxVersion>
49  <require type="plugin">_libly.js</require>
50  <detail><![CDATA[
51    let g:no_reading_do_echo = 1
52    let g:no_reading_on_statusline = 1
53    let g:no_reading_statusline_limit = 1
54  ]]></detail>
55  <detail lang="ja"><![CDATA[
56    let g:no_reading_do_echo = 1
57    let g:no_reading_on_statusline = 1
58    let g:no_reading_statusline_limit = 1
59  ]]></detail>
60</VimperatorPlugin>;
61// }}}
62// INFO {{{
63let INFO =
64<>
65  <plugin name="No-Reading" version="1.2.1"
66          href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/no-reading.js"
67          summary="No Reading"
68          lang="en-US"
69          xmlns="http://vimperator.org/namespaces/liberator">
70    <author email="anekos@snca.net">anekos</author>
71    <license>New BSD License</license>
72    <project name="Vimperator" minVersion="2.3"/>
73    <p>
74      Remove or move some messages for statusline.
75    </p>
76    <item>
77      <tags>g:no_reading_do_echo</tags>
78      <spec>let g:no_reading_do_echo</spec>
79      <spec>liberator.globalVariables.no_reading_do_echo</spec>
80      <description>
81        <p>substitute by echo</p>
82      </description>
83    </item>
84    <item>
85      <tags>g:no_reading_on_statusline</tags>
86      <spec>let g:no_reading_on_statusline</spec>
87      <spec>liberator.globalVariables.no_reading_on_statusline</spec>
88      <description>
89        <p>Move displays into statusline.</p>
90      </description>
91    </item>
92  </plugin>
93  <plugin name="No-Reading" version="1.2.1"
94          href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/no-reading.js"
95          summary="~からデータを転送していますなどの表示を消したり移動したり"
96          lang="ja"
97          xmlns="http://vimperator.org/namespaces/liberator">
98    <author email="anekos@snca.net">anekos</author>
99    <license>New BSD License</license>
100    <project name="Vimperator" minVersion="2.3"/>
101    <p>
102      ~からデータを転送していますなどの表示を消したり、ステータスラインに移動したり、echo したり。
103    </p>
104    <item>
105      <tags>g:no_reading_do_echo</tags>
106      <spec>let g:no_reading_do_echo</spec>
107      <spec>liberator.globalVariables.no_reading_do_echo</spec>
108      <description>
109        <p>echo で代用</p>
110      </description>
111    </item>
112    <item>
113      <tags>g:no_reading_on_statusline</tags>
114      <spec>let g:no_reading_on_statusline</spec>
115      <spec>liberator.globalVariables.no_reading_on_statusline</spec>
116      <description>
117        <p>表示をステータスラインに移動</p>
118      </description>
119    </item>
120  </plugin>
121</>;
122// }}}
123
124(function () {
125
126    let eraseTimerHandle;
127    let label;
128    let (
129      sl = document.getElementById('liberator-statusline'),
130      slfu = document.getElementById('liberator-statusline-field-inputbuffer')
131    ) {
132      label = document.createElement('label');
133      label.setAttribute('id', 'vimperator-plugin-no-reading-label');
134      sl.insertBefore(label, slfu);
135    }
136
137  let $ = {
138    get doEcho ()
139      liberator.globalVariables.no_reading_do_echo,
140
141    get onStatusLine ()
142      !!liberator.globalVariables.no_reading_on_statusline,
143
144    get statuslineLimit ()
145      liberator.globalVariables.no_reading_statusline_limit
146  };
147
148  let (doErase = true)
149    liberator.plugins.libly.$U.around(
150      statusline,
151      'updateUrl',
152      function (next, args) {
153        function setLabel (status) {
154          label.tooltipText = status;
155          label.value = status;
156        }
157
158        function updateStatus (status) {
159          doErase = true;
160          if ($.onStatusLine) {
161            eraseTimerHandle && clearTimeout(eraseTimerHandle);
162            if ($.statuslineLimit) {
163              eraseTimerHandle =
164                setTimeout(
165                  function () (eraseTimerHandle = null, setLabel('')),
166                  $.statuslineLimit
167                );
168            }
169            setLabel(status);
170          } else {
171            if ($.doEcho)
172              liberator.echo(status, commandline.FORCE_SINGLELINE)
173          }
174        }
175
176        function showURL () {
177          if ($.onStatusLine) {
178            setLabel('');
179          } else {
180            if (doErase && $.doEcho)
181              liberator.echo('', commandline.FORCE_SINGLELINE)
182          }
183          doErase = false;
184          return next();
185        }
186
187        let [url] = args;
188        return (url ? updateStatus : showURL)(url);
189      }
190    );
191
192})();
193
194// vim:sw=2 ts=2 et si fdm=marker:
Note: See TracBrowser for help on using the browser.