Trying to fix the youtube popup bug by re-detecting player element every time a new <video> tag is detected.
This commit is contained in:
parent
eebed0e1c4
commit
b0ef12d97b
@ -323,6 +323,8 @@ function _res_applyCss(dimensions){
|
||||
for(var key in dimensions)
|
||||
styleArray.push( dimensions[key] );
|
||||
|
||||
|
||||
|
||||
// build style string back
|
||||
var styleString = "";
|
||||
for(var i in styleArray)
|
||||
@ -342,6 +344,10 @@ var _res_antiCssOverride = function(){
|
||||
if(GlobalVars.video == undefined || GlobalVars.video == null)
|
||||
return;
|
||||
|
||||
// // our current css is fucky? Null, undefined and 0 are invalid values.
|
||||
// if(! GlobalVars.currentCss.width || ! GlobalVars.currentCss.height )
|
||||
// return;
|
||||
|
||||
var styleArrayStr = GlobalVars.video.getAttribute('style');
|
||||
|
||||
if (styleArrayStr !== null && styleArrayStr !== undefined){
|
||||
@ -357,7 +363,7 @@ var _res_antiCssOverride = function(){
|
||||
if(styleArray[i] != GlobalVars.currentCss.top){
|
||||
if(Debug.debug){
|
||||
console.log("[Resizer::_res_antiCssOverride] SOMEBODY TOUCHED MA SPAGHETT (our CSS got overriden, restoring our css)");
|
||||
console.log("[Resizer::_res_antiCssOverride] MA SPAGHETT: width:", GlobalVars.currentCss.width, "height:", GlobalVars.currentCss.height, "thing that touched ma spaghett", styleArrayStr);
|
||||
console.log("[Resizer::_res_antiCssOverride] MA SPAGHETT: top:", GlobalVars.currentCss.top, "left:", GlobalVars.currentCss.left, "thing that touched ma spaghett", styleArrayStr);
|
||||
}
|
||||
_res_restore();
|
||||
return;
|
||||
|
13
js/uw.js
13
js/uw.js
@ -24,6 +24,14 @@ async function main(){
|
||||
var scpromise = SitesConf.init();
|
||||
var kbpromise = Keybinds.init();
|
||||
|
||||
// reset current css stuff in GlobalVars
|
||||
GlobalVars.correctedVideoDimensions.top = null;
|
||||
GlobalVars.correctedVideoDimensions.left = null;
|
||||
GlobalVars.correctedVideoDimensions.width = null;
|
||||
GlobalVars.correctedVideoDimensions.height = null;
|
||||
|
||||
GlobalVars.currentCss = {top: null, left: null};
|
||||
|
||||
// počakamo, da so nastavitve naložene
|
||||
// wait for settings to load
|
||||
await scpromise;
|
||||
@ -103,8 +111,13 @@ function ghettoOnChange(){
|
||||
video.videoHeight > 0 ){
|
||||
if(Debug.debug){
|
||||
console.log("%c[uw::ghettoOnChange] detected video. registering!", "color: #99f, background: #000");
|
||||
console.log("[uw::ghettoOnChange] just for shits and giggles, let's see what's happened with GlobalVars.playerDimensions:", GlobalVars.playerDimensions)
|
||||
}
|
||||
|
||||
// zaznali smo novo <video> značko. Zaradi tega bomo resetirali GlobalVars.playerDimensions
|
||||
// a new <video> has been detected. We'll be resetting GlobalVars.playerDimensions
|
||||
GlobalVars.playerDimensions = PlayerDetect.getPlayerDimensions(video);
|
||||
|
||||
GlobalVars.video = video;
|
||||
Comms.sendToBackgroundScript({"cmd":"register-video"});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user