unfuck progress before switching branches.
This commit is contained in:
parent
18f1ea26a7
commit
ba841c6ea3
@ -41,17 +41,21 @@ var _pd_getPlayerDimensions = function(element){
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var playerCandidateNode = element;
|
|
||||||
|
try{
|
||||||
var trustCandidateAfterGrows = 2; // if candidate_width or candidate_height increases in either dimensions this many
|
var trustCandidateAfterGrows = 2; // if candidate_width or candidate_height increases in either dimensions this many
|
||||||
// times, we say we found our player. (This number ignores weird elements)
|
// times, we say we found our player. (This number ignores weird elements)
|
||||||
// in case our <video> is bigger than player in one dimension but smaller in the other
|
// in case our <video> is bigger than player in one dimension but smaller in the other
|
||||||
// if site is coded properly, player can't be wider than that
|
// if site is coded properly, player can't be wider than that
|
||||||
var candidate_width = Math.max(element.offsetWidth, screen.width);
|
var candidate_width = Math.max(element.offsetWidth, window.width);
|
||||||
var candidate_height = Math.max(element.offsetHeight, screen.height);
|
var candidate_height = Math.max(element.offsetHeight, window.height);
|
||||||
|
var playerCandidateNode = element;
|
||||||
|
|
||||||
// <video> can't be root in a document, so we can do this
|
// <video> can't be root in a document, so we can do this
|
||||||
element = element.parentNode;
|
element = element.parentNode;
|
||||||
|
|
||||||
|
|
||||||
|
var grows = trustCandidateAfterGrows;
|
||||||
while(element != undefined){
|
while(element != undefined){
|
||||||
// odstranimo čudne elemente, ti bi pokvarili zadeve
|
// odstranimo čudne elemente, ti bi pokvarili zadeve
|
||||||
// remove weird elements, those would break our stuff
|
// remove weird elements, those would break our stuff
|
||||||
@ -59,19 +63,23 @@ var _pd_getPlayerDimensions = function(element){
|
|||||||
element = element.parentNode;
|
element = element.parentNode;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( element.offsetHeight <= candidate_height &&
|
if ( element.offsetHeight <= candidate_height &&
|
||||||
element.offsetWidth <= candidate_width ){
|
element.offsetWidth <= candidate_width ){
|
||||||
|
|
||||||
playerCandidateNode = element;
|
playerCandidateNode = element;
|
||||||
candidate_width = element.offsetWidth;
|
candidate_width = element.offsetWidth;
|
||||||
candidate_height = element.offsetHeight;
|
candidate_height = element.offsetHeight;
|
||||||
|
|
||||||
|
|
||||||
|
grows = trustCandidateAfterGrows;
|
||||||
|
|
||||||
if(Debug.debug){
|
if(Debug.debug){
|
||||||
console.log("Found new candidate for player. Dimensions: w:", candidate_width, "h:",candidate_height, "node:", playerCandidateNode);
|
console.log("Found new candidate for player. Dimensions: w:", candidate_width, "h:",candidate_height, "node:", playerCandidateNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(trustCandidateAfterGrows --<= 0){
|
else if(grows --<= 0){
|
||||||
|
|
||||||
if(Debug.debug && Debug.playerDetect){
|
if(Debug.debug && Debug.playerDetect){
|
||||||
console.log("Current element grew in comparrison to the child. We probably found the player. breaking loop, returning current result");
|
console.log("Current element grew in comparrison to the child. We probably found the player. breaking loop, returning current result");
|
||||||
}
|
}
|
||||||
@ -80,7 +88,10 @@ var _pd_getPlayerDimensions = function(element){
|
|||||||
|
|
||||||
element = element.parentNode;
|
element = element.parentNode;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(e){
|
||||||
|
console.log("pdeeee,",e);
|
||||||
|
}
|
||||||
var dims = {
|
var dims = {
|
||||||
width: candidate_width,
|
width: candidate_width,
|
||||||
height: candidate_height,
|
height: candidate_height,
|
||||||
|
@ -61,8 +61,10 @@ var _arSetup = function(cwidth, cheight){
|
|||||||
// imamo video, pa tudi problem. Ta problem bo verjetno kmalu popravljen, zato setup začnemo hitreje kot prej
|
// imamo video, pa tudi problem. Ta problem bo verjetno kmalu popravljen, zato setup začnemo hitreje kot prej
|
||||||
// we have a video, but also a problem. This problem will prolly be fixed very soon, so setup is called with
|
// we have a video, but also a problem. This problem will prolly be fixed very soon, so setup is called with
|
||||||
// less delay than before
|
// less delay than before
|
||||||
if(vid.videoWidth === 0 || vid.videoHeight === 0){
|
if(vid.videoWidth === 0 || vid.videoHeight === 0 ){
|
||||||
_ard_setup_timer = setTimeout(_arSetup, 100);
|
if(! _ard_timer)
|
||||||
|
_ard_setup_timer = setTimeout(_arSetup, 100);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,10 +250,17 @@ var _ard_processAr = function(video, width, height, edge_h, edge_w, fallbackMode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var clearTimeoutCount = 0;
|
||||||
|
|
||||||
|
var _ard_vdraw = function (timeout, force_reset){
|
||||||
var _ard_vdraw = function (timeout){
|
// don't allow more than 1 instance
|
||||||
|
if(_ard_timer){
|
||||||
|
++clearTimeoutCount;
|
||||||
|
clearTimeout(_ard_timer);
|
||||||
|
}
|
||||||
|
|
||||||
_ard_timer = setTimeout(function(){
|
_ard_timer = setTimeout(function(){
|
||||||
|
_ard_timer = null;
|
||||||
_ard_vdraw_but_for_reals();
|
_ard_vdraw_but_for_reals();
|
||||||
},
|
},
|
||||||
timeout);
|
timeout);
|
||||||
@ -260,8 +269,9 @@ var _ard_vdraw = function (timeout){
|
|||||||
var executions = 0;
|
var executions = 0;
|
||||||
|
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
console.log("this many executions in last second:", executions);
|
console.log("STATS FOR LAST SECOND\nexecutions:", executions,"; vdraw timeouts cleared:", clearTimeoutCount);
|
||||||
executions = 0;
|
executions = 0;
|
||||||
|
clearTimeoutCount = 0;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
var _ard_vdraw_but_for_reals = function() {
|
var _ard_vdraw_but_for_reals = function() {
|
||||||
|
4
js/uw.js
4
js/uw.js
@ -60,7 +60,7 @@ async function main(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
browser.runtime.onMessage.addListener(receiveMessage);
|
browser.runtime.onMessage.addListener(receiveMessage);
|
||||||
setInterval( ghettoOnChange, 33);
|
setInterval( ghettoOnChange, 10000);
|
||||||
setInterval( ghettoUrlWatcher, 500);
|
setInterval( ghettoUrlWatcher, 500);
|
||||||
|
|
||||||
// ko se na ticevki zamenja video, console.log pravi da ultrawidify spremeni razmerje stranic. preglej element
|
// ko se na ticevki zamenja video, console.log pravi da ultrawidify spremeni razmerje stranic. preglej element
|
||||||
@ -79,7 +79,7 @@ async function main(){
|
|||||||
// here we check (in the most ghetto way) whether player size has changed. If it has, we retrigger resizer.
|
// here we check (in the most ghetto way) whether player size has changed. If it has, we retrigger resizer.
|
||||||
|
|
||||||
var _video_recheck_counter = 0;
|
var _video_recheck_counter = 0;
|
||||||
var _video_recheck_period = 60; // on this many retries
|
var _video_recheck_period = 1; // on this many retries
|
||||||
|
|
||||||
function ghettoOnChange(){
|
function ghettoOnChange(){
|
||||||
|
|
||||||
|
@ -200,6 +200,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="autoar-basic-settings" class="suboption hidden">
|
||||||
|
Automatic aspect ratio mode detection.
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="aspect-ratio-settings" class="suboption hidden">
|
<div id="aspect-ratio-settings" class="suboption hidden">
|
||||||
|
|
||||||
<div id="no-videos-warning" class="warning">No videos were detected on this page. The buttons may not work at all. Check that this site is not blacklisted and reload the page.</div>
|
<div id="no-videos-warning" class="warning">No videos were detected on this page. The buttons may not work at all. Check that this site is not blacklisted and reload the page.</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user