mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2024-11-22 02:12:45 +01:00
Possibly fix midroll pause/play issue
This commit is contained in:
parent
ac04e98d61
commit
e476b5d661
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.9
|
||||
// @version 1.10
|
||||
// @description Multiple solutions for blocking Twitch ads
|
||||
// @author pixeltris
|
||||
// @match *://*.twitch.tv/*
|
||||
@ -148,7 +148,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds = true;
|
||||
streamInfo.HadAds[url] = true;
|
||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||
@ -272,9 +272,9 @@
|
||||
streamInfo.BackupUrl = null;
|
||||
return '';
|
||||
}
|
||||
if (streamInfo.HadAds) {
|
||||
if (streamInfo.HadAds[url]) {
|
||||
postMessage({key:'UboPauseResumePlayer'});
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds[url] = false;
|
||||
}
|
||||
postMessage({key:'UboHideAdBanner'});
|
||||
return textStr;
|
||||
@ -340,7 +340,7 @@
|
||||
streamInfo.BackupRegUrl = null;
|
||||
streamInfo.BackupRegRes = null;
|
||||
streamInfo.IsMidroll = false;
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||
@ -351,6 +351,7 @@
|
||||
streamInfo.Urls[lines[i]] = res;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds[lines[i]] = false;
|
||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ twitch-videoad.js application/javascript
|
||||
break;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds = true;
|
||||
streamInfo.HadAds[url] = true;
|
||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||
@ -263,9 +263,9 @@ twitch-videoad.js application/javascript
|
||||
streamInfo.BackupUrl = null;
|
||||
return '';
|
||||
}
|
||||
if (streamInfo.HadAds) {
|
||||
if (streamInfo.HadAds[url]) {
|
||||
postMessage({key:'UboPauseResumePlayer'});
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds[url] = false;
|
||||
}
|
||||
postMessage({key:'UboHideAdBanner'});
|
||||
return textStr;
|
||||
@ -331,7 +331,7 @@ twitch-videoad.js application/javascript
|
||||
streamInfo.BackupRegUrl = null;
|
||||
streamInfo.BackupRegRes = null;
|
||||
streamInfo.IsMidroll = false;
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||
@ -342,6 +342,7 @@ twitch-videoad.js application/javascript
|
||||
streamInfo.Urls[lines[i]] = res;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds[lines[i]] = false;
|
||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (notify-reload)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.9
|
||||
// @version 1.10
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
|
||||
// @description Multiple solutions for blocking Twitch ads (notify-reload)
|
||||
@ -150,7 +150,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds = true;
|
||||
streamInfo.HadAds[url] = true;
|
||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||
@ -274,9 +274,9 @@
|
||||
streamInfo.BackupUrl = null;
|
||||
return '';
|
||||
}
|
||||
if (streamInfo.HadAds) {
|
||||
if (streamInfo.HadAds[url]) {
|
||||
postMessage({key:'UboPauseResumePlayer'});
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds[url] = false;
|
||||
}
|
||||
postMessage({key:'UboHideAdBanner'});
|
||||
return textStr;
|
||||
@ -342,7 +342,7 @@
|
||||
streamInfo.BackupRegUrl = null;
|
||||
streamInfo.BackupRegRes = null;
|
||||
streamInfo.IsMidroll = false;
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||
@ -353,6 +353,7 @@
|
||||
streamInfo.Urls[lines[i]] = res;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds[lines[i]] = false;
|
||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ twitch-videoad.js application/javascript
|
||||
break;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds = true;
|
||||
streamInfo.HadAds[url] = true;
|
||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||
@ -263,9 +263,9 @@ twitch-videoad.js application/javascript
|
||||
streamInfo.BackupUrl = null;
|
||||
return '';
|
||||
}
|
||||
if (streamInfo.HadAds) {
|
||||
if (streamInfo.HadAds[url]) {
|
||||
postMessage({key:'UboPauseResumePlayer'});
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds[url] = false;
|
||||
}
|
||||
postMessage({key:'UboHideAdBanner'});
|
||||
return textStr;
|
||||
@ -331,7 +331,7 @@ twitch-videoad.js application/javascript
|
||||
streamInfo.BackupRegUrl = null;
|
||||
streamInfo.BackupRegRes = null;
|
||||
streamInfo.IsMidroll = false;
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||
@ -342,6 +342,7 @@ twitch-videoad.js application/javascript
|
||||
streamInfo.Urls[lines[i]] = res;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds[lines[i]] = false;
|
||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (notify-strip)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.9
|
||||
// @version 1.10
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
|
||||
// @description Multiple solutions for blocking Twitch ads (notify-strip)
|
||||
@ -150,7 +150,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds = true;
|
||||
streamInfo.HadAds[url] = true;
|
||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||
@ -274,9 +274,9 @@
|
||||
streamInfo.BackupUrl = null;
|
||||
return '';
|
||||
}
|
||||
if (streamInfo.HadAds) {
|
||||
if (streamInfo.HadAds[url]) {
|
||||
postMessage({key:'UboPauseResumePlayer'});
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds[url] = false;
|
||||
}
|
||||
postMessage({key:'UboHideAdBanner'});
|
||||
return textStr;
|
||||
@ -342,7 +342,7 @@
|
||||
streamInfo.BackupRegUrl = null;
|
||||
streamInfo.BackupRegRes = null;
|
||||
streamInfo.IsMidroll = false;
|
||||
streamInfo.HadAds = false;
|
||||
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||
@ -353,6 +353,7 @@
|
||||
streamInfo.Urls[lines[i]] = res;
|
||||
}
|
||||
}
|
||||
streamInfo.HadAds[lines[i]] = false;
|
||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user