Add new scriptlet — trusted version of `set-constant` for none-predefined values
Some of AG_defineProperty rules can't be converted to scriptlets, because in set-constant scriptlet we can use only predefined values, so I think that it would be nice if could use not only predefined values.
For example, maybe adding something like #%#//ag-scriptlet will be okay and it will be restricted to use it only in AdGuard filters, the same like $replace and other JS (#%#) rules.
example.org#%#//ag-scriptlet("set-constant", "property", "value")
https://github.com/AdguardTeam/AdguardFilters/issues/88860
! 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 });
! 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"});
we will add new scriptlet agtrusted-set-constant to avoid predefined values
due to https://github.com/AdguardTeam/Scriptlets/issues/106
Before we do that, are you sure there're no alternative solutions on all these websites?
We have alternative solutions for most of these rules, but sometimes it's not easy to find them and sometimes there may not be alternative solution (with current scriptlets).
The thing is that JS rules will be fully deprecated rather soon so we'd better find ones:)
We have a lot of JS rules, for example with AG_onLoad function, so it doesn't sound good.
Yep, we should gradually remove them all
! 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"});
so we need a possibility to set the needed type of value?
#%#AG_defineProperty('exoDocumentProtocol', { value: window.document.location.protocol });
if I got it correctly, for such cases we need to get the value of window.document.location.protocol first, and after that to set the value to exoDocumentProtocol, right?
The thing is that JS rules will be fully deprecated rather soon we should gradually remove them all
I'm curious about the reason. add-on store policy?
Bad link, incompatible with Firefox and Safari without Google WebExtension (If these fails: https://addons.mozilla.org/en-US/firefox/addon/link-to-text-fragment/ may need rewrite origin CRX to XPI or user script for Tampemonkey/Violentmonkey/Greasymonkey: https://chrome.google.com/webstore/detail/link-to-text-fragment/pbcodcjpfjdpcineamnnmbkkmkdpajjg).
https://developer.mozilla.org/en-US/docs/Web/Text_fragments#browser_compatibility