Fix streams pausing when switching tab #414
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
twitch-videoad.js text/javascript
|
twitch-videoad.js text/javascript
|
||||||
(function() {
|
(function() {
|
||||||
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
||||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
var ourTwitchAdSolutionsVersion = 9;// Used to prevent conflicts with outdated versions of the scripts
|
||||||
if (typeof unsafeWindow === 'undefined') {
|
if (typeof unsafeWindow === 'undefined') {
|
||||||
unsafeWindow = window;
|
unsafeWindow = window;
|
||||||
}
|
}
|
||||||
@@ -1019,6 +1019,7 @@ twitch-videoad.js text/javascript
|
|||||||
});
|
});
|
||||||
}catch{}
|
}catch{}
|
||||||
let hidden = document.__lookupGetter__('hidden');
|
let hidden = document.__lookupGetter__('hidden');
|
||||||
|
let webkitHidden = document.__lookupGetter__('webkitHidden');
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(document, 'hidden', {
|
Object.defineProperty(document, 'hidden', {
|
||||||
get() {
|
get() {
|
||||||
@@ -1036,7 +1037,7 @@ twitch-videoad.js text/javascript
|
|||||||
if (typeof chrome !== 'undefined') {
|
if (typeof chrome !== 'undefined') {
|
||||||
const videos = document.getElementsByTagName('video');
|
const videos = document.getElementsByTagName('video');
|
||||||
if (videos.length > 0) {
|
if (videos.length > 0) {
|
||||||
if (hidden.apply(document) === true) {
|
if (hidden.apply(document) === true || (webkitHidden && webkitHidden.apply(document) === true)) {
|
||||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||||
videos[0].play();
|
videos[0].play();
|
||||||
|
|||||||
+4
-3
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name TwitchAdSolutions (vaft)
|
// @name TwitchAdSolutions (vaft)
|
||||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||||
// @version 23.0.0
|
// @version 24.0.0
|
||||||
// @description Multiple solutions for blocking Twitch ads (vaft)
|
// @description Multiple solutions for blocking Twitch ads (vaft)
|
||||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js
|
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js
|
||||||
// @downloadURL 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==
|
// ==/UserScript==
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
var ourTwitchAdSolutionsVersion = 9;// Used to prevent conflicts with outdated versions of the scripts
|
||||||
if (typeof unsafeWindow === 'undefined') {
|
if (typeof unsafeWindow === 'undefined') {
|
||||||
unsafeWindow = window;
|
unsafeWindow = window;
|
||||||
}
|
}
|
||||||
@@ -1032,6 +1032,7 @@
|
|||||||
});
|
});
|
||||||
}catch{}
|
}catch{}
|
||||||
let hidden = document.__lookupGetter__('hidden');
|
let hidden = document.__lookupGetter__('hidden');
|
||||||
|
let webkitHidden = document.__lookupGetter__('webkitHidden');
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(document, 'hidden', {
|
Object.defineProperty(document, 'hidden', {
|
||||||
get() {
|
get() {
|
||||||
@@ -1049,7 +1050,7 @@
|
|||||||
if (typeof chrome !== 'undefined') {
|
if (typeof chrome !== 'undefined') {
|
||||||
const videos = document.getElementsByTagName('video');
|
const videos = document.getElementsByTagName('video');
|
||||||
if (videos.length > 0) {
|
if (videos.length > 0) {
|
||||||
if (hidden.apply(document) === true) {
|
if (hidden.apply(document) === true || (webkitHidden && webkitHidden.apply(document) === true)) {
|
||||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||||
videos[0].play();
|
videos[0].play();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
twitch-videoad.js text/javascript
|
twitch-videoad.js text/javascript
|
||||||
(function() {
|
(function() {
|
||||||
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
||||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
var ourTwitchAdSolutionsVersion = 9;// Used to prevent conflicts with outdated versions of the scripts
|
||||||
if (typeof unsafeWindow === 'undefined') {
|
if (typeof unsafeWindow === 'undefined') {
|
||||||
unsafeWindow = window;
|
unsafeWindow = window;
|
||||||
}
|
}
|
||||||
@@ -790,6 +790,7 @@ twitch-videoad.js text/javascript
|
|||||||
});
|
});
|
||||||
}catch{}
|
}catch{}
|
||||||
let hidden = document.__lookupGetter__('hidden');
|
let hidden = document.__lookupGetter__('hidden');
|
||||||
|
let webkitHidden = document.__lookupGetter__('webkitHidden');
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(document, 'hidden', {
|
Object.defineProperty(document, 'hidden', {
|
||||||
get() {
|
get() {
|
||||||
@@ -807,7 +808,7 @@ twitch-videoad.js text/javascript
|
|||||||
if (typeof chrome !== 'undefined') {
|
if (typeof chrome !== 'undefined') {
|
||||||
const videos = document.getElementsByTagName('video');
|
const videos = document.getElementsByTagName('video');
|
||||||
if (videos.length > 0) {
|
if (videos.length > 0) {
|
||||||
if (hidden.apply(document) === true) {
|
if (hidden.apply(document) === true || (webkitHidden && webkitHidden.apply(document) === true)) {
|
||||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||||
videos[0].play();
|
videos[0].play();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name TwitchAdSolutions (video-swap-new)
|
// @name TwitchAdSolutions (video-swap-new)
|
||||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||||
// @version 1.41
|
// @version 1.42
|
||||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
|
// @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
|
// @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)
|
// @description Multiple solutions for blocking Twitch ads (video-swap-new)
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
var ourTwitchAdSolutionsVersion = 8;// Used to prevent conflicts with outdated versions of the scripts
|
var ourTwitchAdSolutionsVersion = 9;// Used to prevent conflicts with outdated versions of the scripts
|
||||||
if (typeof unsafeWindow === 'undefined') {
|
if (typeof unsafeWindow === 'undefined') {
|
||||||
unsafeWindow = window;
|
unsafeWindow = window;
|
||||||
}
|
}
|
||||||
@@ -803,6 +803,7 @@
|
|||||||
});
|
});
|
||||||
}catch{}
|
}catch{}
|
||||||
let hidden = document.__lookupGetter__('hidden');
|
let hidden = document.__lookupGetter__('hidden');
|
||||||
|
let webkitHidden = document.__lookupGetter__('webkitHidden');
|
||||||
try {
|
try {
|
||||||
Object.defineProperty(document, 'hidden', {
|
Object.defineProperty(document, 'hidden', {
|
||||||
get() {
|
get() {
|
||||||
@@ -820,7 +821,7 @@
|
|||||||
if (typeof chrome !== 'undefined') {
|
if (typeof chrome !== 'undefined') {
|
||||||
const videos = document.getElementsByTagName('video');
|
const videos = document.getElementsByTagName('video');
|
||||||
if (videos.length > 0) {
|
if (videos.length > 0) {
|
||||||
if (hidden.apply(document) === true) {
|
if (hidden.apply(document) === true || (webkitHidden && webkitHidden.apply(document) === true)) {
|
||||||
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
wasVideoPlaying = !videos[0].paused && !videos[0].ended;
|
||||||
} else if (wasVideoPlaying && !videos[0].ended) {
|
} else if (wasVideoPlaying && !videos[0].ended) {
|
||||||
videos[0].play();
|
videos[0].play();
|
||||||
|
|||||||
Reference in New Issue
Block a user