Another attempt at fixing the youtube search popup.
This commit is contained in:
parent
77e1f711fd
commit
64e28e8074
14
.vscode/launch.json
vendored
Normal file
14
.vscode/launch.json
vendored
Normal 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}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -127,7 +127,7 @@ var _pd_getPlayerDimensions = function(startElement, elementNames){
|
|||||||
// returns 'true' if there was a change.
|
// returns 'true' if there was a change.
|
||||||
var _pd_checkPlayerSizeChange = function(){
|
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(Debug.debug){
|
||||||
if(GlobalVars.playerDimensions.element == undefined)
|
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 ){
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ var _arSetup = function(cwidth, cheight){
|
|||||||
|
|
||||||
var vid = document.getElementsByTagName("video")[0];
|
var vid = document.getElementsByTagName("video")[0];
|
||||||
|
|
||||||
if(vid === undefined){
|
if(vid === undefined || vid === null){
|
||||||
_ard_setup_timer = setTimeout(_arSetup, 1000);
|
_ard_setup_timer = setTimeout(_arSetup, 1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -294,6 +294,15 @@ var _ard_vdraw_but_for_reals = function() {
|
|||||||
|
|
||||||
if(this._forcehalt)
|
if(this._forcehalt)
|
||||||
return;
|
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 fallbackMode = false;
|
||||||
var startTime = performance.now();
|
var startTime = performance.now();
|
||||||
|
@ -47,11 +47,11 @@ var _res_char = function(newAr, video, player){
|
|||||||
// Skrbi za "stare" možnosti, kot na primer "na širino zaslona", "na višino zaslona" in "ponastavi".
|
// Skrbi za "stare" možnosti, kot na primer "na širino zaslona", "na višino zaslona" in "ponastavi".
|
||||||
// Približevanje opuščeno.
|
// Približevanje opuščeno.
|
||||||
// handles "legacy" options, such as 'fit to widht', 'fit to height' and 'reset'. No zoom tho
|
// handles "legacy" options, such as 'fit to widht', 'fit to height' and 'reset'. No zoom tho
|
||||||
var _res_legacyAr = function(action){
|
var _res_legacyAr = function(action){
|
||||||
var vid = GlobalVars.video;
|
var vid = GlobalVars.video;
|
||||||
var ar;
|
var ar;
|
||||||
|
|
||||||
if(GlobalVars.playerDimensions === null || GlobalVars.playerDimensions === undefined){
|
if(! GlobalVars.playerDimensions ){
|
||||||
ar = screen.width / screen.height;
|
ar = screen.width / screen.height;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -98,7 +98,7 @@ var _res_setAr = function(ar){
|
|||||||
|
|
||||||
if(vid == null || vid==undefined || vid.videoWidth == 0 || vid.videoHeight == 0){
|
if(vid == null || vid==undefined || vid.videoWidth == 0 || vid.videoHeight == 0){
|
||||||
if(Debug.debug)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,6 +209,12 @@ var _res_setStyleString = function(vid, styleString, count){
|
|||||||
|
|
||||||
if(_res_restore_wd){
|
if(_res_restore_wd){
|
||||||
var vid2 = GlobalVars.video;
|
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(
|
if(
|
||||||
styleString.indexOf("width: " + vid2.style.width) == -1 ||
|
styleString.indexOf("width: " + vid2.style.width) == -1 ||
|
||||||
@ -236,6 +242,12 @@ var _res_setStyleString = function(vid, styleString, count){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _res_applyCss(dimensions){
|
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)
|
if(Debug.debug)
|
||||||
console.log("[Resizer::_res_applyCss] Starting to apply css. this is what we're getting in:", dimensions);
|
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)
|
if(GlobalVars.currentCss.top === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// this means video went missing.
|
||||||
|
if(GlobalVars.video == undefined || GlobalVars.video == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var styleArrayStr = GlobalVars.video.getAttribute('style');
|
var styleArrayStr = GlobalVars.video.getAttribute('style');
|
||||||
|
|
||||||
|
12
js/uw.js
12
js/uw.js
@ -47,12 +47,12 @@ async function main(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(SitesConf.isArEnabled(window.location.hostname)){
|
// if(SitesConf.isArEnabled(window.location.hostname)){
|
||||||
// if(Debug.debug)
|
// if(Debug.debug)
|
||||||
// console.log("[uw::main] Aspect ratio detection is enabled. Starting ArDetect");
|
// console.log("[uw::main] Aspect ratio detection is enabled. Starting ArDetect");
|
||||||
// ArDetect.arSetup();
|
// ArDetect.arSetup();
|
||||||
// }
|
// }
|
||||||
// console.log("[uw::main] ExtensionConf:", ExtensionConf);
|
// console.log("[uw::main] ExtensionConf:", ExtensionConf);
|
||||||
|
|
||||||
if(ExtensionConf.arDetect.mode == "blacklist"){
|
if(ExtensionConf.arDetect.mode == "blacklist"){
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
|
Loading…
Reference in New Issue
Block a user