The question is, you need to change some links on the page, but unfortunately they are not stored in the form of html, but inside js and then only pull up on a click. Is it possible to change the already written js? Or is it possible, when downloading for example using the Tampermonkey extension, to disable the js script that loads and connect its own, similar, only slightly modified. If yes, then tell me how it can be done :)
- Everything is possible. The question is what handles the click. Named function called exactly by name or nameless handler hung on event - Mike
|
1 answer
It depends on how the script works, and what is required.
If you just replace the links, then you can add a button inside the existing buttons, and cancel the promotion of the event up. Example:
<div onclick="alert('ΠΡΠΈΠ³ΠΈΠ½Π°Π»ΡΠ½Π°Ρ ΠΊΠ½ΠΎΠΏΠΊΠ° Π½Π°ΠΆΠ°ΡΠ°')"> <span onclick="var event = arguments[0] || window.event; alert('ΠΠ½ΠΆΠ΅ΠΊΡΠ½Π°Ρ ΠΊΠ½ΠΎΠΏΠΊΠ° Π½Π°ΠΆΠ°ΡΠ°'); event.stopPropagation()">Π’ΠΎ ΡΡΠΎ Π±ΡΠ»ΠΎ ΡΠ°Π½ΡΡΠ΅ Π² ΠΊΠ½ΠΎΠΏΠΊΠ΅.</span> </div> Moreover, if instead of div element a - then you need to cancel the event. Also, if you need to get a link, it all depends on the specific situation.
JSFiddle example: https://jsfiddle.net/z4ospxem/
You can inject your item in many ways. The easiest of them:
document.getElementById("elementToInject").innerHTML = ... - If the problem was in external links. The fact is that the startup link is inside the js script at runtime. It is not on the page itself. All that concerns html is no problem at all. But the problem itself is to change the data that is stored in the variable js. In the file that connects to the site. - vichen
- Variable, as I understand it, not global? And as I understand it, you need to get the link itself? - Qertu Uerty
- As an option, this is via developer.chrome.com/extensions/webRequest , if you can write your own addition to Google Chrome. I think you can find plugins that allow you to download the code as the code for the plugin. - Qertu Uerty
- Yes, not global. if it were, it would be easier. And you need to get a link. The big problem is that the code is compressed and unreadable. That is, the entire name is changed to a set of letters. - vichen
- In what sense, download the code as a plugin code? - vichen
|