Skip to content

Commit

Permalink
Fix conflicts with other solutions #282
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeltris committed Sep 24, 2024
1 parent 055e1ad commit 69f098d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion vaft/vaft-ublock-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ twitch-videoad.js text/javascript
var IsPlayerAutoQuality = null;
const oldWorker = window.Worker;
function hookWindowWorker() {
window.Worker = class Worker extends oldWorker {
var newWorker = window.Worker = class Worker extends oldWorker {
constructor(twitchBlobUrl, options) {
var isTwitchWorker = false;
try {
isTwitchWorker = new URL(twitchBlobUrl).origin.endsWith('.twitch.tv');
} catch {}
if (newWorker.toString() !== window.Worker.toString()) {
console.log('Multiple twitch adblockers installed. Skipping Worker hook (vaft)');
isTwitchWorker = false;
}
if (!isTwitchWorker) {
super(twitchBlobUrl, options);
return;
Expand Down
6 changes: 5 additions & 1 deletion vaft/vaft.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@
var IsPlayerAutoQuality = null;
const oldWorker = window.Worker;
function hookWindowWorker() {
window.Worker = class Worker extends oldWorker {
var newWorker = window.Worker = class Worker extends oldWorker {
constructor(twitchBlobUrl, options) {
var isTwitchWorker = false;
try {
isTwitchWorker = new URL(twitchBlobUrl).origin.endsWith('.twitch.tv');
} catch {}
if (newWorker.toString() !== window.Worker.toString()) {
console.log('Multiple twitch adblockers installed. Skipping Worker hook (vaft)');
isTwitchWorker = false;
}
if (!isTwitchWorker) {
super(twitchBlobUrl, options);
return;
Expand Down
6 changes: 5 additions & 1 deletion video-swap-new/video-swap-new-ublock-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ twitch-videoad.js text/javascript
var twitchWorkers = [];
const oldWorker = window.Worker;
function hookWindowWorker() {
window.Worker = class Worker extends oldWorker {
var newWorker = window.Worker = class Worker extends oldWorker {
constructor(twitchBlobUrl, options) {
var isTwitchWorker = false;
try {
isTwitchWorker = new URL(twitchBlobUrl).origin.endsWith('.twitch.tv');
} catch {}
if (newWorker.toString() !== window.Worker.toString()) {
console.log('Multiple twitch adblockers installed. Skipping Worker hook (video-swap-new)');
isTwitchWorker = false;
}
if (!isTwitchWorker) {
super(twitchBlobUrl, options);
return;
Expand Down
6 changes: 5 additions & 1 deletion video-swap-new/video-swap-new.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@
var twitchWorkers = [];
const oldWorker = window.Worker;
function hookWindowWorker() {
window.Worker = class Worker extends oldWorker {
var newWorker = window.Worker = class Worker extends oldWorker {
constructor(twitchBlobUrl, options) {
var isTwitchWorker = false;
try {
isTwitchWorker = new URL(twitchBlobUrl).origin.endsWith('.twitch.tv');
} catch {}
if (newWorker.toString() !== window.Worker.toString()) {
console.log('Multiple twitch adblockers installed. Skipping Worker hook (video-swap-new)');
isTwitchWorker = false;
}
if (!isTwitchWorker) {
super(twitchBlobUrl, options);
return;
Expand Down

0 comments on commit 69f098d

Please sign in to comment.