diff options
author | anekos | 2008-12-10 10:46:18 +0000 |
---|---|---|
committer | anekos | 2008-12-10 10:46:18 +0000 |
commit | a1ab22fbd5bac7ada09ce2b92faa4d643f269c3d (patch) | |
tree | 40cd34778b6ecdc30bf19928eff15a4a4e77f5b3 /maine_coon.js | |
parent | 6278509a75eb164feeb40e6104b16eaf3a0c2a09 (diff) | |
download | vimperator-plugins-a1ab22fbd5bac7ada09ce2b92faa4d643f269c3d.tar.bz2 |
Initial release: なるべく大きい画面で操作したいような趣
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26310 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'maine_coon.js')
-rw-r--r-- | maine_coon.js | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/maine_coon.js b/maine_coon.js new file mode 100644 index 0000000..9464168 --- /dev/null +++ b/maine_coon.js @@ -0,0 +1,94 @@ +let PLUGIN_INFO = +<VimperatorPlugin> + <name>Maine Coon</name> + <name lang="ja">メインクーン</name> + <description>Makes more large screen</description> + <description lang="ja">なるべくでかい画面で使えるように</description> + <version>1.0</version> + <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> + <minVersion>2.0pre</minVersion> + <maxVersion>2.0pre</maxVersion> + <license document="http://creativecommons.org/licenses/by-sa/3.0/"> + Creative Commons Attribution-Share Alike 3.0 Unported + </license> + <detail><![CDATA[ + == Commands == + :fullscreen: + toggle fullscreen <-> normal + == Global Variables == + :maine_coon_targets: + other elements ids that you want to kill. + let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter" + ]]></detail> + <detail lang="ja"><![CDATA[ + == Commands == + :fullscreen: + 切り替え fullscreen <-> normal + == Global Variables == + :maine_coon_targets: + 他の非表示にしたい要素のIDを空白区切りで指定します。 + let g:maine_coon_targets = "sidebar-2 sidebar-2-splitter" + ]]></detail> +</VimperatorPlugin>; + +let tagetIDs = (liberator.globalVariables.maine_coon_targets || '').split(/\s+/); + +(function () { + + 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<<!s; + + let mainWindow = document.getElementById('main-window'); + let messageBox = document.getElementById('liberator-message'); + messageBox.collapsed = true; + + around(commandline, 'open', function (next, args) { + messageBox.collapsed = false; + return next(); + }); + + around(commandline, 'close', function (next, args) { + messageBox.collapsed = true; + return next(); + }); + + function hideTargets (hide) { + tagetIDs.forEach( + function (id) + let (elem = document.getElementById(id)) + (elem && (elem.collapsed = hide)) + ); + } + + function hideChrome (hide) + mainWindow.setAttribute('hidechrome', hide); + + commands.addUserCommand( + ['fullscreen', 'fs'], + 'Toggle fullscreen mode', + function () { + let hide = !window.fullScreen; + window.fullScreen = hide; + setTimeout(function () { + hideTargets(hide); + document.getElementById('status-bar').setAttribute('moz-collapsed', false); + document.getElementById('navigator-toolbox').collapsed = hide; + if (!hide) + window.maximize(); + }, 400); + }, + {}, + true + ); + +})(); + +// vim:sw=2 ts=2 et si fdm=marker: |