Sleazy Fork is available in English.

Discuții » Dezvoltare

How to disable specific java script

§
Postat în: 10-08-2018
Editat în: 10-08-2018

How to disable specific java script

Some site (html) contains the following code:

<script>
    document.addEventListener('DOMContentLoaded', function(){
        $('.answer-text > div:first').attr('class', 'defdecefcfeda');
        try {
            var script = document.createElement('script');
            script.src = '###LINK TO SOME *.JS SCRIPT###';
            script.onerror = function() {
                adbd('defdecefcfeda', 'qqg', '###SOME UNDESIRABLE TEXT###');
            };
            script.onload = function () {
                adbd('defdecefcfeda', 'qqg', '###SOME UNDESIRABLE TEXT###');
                SomeFunc1.setOption('debug', false);
                SomeFunc1.setOption('baitClass', 'pub_300x250 propel-ad adfox rtb pub_300x250m dfp-slot__banner dfp-slot__placeholder dfp-slot__placeholder-text pub_teasers pud_ads pub_300x600 center_adsense advertorial-block hr-ads adboxbot pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links');
                SomeFunc1.onDetected(function () {
                    adbd('defdecefcfeda', 'qqg', '###SOME UNDESIRABLE TEXT###');
                });
                 SomeFunc1.onNotDetected(function () {
                 });
            };
            document.documentElement.appendChild(script);
        } catch (err) {}
    });
</script>  

I need to do only one thing among 3: 1) OR Disable (delete\replace) array of commands in a whole block "script" 2) OR Delete EventListener (not using deleteEventListener because it doesn't work here) 3) OR Forbid geting script from URL in line 6 (Not desirable solution, because it may has no effect)

(Attachment: File with code that given before but with spaces and tabs to better viewing)

§
Postat în: 01-10-2018

maybe you can add the link of line 6 onto ublock Orign or Adblock or other blocker if you has some feature of the link address. ScriptManager inject the script after the DOMContentLoaded event, so it too late to block a script on the html dom if you use a script from scriptManager

§
Postat în: 29-03-2019
Editat în: 03-07-2020

for example, you can make the usage of this one prefs.js: userpref("capability.policy.policynames", "killfunction"); userpref("capability.policy.killfunction.open", "noAccess"); userpref("capability.policy.killfunction.XMLHttpRequest.open", "noAccess"); userpref("capability.policy.killfunction.XMLHttpRequest.send", "noAccess"); user_pref("capability.policy.killfunction.sites", http://evilsite.org);

Postează un raspuns

Autentifică-te pentru a posta un răspuns.