/* Copyright (c) 2008, anekos. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ################################################################################### # http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license # # に参考になる日本語訳がありますが、有効なのは上記英文となります。 # ################################################################################### */ let PLUGIN_INFO = Maine Coon メインクーン Make the screen larger なるべくでかい画面で使えるように 2.2.2 anekos 2.0pre 2.0pre http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/maine_coon.js new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) || :set mainecoon=ac ||< The default value of this option is "am". === note === The C and c options probably are supported on some OSs only. == Global Variables == maine_coon_targets: Other elements IDs that you want to hide. let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter" maine_coon_default: The default value of 'mainecoon' option. >|| let g:maine_coon_default = "ac" ||< == Example == === The mapping for large mode (l) === >|| :noremap s :set mainecoon!=l ||< == Thanks == snaka72 (hidechrome part): http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955 == Maine Coon == http://en.wikipedia.org/wiki/Maine_Coon ]]> || :set mainecoon=ac ||< デフォルト値は "am" === 備考 === C c オプションはいくつかの OS でのみ有効です。多分。 == Global Variables == maine_coon_targets: フルスクリーン時にの非表示にしたい要素のIDを空白区切りで指定します。 >|| let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter" ||< maine_coon_default: オプションのデフォルト値を設定します。 >|| let g:maine_coon_default = "ac" ||< == Example == === ラージモード(l) 用のマッピング === >|| :noremap s :set mainecoon!=l ||< == Thanks == snaka72 (hidechrome part): http://vimperator.g.hatena.ne.jp/snaka72/20090106/1231262955 == メインクーン == http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%82%AF%E3%83%BC%E3%83%B3 ]]> ; let tagetIDs = (liberator.globalVariables.maine_coon_targets || '').split(/\s+/); (function () { let U = libly.$U; let mainWindow = document.getElementById('main-window'); let messageBox = document.getElementById('liberator-message'); function around (obj, name, func) { let next = obj[name]; obj[name] = function () let (self = this, args = arguments) func.call(self, function () next.apply(self, args), args); } function s2b (s, d) !!((!/^(\d+|false)$/i.test(s)|parseInt(s)|!!d*2)&1<{message}, doc); doc.body.appendChild(elem); let count = time; let handle = setInterval(function () { if (count <= 0) { if (remove) remove(); } else { elem.style.opacity = count / time; } count--; }, 100); remove = function () { doc.body.removeChild(elem); clearInterval(handle); remove = null; }; }; })(); let setAutoHideCommandLine = (function () { let hiddenNodes = []; return function (hide) { hide = !!hide; if (hide === autoHideCommandLine) return; autoHideCommandLine = hide; if (hide) { let cs = messageBox.parentNode.childNodes; hiddenNodes = []; for (let i = 0, l = cs.length, c; i < l; i++) { c = cs[i]; if (c.id == 'liberator-commandline') continue; let style = window.getComputedStyle(c, ''); hiddenNodes.push([c, c.collapsed, style.display]); if (c.id != 'liberator-message') c.style.display = 'none'; c.collapsed = true; } } else { hiddenNodes.forEach(function ([c, v, d]) [c.collapsed, c.style.display] = [v, d]); } } })(); let useEcho = false; let autoHideCommandLine = false; let windowInfo = {}; { let a = liberator.globalVariables.maine_coon_auto_hide; let d = liberator.globalVariables.maine_coon_default; let def = !nothing(d) ? d : nothing(a) ? 'am' : s2b(a) ? 'am' : 'm'; autocommands.add( 'VimperatorEnter', /.*/, function () delay(function () options.get('mainecoon').set(def), 1000) ); } { let last; messageBox.watch('value', function (name, oldValue, newValue) { try { if (autoHideCommandLine && useEcho && /\S/.test(newValue) && messageBox.collapsed && last != newValue && newValue != 'Press ENTER or type command to continue') { echo(newValue); } } catch (e) { liberator.reportError(e); } last = newValue; return newValue; }); } around(commandline, 'open', function (next, args) { messageBox.collapsed = false; return next(); }); around(commandline, 'close', function (next, args) { if (autoHideCommandLine) messageBox.collapsed = true; return next(); }); options.add( ['mainecoon'], 'Make big screen like a Maine Coone', 'charlist', '', { setter: function (value) { function has (c) (value.indexOf(c) >= 0); document.getElementById('status-bar').setAttribute('moz-collapsed', has('l')); if (has('f')) { hideChrome(false); delay(function () setFullscreen(true)); } else if (has('c')) { setFullscreen(false); delay(function () hideChrome(true)); } else if (has('C')) { setFullscreen(false); delay(function () hideChrome(true, true)); } else { hideChrome(false); delay(function () setFullscreen(false)); } setAutoHideCommandLine(has('a')); useEcho = has('m'); return value; }, completer: function (context, args) { context.title = ['Value', 'Description']; context.completions = [ ['c', 'Hide caption bar'], ['f', 'Fullscreen'], ['a', 'Hide automatically command-line'], ['C', 'Hide caption bar (maximize)'], ['m', 'Displays the message to command-line'], ['l', 'Large mode. Hide status-line'], ]; }, validater: function (value) /^[cfa]*$/.test(value) } ); // XXX obsolete commands.addUserCommand( ['fullscreen', 'fs'], 'Toggle fullscreen mode', function () setFullscreen(!window.fullScreen), {}, true ); })(); // vim:sw=2 ts=2 et si fdm=marker: