Unhardcoded the classes, which are used to determine the sample button, player, and place where UI gets anchored. We can now add the ability for user to add rules for custom pages.
This commit is contained in:
parent
d22dd18a9d
commit
e36689e708
850
js/uw.js
850
js/uw.js
@ -175,12 +175,11 @@ var buttons = [];
|
|||||||
|
|
||||||
//BEGIN determining which site we're on and the associated names
|
//BEGIN determining which site we're on and the associated names
|
||||||
|
|
||||||
var control_bar;
|
|
||||||
var ui_anchor;
|
var ui_anchor;
|
||||||
var player;
|
var player;
|
||||||
var vid_el;
|
var vid_el;
|
||||||
var sample_button_class; // Class of a sample button
|
var SAMPLE_BUTTON_CLASS; // Class of a sample button
|
||||||
var sample_button_index = 0; // index of a sample button
|
var SAMPLE_BUTTON_INDEX = 0; // index of a sample button
|
||||||
var button_size_base = "x"; // Determines if size of extension buttons is defined by width or height of sample button
|
var button_size_base = "x"; // Determines if size of extension buttons is defined by width or height of sample button
|
||||||
|
|
||||||
var char_strat = "contain";
|
var char_strat = "contain";
|
||||||
@ -209,7 +208,18 @@ if(usebrowser == "chrome"){
|
|||||||
|
|
||||||
var UW_SITES = {
|
var UW_SITES = {
|
||||||
youtube: {
|
youtube: {
|
||||||
urlRules: ["youtu"]
|
urlRules: ["youtu"],
|
||||||
|
player: {
|
||||||
|
name: "movie_player",
|
||||||
|
isClass: false,
|
||||||
|
},
|
||||||
|
sampleButtonClass: "ytp-button ytp-settings-button",
|
||||||
|
sampleButtonIndex: 0,
|
||||||
|
uiParent: {
|
||||||
|
name: "ytp-right-controls",
|
||||||
|
isClass: true,
|
||||||
|
insertStrat: "prepend",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
netflix: {
|
netflix: {
|
||||||
urlRules: ["netflix"]
|
urlRules: ["netflix"]
|
||||||
@ -289,8 +299,7 @@ function init(force_reload){
|
|||||||
if(debugmsg)
|
if(debugmsg)
|
||||||
console.log("uw::init | we're on youtube. Page url:", page_url);
|
console.log("uw::init | we're on youtube. Page url:", page_url);
|
||||||
|
|
||||||
control_bar = "ytp-chrome-controls";
|
// SAMPLE_BUTTON_CLASS = "ytp-button ytp-settings-button";
|
||||||
sample_button_class = "ytp-button ytp-settings-button";
|
|
||||||
|
|
||||||
if(inIframe())
|
if(inIframe())
|
||||||
player = document.getElementById("player")
|
player = document.getElementById("player")
|
||||||
@ -354,7 +363,7 @@ function init(force_reload){
|
|||||||
|
|
||||||
vid_el = document.getElementsByTagName("video")[0];
|
vid_el = document.getElementsByTagName("video")[0];
|
||||||
|
|
||||||
sample_button_class = "player-control-button player-fill-screen";
|
SAMPLE_BUTTON_CLASS = "player-control-button player-fill-screen";
|
||||||
video_wrap = "player-video-wrapper";
|
video_wrap = "player-video-wrapper";
|
||||||
button_size_base = "y";
|
button_size_base = "y";
|
||||||
|
|
||||||
@ -711,6 +720,7 @@ function extsetup_stage2(op){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(SITE){
|
if(SITE){
|
||||||
|
uinit();
|
||||||
keydownSetup();
|
keydownSetup();
|
||||||
extsetup_comms();
|
extsetup_comms();
|
||||||
buildUInative();
|
buildUInative();
|
||||||
@ -734,6 +744,29 @@ function extsetup_stage2(op){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function uinit(){
|
||||||
|
if(debugmsg)
|
||||||
|
console.log("uw::uinit | initializing elements from the webpage");
|
||||||
|
|
||||||
|
var site = UW_SITES[SITE];
|
||||||
|
// var inIframe = inIframe();
|
||||||
|
|
||||||
|
if(debugmsg)
|
||||||
|
console.log("uw::uinit | site data:",site,"\n\n\nsite.player.name:", site.player.name,"\nsite.player.isClass:", site.player.isClass);
|
||||||
|
|
||||||
|
// if(inIframe){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
PLAYER = (site.player.isClass ? document.getElementsByClassName(site.player.name)[0] : document.getElementById(site.player.name));
|
||||||
|
SAMPLE_BUTTON_CLASS = site.sampleButtonClass;
|
||||||
|
SAMPLE_BUTTON_INDEX = site.sampleButtonIndex;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if(debugmsg)
|
||||||
|
console.log("uw::uinit | initializing elements from the webpage");
|
||||||
|
}
|
||||||
|
|
||||||
function getopt(prop, callback){
|
function getopt(prop, callback){
|
||||||
if(usebrowser == "chrome")
|
if(usebrowser == "chrome")
|
||||||
browser.storage.local.get(prop, callback);
|
browser.storage.local.get(prop, callback);
|
||||||
@ -850,14 +883,14 @@ function extsetup_siterules(opt){
|
|||||||
// else
|
// else
|
||||||
// var obj = opt[0];
|
// var obj = opt[0];
|
||||||
|
|
||||||
if(obj.ultrawidify_siterules === undefined){
|
// if(obj.ultrawidify_siterules === undefined){
|
||||||
if(debugmsg)
|
// if(debugmsg)
|
||||||
console.log("uw::extsetup_siterules | site url rules missing from storage. Setting defaults.");
|
// console.log("uw::extsetup_siterules | site url rules missing from storage. Setting defaults.");
|
||||||
browser.storage.local.set({ultrawidify_siterules: UW_SITES});
|
// browser.storage.local.set({ultrawidify_siterules: UW_SITES});
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
UW_SITES = obj.ultrawidify_siterules;
|
// UW_SITES = obj.ultrawidify_siterules;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(debugmsg)
|
if(debugmsg)
|
||||||
console.log("uw::extsetup_siterules | UW_SITES:",UW_SITES,"current site:",SITE);
|
console.log("uw::extsetup_siterules | UW_SITES:",UW_SITES,"current site:",SITE);
|
||||||
@ -986,7 +1019,7 @@ function extsetup_keybinds(res){
|
|||||||
|
|
||||||
function check4player(recursion_depth){
|
function check4player(recursion_depth){
|
||||||
try{
|
try{
|
||||||
var button_width = document.getElementsByClassName(sample_button_class)[sample_button_index].scrollWidth;
|
var button_width = document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollWidth;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
@ -1013,9 +1046,10 @@ function mkanchor(){
|
|||||||
ui_anchor.className = "uw_ui_anchor";
|
ui_anchor.className = "uw_ui_anchor";
|
||||||
ui_anchor.id = "uw_ui_anchor";
|
ui_anchor.id = "uw_ui_anchor";
|
||||||
|
|
||||||
// Youtube
|
var site = UW_SITES[SITE];
|
||||||
if(SITE == "youtube"){
|
|
||||||
$(document.getElementsByClassName("ytp-right-controls")[0]).prepend(ui_anchor);
|
if(site.uiParent.insertStrat == "prepend"){
|
||||||
|
$(document.getElementsByClassName(site.uiParent.name)[0]).prepend(ui_anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1241,9 +1275,9 @@ function getBaseButtonWidth(){
|
|||||||
try{
|
try{
|
||||||
// Na različnih straneh širino gumba poberemo na različne načine.
|
// Na različnih straneh širino gumba poberemo na različne načine.
|
||||||
if(button_size_base == "y")
|
if(button_size_base == "y")
|
||||||
return document.getElementsByClassName(sample_button_class)[sample_button_index].scrollHeight;
|
return document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollHeight;
|
||||||
else
|
else
|
||||||
return document.getElementsByClassName(sample_button_class)[sample_button_index].scrollWidth;
|
return document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollWidth;
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
// Zato, ker predvajalnik ni vselej prisoten. Če predvajalnik ni prisoten,
|
// Zato, ker predvajalnik ni vselej prisoten. Če predvajalnik ni prisoten,
|
||||||
@ -1264,392 +1298,396 @@ function alignToBottom(){
|
|||||||
return align_to == "bottom";
|
return align_to == "bottom";
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCtlButtons(recursion_depth){
|
//BEGIN legacy
|
||||||
return;
|
|
||||||
if(debugmsg)
|
// function addCtlButtons(recursion_depth){
|
||||||
console.log("uw::addCtlButtons | function started");
|
// return;
|
||||||
|
// if(debugmsg)
|
||||||
// Gumb za nastavitve je bolj kot ne vselej prisoten, zato širino tega gumba uporabimo kot širino naših gumbov
|
// console.log("uw::addCtlButtons | function started");
|
||||||
// Settings button is more or less always there, so we use its width as width of our buttons
|
//
|
||||||
try{
|
// // Gumb za nastavitve je bolj kot ne vselej prisoten, zato širino tega gumba uporabimo kot širino naših gumbov
|
||||||
// Na različnih straneh širino gumba poberemo na različne načine.
|
// // Settings button is more or less always there, so we use its width as width of our buttons
|
||||||
if(button_size_base == "y")
|
// try{
|
||||||
var button_width = document.getElementsByClassName(sample_button_class)[sample_button_index].scrollHeight;
|
// // Na različnih straneh širino gumba poberemo na različne načine.
|
||||||
else
|
// if(button_size_base == "y")
|
||||||
var button_width = document.getElementsByClassName(sample_button_class)[sample_button_index].scrollWidth;
|
// var button_width = document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollHeight;
|
||||||
|
// else
|
||||||
if(debugmsg)
|
// var button_width = document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollWidth;
|
||||||
console.log("uw::addCtlButtons | width of the element is ", button_width , "and is based on the height of this element:", document.getElementsByClassName(sample_button_class)[sample_button_index], " <extra tags: onMessage>")
|
//
|
||||||
}
|
// if(debugmsg)
|
||||||
catch(e){
|
// console.log("uw::addCtlButtons | width of the element is ", button_width , "and is based on the height of this element:", document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX], " <extra tags: onMessage>")
|
||||||
// Zato, ker predvajalnik ni vselej prisoten. Če predvajalnik ni prisoten,
|
// }
|
||||||
// potem tudi knofov ni. Kar pomeni problem.
|
// catch(e){
|
||||||
//
|
// // Zato, ker predvajalnik ni vselej prisoten. Če predvajalnik ni prisoten,
|
||||||
// Because the player isn't always there, and when the player isn't there the buttons aren't, either.
|
// // potem tudi knofov ni. Kar pomeni problem.
|
||||||
// In that case, the above statement craps out, throws an exception and trashes the extension.
|
// //
|
||||||
|
// // Because the player isn't always there, and when the player isn't there the buttons aren't, either.
|
||||||
if(recursion_depth === undefined)
|
// // In that case, the above statement craps out, throws an exception and trashes the extension.
|
||||||
recursion_depth = 0;
|
//
|
||||||
|
// if(recursion_depth === undefined)
|
||||||
if(debugmsg)
|
// recursion_depth = 0;
|
||||||
console.log("uw::addCtlButtons | seems there was a fuckup and no buttons were found on this page. No player (and therefore no buttons) found. Recursion depth:",recursion_depth);
|
//
|
||||||
|
// if(debugmsg)
|
||||||
// If buttons weren't found, we relaunch init() just in case
|
// console.log("uw::addCtlButtons | seems there was a fuckup and no buttons were found on this page. No player (and therefore no buttons) found. Recursion depth:",recursion_depth);
|
||||||
init();
|
//
|
||||||
return recursion_depth < playercheck_recursion_depth_limit ? addCtlButtons(++recursion_depth) : false;
|
// // If buttons weren't found, we relaunch init() just in case
|
||||||
|
// init();
|
||||||
return false;
|
// return recursion_depth < playercheck_recursion_depth_limit ? addCtlButtons(++recursion_depth) : false;
|
||||||
}
|
//
|
||||||
var button_def = [];
|
// return false;
|
||||||
if(page_url.indexOf("netflix.com") != -1)
|
// }
|
||||||
button_def = [ "fitw", "fith", "reset", "zoom", "uzoom"/*, "settings" */]; // No settings button on netflix until further notice
|
// var button_def = [];
|
||||||
else
|
// if(page_url.indexOf("netflix.com") != -1)
|
||||||
button_def = [ "fitw", "fith", "reset", "zoom", "uzoom", "settings" ];
|
// button_def = [ "fitw", "fith", "reset", "zoom", "uzoom"/*, "settings" */]; // No settings button on netflix until further notice
|
||||||
|
// else
|
||||||
if(debugmsg)
|
// button_def = [ "fitw", "fith", "reset", "zoom", "uzoom", "settings" ];
|
||||||
console.log("uw::addCtlButtons | trying to add buttons");
|
//
|
||||||
|
// if(debugmsg)
|
||||||
/* Če je ta dodatek že nameščen, potem odstranimo vse elemente. Vsi top-level elementi imajo definiran prazen razred
|
// console.log("uw::addCtlButtons | trying to add buttons");
|
||||||
// uw_element, prek katerega jih naberemo na kup. Ta del kode je tu bolj ali manj zaradi debugiranja.
|
//
|
||||||
//
|
// /* Če je ta dodatek že nameščen, potem odstranimo vse elemente. Vsi top-level elementi imajo definiran prazen razred
|
||||||
// If this addon is already installed, we have to remove all prevously added elements (to avoid duplicating).
|
// // uw_element, prek katerega jih naberemo na kup. Ta del kode je tu bolj ali manj zaradi debugiranja.
|
||||||
// The easiest way to gather all of them is to tack an empty class, 'uw_element,' to each top-level element we add.
|
// //
|
||||||
// This is here mostly because debugging, but could also be useful in case of unforseen happenings.
|
// // If this addon is already installed, we have to remove all prevously added elements (to avoid duplicating).
|
||||||
*/
|
// // The easiest way to gather all of them is to tack an empty class, 'uw_element,' to each top-level element we add.
|
||||||
var previousElements = document.getElementsByClassName("uw_element");
|
// // This is here mostly because debugging, but could also be useful in case of unforseen happenings.
|
||||||
|
// */
|
||||||
/* Uporabimo while loop in vselej odstranimo prvi element. Tabela previousElements se z odstranjevanjem elementov
|
// var previousElements = document.getElementsByClassName("uw_element");
|
||||||
// krajša.
|
//
|
||||||
//
|
// /* Uporabimo while loop in vselej odstranimo prvi element. Tabela previousElements se z odstranjevanjem elementov
|
||||||
// Da, to je bil bug.
|
// // krajša.
|
||||||
//
|
// //
|
||||||
// --------------------------------
|
// // Da, to je bil bug.
|
||||||
//
|
// //
|
||||||
// As previousElements.length decreases as we remove elements, we use a while loop and remove the first element
|
// // --------------------------------
|
||||||
// for as long as the array contains elements.
|
// //
|
||||||
//
|
// // As previousElements.length decreases as we remove elements, we use a while loop and remove the first element
|
||||||
// Yes, that used to be a bug.
|
// // for as long as the array contains elements.
|
||||||
*/
|
// //
|
||||||
if(!debugmsg && !debugmsg_click){
|
// // Yes, that used to be a bug.
|
||||||
/* Če je debugmsg false, potem verjetno ne dodajamo nobenih novih funkcionalnosti, zaradi katerih bi bilo potrebno
|
// */
|
||||||
// ponovno naložiti vmesnik. Zato tega ne storimo, temveč ohranimo stare gumbe. Ker so ok.
|
// if(!debugmsg && !debugmsg_click){
|
||||||
//
|
// /* Če je debugmsg false, potem verjetno ne dodajamo nobenih novih funkcionalnosti, zaradi katerih bi bilo potrebno
|
||||||
// If debugging is false, then we aren't adding any new features that would require us to reload UI. So we leave
|
// // ponovno naložiti vmesnik. Zato tega ne storimo, temveč ohranimo stare gumbe. Ker so ok.
|
||||||
// the old UI in place, because it should be good enough.
|
// //
|
||||||
*/
|
// // If debugging is false, then we aren't adding any new features that would require us to reload UI. So we leave
|
||||||
|
// // the old UI in place, because it should be good enough.
|
||||||
if(previousElements && previousElements.length > 0){
|
// */
|
||||||
return;
|
//
|
||||||
}
|
// if(previousElements && previousElements.length > 0){
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
while (previousElements && previousElements.length > 0){
|
// }
|
||||||
previousElements[0].parentNode.removeChild(previousElements[0]);
|
//
|
||||||
}
|
// while (previousElements && previousElements.length > 0){
|
||||||
|
// previousElements[0].parentNode.removeChild(previousElements[0]);
|
||||||
var check_width = false;
|
// }
|
||||||
|
//
|
||||||
// If we're on youtube:
|
// var check_width = false;
|
||||||
if(page_url.indexOf("youtu") != -1){
|
//
|
||||||
check_width = true;
|
// // If we're on youtube:
|
||||||
|
// if(page_url.indexOf("youtu") != -1){
|
||||||
var rctl;
|
// check_width = true;
|
||||||
var rctl_width;
|
//
|
||||||
var lctl_width;
|
// var rctl;
|
||||||
var ctlbar_width;
|
// var rctl_width;
|
||||||
|
// var lctl_width;
|
||||||
if(inIframe())
|
// var ctlbar_width;
|
||||||
player = document.getElementById("player");
|
//
|
||||||
else
|
// if(inIframe())
|
||||||
player = document.getElementById("movie_player");
|
// player = document.getElementById("player");
|
||||||
|
// else
|
||||||
rctl = document.getElementsByClassName("ytp-right-controls")[0];
|
// player = document.getElementById("movie_player");
|
||||||
rctl_width = rctl.offsetWidth;
|
//
|
||||||
lctl_width = document.getElementsByClassName("ytp-left-controls")[0].offsetWidth;
|
// rctl = document.getElementsByClassName("ytp-right-controls")[0];
|
||||||
ctlbar_width = document.getElementsByClassName("ytp-chrome-controls")[0].offsetWidth;
|
// rctl_width = rctl.offsetWidth;
|
||||||
|
// lctl_width = document.getElementsByClassName("ytp-left-controls")[0].offsetWidth;
|
||||||
}
|
// ctlbar_width = document.getElementsByClassName("ytp-chrome-controls")[0].offsetWidth;
|
||||||
|
//
|
||||||
// Ker na različne strani knofe dodajamo na različne načine, določanje lastnosti in dodajanje gumbov na
|
// }
|
||||||
// vmesnik izvedemo posebej
|
//
|
||||||
// Because different pages require adding buttons to the UI in a different order, we handle defining button
|
// // Ker na različne strani knofe dodajamo na različne načine, določanje lastnosti in dodajanje gumbov na
|
||||||
// properties and adding buttons to the UI in different loops.
|
// // vmesnik izvedemo posebej
|
||||||
|
// // Because different pages require adding buttons to the UI in a different order, we handle defining button
|
||||||
var btns = button_def.length;
|
// // properties and adding buttons to the UI in different loops.
|
||||||
var settings_menu_mid = document.createElement("div");
|
//
|
||||||
|
// var btns = button_def.length;
|
||||||
for(var i = 0; i < btns; i++){
|
// var settings_menu_mid = document.createElement("div");
|
||||||
buttons[i] = document.createElement('div');
|
//
|
||||||
buttons[i].style.backgroundImage = 'url(' + resourceToUrl("/res/img/ytplayer-icons/" + button_def[i] + ".png") + ')';
|
// for(var i = 0; i < btns; i++){
|
||||||
buttons[i].style.width = (button_width * 0.75) + "px";
|
// buttons[i] = document.createElement('div');
|
||||||
buttons[i].style.height = (button_width) + "px";
|
// buttons[i].style.backgroundImage = 'url(' + resourceToUrl("/res/img/ytplayer-icons/" + button_def[i] + ".png") + ')';
|
||||||
buttons[i].style.width = 0;
|
// buttons[i].style.width = (button_width * 0.75) + "px";
|
||||||
// buttons[i].style.marginLeft = (button_width * 0.3) + "px";
|
// buttons[i].style.height = (button_width) + "px";
|
||||||
buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
|
// buttons[i].style.width = 0;
|
||||||
buttons[i].style.paddingRight = (button_width * 0.15) + "px";
|
// // buttons[i].style.marginLeft = (button_width * 0.3) + "px";
|
||||||
buttons[i].className += " uw-button uw_element";
|
// buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
|
||||||
}
|
// buttons[i].style.paddingRight = (button_width * 0.15) + "px";
|
||||||
|
// buttons[i].className += " uw-button uw_element";
|
||||||
// Tukaj dodamo gumbe na stran
|
// }
|
||||||
// Here we add the buttons
|
//
|
||||||
|
// // Tukaj dodamo gumbe na stran
|
||||||
if(page_url.indexOf("netflix.com") != -1){
|
// // Here we add the buttons
|
||||||
for( var i = 0; i < btns; i++){
|
//
|
||||||
ui_anchor.appendChild(buttons[i]);
|
// if(page_url.indexOf("netflix.com") != -1){
|
||||||
}
|
// for( var i = 0; i < btns; i++){
|
||||||
}
|
// ui_anchor.appendChild(buttons[i]);
|
||||||
else{
|
// }
|
||||||
for( var i = (btns - 1); i >= 0; i--){
|
// }
|
||||||
$(rctl).prepend(buttons[i]);
|
// else{
|
||||||
}
|
// for( var i = (btns - 1); i >= 0; i--){
|
||||||
}
|
// $(rctl).prepend(buttons[i]);
|
||||||
|
// }
|
||||||
// Če na ctlbar ni prostora za vse knofe, potem skrijemo vse knofe razen tistega, ki ima popup z vsemi možnostmi
|
// }
|
||||||
//
|
//
|
||||||
// If ctlbar doesn't have the space for all the buttons, we hide all except the one that contains the popup
|
// // Če na ctlbar ni prostora za vse knofe, potem skrijemo vse knofe razen tistega, ki ima popup z vsemi možnostmi
|
||||||
// with all the options
|
// //
|
||||||
|
// // If ctlbar doesn't have the space for all the buttons, we hide all except the one that contains the popup
|
||||||
if(check_width && (rctl_width + lctl_width) * 1.1 > ctlbar_width){ //TODO: don't hardcode that 4
|
// // with all the options
|
||||||
for( var i = 4; i >= 0; i--){
|
//
|
||||||
buttons[i].classList.add("uw_hide");
|
// if(check_width && (rctl_width + lctl_width) * 1.1 > ctlbar_width){ //TODO: don't hardcode that 4
|
||||||
}
|
// for( var i = 4; i >= 0; i--){
|
||||||
}
|
// buttons[i].classList.add("uw_hide");
|
||||||
|
// }
|
||||||
buttons[0].onclick = function() { changeCSS("fit", "fitw") };
|
// }
|
||||||
buttons[1].onclick = function() { changeCSS("fit", "fith") };
|
//
|
||||||
buttons[2].onclick = function() { changeCSS("reset", "reset") };
|
// buttons[0].onclick = function() { changeCSS("fit", "fitw") };
|
||||||
buttons[3].onclick = function() { changeCSS("fit", "zoom") };
|
// buttons[1].onclick = function() { changeCSS("fit", "fith") };
|
||||||
buttons[4].onclick = function() { changeCSS("fit", "unzoom") };
|
// buttons[2].onclick = function() { changeCSS("reset", "reset") };
|
||||||
|
// buttons[3].onclick = function() { changeCSS("fit", "zoom") };
|
||||||
// Knof za nastavitve ima še vgnezden meni, ki ga dodamo tu (privzeto je ta meni skrit)
|
// buttons[4].onclick = function() { changeCSS("fit", "unzoom") };
|
||||||
// Settings button contains a menu that's nested in the element. By default, that menu is
|
//
|
||||||
// hidden.
|
// // Knof za nastavitve ima še vgnezden meni, ki ga dodamo tu (privzeto je ta meni skrit)
|
||||||
if(btns > 5){
|
// // Settings button contains a menu that's nested in the element. By default, that menu is
|
||||||
buttons[5].onclick = function() {
|
// // hidden.
|
||||||
if(debugmsg || debugmsg_click)
|
// if(btns > 5){
|
||||||
console.log("uw::kbm <button[5] onclick> | we clicked the button 5 with id ‘uw-smenu’. Button:",document.getElementById("uw-smenu"));
|
// buttons[5].onclick = function() {
|
||||||
toggleMenu("uw-smenu");
|
// if(debugmsg || debugmsg_click)
|
||||||
};
|
// console.log("uw::kbm <button[5] onclick> | we clicked the button 5 with id ‘uw-smenu’. Button:",document.getElementById("uw-smenu"));
|
||||||
buttons[5].id = "uw-settings-button";
|
// toggleMenu("uw-smenu");
|
||||||
}
|
// };
|
||||||
var settings_menu = document.createElement("div");
|
// buttons[5].id = "uw-settings-button";
|
||||||
// settings_menu_mid.appendChild(settings_menu);
|
// }
|
||||||
var smenu_ar_menu = document.createElement("div");
|
// var settings_menu = document.createElement("div");
|
||||||
|
// // settings_menu_mid.appendChild(settings_menu);
|
||||||
var smenu_el = [];
|
// var smenu_ar_menu = document.createElement("div");
|
||||||
for(var i = 0; i < 7; i++){
|
//
|
||||||
smenu_el[i] = document.createElement("div");
|
// var smenu_el = [];
|
||||||
}
|
// for(var i = 0; i < 7; i++){
|
||||||
|
// smenu_el[i] = document.createElement("div");
|
||||||
var smenu_ar_options = [];
|
// }
|
||||||
|
//
|
||||||
if(buttons[5])
|
// var smenu_ar_options = [];
|
||||||
buttons[5].appendChild(settings_menu);
|
//
|
||||||
|
// if(buttons[5])
|
||||||
//Če rabimo skriti gumb za nastavitve, potem mora biti i=1
|
// buttons[5].appendChild(settings_menu);
|
||||||
//If we need to hide settings button, then we should make i=1
|
//
|
||||||
|
// //Če rabimo skriti gumb za nastavitve, potem mora biti i=1
|
||||||
//FIXME: knof za nastavitve ne radi (nastavitve se ne odprejo)
|
// //If we need to hide settings button, then we should make i=1
|
||||||
//FIXME: 'settings' button on the player doesn't work
|
//
|
||||||
|
// //FIXME: knof za nastavitve ne radi (nastavitve se ne odprejo)
|
||||||
for(var i = 1; i < smenu_el.length; i++){
|
// //FIXME: 'settings' button on the player doesn't work
|
||||||
settings_menu.appendChild(smenu_el[i]);
|
//
|
||||||
smenu_el[i].className += "uw-setmenu-item uw_setmenu_main uw_element";
|
// for(var i = 1; i < smenu_el.length; i++){
|
||||||
}
|
// settings_menu.appendChild(smenu_el[i]);
|
||||||
|
// smenu_el[i].className += "uw-setmenu-item uw_setmenu_main uw_element";
|
||||||
|
// }
|
||||||
for(var i = 0; i < 4; i++){
|
//
|
||||||
smenu_ar_options[i] = document.createElement("div");
|
//
|
||||||
smenu_ar_options[i].className = "uw-setmenu-item uw_setmenu_ar uw_element";
|
// for(var i = 0; i < 4; i++){
|
||||||
smenu_ar_menu.appendChild(smenu_ar_options[i]);
|
// smenu_ar_options[i] = document.createElement("div");
|
||||||
}
|
// smenu_ar_options[i].className = "uw-setmenu-item uw_setmenu_ar uw_element";
|
||||||
|
// smenu_ar_menu.appendChild(smenu_ar_options[i]);
|
||||||
settings_menu.id = "uw-smenu";
|
// }
|
||||||
// settings_menu_mid.className = "uw-setmenu uw_element";
|
//
|
||||||
settings_menu.className = "uw-setmenu uw_element";
|
// settings_menu.id = "uw-smenu";
|
||||||
// settings_menu.className = "uw_element";
|
// // settings_menu_mid.className = "uw-setmenu uw_element";
|
||||||
|
// settings_menu.className = "uw-setmenu uw_element";
|
||||||
|
// // settings_menu.className = "uw_element";
|
||||||
smenu_el[0].id = "uw-smenu_settings";
|
//
|
||||||
smenu_el[6].id = "uw-smenu_ar";
|
//
|
||||||
|
// smenu_el[0].id = "uw-smenu_settings";
|
||||||
|
// smenu_el[6].id = "uw-smenu_ar";
|
||||||
smenu_ar_menu.id = "uw-armenu";
|
//
|
||||||
smenu_ar_menu.className = "uw-setmenu uw_element";
|
//
|
||||||
|
// smenu_ar_menu.id = "uw-armenu";
|
||||||
// Stvari, ki se spreminjajo, se določijo tukaj
|
// smenu_ar_menu.className = "uw-setmenu uw_element";
|
||||||
//
|
//
|
||||||
// Things that can change are defined here.
|
// // Stvari, ki se spreminjajo, se določijo tukaj
|
||||||
|
// //
|
||||||
var smenu_item_width = (button_width * 7.5);
|
// // Things that can change are defined here.
|
||||||
var smenu_item_fontSize = (button_width * 0.5);
|
//
|
||||||
var smenu_ar_item_width = (smenu_item_width / 3);
|
// var smenu_item_width = (button_width * 7.5);
|
||||||
var smenu_item_height = button_width;
|
// var smenu_item_fontSize = (button_width * 0.5);
|
||||||
|
// var smenu_ar_item_width = (smenu_item_width / 3);
|
||||||
// Popup meni je lahko visok največ 75% višine predvajalnika
|
// var smenu_item_height = button_width;
|
||||||
// Popup menu can be at most 75% of the video player tall
|
//
|
||||||
var smenu_max_h = player.clientHeight * 0.75;
|
// // Popup meni je lahko visok največ 75% višine predvajalnika
|
||||||
|
// // Popup menu can be at most 75% of the video player tall
|
||||||
// Če je popup večji, kot 80% predvajalnika, potem ga pomanjšamo. Višina elementa na popupu je približno enaka
|
// var smenu_max_h = player.clientHeight * 0.75;
|
||||||
// višini knofa. Gumbi so načeloma kvadratni, zato je višina enaka širini.
|
//
|
||||||
// If the popup menu is taller than 80% of the player, we resize it. height of an element in the popup is roughly
|
// // Če je popup večji, kot 80% predvajalnika, potem ga pomanjšamo. Višina elementa na popupu je približno enaka
|
||||||
// equal to the height of a button. Buttons are generally squares, so width is equal to heigth. (And if it's not,
|
// // višini knofa. Gumbi so načeloma kvadratni, zato je višina enaka širini.
|
||||||
// that's still close enough for us!)
|
// // If the popup menu is taller than 80% of the player, we resize it. height of an element in the popup is roughly
|
||||||
|
// // equal to the height of a button. Buttons are generally squares, so width is equal to heigth. (And if it's not,
|
||||||
var smenu_default_h = button_width * smenu_el.length;
|
// // that's still close enough for us!)
|
||||||
|
//
|
||||||
|
// var smenu_default_h = button_width * smenu_el.length;
|
||||||
if(smenu_max_h < smenu_default_h){
|
//
|
||||||
var scale_factor = smenu_max_h / smenu_default_h;
|
//
|
||||||
|
// if(smenu_max_h < smenu_default_h){
|
||||||
smenu_item_width *= scale_factor;
|
// var scale_factor = smenu_max_h / smenu_default_h;
|
||||||
smenu_item_fontSize *= scale_factor;
|
//
|
||||||
smenu_item_height = button_width * scale_factor;
|
// smenu_item_width *= scale_factor;
|
||||||
smenu_ar_item_width *= scale_factor;
|
// smenu_item_fontSize *= scale_factor;
|
||||||
|
// smenu_item_height = button_width * scale_factor;
|
||||||
}
|
// smenu_ar_item_width *= scale_factor;
|
||||||
|
//
|
||||||
settings_menu.style.bottom = (button_width * 1.5) + "px";
|
// }
|
||||||
settings_menu.style.width = smenu_item_width + "px";
|
//
|
||||||
settings_menu.style.fontSize = smenu_item_fontSize + "px";
|
// settings_menu.style.bottom = (button_width * 1.5) + "px";
|
||||||
|
// settings_menu.style.width = smenu_item_width + "px";
|
||||||
smenu_ar_menu.style.right = smenu_item_width + "px";
|
// settings_menu.style.fontSize = smenu_item_fontSize + "px";
|
||||||
smenu_ar_menu.style.width = smenu_ar_item_width + "px";
|
//
|
||||||
smenu_ar_menu.style.bottom = "0px";
|
|
||||||
|
|
||||||
for(var i = 0; i < smenu_el.length; i++){
|
|
||||||
smenu_el[i].style.width = smenu_item_width + "px";
|
|
||||||
smenu_el[i].style.height = smenu_item_height + "px";
|
|
||||||
smenu_el[i].style.fontSize = smenu_item_fontSize + "px";
|
|
||||||
}
|
|
||||||
for(var i = 0; i < smenu_ar_options.length; i++){
|
|
||||||
smenu_ar_options[i].height = smenu_item_height + "px";
|
|
||||||
smenu_ar_options[i].width = smenu_ar_item_width + "px";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Tukaj se določa notranji HTML knofov
|
|
||||||
// Inner HTML of elements is defined here
|
|
||||||
smenu_el[6].textContent = "Force aspect ratio";
|
|
||||||
smenu_el[6].appendChild(smenu_ar_menu);
|
|
||||||
|
|
||||||
smenu_el[0].textContent = "Settings";
|
|
||||||
|
|
||||||
smenu_ar_options[0].textContent = "4:3";
|
|
||||||
smenu_ar_options[1].textContent = "16:10";
|
|
||||||
smenu_ar_options[2].textContent = "16:9";
|
|
||||||
smenu_ar_options[3].textContent = "21:9";
|
|
||||||
|
|
||||||
smenu_el[5].textContent = "Fit width";
|
|
||||||
smenu_el[4].textContent = "Fit height";
|
|
||||||
smenu_el[3].textContent = "Reset";
|
|
||||||
smenu_el[1].textContent = "Zoom in";
|
|
||||||
smenu_el[2].textContent = "Zoom out";
|
|
||||||
|
|
||||||
// Pritisneš gumb, nekej zakon se more narest.
|
|
||||||
// — Bioware
|
|
||||||
// ( https://www.youtube.com/watch?v=hMcVZQI6ybw | [NVZD] )
|
|
||||||
//
|
|
||||||
// Press the button, something awesome has to happen.
|
|
||||||
// — Bioware
|
|
||||||
// ( https://www.youtube.com/watch?v=hMcVZQI6ybw | [NSFW] )
|
|
||||||
if(smenu_el[6]){
|
|
||||||
$(smenu_el[6]).on("mouseenter", function(){showMenu("uw-armenu")});
|
|
||||||
$(smenu_el[6]).on("mouseleave", function(){hideMenu("uw-armenu")});
|
|
||||||
smenu_el[6].onclick = function(event){event.stopPropagation(); showMenu("uw-armenu")};
|
|
||||||
}
|
|
||||||
// event.stopPropagation, ker nočemo togglati še funkcij od knofa za popup z nastavitvami
|
|
||||||
// event.stopPropagation, because we don't want to trigger onclick functions of the settings popup button in
|
|
||||||
// the player bar
|
|
||||||
|
|
||||||
smenu_ar_options[0].onclick = function(event) {event.stopPropagation(); changeCSS("char", ( 4/3 )); };
|
|
||||||
smenu_ar_options[1].onclick = function(event) {event.stopPropagation(); changeCSS("char", (16/10)); };
|
|
||||||
smenu_ar_options[2].onclick = function(event) {event.stopPropagation(); changeCSS("char", (16/9 )); };
|
|
||||||
smenu_ar_options[3].onclick = function(event) {event.stopPropagation(); changeCSS("char", (21/9 )); };
|
|
||||||
|
|
||||||
|
|
||||||
// smenu_el[0].onclick = function (event) {event.stopPropagation(); showSettings() };
|
|
||||||
|
|
||||||
smenu_el[5].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"fitw" ) };
|
|
||||||
smenu_el[4].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"fith" ) };
|
|
||||||
smenu_el[3].onclick = function (event) {event.stopPropagation(); changeCSS("reset","reset" ) };
|
|
||||||
smenu_el[1].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"zoom" ) };
|
|
||||||
smenu_el[2].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"unzoom") };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(debugmsg)
|
|
||||||
console.log("uw::addCtlButtons | buttons added");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateCtlButtonSize(){
|
|
||||||
// Gumb za nastavitve je bolj kot ne vselej prisoten, zato širino tega gumba uporabimo kot širino naših gumbov
|
|
||||||
// Settings button is more or less always there, so we use its width as width of our buttons
|
|
||||||
try{
|
|
||||||
// Na različnih straneh širino gumba poberemo na različne načine.
|
|
||||||
if(button_size_base == "y")
|
|
||||||
var button_width = document.getElementsByClassName(sample_button_class)[sample_button_index].scrollHeight;
|
|
||||||
else
|
|
||||||
var button_width = document.getElementsByClassName(sample_button_class)[sample_button_index].scrollWidth;
|
|
||||||
}
|
|
||||||
catch(e){
|
|
||||||
// Zato, ker predvajalnik ni vselej prisoten. Če predvajalnik ni prisoten,
|
|
||||||
// potem tudi knofov ni. Kar pomeni problem.
|
|
||||||
//
|
|
||||||
// Because the player isn't always there, and when the player isn't there the buttons aren't, either.
|
|
||||||
// In that case, the above statement craps out, throws an exception and trashes the extension.
|
|
||||||
if(debugmsg)
|
|
||||||
console.log("uw::updateCtlButtonSize | seems there was a fuckup and no buttons were found on this page. No player (and therefore no buttons) found.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var buttons = document.getElementsByClassName("uw-button");
|
|
||||||
|
|
||||||
for(var i = 0; i < buttons.length; i++){
|
|
||||||
buttons[i].style.width = (button_width * 0.75) + "px";
|
|
||||||
buttons[i].style.height = (button_width) + "px";
|
|
||||||
buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
|
|
||||||
buttons[i].style.paddingRight = (button_width * 0.15) + "px";
|
|
||||||
}
|
|
||||||
|
|
||||||
var smenu_item_width = (button_width * 7.5);
|
|
||||||
var smenu_item_fontSize = (button_width * 0.5);
|
|
||||||
var smenu_ar_item_width = (smenu_item_width / 3);
|
|
||||||
var smenu_item_height = button_width;
|
|
||||||
|
|
||||||
if(debugmsg || debugmsg_click)
|
|
||||||
console.log("uw::updateCtlButtonSize | changing css of menu items");
|
|
||||||
|
|
||||||
var settings_menu = document.getElementById("uw-smenu");
|
|
||||||
if(settings_menu != null){
|
|
||||||
settings_menu.style.bottom = (button_width * 1.5) + "px";
|
|
||||||
settings_menu.style.width = smenu_item_width + "px";
|
|
||||||
settings_menu.style.fontSize = smenu_item_fontSize + "px";
|
|
||||||
}
|
|
||||||
// smenu_ar_menu.style.right = smenu_item_width + "px";
|
// smenu_ar_menu.style.right = smenu_item_width + "px";
|
||||||
// smenu_ar_menu.style.width = smenu_ar_item_width + "px";
|
// smenu_ar_menu.style.width = smenu_ar_item_width + "px";
|
||||||
// smenu_ar_menu.style.bottom = "0px";
|
// smenu_ar_menu.style.bottom = "0px";
|
||||||
// smenu_ar_men
|
//
|
||||||
|
// for(var i = 0; i < smenu_el.length; i++){
|
||||||
|
// smenu_el[i].style.width = smenu_item_width + "px";
|
||||||
|
// smenu_el[i].style.height = smenu_item_height + "px";
|
||||||
|
// smenu_el[i].style.fontSize = smenu_item_fontSize + "px";
|
||||||
|
// }
|
||||||
|
// for(var i = 0; i < smenu_ar_options.length; i++){
|
||||||
|
// smenu_ar_options[i].height = smenu_item_height + "px";
|
||||||
|
// smenu_ar_options[i].width = smenu_ar_item_width + "px";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // Tukaj se določa notranji HTML knofov
|
||||||
|
// // Inner HTML of elements is defined here
|
||||||
|
// smenu_el[6].textContent = "Force aspect ratio";
|
||||||
|
// smenu_el[6].appendChild(smenu_ar_menu);
|
||||||
|
//
|
||||||
|
// smenu_el[0].textContent = "Settings";
|
||||||
|
//
|
||||||
|
// smenu_ar_options[0].textContent = "4:3";
|
||||||
|
// smenu_ar_options[1].textContent = "16:10";
|
||||||
|
// smenu_ar_options[2].textContent = "16:9";
|
||||||
|
// smenu_ar_options[3].textContent = "21:9";
|
||||||
|
//
|
||||||
|
// smenu_el[5].textContent = "Fit width";
|
||||||
|
// smenu_el[4].textContent = "Fit height";
|
||||||
|
// smenu_el[3].textContent = "Reset";
|
||||||
|
// smenu_el[1].textContent = "Zoom in";
|
||||||
|
// smenu_el[2].textContent = "Zoom out";
|
||||||
|
//
|
||||||
|
// // Pritisneš gumb, nekej zakon se more narest.
|
||||||
|
// // — Bioware
|
||||||
|
// // ( https://www.youtube.com/watch?v=hMcVZQI6ybw | [NVZD] )
|
||||||
|
// //
|
||||||
|
// // Press the button, something awesome has to happen.
|
||||||
|
// // — Bioware
|
||||||
|
// // ( https://www.youtube.com/watch?v=hMcVZQI6ybw | [NSFW] )
|
||||||
|
// if(smenu_el[6]){
|
||||||
|
// $(smenu_el[6]).on("mouseenter", function(){showMenu("uw-armenu")});
|
||||||
|
// $(smenu_el[6]).on("mouseleave", function(){hideMenu("uw-armenu")});
|
||||||
|
// smenu_el[6].onclick = function(event){event.stopPropagation(); showMenu("uw-armenu")};
|
||||||
|
// }
|
||||||
|
// // event.stopPropagation, ker nočemo togglati še funkcij od knofa za popup z nastavitvami
|
||||||
|
// // event.stopPropagation, because we don't want to trigger onclick functions of the settings popup button in
|
||||||
|
// // the player bar
|
||||||
|
//
|
||||||
|
// smenu_ar_options[0].onclick = function(event) {event.stopPropagation(); changeCSS("char", ( 4/3 )); };
|
||||||
|
// smenu_ar_options[1].onclick = function(event) {event.stopPropagation(); changeCSS("char", (16/10)); };
|
||||||
|
// smenu_ar_options[2].onclick = function(event) {event.stopPropagation(); changeCSS("char", (16/9 )); };
|
||||||
|
// smenu_ar_options[3].onclick = function(event) {event.stopPropagation(); changeCSS("char", (21/9 )); };
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // smenu_el[0].onclick = function (event) {event.stopPropagation(); showSettings() };
|
||||||
|
//
|
||||||
|
// smenu_el[5].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"fitw" ) };
|
||||||
|
// smenu_el[4].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"fith" ) };
|
||||||
|
// smenu_el[3].onclick = function (event) {event.stopPropagation(); changeCSS("reset","reset" ) };
|
||||||
|
// smenu_el[1].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"zoom" ) };
|
||||||
|
// smenu_el[2].onclick = function (event) {event.stopPropagation(); changeCSS("fit" ,"unzoom") };
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if(debugmsg)
|
||||||
|
// console.log("uw::addCtlButtons | buttons added");
|
||||||
|
//
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
document.getElementById("uw-smenu_ar").right = smenu_item_width;
|
// function updateCtlButtonSize(){
|
||||||
|
// // Gumb za nastavitve je bolj kot ne vselej prisoten, zato širino tega gumba uporabimo kot širino naših gumbov
|
||||||
|
// // Settings button is more or less always there, so we use its width as width of our buttons
|
||||||
|
// try{
|
||||||
|
// // Na različnih straneh širino gumba poberemo na različne načine.
|
||||||
|
// if(button_size_base == "y")
|
||||||
|
// var button_width = document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollHeight;
|
||||||
|
// else
|
||||||
|
// var button_width = document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollWidth;
|
||||||
|
// }
|
||||||
|
// catch(e){
|
||||||
|
// // Zato, ker predvajalnik ni vselej prisoten. Če predvajalnik ni prisoten,
|
||||||
|
// // potem tudi knofov ni. Kar pomeni problem.
|
||||||
|
// //
|
||||||
|
// // Because the player isn't always there, and when the player isn't there the buttons aren't, either.
|
||||||
|
// // In that case, the above statement craps out, throws an exception and trashes the extension.
|
||||||
|
// if(debugmsg)
|
||||||
|
// console.log("uw::updateCtlButtonSize | seems there was a fuckup and no buttons were found on this page. No player (and therefore no buttons) found.");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// var buttons = document.getElementsByClassName("uw-button");
|
||||||
|
//
|
||||||
|
// for(var i = 0; i < buttons.length; i++){
|
||||||
|
// buttons[i].style.width = (button_width * 0.75) + "px";
|
||||||
|
// buttons[i].style.height = (button_width) + "px";
|
||||||
|
// buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
|
||||||
|
// buttons[i].style.paddingRight = (button_width * 0.15) + "px";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// var smenu_item_width = (button_width * 7.5);
|
||||||
|
// var smenu_item_fontSize = (button_width * 0.5);
|
||||||
|
// var smenu_ar_item_width = (smenu_item_width / 3);
|
||||||
|
// var smenu_item_height = button_width;
|
||||||
|
//
|
||||||
|
// if(debugmsg || debugmsg_click)
|
||||||
|
// console.log("uw::updateCtlButtonSize | changing css of menu items");
|
||||||
|
//
|
||||||
|
// var settings_menu = document.getElementById("uw-smenu");
|
||||||
|
// if(settings_menu != null){
|
||||||
|
// settings_menu.style.bottom = (button_width * 1.5) + "px";
|
||||||
|
// settings_menu.style.width = smenu_item_width + "px";
|
||||||
|
// settings_menu.style.fontSize = smenu_item_fontSize + "px";
|
||||||
|
// }
|
||||||
|
// // smenu_ar_menu.style.right = smenu_item_width + "px";
|
||||||
|
// // smenu_ar_menu.style.width = smenu_ar_item_width + "px";
|
||||||
|
// // smenu_ar_menu.style.bottom = "0px";
|
||||||
|
// // smenu_ar_men
|
||||||
|
//
|
||||||
|
// document.getElementById("uw-smenu_ar").right = smenu_item_width;
|
||||||
|
//
|
||||||
|
// buttons = document.getElementsByClassName("uw_setmenu_main");
|
||||||
|
// for(var i = 0; i < buttons.length; i++){
|
||||||
|
// buttons[i].style.width = smenu_item_width + "px";
|
||||||
|
// buttons[i].style.height = smenu_item_height + "px";
|
||||||
|
// buttons[i].style.fontSize = smenu_item_fontSize + "px";
|
||||||
|
// }
|
||||||
|
// buttons = document.getElementsByClassName("uw_setmenu_ar");
|
||||||
|
// for(var i = 0; i < buttons.length; i++){
|
||||||
|
// buttons[i].style.width = smenu_ar_item_width + "px";
|
||||||
|
// buttons[i].style.height = smenu_item_height + "px";
|
||||||
|
// buttons[i].style.fontSize = smenu_item_fontSize + "px";
|
||||||
|
// buttons[i].style.right = smenu_item_width + "px";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
buttons = document.getElementsByClassName("uw_setmenu_main");
|
//END legacy
|
||||||
for(var i = 0; i < buttons.length; i++){
|
|
||||||
buttons[i].style.width = smenu_item_width + "px";
|
|
||||||
buttons[i].style.height = smenu_item_height + "px";
|
|
||||||
buttons[i].style.fontSize = smenu_item_fontSize + "px";
|
|
||||||
}
|
|
||||||
buttons = document.getElementsByClassName("uw_setmenu_ar");
|
|
||||||
for(var i = 0; i < buttons.length; i++){
|
|
||||||
buttons[i].style.width = smenu_ar_item_width + "px";
|
|
||||||
buttons[i].style.height = smenu_item_height + "px";
|
|
||||||
buttons[i].style.fontSize = smenu_item_fontSize + "px";
|
|
||||||
buttons[i].style.right = smenu_item_width + "px";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//END UI
|
//END UI
|
||||||
//END EXTENSION SETUP
|
//END EXTENSION SETUP
|
||||||
@ -1675,7 +1713,7 @@ function showSettings(){
|
|||||||
function onFullScreenChange(){
|
function onFullScreenChange(){
|
||||||
// Popravimo velikost gumbov
|
// Popravimo velikost gumbov
|
||||||
// Let's fix the button size:
|
// Let's fix the button size:
|
||||||
var button_width = document.getElementsByClassName(sample_button_class)[sample_button_index].scrollWidth;
|
var button_width = document.getElementsByClassName(SAMPLE_BUTTON_CLASS)[SAMPLE_BUTTON_INDEX].scrollWidth;
|
||||||
for( var i = 5; i >= 0; i--){
|
for( var i = 5; i >= 0; i--){
|
||||||
buttons[i].style.width = (button_width * 0.75) + "px";
|
buttons[i].style.width = (button_width * 0.75) + "px";
|
||||||
buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
|
buttons[i].style.paddingLeft = (button_width *0.15 ) + "px";
|
||||||
@ -1744,7 +1782,9 @@ function changeCSS(type, what_do){
|
|||||||
|
|
||||||
var video = { width: evideo.videoWidth, height: evideo.videoHeight };
|
var video = { width: evideo.videoWidth, height: evideo.videoHeight };
|
||||||
|
|
||||||
var nplayer = { width: player.clientWidth, height: player.clientHeight };
|
var nplayer = { width: PLAYER.clientWidth, height: PLAYER.clientHeight };
|
||||||
|
console.log("uw::changeCSS | video:", video, "nplayer: (player)", nplayer);
|
||||||
|
|
||||||
|
|
||||||
if(debugmsg)
|
if(debugmsg)
|
||||||
console.log("uw::changeCSS | video dimensions:",video.width,"x",video.height,"; player:",nplayer.width,"x",nplayer.height);
|
console.log("uw::changeCSS | video dimensions:",video.width,"x",video.height,"; player:",nplayer.width,"x",nplayer.height);
|
||||||
@ -1963,7 +2003,7 @@ function set_best_fit(ar){
|
|||||||
if(debugmsg || debugmsg_autoar)
|
if(debugmsg || debugmsg_autoar)
|
||||||
console.log("uw::set_best_fit | got ar:",ar);
|
console.log("uw::set_best_fit | got ar:",ar);
|
||||||
|
|
||||||
var player = {width: this.player.clientWidth, height: this.player.clientHeight};
|
var player = {width: PLAYER.clientWidth, height: PLAYER.clientHeight};
|
||||||
var player_ar = player.width / player.height;
|
var player_ar = player.width / player.height;
|
||||||
|
|
||||||
var evideo = $("video")[0];
|
var evideo = $("video")[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user