diff --git a/base/base.user.js b/base/base.user.js index 436a68d..9d23621 100644 --- a/base/base.user.js +++ b/base/base.user.js @@ -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; } } diff --git a/notify-reload/notify-reload-ublock-origin.js b/notify-reload/notify-reload-ublock-origin.js index 1a5e165..46e9acf 100644 --- a/notify-reload/notify-reload-ublock-origin.js +++ b/notify-reload/notify-reload-ublock-origin.js @@ -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; } } diff --git a/notify-reload/notify-reload.user.js b/notify-reload/notify-reload.user.js index dcdc462..2d877cc 100644 --- a/notify-reload/notify-reload.user.js +++ b/notify-reload/notify-reload.user.js @@ -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; } } diff --git a/notify-strip/notify-strip-ublock-origin.js b/notify-strip/notify-strip-ublock-origin.js index df1b3dd..5874e2b 100644 --- a/notify-strip/notify-strip-ublock-origin.js +++ b/notify-strip/notify-strip-ublock-origin.js @@ -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; } } diff --git a/notify-strip/notify-strip.user.js b/notify-strip/notify-strip.user.js index 2693897..ec629ff 100644 --- a/notify-strip/notify-strip.user.js +++ b/notify-strip/notify-strip.user.js @@ -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; } }