diff options
author | anekos | 2008-12-03 11:31:13 +0000 |
---|---|---|
committer | anekos | 2008-12-03 11:31:13 +0000 |
commit | 2652cc1706f905a80e55939301e4eb0a6f284770 (patch) | |
tree | d62a7e29bd3b6388e9ddccaa8aaa3244453deb29 | |
parent | 5bc8635b848acdc4a80e6bd3e62fa8a263b4f7f4 (diff) | |
download | vimperator-plugins-2652cc1706f905a80e55939301e4eb0a6f284770.tar.bz2 |
Meow meow fixes.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25786 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | stella.js | 121 |
1 files changed, 65 insertions, 56 deletions
@@ -472,7 +472,6 @@ get fullscreen () !!this.storage.fullscreen, set fullscreen (value) { - let self = this; value = !!value; if (this.storage.fullscreen === value) @@ -480,69 +479,75 @@ this.storage.fullscreen = value; - let variablesSetter = function () { + let self = this, player = this.player, + win = content.wrappedJSObject, doc = content.document.wrappedJSObject; + + win.toggleMaximizePlayer(); + if(value) { + turnOn(); + win.onresize = fixFullscreen; + } else { + turnOff(); + delete win.onresize; + } + win.scrollTo(0, 0); + + // 以下関数定義のみ - setVariables turnOn/Off fixFullscreen + + function setVariables (fullscreen) { NicoPlayer.Variables.forEach(function ([name, normal, full]) { - let v = value ? full : normal; + let v = fullscreen ? full : normal; if (v !== null) self.player.SetVariable(name, v); }); - }; - - let doc = content.document.wrappedJSObject; - let win = content.wrappedJSObject; - let player = getElementByIdEx('flvplayer'); - - win.toggleMaximizePlayer(); + } - if(value) { - let f = function () { - let viewer = {w: 544, h: 384}; - let screen = { - w: content.innerWidth, - h: content.innerHeight - }; - let scale = { - w: Math.max(1, screen.w / viewer.w), - h: Math.max(1, screen.h / viewer.h) - }; - scale.v = Math.min(scale.w, scale.h); - storeStyle(doc.body, { - backgroundImage: 'url()', - backgroundRepeat: '', - backgroundColor: 'black' - }); - player.SetVariable('videowindow.video_mc.video.smoothing' , 1); - player.SetVariable('videowindow.video_mc.video.deblocking', 5); - storeStyle( - player, - (scale.w >= scale.h) ? { - width: Math.floor(viewer.w * scale.h) + 'px', - height: screen.h + 'px', - marginLeft: ((screen.w - viewer.w * scale.h) / 2) + 'px', - marginTop: '0px' - } : { - width: screen.w + 'px', - height: Math.floor(viewer.h * scale.w) + 'px', - marginLeft: '0px', - marginTop: ((screen.h - viewer.h * scale.w) / 2) + 'px' - } - ); - player.SetVariable('videowindow._xscale', 100 * scale.v); - player.SetVariable('videowindow._yscale', 100 * scale.v); - variablesSetter(); + function turnOn () { + let viewer = {w: 544, h: 384}; + let screen = { + w: content.innerWidth, + h: content.innerHeight }; - f(); - win.onresize = function () - (InVimperator && liberator.mode === modes.COMMAND_LINE) || setTimeout(f, 1000); - } else { - restoreStyle(doc.body); + let scale = { + w: Math.max(1, screen.w / viewer.w), + h: Math.max(1, screen.h / viewer.h) + }; + scale.v = Math.min(scale.w, scale.h); + storeStyle(doc.body, { + backgroundImage: 'url()', + backgroundRepeat: '', + backgroundColor: 'black' + }); + storeStyle( + player, + (scale.w >= scale.h) ? { + width: Math.floor(viewer.w * scale.h) + 'px', + height: screen.h + 'px', + marginLeft: ((screen.w - viewer.w * scale.h) / 2) + 'px', + marginTop: '0px' + } : { + width: screen.w + 'px', + height: Math.floor(viewer.h * scale.w) + 'px', + marginLeft: '0px', + marginTop: ((screen.h - viewer.h * scale.w) / 2) + 'px' + } + ); + player.SetVariable('videowindow._xscale', 100 * scale.v); + player.SetVariable('videowindow._yscale', 100 * scale.v); + setVariables(true); + } + + function turnOff () { + restoreStyle(content.document.wrappedJSObject.body); //restoreStyle(player); player.style.marginLeft = ''; player.style.marginTop = ''; - variablesSetter(); - delete win.onresize; + setVariables(false); } - win.scrollTo(0, 0); + + function fixFullscreen () + ((InVimperator && liberator.mode === modes.COMMAND_LINE) || setTimeout(turnOn, 500)); + }, get id () @@ -599,7 +604,8 @@ let base = this.currentTime; setTimeout(bindr(this, function () (base === this.currentTime ? this.playEx() : this.pause())), 100); } - } + }, + }; // }}} @@ -618,6 +624,7 @@ 'comment', 'repeat', 'fullscreen', + 'fetch', { name: 'volume-root', label: 'Volume', @@ -886,6 +893,8 @@ onCommentClick: function () (this.player.toggle('comment')), + onFetchClick: function () this.player.fetch(), + // フルスクリーン時にステータスバーを隠さないようにする onFullScreen: function () { if (window.fullScreen) { @@ -927,7 +936,7 @@ onPlayClick: function () this.player.play(), - onRepeatingClick: function () this.player.toggle('repeating'), + onRepeatClick: function () this.player.toggle('repeating'), onResize: function () { if (this.__fullScreen !== window.fullScreen) { |