-
-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bestiefy.com #2865
Fix bestiefy.com #2865
Conversation
Also, I used Prettier as a formatter, so I accidentally changed some of the quote formatting - somebody could put it back though. |
Hello and thank you for the PR! Does this fix #2847? If this is about something else, could you provide examples of breakages that this resolves? |
Yes, it fixes #2847 |
The following WIP patch seems to fix quiz taking at Bestiefy, but I'm not sure it makes sense to release a surrogate to fix a single minor site. Are there other sites where surrogating Playwire fixes something? diff --git a/src/data/surrogates.js b/src/data/surrogates.js
index 54ca250..fabcd72 100644
--- a/src/data/surrogates.js
+++ b/src/data/surrogates.js
@@ -24,6 +24,10 @@ const MATCH_SUFFIX = 'suffix',
* `hostnames` maps hostnames to surrogate pattern tokens.
*/
const hostnames = {
+ 'cdn.intergient.com': {
+ match: MATCH_SUFFIX,
+ tokens: ['/ramp.js']
+ },
'b.scorecardresearch.com': {
match: MATCH_SUFFIX,
tokens: [
@@ -178,6 +195,8 @@ const surrogates = {
'/omweb-v1.js': 'noop.js',
+ '/ramp.js': 'ramp.js',
+
'noopjs': 'noop.js'
};
diff --git a/src/data/web_accessible_resources/ramp.js b/src/data/web_accessible_resources/ramp.js
new file mode 100644
index 0000000..e8bb1f6
--- /dev/null
+++ b/src/data/web_accessible_resources/ramp.js
@@ -0,0 +1,16 @@
+// https://developers.playwire.com/api/docs/ads/getting-started-ads.html
+(function () {
+ function noopfn() {}
+ function checkForOnReady() {
+ if (!window.ramp) {
+ window.ramp = {};
+ }
+ window.ramp.addUnits = () => new Promise(noopfn);
+ window.ramp.displayUnits = noopfn;
+ window.ramp.destroyUnits = noopfn;
+ if (typeof window.ramp.onReady == "function") {
+ window.ramp.onReady();
+ }
+ }
+ setTimeout(checkForOnReady, 10);
+}()); I'm going to close this for now, but please let me know if you have more broken site examples. |
Yes, it does fix other sites too:
I'm sure there are even more that are unreported. I vaguely remember there being some India-related news website that had a similar breakage issue, but I forgot the exact issue with it. This is a fairly common tracking script which has functions that can be (and are) directly referenced. |
Another thing I found in uBlock's unbreak list that shows more sites that this might unbreak:
I'm unsure how many more of these there are, but this seems like a script that is used more on either gaming or small sites, but is too invasive/annoying for larger sites. It seems to make bigger profits for sites that would get less money with AdSense for example and don't really care that it tracks everything users do and makes big flashy annoying popups. |
I don't have the time yet to test this as an extension, though if I understand how surrogates.js is supposed to work, my testing in the browser console should show that this works. Someone else should check though.