/** * ==VimperatorPlugin== * @name proxy.js * @description proxy setting plugin * @description-ja プロクシ設定 * @minVersion 0.6pre * @author cho45, halt feits * @version 0.6.2 * ==/VimperatorPlugin== * * Usage: * :proxy {conf_name} -> set proxy setting to conf_name * * The proxy_settings is a string variable which can set on * vimperatorrc as following. * * let proxy_settings = "[{ { conf_name:'disable', conf_usage:'direct connection', settings:[{label:'type', param:0}] } }]" * * or your can set it using inline JavaScript. * * javascript < 1) ? args[0].toString() : args.string; if (!name) { liberator.echo("Usage: proxy {setting name}"); } proxy_settings.some(function (proxy_setting) { if (proxy_setting.conf_name.toLowerCase() != name.toLowerCase()) { return false; } //delete setting ['http', 'ssl', 'ftp', 'gopher'].forEach(function (scheme_name) { prefs.setCharPref("network.proxy." + scheme_name, ''); prefs.setIntPref("network.proxy." + scheme_name + "_port", 0); }); proxy_setting.settings.forEach(function (conf) { options.setPref('network.proxy.' + conf.label, conf.param); }); liberator.echo("Set config: " + name); return true; }); }, { completer: function (context, args) { var completions = []; context.title = ["Proxy Name", "Proxy Usage"]; context.completions = [[c.conf_name, c.conf_usage] for each (c in proxy_settings)]; } }); })(); // vim: set sw=4 ts=4 et: ='n7' href='#n7'>7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
var PLUGIN_INFO =
<VimperatorPlugin>
<name>removetabs</name>
<description>RemoveTabs</description>
<description lang="ja">タブをまとめて閉じる</description>
<author mail="fifnel@gmail.com" homepage="http://fifnel.com/">fifnel</author>
<version>0.1</version>
<minVersion>2.0pre</minVersion>
<maxVersion>2.0pre</maxVersion>
<updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/removetabs.js</updateURL>
<detail lang="ja"><![CDATA[
これはremovetabsアドオンと似たような処理を行うアドオンです
現在のタブから左もしくは右のタブをすべてクローズすることができます
https://addons.mozilla.org/ja/firefox/addon/4227

== Command ==

:removetabsleft:
    現在のタブから左にあるタブをすべて閉じます
    現在のタブは閉じられません
    
:removetabsright:
    現在のタブから右にあるタブをすべて閉じます
    現在のタブは閉じられません

== 設定例 ==
.vimperatorrcに以下のような感じで設定すると良いかもしれません
>||
    noremap <C-P> :removetabsleft<CR>
    noremap <C-N> :removetabsright<CR>
||<
]]></detail>
</VimperatorPlugin>;

(function(){
    liberator.modules.commands.addUserCommand(['removetabsleft'], 'remove tabs left',
        function() {
            var ts = getBrowser().tabContainer.childNodes;
            var ct = getBrowser().selectedTab;
            var i;
            for( i=ts.length-1; ts[i]!=ct; i-- ) {}
            for( i--; i>=0; i-- ) {
                getBrowser().removeTab( ts[i] );
            }
        },{}
    );
    liberator.modules.commands.addUserCommand(['removetabsright'], 'remove tabs right',
        function(){
            var ts = getBrowser().tabContainer.childNodes;
            var ct = getBrowser().selectedTab;
            for( var i=ts.length-1; ts[i]!=ct; i-- ) {
                getBrowser().removeTab( ts[i] );
            }
        },{}
    );
})();