1
0
mirror of https://github.com/pixeltris/TwitchAdSolutions.git synced 2024-11-22 10:22:51 +01:00

Unlist "dyn-skip-midroll" and disable reloading in "dyn-skip-midroll-alt"

This commit is contained in:
pixeltris 2020-12-30 01:11:34 +00:00
parent 8e87d53987
commit 6791c44de3
16 changed files with 63 additions and 50 deletions

View File

@ -19,12 +19,10 @@ If you don't trust third parties then `dyn-skip` / `dyn-skip-midroll-alt` are de
- dyn-skip ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-skip/dyn-skip-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-skip/dyn-skip.user.js))
- Notifies Twitch that ads were watched before requesting the main live stream.
- Falls back to mute-black if this fails (use an alternative solution if it always fails for you, as it adds additional load).
- *Midroll ads are muted/blacked out, try `dyn-skip-midroll` or `dyn-skip-midroll-alt` for a more complete solution.*
- dyn-skip-midroll ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-skip-midroll/dyn-skip-midroll-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-skip-midroll/dyn-skip-midroll.user.js))
- The same as `dyn-skip`, but also *attempts* to skip midroll ads (it looks like this results in a reload loop, an alternative is `dyn-skip-midroll-alt`).
- **This requires the script to work perfectly, otherwise the player will hit a reload loop.**
- *Midroll ads are muted/blacked out. See `dyn-skip-midroll-alt` for a an alternative solution.*
- dyn-skip-midroll-alt ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-skip-midroll-alt/dyn-skip-midroll-alt-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-skip-midroll-alt/dyn-skip-midroll-alt.user.js))
- A mix of `dyn-skip-midroll` / `dyn` to avoid player reload spam during midroll ads (player reloads are limited to 60 seconds apart, low resolution stream plays when nothing else is available - might be a little glitchy but better than player reload spam).
- A mix of `dyn-skip` / `dyn`. During midrolls this plays a low resolution stream instead of nothing - might be a little glitchy but should always play *something*.
- *If you see a `Waiting for ads to finish` banner without `midroll` in the banner text, you should be able to just refresh the page to get a regular stream.*
- dyn-video-swap ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-video-swap/dyn-video-swap-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/dyn-video-swap/dyn-video-swap.user.js))
- Ads are replaced by a low resolution stream for the duration of the ad.
- Similar to `dyn`, but skips closer to 20 seconds when switching to the live stream.

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -75,6 +75,7 @@ twitch-videoad.js application/javascript
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -89,7 +90,6 @@ twitch-videoad.js application/javascript
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -97,8 +97,9 @@ twitch-videoad.js application/javascript
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -139,7 +140,7 @@ twitch-videoad.js application/javascript
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;

View File

@ -84,6 +84,7 @@
this.onmessage = function(e) {
if (e.data.key == 'UboShowAdBanner') {
if (adDiv == null) { adDiv = getAdDiv(); }
adDiv.P.textContent = 'Waiting for' + (e.data.isMidroll ? ' midroll' : '') + ' ads to finish...';
adDiv.style.display = 'block';
}
else if (e.data.key == 'UboHideAdBanner') {
@ -98,7 +99,6 @@
}
}
function getAdDiv() {
var msg = 'Waiting for ads to finish...';
var playerRootDiv = document.querySelector('.video-player');
var adDiv = null;
if (playerRootDiv != null) {
@ -106,8 +106,9 @@
if (adDiv == null) {
adDiv = document.createElement('div');
adDiv.className = 'ubo-overlay';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p>' + msg + '</p></div>';
adDiv.innerHTML = '<div class="player-ad-notice" style="color: white; background-color: rgba(0, 0, 0, 0.8); position: absolute; top: 0px; left: 0px; padding: 10px;"><p></p></div>';
adDiv.style.display = 'none';
adDiv.P = adDiv.querySelector('p');
playerRootDiv.appendChild(adDiv);
}
}
@ -148,7 +149,7 @@
}
// NOTE: midroll ads are intertwined with live segments, always display the banner on midroll ads
if (haveAdTags && (!textStr.includes(LIVE_SIGNIFIER) || textStr.includes('MIDROLL'))) {
postMessage({key:'UboShowAdBanner'});
postMessage({key:'UboShowAdBanner',isMidroll:textStr.includes('MIDROLL')});
} else if ((LastAdUrl && LastAdUrl == url) || LastAdTime < Date.now() - 10000) {
postMessage({key:'UboHideAdBanner'});
LastAdTime = 0;