From 233bedd48bd44a999e9cb7bc15c200115a522747 Mon Sep 17 00:00:00 2001 From: pixeltris <6952411+pixeltris@users.noreply.github.com> Date: Fri, 21 Nov 2025 21:20:47 +0000 Subject: [PATCH] Fix mini player staying above chat #480 --- vaft/vaft-ublock-origin.js | 25 ++++++----------- vaft/vaft.user.js | 27 +++++++------------ .../video-swap-new-ublock-origin.js | 25 ++++++----------- video-swap-new/video-swap-new.user.js | 27 +++++++------------ 4 files changed, 34 insertions(+), 70 deletions(-) diff --git a/vaft/vaft-ublock-origin.js b/vaft/vaft-ublock-origin.js index 595ba6c..5b8dd6f 100644 --- a/vaft/vaft-ublock-origin.js +++ b/vaft/vaft-ublock-origin.js @@ -2,7 +2,7 @@ twitch-videoad.js text/javascript (function() { if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; } '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) { console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; @@ -26,7 +26,6 @@ twitch-videoad.js text/javascript scope.PlayerReloadMinimalRequestsTime = 1500; scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed scope.HasTriggeredPlayerReload = false; - scope.DisableMatureConentPopup = false;// If true this avoids having to log in to watch age gated content scope.StreamInfos = []; scope.StreamInfosByUrl = []; scope.GQLDeviceID = null; @@ -945,21 +944,13 @@ twitch-videoad.js text/javascript init.body = JSON.stringify(newBody); } } - if (DisableMatureConentPopup) { - const newBody2 = JSON.parse(init.body); - if (Array.isArray(newBody2)) { - let hasRemovedClassification = false; - for (let i = 0; i < newBody2.length; i++) { - if (newBody2[i]?.operationName == 'ContentClassificationContext') { - hasRemovedClassification = true; - // 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); - } - } + // Get rid of mini player above chat + if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) { + init.body = ''; + } + var isPBYPRequest = url.includes('picture-by-picture'); + if (isPBYPRequest) { + url = ''; } } } diff --git a/vaft/vaft.user.js b/vaft/vaft.user.js index 0d641c0..53095fa 100644 --- a/vaft/vaft.user.js +++ b/vaft/vaft.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name TwitchAdSolutions (vaft) // @namespace https://github.com/pixeltris/TwitchAdSolutions -// @version 31.0.0 +// @version 32.0.0 // @description Multiple solutions for blocking Twitch ads (vaft) // @updateURL 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== (function() { '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) { console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; @@ -37,7 +37,6 @@ scope.PlayerReloadMinimalRequestsTime = 1500; scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed scope.HasTriggeredPlayerReload = false; - scope.DisableMatureConentPopup = false;// If true this avoids having to log in to watch age gated content scope.StreamInfos = []; scope.StreamInfosByUrl = []; scope.GQLDeviceID = null; @@ -956,21 +955,13 @@ init.body = JSON.stringify(newBody); } } - if (DisableMatureConentPopup) { - const newBody2 = JSON.parse(init.body); - if (Array.isArray(newBody2)) { - let hasRemovedClassification = false; - for (let i = 0; i < newBody2.length; i++) { - if (newBody2[i]?.operationName == 'ContentClassificationContext') { - hasRemovedClassification = true; - // 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); - } - } + // Get rid of mini player above chat + if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) { + init.body = ''; + } + var isPBYPRequest = url.includes('picture-by-picture'); + if (isPBYPRequest) { + url = ''; } } } diff --git a/video-swap-new/video-swap-new-ublock-origin.js b/video-swap-new/video-swap-new-ublock-origin.js index bde375d..ca2ec92 100644 --- a/video-swap-new/video-swap-new-ublock-origin.js +++ b/video-swap-new/video-swap-new-ublock-origin.js @@ -1,7 +1,7 @@ twitch-videoad.js text/javascript (function() { 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) { console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; @@ -12,7 +12,6 @@ twitch-videoad.js text/javascript // Options / globals scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ]; 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.LIVE_SIGNIFIER = ',live'; scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko'; @@ -708,21 +707,13 @@ twitch-videoad.js text/javascript init.body = JSON.stringify(newBody); } } - if (OPT_DISABLE_MATURE_CONTENT_POPUP) { - const newBody2 = JSON.parse(init.body); - if (Array.isArray(newBody2)) { - let hasRemovedClassification = false; - for (let i = 0; i < newBody2.length; i++) { - if (newBody2[i]?.operationName == 'ContentClassificationContext') { - hasRemovedClassification = true; - // 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); - } - } + // Get rid of mini player above chat + if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) { + init.body = ''; + } + var isPBYPRequest = url.includes('picture-by-picture'); + if (isPBYPRequest) { + url = ''; } } } diff --git a/video-swap-new/video-swap-new.user.js b/video-swap-new/video-swap-new.user.js index 37af4d0..f25bd58 100644 --- a/video-swap-new/video-swap-new.user.js +++ b/video-swap-new/video-swap-new.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name TwitchAdSolutions (video-swap-new) // @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 // @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) @@ -13,7 +13,7 @@ // ==/UserScript== (function() { '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) { console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion); window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion; @@ -24,7 +24,6 @@ // Options / globals scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ]; 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.LIVE_SIGNIFIER = ',live'; scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko'; @@ -720,21 +719,13 @@ init.body = JSON.stringify(newBody); } } - if (OPT_DISABLE_MATURE_CONTENT_POPUP) { - const newBody2 = JSON.parse(init.body); - if (Array.isArray(newBody2)) { - let hasRemovedClassification = false; - for (let i = 0; i < newBody2.length; i++) { - if (newBody2[i]?.operationName == 'ContentClassificationContext') { - hasRemovedClassification = true; - // 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); - } - } + // Get rid of mini player above chat + if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) { + init.body = ''; + } + var isPBYPRequest = url.includes('picture-by-picture'); + if (isPBYPRequest) { + url = ''; } } }