Fix muted streams pausing when switching tabs on chrome #336
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
twitch-videoad.js text/javascript
|
||||
(function() {
|
||||
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
||||
var ourTwitchAdSolutionsVersion = 7;// Only bump this when there's a breaking change to Twitch, the script, or there's a conflict with an unmaintained extension which uses this script
|
||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
||||
if (typeof unsafeWindow === 'undefined') {
|
||||
unsafeWindow = window;
|
||||
}
|
||||
@@ -1018,6 +1018,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
});
|
||||
}catch{}
|
||||
let hidden = document.__lookupGetter__('hidden');
|
||||
try {
|
||||
Object.defineProperty(document, 'hidden', {
|
||||
get() {
|
||||
@@ -1030,9 +1031,23 @@ twitch-videoad.js text/javascript
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
};
|
||||
document.addEventListener('visibilitychange', block, true);
|
||||
document.addEventListener('webkitvisibilitychange', block, true);
|
||||
document.addEventListener('mozvisibilitychange', block, true);
|
||||
let wasVideoPlaying = true;
|
||||
var visibilityChange = e => {
|
||||
if (typeof chrome !== 'undefined') {
|
||||
const videos = document.getElementsByTagName('video');
|
||||
if (videos.length > 0) {
|
||||
if (hidden.apply(document) === true) {
|
||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||
videos[0].play();
|
||||
}
|
||||
}
|
||||
}
|
||||
block(e);
|
||||
};
|
||||
document.addEventListener('visibilitychange', visibilityChange, true);
|
||||
document.addEventListener('webkitvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('mozvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('hasFocus', block, true);
|
||||
try {
|
||||
if (/Firefox/.test(navigator.userAgent)) {
|
||||
|
||||
+20
-5
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (vaft)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 22.0.0
|
||||
// @version 23.0.0
|
||||
// @description Multiple solutions for blocking Twitch ads (vaft)
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js
|
||||
@@ -14,7 +14,7 @@
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
'use strict';
|
||||
var ourTwitchAdSolutionsVersion = 7;// Only bump this when there's a breaking change to Twitch, the script, or there's a conflict with an unmaintained extension which uses this script
|
||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
||||
if (typeof unsafeWindow === 'undefined') {
|
||||
unsafeWindow = window;
|
||||
}
|
||||
@@ -1031,6 +1031,7 @@
|
||||
}
|
||||
});
|
||||
}catch{}
|
||||
let hidden = document.__lookupGetter__('hidden');
|
||||
try {
|
||||
Object.defineProperty(document, 'hidden', {
|
||||
get() {
|
||||
@@ -1043,9 +1044,23 @@
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
};
|
||||
document.addEventListener('visibilitychange', block, true);
|
||||
document.addEventListener('webkitvisibilitychange', block, true);
|
||||
document.addEventListener('mozvisibilitychange', block, true);
|
||||
let wasVideoPlaying = true;
|
||||
var visibilityChange = e => {
|
||||
if (typeof chrome !== 'undefined') {
|
||||
const videos = document.getElementsByTagName('video');
|
||||
if (videos.length > 0) {
|
||||
if (hidden.apply(document) === true) {
|
||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||
videos[0].play();
|
||||
}
|
||||
}
|
||||
}
|
||||
block(e);
|
||||
};
|
||||
document.addEventListener('visibilitychange', visibilityChange, true);
|
||||
document.addEventListener('webkitvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('mozvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('hasFocus', block, true);
|
||||
try {
|
||||
if (/Firefox/.test(navigator.userAgent)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
twitch-videoad.js text/javascript
|
||||
(function() {
|
||||
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
||||
var ourTwitchAdSolutionsVersion = 7;// Only bump this when there's a breaking change to Twitch, the script, or there's a conflict with an unmaintained extension which uses this script
|
||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
||||
if (typeof unsafeWindow === 'undefined') {
|
||||
unsafeWindow = window;
|
||||
}
|
||||
@@ -789,6 +789,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
});
|
||||
}catch{}
|
||||
let hidden = document.__lookupGetter__('hidden');
|
||||
try {
|
||||
Object.defineProperty(document, 'hidden', {
|
||||
get() {
|
||||
@@ -801,9 +802,23 @@ twitch-videoad.js text/javascript
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
};
|
||||
document.addEventListener('visibilitychange', block, true);
|
||||
document.addEventListener('webkitvisibilitychange', block, true);
|
||||
document.addEventListener('mozvisibilitychange', block, true);
|
||||
let wasVideoPlaying = true;
|
||||
var visibilityChange = e => {
|
||||
if (typeof chrome !== 'undefined') {
|
||||
const videos = document.getElementsByTagName('video');
|
||||
if (videos.length > 0) {
|
||||
if (hidden.apply(document) === true) {
|
||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||
videos[0].play();
|
||||
}
|
||||
}
|
||||
}
|
||||
block(e);
|
||||
};
|
||||
document.addEventListener('visibilitychange', visibilityChange, true);
|
||||
document.addEventListener('webkitvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('mozvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('hasFocus', block, true);
|
||||
try {
|
||||
if (/Firefox/.test(navigator.userAgent)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (video-swap-new)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.40
|
||||
// @version 1.41
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
|
||||
// @description Multiple solutions for blocking Twitch ads (video-swap-new)
|
||||
@@ -14,7 +14,7 @@
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
'use strict';
|
||||
var ourTwitchAdSolutionsVersion = 7;// Only bump this when there's a breaking change to Twitch, the script, or there's a conflict with an unmaintained extension which uses this script
|
||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
||||
if (typeof unsafeWindow === 'undefined') {
|
||||
unsafeWindow = window;
|
||||
}
|
||||
@@ -802,6 +802,7 @@
|
||||
}
|
||||
});
|
||||
}catch{}
|
||||
let hidden = document.__lookupGetter__('hidden');
|
||||
try {
|
||||
Object.defineProperty(document, 'hidden', {
|
||||
get() {
|
||||
@@ -814,9 +815,23 @@
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
};
|
||||
document.addEventListener('visibilitychange', block, true);
|
||||
document.addEventListener('webkitvisibilitychange', block, true);
|
||||
document.addEventListener('mozvisibilitychange', block, true);
|
||||
let wasVideoPlaying = true;
|
||||
var visibilityChange = e => {
|
||||
if (typeof chrome !== 'undefined') {
|
||||
const videos = document.getElementsByTagName('video');
|
||||
if (videos.length > 0) {
|
||||
if (hidden.apply(document) === true) {
|
||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||
videos[0].play();
|
||||
}
|
||||
}
|
||||
}
|
||||
block(e);
|
||||
};
|
||||
document.addEventListener('visibilitychange', visibilityChange, true);
|
||||
document.addEventListener('webkitvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('mozvisibilitychange', visibilityChange, true);
|
||||
document.addEventListener('hasFocus', block, true);
|
||||
try {
|
||||
if (/Firefox/.test(navigator.userAgent)) {
|
||||
|
||||
Reference in New Issue
Block a user