greasemonkey

Changing Javascript on an HTML page out of my control [duplicate]

感情迁移 提交于 2019-12-17 19:04:09
问题 This question already has answers here : Stop execution of Javascript function (client side) or tweak it (4 answers) Closed 4 years ago . This question was migrated from Super User because it can be answered on Stack Overflow. Migrated 7 years ago . I'm using an HTML page out of my control. It defines a Javascript function in an inline <script> tag and calls it in <body onload="..."> : <html> ... <body onload="init()"> <script type="text/javascript" language="javascript"> function init() { ..

Using Greasemonkey and jQuery to intercept JSON/AJAX data from a page, and process it

放肆的年华 提交于 2019-12-17 17:12:11
问题 Right, I partly got an answer in my previous question. But, I still sit with the problem of telling GM where to go and fetch the data to put into the array... On the web page http://www.trada.net/p_home.aspx, if I run firebug console, I get the data from the above mentioned question, but it is ever changing, updating every second. This data I've got an idea how to put it in an array, and from there I'll tell GM what to do with it. I cant run the firebug console the whole time, and I dont know

Remove a javascript function with Greasemonkey

て烟熏妆下的殇ゞ 提交于 2019-12-17 16:31:26
问题 I visit a website with a javascript file in the head of the HTML <script language="javascript" src="javscript.js"></script> The code inside this file is: // keypress management if (document.layers) document.captureEvents(Event.KEYPRESS) function update(e) { if (document.all) { // Explorer if (event.keyCode==13) document.forms[0].submit(); // 13 = ENTER else if (event.keyCode==26) runHelp(hplk); // 26 = CTRL+Z return; } else { // mozilla if (e.which==13) document.forms[0].submit(); // 13 =

Modifying all links w/ Greasemonkey

白昼怎懂夜的黑 提交于 2019-12-17 14:55:19
问题 I want to mod a page from a site that prefixes all its links with "http://linkblur.com/?" I tried this: links = getElementsByTagName('a'); for (l in links) { l.href = l.href.replace('http://linkblur.com/?',''); } But it doesn't work. What am I doing wrong? 回答1: Try: var links = document.links; var link; for(var i=links.length-1; i >=0; i--){ link = links[i]; link.href = link.href.replace("http://linkblur.com/?", ''); } 回答2: You for iterator iterates over all the properties of your array,

Chrome userscript error: “Unsafe JavaScript attempt to access frame”

你。 提交于 2019-12-17 13:23:48
问题 // the iframe of the div I need to access var iframe = document.getElementsByTagName("iframe")[2]; var innerDoc = iframe.contentDocument || iframe.contentWindow.document; // resize 'player' in the iframe innerDoc.getElementById('player').width = "1000px"; innerDoc.getElementById('player').height = "650px"; Running in a userscript for this url: http://www.free-tv-video-online.me/player/sockshare.php?id=24DA6EAA2561FD60 Why does Chrome come out with this error and fail the script?: Unsafe

Chrome userscript error: “Unsafe JavaScript attempt to access frame”

假如想象 提交于 2019-12-17 13:23:32
问题 // the iframe of the div I need to access var iframe = document.getElementsByTagName("iframe")[2]; var innerDoc = iframe.contentDocument || iframe.contentWindow.document; // resize 'player' in the iframe innerDoc.getElementById('player').width = "1000px"; innerDoc.getElementById('player').height = "650px"; Running in a userscript for this url: http://www.free-tv-video-online.me/player/sockshare.php?id=24DA6EAA2561FD60 Why does Chrome come out with this error and fail the script?: Unsafe

How to use GM_xmlhttpRequest in Injected Code?

血红的双手。 提交于 2019-12-17 07:41:31
问题 I am writing a userscript that is injected into a webpage. The script reads some data from a web-server and I want to send messages to a listening application to react to the data. For now, all I'm doing is trying to send a string command to my listening application and see if I can read it. My code worked before it was injected, but afterwards I get an "undefined reference error". I suspect that this has something to do with this "Greasemonkey access violation". However, I have been unable

Error: Permission denied to access property 'handler'

谁说胖子不能爱 提交于 2019-12-17 06:53:50
问题 I have a greasemonkey script for Firefox, which yesterday was working perfectly. I tried using it today (no code was modified) and I noticed that it stopped working. Upon further inspection, the script is now throwing the following error: Error: Permission denied to access property 'handler' This error is being thrown in the following block of code: $('body').click(function() { // code here }); This error magically started happening today when the script was working just fine yesterday. I'm

Simulating a mousedown, click, mouseup sequence in Tampermonkey?

拜拜、爱过 提交于 2019-12-17 06:29:29
问题 I would like to simulate a whole click not just document.getElementsByClassName()[0].click(); How do I do that? Search results all seem to be about handling such events, not triggering them. 回答1: Send mouse events. Like so: //--- Get the first link that has "stackoverflow" in its URL. var targetNode = document.querySelector ("a[href*='stackoverflow']"); if (targetNode) { //--- Simulate a natural mouse-click sequence. triggerMouseEvent (targetNode, "mouseover"); triggerMouseEvent (targetNode,

How to change a class CSS with a Greasemonkey/Tampermonkey script?

混江龙づ霸主 提交于 2019-12-17 04:57:10
问题 I'm trying to set the background image of the body, but only where it uses the class banner_url . The HTML is as follows: <body id="app_body" class="banner_url desktopapp" data-backdrop-limit="1"> Basically, I would like to force the page to use the following CSS instead: .banner_url { background: url('http://www.pxleyes.com/images/contests/kiwis/fullsize/sourceimage.jpg') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover;