aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--viewtube.js71
1 files changed, 2 insertions, 69 deletions
diff --git a/viewtube.js b/viewtube.js
index 86c9ecf..2a0f7b0 100644
--- a/viewtube.js
+++ b/viewtube.js
@@ -131,24 +131,13 @@
function onGot(item) {
Object.assign(option, item);
- /* Player Settings */
- player['panelHeight'] = 18;
- player['panelPadding'] = 2;
-
/* The Panel */
- var panelWidth = player['playerWidth'] - player['panelPadding'] * 2;
player['playerPanel'] = createMyElement('div', '', '', '', '');
- styleMyElement(player['playerPanel'], {width: panelWidth + 'px', height: player['panelHeight'] + 'px', padding: player['panelPadding'] + 'px', backgroundColor: 'inherit', textAlign: 'center'});
player['playerWindow'].appendChild(player['playerPanel']);
- /* Panel Items */
- var panelItemBorder = 1;
- var panelItemHeight = player['panelHeight'] - panelItemBorder * 2;
-
/* Panel Video Menu */
player['videoMenu'] = createMyElement('select', '', 'change', '', 'video');
player['videoMenu'].title = '{Videos: select the video format for playback}';
- styleMyElement(player['videoMenu'], {width: '200px', height: panelItemHeight + 'px', border: '1px solid transparent', padding: '0px', display: 'inline', backgroundColor: 'inherit', color: '#336699', fontSize: '12px', textShadow: '0px 1px 1px #CCCCCC', verticalAlign: 'baseline', cursor: 'pointer'});
player['playerPanel'].appendChild(player['videoMenu']);
for (var videoCode in player['videoList']) {
player['videoItem'] = createMyElement('option', videoCode, '', '', '');
@@ -160,10 +149,7 @@
}
/* The Content */
- player['contentWidth'] = player['playerWidth'];
- player['contentHeight'] = player['playerHeight'] - player['panelHeight'] - player['panelPadding'] * 2;
player['playerContent'] = createMyElement('div', '', '', '', '');
- 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']);
/* Play My Video */
@@ -227,10 +213,7 @@
playDASHwithHTML5();
else
player['contentVideo'] = createMyElement('video', player['videoList'][player['videoPlay']], '', '', '');
- player['contentVideo'].width = player['contentWidth'];
- player['contentVideo'].height = player['contentHeight'];
player['contentVideo'].poster = player['videoThumb'];
- styleMyElement(player['contentVideo'], {position: 'relative', width: player['contentWidth'] + 'px', height: player['contentHeight'] + 'px'});
player['playerContent'].appendChild(player['contentVideo']);
}
@@ -381,42 +364,6 @@
}
}
- /* Player Size */
- var ytSidebarMarginNormal = 382;
- var ytSidebarWindow = document.querySelector("#watch7-sidebar");
- if (ytSidebarWindow) {
- var ytSidebarWindowStyle = ytSidebarWindow.currentStyle || window.getComputedStyle(ytSidebarWindow);
- if (ytSidebarWindowStyle) ytSidebarMarginNormal = -12 + parseInt(ytSidebarWindowStyle.marginTop.replace('px', ''));
- styleMyElement(ytSidebarWindow, {marginTop: ytSidebarMarginNormal + 'px'});
- }
- var ytPlayerWidth, ytPlayerHeight;
- var ytPlayerWideWidth, ytPlayerWideHeight;
- var ytSidebarMarginWide;
- var ytScreenWidth, ytScreenHeight;
- function ytSizes() {
- ytScreenWidth = page.win.innerWidth || page.doc.documentElement.clientWidth;
- ytScreenHeight = page.win.innerHeight || page.doc.documentElement.clientHeight;
- if (ytScreenWidth >= 1720 && ytScreenHeight >= 980) {
- ytPlayerWidth = 1280;
- ytPlayerHeight = 742;
- ytPlayerWideWidth = 1706;
- ytPlayerWideHeight = 982;
- }
- else if (ytScreenWidth >= 1294 && ytScreenHeight >= 630) {
- ytPlayerWidth = 854;
- ytPlayerHeight = 502;
- ytPlayerWideWidth = 1280;
- ytPlayerWideHeight = 742;
- }
- else {
- ytPlayerWidth = 640;
- ytPlayerHeight = 382;
- ytPlayerWideWidth = 1066;
- ytPlayerWideHeight = 622;
- }
- ytSidebarMarginWide = ytPlayerHeight + ytSidebarMarginNormal;
- }
-
/* Get Player Window */
var ytPlayerWindow = document.querySelector("#player");
if (!ytPlayerWindow) {
@@ -475,9 +422,6 @@
else ytVideosContent = ytVideosAdaptiveFmts;
}
- /* Get Sizes */
- ytSizes();
-
function removeElements (selector) {
document.querySelectorAll(selector).forEach(function (element) { element.remove(); });
}
@@ -491,16 +435,12 @@
/* Playlist */
var ytPlaylist = document.querySelector("#player-playlist");
if (ytPlaylist) {
- styleMyElement(ytPlaylist, {marginLeft: '-' + ytPlayerWidth + 'px'});
var ytPlaceholderPlaylist = document.querySelector("#placeholder-playlist");
if (ytPlaceholderPlaylist) ytPlaceholderPlaylist.appendChild(ytPlaylist);
}
/* My Player Window */
- var myPlayerWindow = createMyElement('div', '', '', '', '');
- styleMyElement(myPlayerWindow, {position: 'relative', width: ytPlayerWidth + 'px', height: ytPlayerHeight + 'px', backgroundColor: '#FFFFFF'});
- modifyMyElement(ytPlayerWindow, 'div', '', false, true);
- ytPlayerWindow.appendChild(myPlayerWindow);
+ var myPlayerWindow = document.querySelector("#player-api");
/* Create Player */
var ytDefaultVideo = 'Low Definition MP4';
@@ -510,14 +450,7 @@
'playerWindow': myPlayerWindow,
'videoList': ytVideoList,
'videoPlay': ytDefaultVideo,
- 'videoThumb': ytVideoThumb,
- 'playerWidth': ytPlayerWidth,
- 'playerHeight': ytPlayerHeight,
- 'playerWideWidth': ytPlayerWideWidth,
- 'playerWideHeight': ytPlayerWideHeight,
- 'sidebarWindow': ytSidebarWindow,
- 'sidebarMarginNormal': ytSidebarMarginNormal,
- 'sidebarMarginWide': ytSidebarMarginWide
+ 'videoThumb': ytVideoThumb
};
option['definitions'] = ['Ultra High Definition', 'Full High Definition', 'High Definition', 'Standard Definition', 'Low Definition', 'Very Low Definition'];
option['containers'] = ['MP4', 'WebM', 'FLV', '3GP', 'Any'];