From e4b509a4777f44b272ed555e0cded2a3a34ebb4b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 6 Jul 2017 03:29:22 +0530 Subject: Remove "widesize" and "fullsize" features. * viewtube.js (option): Remove "widesize" and "fullsize". (createMyElement): Remove handling of "widesize" and "fullsize" actions. (createMyPlayer): Remove panel "widesize" and "fullsize" buttons. (resizeMyPlayer): Remove function. Remove invocations of `resizeMyPlayer'. --- viewtube.js | 109 +----------------------------------------------------------- 1 file changed, 1 insertion(+), 108 deletions(-) diff --git a/viewtube.js b/viewtube.js index c4180f9..0b0f308 100644 --- a/viewtube.js +++ b/viewtube.js @@ -30,7 +30,7 @@ // Player var player = {}; - var option = {'definition': 'HD', 'container': 'MP4', 'dash': false, 'direct': false, 'widesize': false, 'fullsize': false}; + var option = {'definition': 'HD', 'container': 'MP4', 'dash': false, 'direct': false}; var mimetypes = { 'MPEG': 'video/mpeg', 'MP4': 'video/mp4', @@ -98,16 +98,6 @@ styleButton('buttonDASH', option['dash']) setMyOptions('dash', option['dash']); break; - case 'widesize': - option['widesize'] = !option['widesize']; - setMyOptions('widesize', option['widesize']); - resizeMyPlayer('widesize'); - break; - case 'fullsize': - option['fullsize'] = !option['fullsize']; - setMyOptions('fullsize', option['fullsize']); - resizeMyPlayer('fullsize'); - break; } }, false); } @@ -186,18 +176,6 @@ if (option['dash']) styleMyElement(player['buttonDASH'], {color: '#008080', textShadow: '0px 1px 1px #CCCCCC'}); player['playerPanel'].appendChild(player['buttonDASH']); - /* Panel Widesize Button */ - player['buttonWidesize'] = createMyElement('div', option['widesize'] ? '<' : '>', 'click', 'widesize', ''); - player['buttonWidesize'].title = '{Widesize: click to enter player widesize or return to normal size}'; - styleMyElement(player['buttonWidesize'], {height: panelItemHeight + 'px', border: '1px solid #CCCCCC', borderRadius: '3px', padding: '0px 5px', display: 'inline', color: '#C05800', fontSize: '12px', textShadow: '1px 1px 2px #CCCCCC', cursor: 'pointer'}); - player['playerPanel'].appendChild(player['buttonWidesize']); - - /* Panel Fullsize Button */ - player['buttonFullsize'] = createMyElement('div', option['fullsize'] ? '-' : '+', 'click', 'fullsize', ''); - player['buttonFullsize'].title = '{Fullsize: click to enter player fullsize or return to normal size}'; - styleMyElement(player['buttonFullsize'], {height: panelItemHeight + 'px', border: '1px solid #CCCCCC', borderRadius: '3px', padding: '0px 5px', display: 'inline', color: '#C05800', fontSize: '12px', textShadow: '1px 1px 2px #CCCCCC', cursor: 'pointer'}); - player['playerPanel'].appendChild(player['buttonFullsize']); - /* The Content */ player['contentWidth'] = player['playerWidth']; player['contentHeight'] = player['playerHeight'] - player['panelHeight'] - player['panelPadding'] * 2; @@ -205,10 +183,6 @@ styleMyElement(player['playerContent'], {width: player['contentWidth'] + 'px', height: player['contentHeight'] + 'px', position: 'relative', color: '#AD0000', backgroundColor: '#000000', fontSize: '14px', fontWeight: 'bold', textAlign: 'center'}); player['playerWindow'].appendChild(player['playerContent']); - /* Resize My Player */ - if (option['widesize']) resizeMyPlayer('widesize'); - if (option['fullsize']) resizeMyPlayer('fullsize'); - /* Play My Video */ playMyVideo(); } @@ -277,75 +251,6 @@ player['playerContent'].appendChild(player['contentVideo']); } - function resizeMyPlayer(size) { - switch (size) { - case 'widesize': - if (option['widesize']) { - if (player['buttonWidesize']) modifyMyElement(player['buttonWidesize'], 'div', '<', false); - var playerWidth = player['playerWideWidth']; - var playerHeight= player['playerWideHeight']; - var sidebarMargin = player['sidebarMarginWide']; - } - else { - if (player['buttonWidesize']) modifyMyElement(player['buttonWidesize'], 'div', '>', false); - var playerWidth = player['playerWidth']; - var playerHeight= player['playerHeight']; - var sidebarMargin = player['sidebarMarginNormal']; - } - break; - case 'fullsize': - if (option['fullsize']) { - var playerPosition = 'fixed'; - var playerWidth = page.win.innerWidth || page.doc.documentElement.clientWidth; - var playerHeight = page.win.innerHeight || page.doc.documentElement.clientHeight; - var playerIndex = '9999999999'; - if (!player['isFullsize']) { - styleMyElement(player['buttonWidesize'], {display: 'none'}); - modifyMyElement(player['buttonFullsize'], 'div', '-', false); - page.body.appendChild(player['playerWindow']); - styleMyElement(page.body, {overflow: 'hidden'}); - styleMyElement(page.body.parentNode, {overflow: 'hidden'}); - if (!player['resizeListener']) player['resizeListener'] = function() {resizeMyPlayer('fullsize')}; - page.win.addEventListener('resize', player['resizeListener'], false); - player['isFullsize'] = true; - } - } - else { - var playerPosition = 'relative'; - var playerWidth = (option['widesize']) ? player['playerWideWidth'] : player['playerWidth']; - var playerHeight = (option['widesize']) ? player['playerWideHeight'] : player['playerHeight']; - var playerIndex = 'auto'; - styleMyElement(player['buttonWidesize'], {display: 'inline'}); - modifyMyElement(player['buttonFullsize'], 'div', '+', false); - player['playerSocket'].appendChild(player['playerWindow']); - styleMyElement(page.body, {overflow: 'auto'}); - styleMyElement(page.body.parentNode, {overflow: 'auto'}); - page.win.removeEventListener('resize', player['resizeListener'], false); - player['isFullsize'] = false; - } - break; - } - - /* Resize The Player */ - if (size == 'widesize') { - if (player['sidebarWindow']) styleMyElement(player['sidebarWindow'], {marginTop: sidebarMargin + 'px'}); - styleMyElement(player['playerWindow'], {width: playerWidth + 'px', height: playerHeight + 'px'}); - } - else styleMyElement(player['playerWindow'], {position: playerPosition, top: '0px', left: '0px', width: playerWidth + 'px', height: playerHeight + 'px', zIndex: playerIndex}); - - /* Resize The Panel */ - var panelWidth = playerWidth - player['panelPadding'] * 2; - styleMyElement(player['playerPanel'], {width: panelWidth + 'px'}); - - /* Resize The Content */ - player['contentWidth'] = playerWidth; - player['contentHeight'] = playerHeight - player['panelHeight'] - player['panelPadding'] * 2; - styleMyElement(player['playerContent'], {width: player['contentWidth'] + 'px', height: player['contentHeight'] + 'px'}); - player['contentVideo'].width = player['contentWidth']; - player['contentVideo'].height = player['contentHeight']; - styleMyElement(player['contentVideo'], {width: player['contentWidth'] + 'px', height: player['contentHeight'] + 'px'}); - } - function cleanMyContent(content, unesc) { var myNewContent = content; if (unesc) myNewContent = unescape(myNewContent); @@ -614,18 +519,6 @@ modifyMyElement(ytPlayerWindow, 'div', '', false, true); ytPlayerWindow.appendChild(myPlayerWindow); - /* Update Sizes */ - page.win.addEventListener('resize', function() { - ytSizes(); - player['playerWidth'] = ytPlayerWidth; - player['playerHeight'] = ytPlayerHeight; - player['playerWideWidth'] = ytPlayerWideWidth; - player['playerWideHeight'] = ytPlayerWideHeight; - player['sidebarMarginWide'] = ytSidebarMarginWide; - resizeMyPlayer('widesize'); - if (ytPlaylist) styleMyElement(ytPlaylist, {marginLeft: '-' + ytPlayerWidth + 'px'}); - }, false); - /* Create Player */ var ytDefaultVideo = 'Low Definition MP4'; function ytPlayer() { -- cgit v1.2.3