Minor fixes
This commit is contained in:
parent
59df28029f
commit
66bcc40fb4
@ -62,7 +62,7 @@ class CommsClient {
|
||||
if (message.cmd === "set-ar") {
|
||||
this.pageInfo.setAr({type: message.arg, ratio: message.customArg}, message.playing);
|
||||
} else if (message.cmd === 'set-alignment') {
|
||||
this.pageInfo.setvideoAlignment(message.arg, message.playing);
|
||||
this.pageInfo.setVideoAlignment(message.arg, message.playing);
|
||||
this.pageInfo.restoreAr();
|
||||
} else if (message.cmd === "set-stretch") {
|
||||
this.pageInfo.setStretchMode(message.arg, message.playing);
|
||||
|
@ -140,85 +140,89 @@ class PageInfo {
|
||||
try{
|
||||
var vids = this.getVideos(window.location.host);
|
||||
|
||||
if(!vids || vids.length == 0){
|
||||
if(!vids || vids.length == 0){
|
||||
this.hasVideos = false;
|
||||
|
||||
if(rescanReason == RescanReason.PERIODIC){
|
||||
this.logger.log('info', 'videoRescan', "[PageInfo::rescan] Scheduling normal rescan.")
|
||||
this.scheduleRescan(RescanReason.PERIODIC);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// add new videos
|
||||
this.hasVideos = false;
|
||||
|
||||
if(rescanReason == RescanReason.PERIODIC){
|
||||
this.logger.log('info', 'videoRescan', "[PageInfo::rescan] Scheduling normal rescan.")
|
||||
this.scheduleRescan(RescanReason.PERIODIC);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var videoExists = false;
|
||||
var video, v;
|
||||
|
||||
// add new videos
|
||||
this.hasVideos = false;
|
||||
var videoExists = false;
|
||||
var video, v;
|
||||
for (video of vids) {
|
||||
// če najdemo samo en video z višino in širino, to pomeni, da imamo na strani veljavne videe
|
||||
// če trenutni video nima definiranih teh vrednostih, preskočimo vse nadaljnja preverjanja
|
||||
// <===[:::::::]===>
|
||||
// if we find even a single video with width and height, that means the page has valid videos
|
||||
// if video lacks either of the two properties, we skip all further checks cos pointless
|
||||
if(video.offsetWidth && video.offsetHeight){
|
||||
this.hasVideos = true;
|
||||
|
||||
for (video of vids) {
|
||||
// če najdemo samo en video z višino in širino, to pomeni, da imamo na strani veljavne videe
|
||||
// če trenutni video nima definiranih teh vrednostih, preskočimo vse nadaljnja preverjanja
|
||||
// <===[:::::::]===>
|
||||
// if we find even a single video with width and height, that means the page has valid videos
|
||||
// if video lacks either of the two properties, we skip all further checks cos pointless
|
||||
if(video.offsetWidth && video.offsetHeight){
|
||||
this.hasVideos = true;
|
||||
if (this.readOnly) {
|
||||
// in lite mode, we're done. This is all the info we want, but we want to actually start doing
|
||||
// things that interfere with the website. We still want to be runnig a rescan, tho.
|
||||
|
||||
if (this.readOnly) {
|
||||
// in lite mode, we're done. This is all the info we want, but we want to actually start doing
|
||||
// things that interfere with the website. We still want to be runnig a rescan, tho.
|
||||
|
||||
if(rescanReason == RescanReason.PERIODIC){
|
||||
this.scheduleRescan(RescanReason.PERIODIC);
|
||||
if(rescanReason == RescanReason.PERIODIC){
|
||||
this.scheduleRescan(RescanReason.PERIODIC);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
videoExists = false;
|
||||
|
||||
for (v of this.videos) {
|
||||
if (v.destroyed) {
|
||||
continue; //TODO: if destroyed video is same as current video, copy aspect ratio settings to current video
|
||||
}
|
||||
|
||||
if (v.video == video) {
|
||||
videoExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (videoExists) {
|
||||
continue;
|
||||
} else {
|
||||
this.logger.log('info', 'videoRescan', "[PageInfo::rescan] found new video candidate:", video, "NOTE:: Video initialization starts here:\n--------------------------------\n")
|
||||
|
||||
v = new VideoData(video, this.settings, this);
|
||||
v.initArDetection();
|
||||
this.videos.push(v);
|
||||
|
||||
this.logger.log('info', 'videoRescan', "END VIDEO INITIALIZATION\n\n\n-------------------------------------\nvideos[] is now this:", this.videos,"\n\n\n\n\n\n\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
this.removeDestroyed();
|
||||
|
||||
// če smo ostali brez videev, potem odregistriraj stran.
|
||||
// če nismo ostali brez videev, potem registriraj stran.
|
||||
//
|
||||
// if we're left withotu videos on the current page, we unregister the page.
|
||||
// if we have videos, we call register.
|
||||
if (this.comms) {
|
||||
if (this.videos.length != oldVideoCount) { // only if number of videos changed, tho
|
||||
if (this.videos.length > 0) {
|
||||
this.comms.registerVideo({host: window.location.host, location: window.location});
|
||||
} else {
|
||||
this.comms.unregisterVideo({host: window.location.host, location: window.location});
|
||||
continue;
|
||||
}
|
||||
|
||||
videoExists = false;
|
||||
|
||||
for (v of this.videos) {
|
||||
if (v.destroyed) {
|
||||
continue; //TODO: if destroyed video is same as current video, copy aspect ratio settings to current video
|
||||
}
|
||||
|
||||
if (v.video == video) {
|
||||
videoExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (videoExists) {
|
||||
continue;
|
||||
} else {
|
||||
this.logger.log('info', 'videoRescan', "[PageInfo::rescan] found new video candidate:", video, "NOTE:: Video initialization starts here:\n--------------------------------\n")
|
||||
|
||||
try {
|
||||
v = new VideoData(video, this.settings, this);
|
||||
v.initArDetection();
|
||||
this.videos.push(v);
|
||||
} catch (e) {
|
||||
this.logger.log('error', 'debug', "rescan error: failed to initialize videoData. Skipping this video.",e);
|
||||
}
|
||||
|
||||
this.logger.log('info', 'videoRescan', "END VIDEO INITIALIZATION\n\n\n-------------------------------------\nvideos[] is now this:", this.videos,"\n\n\n\n\n\n\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
this.removeDestroyed();
|
||||
|
||||
// če smo ostali brez videev, potem odregistriraj stran.
|
||||
// če nismo ostali brez videev, potem registriraj stran.
|
||||
//
|
||||
// if we're left withotu videos on the current page, we unregister the page.
|
||||
// if we have videos, we call register.
|
||||
if (this.comms) {
|
||||
if (this.videos.length != oldVideoCount) { // only if number of videos changed, tho
|
||||
if (this.videos.length > 0) {
|
||||
this.comms.registerVideo({host: window.location.host, location: window.location});
|
||||
} else {
|
||||
this.comms.unregisterVideo({host: window.location.host, location: window.location});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch(e) {
|
||||
// če pride do zajeba, potem lahko domnevamo da na strani ni nobenega videa. Uničimo vse objekte videoData
|
||||
@ -275,8 +279,8 @@ class PageInfo {
|
||||
|
||||
var ths = this;
|
||||
|
||||
this.rescanTimer = setTimeout(function(){
|
||||
ths.rescanTimer = null;
|
||||
this.urlCheckTimer = setTimeout(function(){
|
||||
ths.urlCheckTimer = null;
|
||||
ths.ghettoUrlCheck();
|
||||
ths = null;
|
||||
}, this.settings.active.pageInfo.timeouts.urlCheck)
|
||||
@ -418,16 +422,16 @@ class PageInfo {
|
||||
}
|
||||
}
|
||||
|
||||
setvideoAlignment(videoAlignment, playingOnly) {
|
||||
setVideoAlignment(videoAlignment, playingOnly) {
|
||||
if (playingOnly) {
|
||||
for(var vd of this.videos) {
|
||||
if (vd.isPlaying()) {
|
||||
vd.setvideoAlignment(videoAlignment)
|
||||
vd.setVideoAlignment(videoAlignment)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(var vd of this.videos) {
|
||||
vd.setvideoAlignment(videoAlignment)
|
||||
vd.setVideoAlignment(videoAlignment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import ArDetector from '../ar-detect/ArDetector';
|
||||
class VideoData {
|
||||
|
||||
constructor(video, settings, pageInfo){
|
||||
this.vdid = (Math.random()*100).toFixed();
|
||||
this.logger = pageInfo.logger;
|
||||
this.arSetupComplete = false;
|
||||
this.video = video;
|
||||
@ -14,7 +15,6 @@ class VideoData {
|
||||
this.pageInfo = pageInfo;
|
||||
this.extensionMode = pageInfo.extensionMode;
|
||||
|
||||
this.vdid = (Math.random()*100).toFixed();
|
||||
this.userCssClassName = `uw-fuck-you-and-do-what-i-tell-you_${this.vdid}`;
|
||||
|
||||
|
||||
@ -244,8 +244,8 @@ class VideoData {
|
||||
this.resizer.setPanMode(mode);
|
||||
}
|
||||
|
||||
setvideoAlignment(videoAlignment) {
|
||||
this.resizer.setvideoAlignment(videoAlignment);
|
||||
setVideoAlignment(videoAlignment) {
|
||||
this.resizer.setVideoAlignment(videoAlignment);
|
||||
}
|
||||
|
||||
restoreAr(){
|
||||
|
@ -15,6 +15,7 @@ if(Debug.debug) {
|
||||
class Resizer {
|
||||
|
||||
constructor(videoData) {
|
||||
this.resizerId = (Math.random(99)*100).toFixed(0);
|
||||
this.conf = videoData;
|
||||
this.logger = videoData.logger;
|
||||
this.video = videoData.video;
|
||||
@ -37,7 +38,6 @@ class Resizer {
|
||||
this.videoAlignment = this.settings.getDefaultVideoAlignment(window.location.hostname); // this is initial video alignment
|
||||
this.destroyed = false;
|
||||
|
||||
this.resizerId = (Math.random(99)*100).toFixed(0);
|
||||
|
||||
if (this.settings.active.pan) {
|
||||
this.canPan = this.settings.active.miscSettings.mousePan.enabled;
|
||||
@ -194,8 +194,8 @@ class Resizer {
|
||||
this.conf.destroy();
|
||||
}
|
||||
|
||||
// // pause AR on basic stretch, unpause when using other mdoes
|
||||
// fir sine reason unpause doesn't unpause. investigate that later
|
||||
// pause AR on basic stretch, unpause when using other modes
|
||||
// for sine reason unpause doesn't unpause. investigate that later
|
||||
try {
|
||||
if (this.stretcher.mode === Stretch.Basic) {
|
||||
this.conf.arDetector.pause();
|
||||
@ -218,7 +218,7 @@ class Resizer {
|
||||
this.conf.destroy();
|
||||
}
|
||||
if (stretchFactors.error === 'illegal_video_dimensions') {
|
||||
this.loggger.log('error', 'debug', `[Resizer::setAr] <rid:${this.resizerId}> Illegal video dimensions found. We will pause everything.`)
|
||||
this.logger.log('error', 'debug', `[Resizer::setAr] <rid:${this.resizerId}> Illegal video dimensions found. We will pause everything.`)
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -300,7 +300,7 @@ class Resizer {
|
||||
this.restore();
|
||||
}
|
||||
|
||||
setvideoAlignment(videoAlignment) {
|
||||
setVideoAlignment(videoAlignment) {
|
||||
this.videoAlignment = videoAlignment;
|
||||
this.restore();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user