Skip to content

Commit 233bedd

Browse files
committed
Fix mini player staying above chat #480
1 parent 8fa846b commit 233bedd

File tree

4 files changed

+34
-70
lines changed

4 files changed

+34
-70
lines changed

vaft/vaft-ublock-origin.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ twitch-videoad.js text/javascript
22
(function() {
33
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
44
'use strict';
5-
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts
5+
const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
66
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
77
console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
88
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -26,7 +26,6 @@ twitch-videoad.js text/javascript
2626
scope.PlayerReloadMinimalRequestsTime = 1500;
2727
scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed
2828
scope.HasTriggeredPlayerReload = false;
29-
scope.DisableMatureConentPopup = false;// If true this avoids having to log in to watch age gated content
3029
scope.StreamInfos = [];
3130
scope.StreamInfosByUrl = [];
3231
scope.GQLDeviceID = null;
@@ -945,21 +944,13 @@ twitch-videoad.js text/javascript
945944
init.body = JSON.stringify(newBody);
946945
}
947946
}
948-
if (DisableMatureConentPopup) {
949-
const newBody2 = JSON.parse(init.body);
950-
if (Array.isArray(newBody2)) {
951-
let hasRemovedClassification = false;
952-
for (let i = 0; i < newBody2.length; i++) {
953-
if (newBody2[i]?.operationName == 'ContentClassificationContext') {
954-
hasRemovedClassification = true;
955-
// 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
956-
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
957-
}
958-
}
959-
if (hasRemovedClassification) {
960-
init.body = JSON.stringify(newBody2);
961-
}
962-
}
947+
// Get rid of mini player above chat
948+
if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
949+
init.body = '';
950+
}
951+
var isPBYPRequest = url.includes('picture-by-picture');
952+
if (isPBYPRequest) {
953+
url = '';
963954
}
964955
}
965956
}

vaft/vaft.user.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name TwitchAdSolutions (vaft)
33
// @namespace https://github.com/pixeltris/TwitchAdSolutions
4-
// @version 31.0.0
4+
// @version 32.0.0
55
// @description Multiple solutions for blocking Twitch ads (vaft)
66
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js
77
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js
@@ -13,7 +13,7 @@
1313
// ==/UserScript==
1414
(function() {
1515
'use strict';
16-
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts
16+
const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
1717
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
1818
console.log("skipping vaft as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
1919
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -37,7 +37,6 @@
3737
scope.PlayerReloadMinimalRequestsTime = 1500;
3838
scope.PlayerReloadMinimalRequestsPlayerIndex = 0;//embed
3939
scope.HasTriggeredPlayerReload = false;
40-
scope.DisableMatureConentPopup = false;// If true this avoids having to log in to watch age gated content
4140
scope.StreamInfos = [];
4241
scope.StreamInfosByUrl = [];
4342
scope.GQLDeviceID = null;
@@ -956,21 +955,13 @@
956955
init.body = JSON.stringify(newBody);
957956
}
958957
}
959-
if (DisableMatureConentPopup) {
960-
const newBody2 = JSON.parse(init.body);
961-
if (Array.isArray(newBody2)) {
962-
let hasRemovedClassification = false;
963-
for (let i = 0; i < newBody2.length; i++) {
964-
if (newBody2[i]?.operationName == 'ContentClassificationContext') {
965-
hasRemovedClassification = true;
966-
// 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
967-
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
968-
}
969-
}
970-
if (hasRemovedClassification) {
971-
init.body = JSON.stringify(newBody2);
972-
}
973-
}
958+
// Get rid of mini player above chat
959+
if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
960+
init.body = '';
961+
}
962+
var isPBYPRequest = url.includes('picture-by-picture');
963+
if (isPBYPRequest) {
964+
url = '';
974965
}
975966
}
976967
}

video-swap-new/video-swap-new-ublock-origin.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
twitch-videoad.js text/javascript
22
(function() {
33
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
4-
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts
4+
const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
55
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
66
console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
77
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -12,7 +12,6 @@ twitch-videoad.js text/javascript
1212
// Options / globals
1313
scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ];
1414
scope.OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE = 'site';
15-
scope.OPT_DISABLE_MATURE_CONTENT_POPUP = false;// If true this avoids having to log in to watch age gated content
1615
scope.AD_SIGNIFIER = 'stitched-ad';
1716
scope.LIVE_SIGNIFIER = ',live';
1817
scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko';
@@ -708,21 +707,13 @@ twitch-videoad.js text/javascript
708707
init.body = JSON.stringify(newBody);
709708
}
710709
}
711-
if (OPT_DISABLE_MATURE_CONTENT_POPUP) {
712-
const newBody2 = JSON.parse(init.body);
713-
if (Array.isArray(newBody2)) {
714-
let hasRemovedClassification = false;
715-
for (let i = 0; i < newBody2.length; i++) {
716-
if (newBody2[i]?.operationName == 'ContentClassificationContext') {
717-
hasRemovedClassification = true;
718-
// 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
719-
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
720-
}
721-
}
722-
if (hasRemovedClassification) {
723-
init.body = JSON.stringify(newBody2);
724-
}
725-
}
710+
// Get rid of mini player above chat
711+
if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
712+
init.body = '';
713+
}
714+
var isPBYPRequest = url.includes('picture-by-picture');
715+
if (isPBYPRequest) {
716+
url = '';
726717
}
727718
}
728719
}

video-swap-new/video-swap-new.user.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name TwitchAdSolutions (video-swap-new)
33
// @namespace https://github.com/pixeltris/TwitchAdSolutions
4-
// @version 1.50
4+
// @version 1.51
55
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
66
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
77
// @description Multiple solutions for blocking Twitch ads (video-swap-new)
@@ -13,7 +13,7 @@
1313
// ==/UserScript==
1414
(function() {
1515
'use strict';
16-
const ourTwitchAdSolutionsVersion = 18;// Used to prevent conflicts with outdated versions of the scripts
16+
const ourTwitchAdSolutionsVersion = 19;// Used to prevent conflicts with outdated versions of the scripts
1717
if (typeof window.twitchAdSolutionsVersion !== 'undefined' && window.twitchAdSolutionsVersion >= ourTwitchAdSolutionsVersion) {
1818
console.log("skipping video-swap-new as there's another script active. ourVersion:" + ourTwitchAdSolutionsVersion + " activeVersion:" + window.twitchAdSolutionsVersion);
1919
window.twitchAdSolutionsVersion = ourTwitchAdSolutionsVersion;
@@ -24,7 +24,6 @@
2424
// Options / globals
2525
scope.OPT_BACKUP_PLAYER_TYPES = [ 'autoplay', 'picture-by-picture', 'autoplay-ALT', 'embed' ];
2626
scope.OPT_FORCE_ACCESS_TOKEN_PLAYER_TYPE = 'site';
27-
scope.OPT_DISABLE_MATURE_CONTENT_POPUP = false;// If true this avoids having to log in to watch age gated content
2827
scope.AD_SIGNIFIER = 'stitched-ad';
2928
scope.LIVE_SIGNIFIER = ',live';
3029
scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko';
@@ -720,21 +719,13 @@
720719
init.body = JSON.stringify(newBody);
721720
}
722721
}
723-
if (OPT_DISABLE_MATURE_CONTENT_POPUP) {
724-
const newBody2 = JSON.parse(init.body);
725-
if (Array.isArray(newBody2)) {
726-
let hasRemovedClassification = false;
727-
for (let i = 0; i < newBody2.length; i++) {
728-
if (newBody2[i]?.operationName == 'ContentClassificationContext') {
729-
hasRemovedClassification = true;
730-
// 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
731-
newBody2[i] = newBody2[i == 0 && newBody2.length > 1 ? 1 : 0];
732-
}
733-
}
734-
if (hasRemovedClassification) {
735-
init.body = JSON.stringify(newBody2);
736-
}
737-
}
722+
// Get rid of mini player above chat
723+
if (init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken') && init.body.includes('picture-by-picture')) {
724+
init.body = '';
725+
}
726+
var isPBYPRequest = url.includes('picture-by-picture');
727+
if (isPBYPRequest) {
728+
url = '';
738729
}
739730
}
740731
}

0 commit comments

Comments
 (0)