Add a site-specific quirk for Discord

Closes #4379
This commit is contained in:
Florian Bruhin 2021-04-28 08:14:43 +02:00
parent 2599e9bc97
commit be37524f47
4 changed files with 17 additions and 0 deletions

View File

@ -2693,6 +2693,7 @@ Valid values:
* +ua-google+
* +ua-slack+
* +js-whatsapp-web+
* +js-discord+
* +js-string-replaceall+
* +js-globalthis+
* +js-object-fromentries+

View File

@ -1152,6 +1152,7 @@ class _WebEngineScripts(QObject):
injection_point=QWebEngineScript.DocumentReady,
world=QWebEngineScript.ApplicationWorld,
),
_Quirk('discord'),
_Quirk(
'string_replaceall',
predicate=versions.webengine < utils.VersionNumber(5, 15, 3),

View File

@ -546,6 +546,7 @@ content.site_specific_quirks.skip:
- ua-google
- ua-slack
- js-whatsapp-web
- js-discord
- js-string-replaceall
- js-globalthis
- js-object-fromentries

View File

@ -0,0 +1,14 @@
// ==UserScript==
// @include https://discord.com/*
// ==/UserScript==
// Workaround for Discord's silly bot detection (or whatever it is logging
// people out with vertical tabs).
"use strict";
Object.defineProperty(window, "outerWidth", {
get() {
return window.innerWidth;
},
});