Skip to content
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

Get rid of the general JS api #88860

Closed
10 tasks done
ameshkov opened this issue Jul 22, 2021 · 2 comments
Closed
10 tasks done

Get rid of the general JS api #88860

ameshkov opened this issue Jul 22, 2021 · 2 comments
Assignees

Comments

@ameshkov
Copy link
Member

ameshkov commented Jul 22, 2021

Most of these functions should be replaced with scriptlets:
https://github.com/AdguardTeam/FiltersRegistry/blob/master/filters/general_js_api.js

Please check filters and get rid of these:

  • AG_removeElementById
  • AG_removeElementBySelector
  • AG_removeParent
  • AG_each
  • AG_removeCookie
  • AG_abortOnPropertyWrite
  • AG_abortOnPropertyRead
  • AG_abortInlineScript
  • AG_setConstant
  • AG_defineProperty

If there're any rules that cannot be replaced with a scriptlet, add a comment with an explanation, we'll have to come up with a feasible solution.

@AdamWr AdamWr added the A: In progress Work on the issue is in progress label Jul 23, 2021
@AdamWr AdamWr added A: Resolved and removed A: In progress Work on the issue is in progress labels Aug 5, 2021
@AdamWr
Copy link
Member

AdamWr commented Aug 5, 2021

Done.
List of rules which can't be changed to scriplets:

! We need a scriptlet to change/set HTML elements attributes, it's part of this task - https://github.com/AdguardTeam/Scriptlets/issues/106
telegraph.co.uk#%#AG_onLoad(function(){AG_each(".gallery.component > .gallery-settings[data-gallery-ad-viewability][data-gallery-slides-per-ad]",function(a){a.setAttribute("data-gallery-ad-viewability","1E9");a.setAttribute("data-gallery-slides-per-ad","1E9")})});

! TODO: replace below rule to scriptlet when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/57#issuecomment-697240649 (it has been fixed, but apps (stable channel) use old scriptlet library)
konnoznet.xyz#%#AG_abortInlineScript(/adblock/, 'document.createElement');

! Can be replaced by "scriptlet" when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/57 (it has been fixed, but apps (stable channel) use old scriptlet library)
animex.club#%#AG_abortInlineScript(/document\.getElementById\('babasbmsgx'\)/, 'Math.floor');

! TODO: Change AG_setConstant to scripltet when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/65
rysafe.blogspot.com#%#AG_setConstant('safelink.counter', '0');
rysafe.blogspot.com#%#AG_setConstant('safelink.click2x', 'false');

! TODO: Change AG_setConstant to scripltet when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/65
extremereportbot.com#%#AG_setConstant('adsbygoogle.loaded', 'false');

! Can't be changed to scriptlet, because in scriptlet we can use only predefined values, so it can't be set to "FREECONTENT"
fashion.appledaily.com.tw#%#AG_defineProperty('options.subscriptionContent', { value: "FREECONTENT" });

! typeof salon_config.live_ads is a "string", so it can't be changed to a scriptlet
salon.com#%#AG_defineProperty('salon_config.live_ads', {value: "0"});

! Can't be changed to scriptlet, because in scriptlet we can use only predefined values, so it can't be set to "no"
ultimedia.com#%#AG_defineProperty('dtkPlayer.infos.autoplay', {value: "no"});

! Probably it will be possible to change this rule to scriptlet when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/65
pewgame.com#%#AG_defineProperty('app_vars.counter_value', {value: 5, writable: false});

! Can't be changed to scriptlet, because in scriptlet we can use only predefined values, so it can't be set to "document.location.protocol"
tnaflix.com#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });
pussyspace.com,pussyspace.net#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });
nakedteens.fun#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });
letfap.com#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });
zbporn.com#%#AG_defineProperty('exoDocumentProtocol', { value: document.location.protocol });
porndroids.com#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });

! typeof ShPublic.extention_session is a "string", so it can't be changed to a scriptlet
filecr.com#%#AG_defineProperty('ShPublic.extention_session', {value: true});

! TODO: Change AG_defineProperty to scripltet when this issue will be fixed - https://github.com/AdguardTeam/Scriptlets/issues/65
safelinkmoba.blogspot.com#%#AG_defineProperty('safelink.adblock', { value: false }); AG_defineProperty('safelink.counter', { value: 0 });
safelink.miuipedia.com#%#AG_defineProperty('safelink.adblock', { value: false }); AG_defineProperty('safelink.counter', { value: 0 });
xberuang.blogspot.de,xberuang.blogspot.com#%#AG_defineProperty('safelink.adblock', {value: false}); AG_defineProperty('safelink.counter', {value: 0});
youjizz.com#%#AG_defineProperty('config.ads.mobilePopunder', {value: false});

! Can't be changed to scriptlet
almapiac.com#%#AG_defineProperty('SqueezeBox.open', { get: function() { return function() { popupAnywherecloseWindow(); }; }, set: function() {} });

! Can't be changed to scriptlet, because in scriptlet we can use only predefined values, so it can't be set to "none"
gameflare.com#%#AG_defineProperty('GameflareAsdk.config.advert.network', {value: "none"});

! typeof dtGonza.playeradstime is a "string", so it can't be changed to a scriptlet
hdss.video#%#AG_defineProperty('dtGonza.playeradstime', {value: -1});

Rules for Sourcepoint and for NoAdBlock (CloudflareApps) can't be changed to scriptlet

@AdamWr AdamWr closed this as completed Aug 5, 2021
@ameshkov
Copy link
Member Author

ameshkov commented Aug 5, 2021

@AdamWr let's open an issue in the scriptlets repo, we should develop a scriptlet alternative for these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants