A
A
andryu2017-03-18 20:53:09
JavaScript
andryu, 2017-03-18 20:53:09

How to disable certain js or part of it on the site?

There is a site (analogue dosk.ru), which, when copying text from it, adds the page address to the selected text. Looking for, for example, a video card. You copy the model in order to search for a description in Google, and there this address is additional. Searching for descriptions or alternatives in the market turns into horror.
Noscript can disable all scripts, how to disable this built-in or rewrite it is not clear to me.

<SCRIPT type="text/javascript">
<!--
if( window.add_link_to_selection && document.body.addEventListener ){document.body.addEventListener( "copy", add_link_to_selection );}
load_script_async( "https://i.doska.ru/w_inc/js/msg.count-doska.js?"+new Date() );
load_script_async( "/w_inc/chk.php?mm=1&c=&db=ru&mode=0" );
-->
</SCRIPT>

On the main page there is such a piece of code, on others all sorts of functions are added to this line, probably only this piece needs to be rewritten. In general, I do not understand this at all.
Help deal with adversity.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex, 2017-03-18
@andryu

× Install the plugin
× Go to https://www.doska.ru
× Open the plugin menu and select New user script...
× In the dialog box that opens, enter:
× The editor window opens, paste it there

document.body.removeEventListener('copy', add_link_to_selection, false);
after "save", then close the window.
× Restart your browser

V
Vitaly, 2017-03-18
@vshvydky

document.body.addEventListener( "copy", add_link_to_selection ); in theory, you can remove this listener, you can make such an extension in chrome to kill this event

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question