Another attempt at fixing the youtube search popup.

This commit is contained in:
Tamius Han 2018-04-22 14:35:40 +02:00
parent 77e1f711fd
commit 64e28e8074
5 changed files with 50 additions and 12 deletions

14
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}"
}
]
}

View File

@ -127,7 +127,7 @@ var _pd_getPlayerDimensions = function(startElement, elementNames){
// returns 'true' if there was a change.
var _pd_checkPlayerSizeChange = function(){
console.log("Player:", GlobalVars.playerDimensions, "Node:", GlobalVars.playerDimensions.element)
// console.log("Player:", GlobalVars.playerDimensions, "Node:", GlobalVars.playerDimensions.element)
if(Debug.debug){
if(GlobalVars.playerDimensions.element == undefined)
@ -140,7 +140,7 @@ var _pd_checkPlayerSizeChange = function(){
}
if(GlobalVars.playerDimensions.width != GlobalVars.playerDimensions.element.offsetWidth || GlobalVars.playerDimensions.height != GlobalVars.playerDimensions.element.offsetHeight ){
console.log("[PlayerDetect] player size changed. reason: dimension change");
console.log("[PlayerDetect] player size changed. reason: dimension change. Old dimensions?", GlobalVars.playerDimensions.width, GlobalVars.playerDimensions.height, "new dimensions:", GlobalVars.playerDimensions.element.offsetWidth, GlobalVars.playerDimensions.element.offsetHeight);
}
}

View File

@ -53,7 +53,7 @@ var _arSetup = function(cwidth, cheight){
var vid = document.getElementsByTagName("video")[0];
if(vid === undefined){
if(vid === undefined || vid === null){
_ard_setup_timer = setTimeout(_arSetup, 1000);
return;
}
@ -295,6 +295,15 @@ var _ard_vdraw_but_for_reals = function() {
if(this._forcehalt)
return;
if(! GlobalVars.video){
if(Debug.debug || Debug.warnings_critical)
console.log("[ArDetect::_ard_vdraw] Video went missing. Stopping current instance of automatic detection and trying to start a new one.")
_ard_stop();
this._forcehalt = true;
_arSetup();
return;
}
var fallbackMode = false;
var startTime = performance.now();
var baseTimeout = ExtensionConf.arDetect.timer_playing;

View File

@ -51,7 +51,7 @@ var _res_legacyAr = function(action){
var vid = GlobalVars.video;
var ar;
if(GlobalVars.playerDimensions === null || GlobalVars.playerDimensions === undefined){
if(! GlobalVars.playerDimensions ){
ar = screen.width / screen.height;
}
else{
@ -98,7 +98,7 @@ var _res_setAr = function(ar){
if(vid == null || vid==undefined || vid.videoWidth == 0 || vid.videoHeight == 0){
if(Debug.debug)
console.log("[Resizer::_res_setAr] I lied. Tricked you! You thought there is a video, didn't you? Never would be.", vid); // of course that's thorin reference -> https://youtu.be/OY5gGkeQn1c?t=1m20s
console.log("[Resizer::_res_setAr] I lied. Tricked you! You thought there's gonna be a video, didn't you? Never would be.", vid); // of course that's thorin reference -> https://youtu.be/OY5gGkeQn1c?t=1m20s
return;
}
}
@ -210,6 +210,12 @@ var _res_setStyleString = function(vid, styleString, count){
if(_res_restore_wd){
var vid2 = GlobalVars.video;
if(vid2 == undefined || vid2 == null){
if(Debug.debug)
console.log("[Resizer::_res_setStyleString] Video element went missing, nothing to do here.")
return;
}
if(
styleString.indexOf("width: " + vid2.style.width) == -1 ||
styleString.indexOf("height: " + vid2.style.height) == -1) {
@ -237,6 +243,12 @@ var _res_setStyleString = function(vid, styleString, count){
function _res_applyCss(dimensions){
if(GlobalVars.video == undefined || GlobalVars.video == null){
if(Debug.debug)
console.log("[Resizer::_res_applyCss] Video went missing, doing nothing.");
return;
}
if(Debug.debug)
console.log("[Resizer::_res_applyCss] Starting to apply css. this is what we're getting in:", dimensions);
@ -323,6 +335,9 @@ var _res_antiCssOverride = function(){
if(GlobalVars.currentCss.top === null)
return;
// this means video went missing.
if(GlobalVars.video == undefined || GlobalVars.video == null)
return;
var styleArrayStr = GlobalVars.video.getAttribute('style');