Reorganized stuff for content script & get it working (preliminary; performance issues on YT)
This commit is contained in:
parent
20030f1679
commit
9c3ca3744b
@ -6,9 +6,4 @@ var ExtensionMode = Object.freeze({
|
|||||||
Full: 2
|
Full: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
var StretchMode = Object.freeze({
|
export default ExtensionMode;
|
||||||
NO_STRETCH: 0,
|
|
||||||
BASIC: 1,
|
|
||||||
HYBRID: 2,
|
|
||||||
CONDITIONAL: 3
|
|
||||||
});
|
|
@ -5,27 +5,27 @@ var _bd_isFirefox = true;
|
|||||||
var _bd_isChrome = false;
|
var _bd_isChrome = false;
|
||||||
var _bd_isEdge = false; // we'll see if FF
|
var _bd_isEdge = false; // we'll see if FF
|
||||||
|
|
||||||
// try{
|
try{
|
||||||
// // todo: find something that works in firefox but not in edge (or vice-versa)
|
// todo: find something that works in firefox but not in edge (or vice-versa)
|
||||||
// // note that this function returns a promise! and is broken for some reason
|
// note that this function returns a promise! and is broken for some reason
|
||||||
// var browserinfo = browser.runtime.getBrowserInfo();
|
var browserinfo = browser.runtime.getBrowserInfo();
|
||||||
|
|
||||||
// // we don't need to actually check because only firefox supports that.
|
// we don't need to actually check because only firefox supports that.
|
||||||
// // if we're not on firefox, the above call will probably throw an exception anyway.
|
// if we're not on firefox, the above call will probably throw an exception anyway.
|
||||||
// // if browsers other than firefox start supporting that, well ... we'll also need to actually await for promise
|
// if browsers other than firefox start supporting that, well ... we'll also need to actually await for promise
|
||||||
// // that getBrowserInfo() returns to resolve.
|
// that getBrowserInfo() returns to resolve.
|
||||||
|
|
||||||
// // if (Browser.name.toLowerCase().indexOf(firefox) !== -1 || Browser.vendor.toLowerCase().indexOf(mozilla) !== -1) {
|
// if (Browser.name.toLowerCase().indexOf(firefox) !== -1 || Browser.vendor.toLowerCase().indexOf(mozilla) !== -1) {
|
||||||
// _bd_isFirefox = true;
|
_bd_isFirefox = true;
|
||||||
// _bd_isEdge = false;
|
_bd_isEdge = false;
|
||||||
// // }
|
// }
|
||||||
|
|
||||||
// }
|
}
|
||||||
// catch (e) {
|
catch (e) {
|
||||||
// if(Debug.debug) {
|
if(Debug.debug) {
|
||||||
// console.info("[BrowserDetect] browser.runtime.getBrowserInfo() probably failed. This means we're probably not using firefox.", e)
|
console.info("[BrowserDetect] browser.runtime.getBrowserInfo() probably failed. This means we're probably not using firefox.", e)
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(browser === undefined){ // This is a good sign we're in chrome or chromium-based browsers
|
if(browser === undefined){ // This is a good sign we're in chrome or chromium-based browsers
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Debug from '../conf/Debug';
|
import Debug from '../conf/Debug';
|
||||||
|
import PlayerData from './video-data/PlayerData'
|
||||||
|
|
||||||
class ActionHandler {
|
class ActionHandler {
|
||||||
|
|
@ -18,4 +18,6 @@ class KeyboardShortcutParser {
|
|||||||
|
|
||||||
return shortcutCombo;
|
return shortcutCombo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default KeyboardShortcutParser;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Debug from '../conf/Debug';
|
import Debug from '../conf/Debug';
|
||||||
import currentBrowser from '../conf/BrowserDetect';
|
import currentBrowser from '../conf/BrowserDetect';
|
||||||
import ExtensionConf from '../conf/ExtensionConf';
|
import ExtensionConf from '../conf/ExtensionConf';
|
||||||
|
import ExtensionMode from '../../common/enums/extension-mode';
|
||||||
|
|
||||||
class Settings {
|
class Settings {
|
||||||
|
|
||||||
@ -380,4 +380,4 @@ class Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Settings;
|
export default Settings;
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
import EdgeDetect from './edge-detect/EdgeDetect';
|
||||||
|
import EdgeStatus from './edge-detect/enums/EdgeStatusEnum';
|
||||||
|
import EdgeDetectPrimaryDirection from './edge-detect/enums/EdgeDetectPrimaryDirectionEnum';
|
||||||
|
import EdgeDetectQuality from './edge-detect/enums/EdgeDetectQualityEnum';
|
||||||
|
import GuardLine from './GuardLine';
|
||||||
|
import DebugCanvas from './DebugCanvas';
|
||||||
|
|
||||||
class ArDetector {
|
class ArDetector {
|
||||||
|
|
||||||
constructor(videoData){
|
constructor(videoData){
|
||||||
@ -34,7 +42,7 @@ class ArDetector {
|
|||||||
if(Debug.debug || Debug.init) {
|
if(Debug.debug || Debug.init) {
|
||||||
console.log(`[ArDetect::destroy] <arid:${this.arid}>`)
|
console.log(`[ArDetect::destroy] <arid:${this.arid}>`)
|
||||||
}
|
}
|
||||||
this.debugCanvas.destroy();
|
// this.debugCanvas.destroy();
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +50,7 @@ class ArDetector {
|
|||||||
|
|
||||||
this.guardLine = new GuardLine(this);
|
this.guardLine = new GuardLine(this);
|
||||||
this.edgeDetector = new EdgeDetect(this);
|
this.edgeDetector = new EdgeDetect(this);
|
||||||
this.debugCanvas = new DebugCanvas(this);
|
// this.debugCanvas = new DebugCanvas(this);
|
||||||
|
|
||||||
if(Debug.debug || Debug.init) {
|
if(Debug.debug || Debug.init) {
|
||||||
console.log("[ArDetect::setup] Starting autodetection setup. arid:", this.arid);
|
console.log("[ArDetect::setup] Starting autodetection setup. arid:", this.arid);
|
||||||
@ -169,7 +177,7 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Debug.debugCanvas.enabled){
|
if(Debug.debugCanvas.enabled){
|
||||||
this.debugCanvas.init({width: cwidth, height: cheight});
|
// this.debugCanvas.init({width: cwidth, height: cheight});
|
||||||
// DebugCanvas.draw("test marker","test","rect", {x:5, y:5}, {width: 5, height: 5});
|
// DebugCanvas.draw("test marker","test","rect", {x:5, y:5}, {width: 5, height: 5});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +284,7 @@ class ArDetector {
|
|||||||
|
|
||||||
postFrameCheck(){
|
postFrameCheck(){
|
||||||
if(Debug.debugCanvas.enabled){
|
if(Debug.debugCanvas.enabled){
|
||||||
this.debugCanvas.update();
|
// this.debugCanvas.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +528,7 @@ class ArDetector {
|
|||||||
var image = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height).data;
|
var image = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height).data;
|
||||||
|
|
||||||
if(Debug.debugCanvas.enabled){
|
if(Debug.debugCanvas.enabled){
|
||||||
this.debugCanvas.setBuffer(image);
|
// this.debugCanvas.setBuffer(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region black level detection
|
//#region black level detection
|
||||||
@ -709,7 +717,7 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
// console.log("SAMPLES:", blackbarSamples, "candidates:", edgeCandidates, "post:", edgePost,"\n\nblack level:", this.blackLevel, "tresh:", this.blackLevel + this.settings.active.arDetect.blackbarTreshold);
|
// console.log("SAMPLES:", blackbarSamples, "candidates:", edgeCandidates, "post:", edgePost,"\n\nblack level:", this.blackLevel, "tresh:", this.blackLevel + this.settings.active.arDetect.blackbarTreshold);
|
||||||
|
|
||||||
if(edgePost.status == "ar_known"){
|
if(edgePost.status == EdgeStatus.AR_KNOWN){
|
||||||
|
|
||||||
// zaznali smo rob — vendar pa moramo pred obdelavo še preveriti, ali ni "rob" slučajno besedilo. Če smo kot rob pofočkali
|
// zaznali smo rob — vendar pa moramo pred obdelavo še preveriti, ali ni "rob" slučajno besedilo. Če smo kot rob pofočkali
|
||||||
// besedilo, potem to ni veljaven rob. Razmerja stranic se zato ne bomo pipali.
|
// besedilo, potem to ni veljaven rob. Razmerja stranic se zato ne bomo pipali.
|
||||||
@ -789,97 +797,95 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(Debug.debug)
|
|
||||||
console.log("Loading: ArDetect");
|
|
||||||
|
|
||||||
var _ard_console_stop = "background: #000; color: #f41";
|
var _ard_console_stop = "background: #000; color: #f41";
|
||||||
var _ard_console_start = "background: #000; color: #00c399";
|
var _ard_console_start = "background: #000; color: #00c399";
|
||||||
|
|
||||||
|
// var textLineTest = function(image, row){
|
||||||
|
// // preverimo, če vrstica vsebuje besedilo na črnem ozadju. Če ob pregledu vrstice naletimo na veliko sprememb
|
||||||
|
// // iz črnega v ne-črno, potem obstaja možnost, da gledamo besedilo. Prisotnost take vrstice je lahko znak, da
|
||||||
|
// // zaznano razmerje stranic ni veljavno
|
||||||
|
// //
|
||||||
|
// // vrne 'true' če zazna text, 'false' drugače.
|
||||||
|
// //
|
||||||
|
// //
|
||||||
|
// // check if line contains any text. If line scan reveals a lot of changes from black to non-black there's a
|
||||||
|
// // chance we're looking at text on a black background. If we detect text near what we think is an edge of the
|
||||||
|
// // video, there's a good chance we're about to incorrectly adjust the aspect ratio.
|
||||||
|
// //
|
||||||
|
// // returns 'true' if text is detected, 'false' otherwise
|
||||||
|
|
||||||
var textLineTest = function(image, row){
|
// var blackbarTreshold = this.blackLevel + this.settings.active.arDetect.blackbarTreshold;
|
||||||
// preverimo, če vrstica vsebuje besedilo na črnem ozadju. Če ob pregledu vrstice naletimo na veliko sprememb
|
// var nontextTreshold = this.canvas.width * this.settings.active.arDetect.textLineTest.nonTextPulse;
|
||||||
// iz črnega v ne-črno, potem obstaja možnost, da gledamo besedilo. Prisotnost take vrstice je lahko znak, da
|
|
||||||
// zaznano razmerje stranic ni veljavno
|
|
||||||
//
|
|
||||||
// vrne 'true' če zazna text, 'false' drugače.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// check if line contains any text. If line scan reveals a lot of changes from black to non-black there's a
|
|
||||||
// chance we're looking at text on a black background. If we detect text near what we think is an edge of the
|
|
||||||
// video, there's a good chance we're about to incorrectly adjust the aspect ratio.
|
|
||||||
//
|
|
||||||
// returns 'true' if text is detected, 'false' otherwise
|
|
||||||
|
|
||||||
var blackbarTreshold = this.blackLevel + this.settings.active.arDetect.blackbarTreshold;
|
// var rowStart = (row * this.canvas.width) << 2;
|
||||||
var nontextTreshold = this.canvas.width * this.settings.active.arDetect.textLineTest.nonTextPulse;
|
// var rowEnd = rowStart + (this.canvas.width << 2);
|
||||||
|
|
||||||
var rowStart = (row * this.canvas.width) << 2;
|
// var pulse = false;
|
||||||
var rowEnd = rowStart + (this.canvas.width << 2);
|
// var currentPulseLength = 0, pulseCount = 0;
|
||||||
|
// var pulses = [];
|
||||||
|
// var longestBlack = 0;
|
||||||
|
|
||||||
var pulse = false;
|
// // preglejmo vrstico
|
||||||
var currentPulseLength = 0, pulseCount = 0;
|
// // analyse the row
|
||||||
var pulses = [];
|
// for(var i = rowStart; i < rowEnd; i+= 4){
|
||||||
var longestBlack = 0;
|
// if(pulse){
|
||||||
|
// if(image[i] < blackbarTreshold || image[i+1] < blackbarTreshold || image[i+2] < blackbarTreshold){
|
||||||
// preglejmo vrstico
|
// // pulses.push(currentPulseLength);
|
||||||
// analyse the row
|
// pulseCount++;
|
||||||
for(var i = rowStart; i < rowEnd; i+= 4){
|
// pulse = false;
|
||||||
if(pulse){
|
// currentPulseLength = 0;
|
||||||
if(image[i] < blackbarTreshold || image[i+1] < blackbarTreshold || image[i+2] < blackbarTreshold){
|
// }
|
||||||
// pulses.push(currentPulseLength);
|
// else{
|
||||||
pulseCount++;
|
// currentPulseLength++;
|
||||||
pulse = false;
|
|
||||||
currentPulseLength = 0;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
currentPulseLength++;
|
|
||||||
|
|
||||||
// če najdemo dovolj dolgo zaporedje ne-črnih točk, potem vrnemo 'false' — dobili smo legitimen rob
|
// // če najdemo dovolj dolgo zaporedje ne-črnih točk, potem vrnemo 'false' — dobili smo legitimen rob
|
||||||
// if we find long enough uninterrupted line of non-black point, we fail the test. We found a legit edge.
|
// // if we find long enough uninterrupted line of non-black point, we fail the test. We found a legit edge.
|
||||||
if(currentPulseLength > nontextTreshold){
|
// if(currentPulseLength > nontextTreshold){
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
if(image[i] > blackbarTreshold || image[i+1] > blackbarTreshold || image[i+2] > blackbarTreshold){
|
// if(image[i] > blackbarTreshold || image[i+1] > blackbarTreshold || image[i+2] > blackbarTreshold){
|
||||||
if(currentPulseLength > longestBlack){
|
// if(currentPulseLength > longestBlack){
|
||||||
longestBlack = currentPulseLength;
|
// longestBlack = currentPulseLength;
|
||||||
}
|
// }
|
||||||
pulse = true;
|
// pulse = true;
|
||||||
currentPulseLength = 0;
|
// currentPulseLength = 0;
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
currentPulseLength++;
|
// currentPulseLength++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if(pulse){
|
// if(pulse){
|
||||||
pulseCount++;
|
// pulseCount++;
|
||||||
// pulses.push(currentPulseLength);
|
// // pulses.push(currentPulseLength);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// pregledamo rezultate:
|
// // pregledamo rezultate:
|
||||||
// analyse the results
|
// // analyse the results
|
||||||
// console.log("pulse test:\n\npulses:", pulseCount, "longest black:", longestBlack);
|
// // console.log("pulse test:\n\npulses:", pulseCount, "longest black:", longestBlack);
|
||||||
|
|
||||||
// če smo zaznali dovolj pulzov, potem vrnemo res
|
// // če smo zaznali dovolj pulzov, potem vrnemo res
|
||||||
// if we detected enough pulses, we return true
|
// // if we detected enough pulses, we return true
|
||||||
if(pulseCount > this.settings.active.arDetect.textLineTest.pulsesToConfirm){
|
// if(pulseCount > this.settings.active.arDetect.textLineTest.pulsesToConfirm){
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// če je najdaljša neprekinjena črta črnih pikslov širša od polovice širine je merilo za zaznavanje
|
// // če je najdaljša neprekinjena črta črnih pikslov širša od polovice širine je merilo za zaznavanje
|
||||||
// besedila rahlo milejše
|
// // besedila rahlo milejše
|
||||||
// if the longest uninterrupted line of black pixels is wider than half the width, we use a more
|
// // if the longest uninterrupted line of black pixels is wider than half the width, we use a more
|
||||||
// forgiving standard for determining if we found text
|
// // forgiving standard for determining if we found text
|
||||||
if( longestBlack > (this.canvas.width >> 1) &&
|
// if( longestBlack > (this.canvas.width >> 1) &&
|
||||||
pulseCount > this.settings.active.arDetect.textLineTest.pulsesToConfirmIfHalfBlack ){
|
// pulseCount > this.settings.active.arDetect.textLineTest.pulsesToConfirmIfHalfBlack ){
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// če pridemo do sem, potem besedilo ni bilo zaznano
|
// // če pridemo do sem, potem besedilo ni bilo zaznano
|
||||||
// if we're here, no text was detected
|
// // if we're here, no text was detected
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
export default ArDetector;
|
@ -116,7 +116,7 @@ class DebugCanvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DebugCanvasClasses = {
|
DebugCanvasClasses = {
|
||||||
VIOLATION: {color: '#ff0000', colorRgb: [255, 00, 0], text: 'violation (general)'},
|
VIOLATION: {color: '#ff0000', colorRgb: [255, 0, 0], text: 'violation (general)'},
|
||||||
WARN: {color: '#d0d039', colorRgb: [208, 208, 57], text: 'lesser violation (general)'},
|
WARN: {color: '#d0d039', colorRgb: [208, 208, 57], text: 'lesser violation (general)'},
|
||||||
GUARDLINE_BLACKBAR: {color: '#3333FF', colorRgb: [51, 51, 255], text: 'guardline/blackbar (expected value)'},
|
GUARDLINE_BLACKBAR: {color: '#3333FF', colorRgb: [51, 51, 255], text: 'guardline/blackbar (expected value)'},
|
||||||
GUARDLINE_IMAGE: {color: '#000088', colorRgb: [0, 0, 136], text: 'guardline/image (expected value)'},
|
GUARDLINE_IMAGE: {color: '#000088', colorRgb: [0, 0, 136], text: 'guardline/image (expected value)'},
|
@ -1,3 +1,5 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
|
||||||
class GuardLine {
|
class GuardLine {
|
||||||
|
|
||||||
// ardConf — reference to ArDetector that has current GuardLine instance
|
// ardConf — reference to ArDetector that has current GuardLine instance
|
||||||
@ -302,3 +304,5 @@ class GuardLine {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default GuardLine;
|
@ -1,12 +1,7 @@
|
|||||||
var EdgeDetectPrimaryDirection = {
|
import Debug from '../../../conf/Debug';
|
||||||
VERTICAL: 0,
|
import EdgeStatus from './enums/EdgeStatusEnum';
|
||||||
HORIZONTAL: 1
|
import EdgeDetectQuality from './enums/EdgeDetectQualityEnum';
|
||||||
}
|
import EdgeDetectPrimaryDirection from './enums/EdgeDetectPrimaryDirectionEnum';
|
||||||
|
|
||||||
var EdgeDetectQuality = {
|
|
||||||
FAST: 0,
|
|
||||||
IMPROVED: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
class EdgeDetect{
|
class EdgeDetect{
|
||||||
|
|
||||||
@ -40,7 +35,7 @@ class EdgeDetect{
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
bars = this.pillarTest(image) ? {status: 'ar_known'} : {status: 'ar_unknown'};
|
bars = this.pillarTest(image) ? {status: EdgeStatus.AR_KNOWN} : {status: EdgeStatus.AR_UNKNOWN};
|
||||||
}
|
}
|
||||||
|
|
||||||
return bars;
|
return bars;
|
||||||
@ -290,7 +285,7 @@ class EdgeDetect{
|
|||||||
edgesTop[0].distance : edgesBottom[0].distance;
|
edgesTop[0].distance : edgesBottom[0].distance;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: "ar_known",
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: blackbarWidth,
|
blackbarWidth: blackbarWidth,
|
||||||
guardLineTop: edgesTop[0].distance,
|
guardLineTop: edgesTop[0].distance,
|
||||||
guardLineBottom: edgesBottom[0].absolute,
|
guardLineBottom: edgesBottom[0].absolute,
|
||||||
@ -321,7 +316,7 @@ class EdgeDetect{
|
|||||||
edgesTop[i].distance : edgesBottom[0].distance;
|
edgesTop[i].distance : edgesBottom[0].distance;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: "ar_known",
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: blackbarWidth,
|
blackbarWidth: blackbarWidth,
|
||||||
guardLineTop: edgesTop[i].distance,
|
guardLineTop: edgesTop[i].distance,
|
||||||
guardLineBottom: edgesBottom[0].absolute,
|
guardLineBottom: edgesBottom[0].absolute,
|
||||||
@ -349,7 +344,7 @@ class EdgeDetect{
|
|||||||
edgesBottom[i].distance : edgesTop[0].distance;
|
edgesBottom[i].distance : edgesTop[0].distance;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: "ar_known",
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: blackbarWidth,
|
blackbarWidth: blackbarWidth,
|
||||||
guardLineTop: edgesTop[0].distance,
|
guardLineTop: edgesTop[0].distance,
|
||||||
guardLineBottom: edgesBottom[0].absolute,
|
guardLineBottom: edgesBottom[0].absolute,
|
||||||
@ -374,7 +369,7 @@ class EdgeDetect{
|
|||||||
for(var edge of edgesBottom){
|
for(var edge of edgesBottom){
|
||||||
if(edge.count >= edgeDetectionTreshold)
|
if(edge.count >= edgeDetectionTreshold)
|
||||||
return {
|
return {
|
||||||
status: "ar_known",
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: edge.distance,
|
blackbarWidth: edge.distance,
|
||||||
guardLineTop: null,
|
guardLineTop: null,
|
||||||
guardLineBottom: edge.bottom,
|
guardLineBottom: edge.bottom,
|
||||||
@ -388,7 +383,7 @@ class EdgeDetect{
|
|||||||
for(var edge of edgesTop){
|
for(var edge of edgesTop){
|
||||||
if(edge.count >= edgeDetectionTreshold)
|
if(edge.count >= edgeDetectionTreshold)
|
||||||
return {
|
return {
|
||||||
status: "ar_known",
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: edge.distance,
|
blackbarWidth: edge.distance,
|
||||||
guardLineTop: edge.top,
|
guardLineTop: edge.top,
|
||||||
guardLineBottom: null,
|
guardLineBottom: null,
|
||||||
@ -401,7 +396,7 @@ class EdgeDetect{
|
|||||||
}
|
}
|
||||||
// če pridemo do sem, nam ni uspelo nič. Razmerje stranic ni znano
|
// če pridemo do sem, nam ni uspelo nič. Razmerje stranic ni znano
|
||||||
// if we reach this bit, we have failed in determining aspect ratio. It remains unknown.
|
// if we reach this bit, we have failed in determining aspect ratio. It remains unknown.
|
||||||
return {status: "ar_unknown"}
|
return {status: EdgeStatus.AR_UNKNOWN}
|
||||||
}
|
}
|
||||||
|
|
||||||
pillarTest(image){
|
pillarTest(image){
|
||||||
@ -646,4 +641,6 @@ class EdgeDetect{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default EdgeDetect;
|
@ -0,0 +1,6 @@
|
|||||||
|
var EdgeDetectPrimaryDirection = Object.freeze({
|
||||||
|
VERTICAL: 0,
|
||||||
|
HORIZONTAL: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
export default EdgeDetectPrimaryDirection;
|
@ -0,0 +1,6 @@
|
|||||||
|
var EdgeDetectQuality = Object.freeze({
|
||||||
|
FAST: 0,
|
||||||
|
IMPROVED: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
export default EdgeDetectQuality;
|
@ -0,0 +1,6 @@
|
|||||||
|
var EdgeStatus = Object.freeze({
|
||||||
|
AR_UNKNOWN: 0,
|
||||||
|
AR_KNOWN: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default EdgeStatus;
|
@ -1,3 +1,7 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
import VideoData from './VideoData';
|
||||||
|
import RescanReason from './enums/RescanReason';
|
||||||
|
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("Loading: PageInfo.js");
|
console.log("Loading: PageInfo.js");
|
||||||
|
|
||||||
@ -444,8 +448,4 @@ class PageInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var RescanReason = {
|
export default PageInfo;
|
||||||
PERIODIC: 0,
|
|
||||||
URL_CHANGE: 1,
|
|
||||||
MANUAL: 2
|
|
||||||
}
|
|
@ -1,3 +1,6 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
import ExtensionMode from '../../../common/enums/extension-mode'
|
||||||
|
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("Loading: PlayerData.js");
|
console.log("Loading: PlayerData.js");
|
||||||
|
|
||||||
@ -381,3 +384,4 @@ class PlayerData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default PlayerData;
|
@ -1,3 +1,8 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
import PlayerData from './PlayerData';
|
||||||
|
import Resizer from '../video-transform/Resizer';
|
||||||
|
import ArDetector from '../ar-detect/ArDetector';
|
||||||
|
|
||||||
class VideoData {
|
class VideoData {
|
||||||
|
|
||||||
constructor(video, settings, pageInfo){
|
constructor(video, settings, pageInfo){
|
||||||
@ -206,4 +211,6 @@ class VideoData {
|
|||||||
|
|
||||||
return this.video && this.video.currentTime > 0 && !this.video.paused && !this.video.ended;
|
return this.video && this.video.currentTime > 0 && !this.video.paused && !this.video.ended;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default VideoData;
|
7
src/ext/lib/video-data/enums/RescanReason.js
Normal file
7
src/ext/lib/video-data/enums/RescanReason.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var RescanReason = Object.freeze({
|
||||||
|
PERIODIC: 0,
|
||||||
|
URL_CHANGE: 1,
|
||||||
|
MANUAL: 2
|
||||||
|
});
|
||||||
|
|
||||||
|
export default RescanReason;
|
@ -1,7 +1,15 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
import Scaler from './Scaler';
|
||||||
|
import Stretcher from './Stretcher';
|
||||||
|
import Zoom from './Zoom';
|
||||||
|
import PlayerData from '../video-data/PlayerData';
|
||||||
|
import ExtensionMode from '../../../common/enums/extension-mode';
|
||||||
|
import StretchMode from '../../../common/enums/stretch-mode';
|
||||||
|
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("Loading: Resizer.js");
|
console.log("Loading: Resizer.js");
|
||||||
|
|
||||||
class Resizer {
|
class Resizer {
|
||||||
|
|
||||||
constructor(videoData) {
|
constructor(videoData) {
|
||||||
this.conf = videoData;
|
this.conf = videoData;
|
||||||
@ -491,3 +499,5 @@ if(Debug.debug)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Resizer;
|
@ -1,3 +1,5 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
|
||||||
// računa velikost videa za približevanje/oddaljevanje
|
// računa velikost videa za približevanje/oddaljevanje
|
||||||
// does video size calculations for zooming/cropping
|
// does video size calculations for zooming/cropping
|
||||||
|
|
||||||
@ -145,4 +147,6 @@ class Scaler {
|
|||||||
|
|
||||||
return videoDimensions;
|
return videoDimensions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Scaler;
|
@ -1,9 +1,10 @@
|
|||||||
|
import Debug from '../../conf/Debug';
|
||||||
|
|
||||||
// računa vrednosti za transform-scale (x, y)
|
// računa vrednosti za transform-scale (x, y)
|
||||||
// transform: scale(x,y) se uporablja za raztegovanje videa, ne pa za približevanje
|
// transform: scale(x,y) se uporablja za raztegovanje videa, ne pa za približevanje
|
||||||
// calculates values for transform scale(x, y)
|
// calculates values for transform scale(x, y)
|
||||||
// transform: scale(x,y) is used for stretching, not zooming.
|
// transform: scale(x,y) is used for stretching, not zooming.
|
||||||
|
|
||||||
|
|
||||||
class Stretcher {
|
class Stretcher {
|
||||||
// internal variables
|
// internal variables
|
||||||
|
|
||||||
@ -177,4 +178,6 @@ class Stretcher {
|
|||||||
|
|
||||||
return stretchFactors;
|
return stretchFactors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Stretcher;
|
@ -1,10 +1,9 @@
|
|||||||
// računa približevanje ter računa/popravlja odmike videa
|
import Debug from '../../conf/Debug';
|
||||||
|
|
||||||
|
// računa približevanje ter računa/popravlja odmike videa
|
||||||
|
// calculates zooming and video offsets/panning
|
||||||
|
|
||||||
class Zoom {
|
class Zoom {
|
||||||
// internal variables
|
|
||||||
|
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
constructor(videoData) {
|
constructor(videoData) {
|
||||||
this.scale = 1;
|
this.scale = 1;
|
||||||
@ -59,4 +58,6 @@ class Zoom {
|
|||||||
stretchFactors.xFactor *= this.scale;
|
stretchFactors.xFactor *= this.scale;
|
||||||
stretchFactors.yFactor *= this.scale;
|
stretchFactors.yFactor *= this.scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default Zoom;
|
@ -1,3 +1,11 @@
|
|||||||
|
import Debug from './conf/Debug';
|
||||||
|
import BrowserDetect from './conf/BrowserDetect';
|
||||||
|
import ExtensionMode from '../common/enums/extension-mode'
|
||||||
|
import Settings from './lib/Settings';
|
||||||
|
import ActionHandler from './lib/ActionHandler';
|
||||||
|
import CommsClient from './lib/comms/CommsClient';
|
||||||
|
import PageInfo from './lib/video-data/PageInfo';
|
||||||
|
|
||||||
if(Debug.debug){
|
if(Debug.debug){
|
||||||
console.log("\n\n\n\n\n\n ——— Sᴛλʀᴛɪɴɢ Uʟᴛʀᴀᴡɪᴅɪꜰʏ ———\n << ʟᴏᴀᴅɪɴɢ ᴍᴀɪɴ ꜰɪʟᴇ >>\n\n\n\n");
|
console.log("\n\n\n\n\n\n ——— Sᴛλʀᴛɪɴɢ Uʟᴛʀᴀᴡɪᴅɪꜰʏ ———\n << ʟᴏᴀᴅɪɴɢ ᴍᴀɪɴ ꜰɪʟᴇ >>\n\n\n\n");
|
||||||
try {
|
try {
|
||||||
|
@ -19,37 +19,8 @@
|
|||||||
|
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
"matches": ["*://*/*"],
|
"matches": ["*://*/*"],
|
||||||
"js": [
|
"js": [
|
||||||
"js/conf/Debug.js",
|
"ext/uw.js"
|
||||||
"js/lib/enums.js",
|
|
||||||
|
|
||||||
"js/lib/BrowserDetect.js",
|
|
||||||
"js/conf/ExtensionConf.js",
|
|
||||||
|
|
||||||
"js/lib/ObjectCopy.js",
|
|
||||||
"js/lib/Settings.js",
|
|
||||||
|
|
||||||
"js/lib/Comms.js",
|
|
||||||
|
|
||||||
"js/lib/EdgeDetect.js",
|
|
||||||
"js/lib/GuardLine.js",
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"js/modules/PageInfo.js",
|
|
||||||
"js/modules/DebugCanvas.js",
|
|
||||||
"js/modules/ArDetect.js",
|
|
||||||
"js/modules/Zoom.js",
|
|
||||||
"js/modules/Scaler.js",
|
|
||||||
"js/modules/Stretcher.js",
|
|
||||||
|
|
||||||
"js/modules/Resizer.js",
|
|
||||||
"js/lib/PlayerData.js",
|
|
||||||
"js/lib/VideoData.js",
|
|
||||||
|
|
||||||
"js/modules/ActionHandler.js",
|
|
||||||
|
|
||||||
"js/uw.js"
|
|
||||||
],
|
],
|
||||||
"all_frames": true
|
"all_frames": true
|
||||||
}],
|
}],
|
||||||
|
Loading…
Reference in New Issue
Block a user