From d61a493ad1df3f9b620e2650b6f3a7b55dfb72d6 Mon Sep 17 00:00:00 2001 From: oniatsu Date: Thu, 1 May 2014 14:09:59 +0900 Subject: youtubeamp: Fix ':ytsize' command to switch maximize/normal --- youtubeamp.js | 79 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 42 deletions(-) (limited to 'youtubeamp.js') diff --git a/youtubeamp.js b/youtubeamp.js index 1ab8833..3a8de0a 100644 --- a/youtubeamp.js +++ b/youtubeamp.js @@ -94,6 +94,23 @@ YouTubePlayerController.prototype = { 'chrome-promo', 'watch-video-quality-setting', ], + + PLAYER_WRAPPER_NODE_ID: 'player-api', + TOGGLE_PLAYER_WRAPPER_STYLE: { + position: 'fixed', + visibility: 'visible', + top: '0px', + left: '0px', + margin: '0px', + padding: '0px', + width: '100%', + height: '100%', + zIndex: '99999999999', + borderWidth: '0px', + backgroundImage: 'none', + backgroundColor: '#000', + overflow: 'hidden', + }, }, getControllerVersion: function() { return this.constants.VERSION; }, @@ -128,10 +145,11 @@ YouTubePlayerController.prototype = { }, toggleSize: function() { - var p = this._player(); - (p.width == this.constants.SIZE_WIDTH_DEFAULT && p.height == this.constants.SIZE_HEIGHT_DEFAULT) - ? this._fullSize() - : this._normalSize(); + var playerWrapper = this._getElementById(this.constants.PLAYER_WRAPPER_NODE_ID); + + (playerWrapper.style.position == 'fixed') + ? this._normalSize() + : this._fullSize(); }, _changeToFull: function() { @@ -152,48 +170,25 @@ YouTubePlayerController.prototype = { }, _fullSize: function() { - var b = this._getElementById('baseDiv'); - this.defMargin = b.style.margin; - this.defPadding = b.style.padding; - this.defWidth = b.style.width; - b.style.margin = 0; - b.style.padding = 0; - b.style.width = '100%'; - - for(let i=0, max=this.constants.HIDE_NODES.length ; i