Fix mini player staying above chat #480

This commit is contained in:
pixeltris
2025-11-21 21:20:47 +00:00
parent 8fa846baac
commit 233bedd48b
4 changed files with 34 additions and 70 deletions
+8 -17
View File
@@ -2,7 +2,7 @@ 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; }
'use strict'; 'use strict';
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) { if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -26,7 +26,6 @@ twitch-videoad.js text/javascript
scope.PlayerReloadMinimalRequestsTime = 1500; scope.PlayerReloadMinimalRequestsTime = 1500;
scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed
scope.HasTriggeredPlayerReload = false; scope.HasTriggeredPlayerReload = false;
scope.DisableMatureConentPopup = false;// If true this avoids having to log in to watch age gated content
scope.StreamInfos = []; scope.StreamInfos = [];
scope.StreamInfosByUrl = []; scope.StreamInfosByUrl = [];
scope.GQLDeviceID = null; scope.GQLDeviceID = null;
@@ -945,21 +944,13 @@ twitch-videoad.js text/javascript
init.body = JSON.stringify(newBody); init.body = JSON.stringify(newBody);
} }
} }
if (DisableMatureConentPopup) { // Get rid of mini player above chat
const newBody2 = JSON.parse(init.body); if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
if (Array.isArray(newBody2)) { init.body = '';
let hasRemovedClassification = false; }
for (let i = 0; i < newBody2.length; i++) { var isPBYPRequest = url.includes('picture-by-picture');
if (newBody2[i]?.operationName == 'ContentClassificationContext') { if (isPBYPRequest) {
hasRemovedClassification = true; url = '';
// Doesn't seem like it if we remove this element from the array so instead we duplicate another entry into this index. TODO: Find out why
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
}
}
if (hasRemovedClassification) {
init.body = JSON.stringify(newBody2);
}
}
} }
} }
} }
+9 -18
View File
@@ -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 31.0.0 // @version 32.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
@@ -13,7 +13,7 @@
// ==/UserScript== // ==/UserScript==
(function() { (function() {
'use strict'; 'use strict';
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) { if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -37,7 +37,6 @@
scope.PlayerReloadMinimalRequestsTime = 1500; scope.PlayerReloadMinimalRequestsTime = 1500;
scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed
scope.HasTriggeredPlayerReload = false; scope.HasTriggeredPlayerReload = false;
scope.DisableMatureConentPopup = false;// If true this avoids having to log in to watch age gated content
scope.StreamInfos = []; scope.StreamInfos = [];
scope.StreamInfosByUrl = []; scope.StreamInfosByUrl = [];
scope.GQLDeviceID = null; scope.GQLDeviceID = null;
@@ -956,21 +955,13 @@
init.body = JSON.stringify(newBody); init.body = JSON.stringify(newBody);
} }
} }
if (DisableMatureConentPopup) { // Get rid of mini player above chat
const newBody2 = JSON.parse(init.body); if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
if (Array.isArray(newBody2)) { init.body = '';
let hasRemovedClassification = false; }
for (let i = 0; i < newBody2.length; i++) { var isPBYPRequest = url.includes('picture-by-picture');
if (newBody2[i]?.operationName == 'ContentClassificationContext') { if (isPBYPRequest) {
hasRemovedClassification = true; url = '';
// Doesn't seem like it if we remove this element from the array so instead we duplicate another entry into this index. TODO: Find out why
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
}
}
if (hasRemovedClassification) {
init.body = JSON.stringify(newBody2);
}
}
} }
} }
} }
+8 -17
View File
@@ -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; }
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) { if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -12,7 +12,6 @@ twitch-videoad.js text/javascript
// Options / globals // Options / globals
scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ]; scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ];
scope.OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE = 'site'; scope.OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE = 'site';
scope.OPT_DISABLE_MATURE_CONTENT_POPUP = false;// If true this avoids having to log in to watch age gated content
scope.AD_SIGNIFIER = 'stitched-ad'; scope.AD_SIGNIFIER = 'stitched-ad';
scope.LIVE_SIGNIFIER = ',live'; scope.LIVE_SIGNIFIER = ',live';
scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko'; scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko';
@@ -708,21 +707,13 @@ twitch-videoad.js text/javascript
init.body = JSON.stringify(newBody); init.body = JSON.stringify(newBody);
} }
} }
if (OPT_DISABLE_MATURE_CONTENT_POPUP) { // Get rid of mini player above chat
const newBody2 = JSON.parse(init.body); if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
if (Array.isArray(newBody2)) { init.body = '';
let hasRemovedClassification = false; }
for (let i = 0; i < newBody2.length; i++) { var isPBYPRequest = url.includes('picture-by-picture');
if (newBody2[i]?.operationName == 'ContentClassificationContext') { if (isPBYPRequest) {
hasRemovedClassification = true; url = '';
// Doesn't seem like it if we remove this element from the array so instead we duplicate another entry into this index. TODO: Find out why
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
}
}
if (hasRemovedClassification) {
init.body = JSON.stringify(newBody2);
}
}
} }
} }
} }
+9 -18
View File
@@ -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.50 // @version 1.51
// @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)
@@ -13,7 +13,7 @@
// ==/UserScript== // ==/UserScript==
(function() { (function() {
'use strict'; 'use strict';
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) { if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -24,7 +24,6 @@
// Options / globals // Options / globals
scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ]; scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ];
scope.OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE = 'site'; scope.OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE = 'site';
scope.OPT_DISABLE_MATURE_CONTENT_POPUP = false;// If true this avoids having to log in to watch age gated content
scope.AD_SIGNIFIER = 'stitched-ad'; scope.AD_SIGNIFIER = 'stitched-ad';
scope.LIVE_SIGNIFIER = ',live'; scope.LIVE_SIGNIFIER = ',live';
scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko'; scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko';
@@ -720,21 +719,13 @@
init.body = JSON.stringify(newBody); init.body = JSON.stringify(newBody);
} }
} }
if (OPT_DISABLE_MATURE_CONTENT_POPUP) { // Get rid of mini player above chat
const newBody2 = JSON.parse(init.body); if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
if (Array.isArray(newBody2)) { init.body = '';
let hasRemovedClassification = false; }
for (let i = 0; i < newBody2.length; i++) { var isPBYPRequest = url.includes('picture-by-picture');
if (newBody2[i]?.operationName == 'ContentClassificationContext') { if (isPBYPRequest) {
hasRemovedClassification = true; url = '';
// Doesn't seem like it if we remove this element from the array so instead we duplicate another entry into this index. TODO: Find out why
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
}
}
if (hasRemovedClassification) {
init.body = JSON.stringify(newBody2);
}
}
} }
} }
} }