greasemonkey

Basic method to Add html content to the page with Greasemonkey?

烈酒焚心 提交于 2019-11-28 18:26:06
Is there a Greasemonkey method to append basic HTML content to the end of a page right after the <body> tag, or right before it ends? I found before/after methods but I need to know names of elements which may change page to page.. The quick and dirty way: Please only use innerHTML for brand- new content. var newHTML = document.createElement ('div'); newHTML.innerHTML = ' \ <div id="gmSomeID"> \ <p>Some paragraph</p> \ etc. \ </div> \ '; document.body.appendChild (newHTML); A complete script showing the somewhat better jQuery way (and with new, ECMAScript 6, multiline string): // ==UserScript=

how to run greasemonkey script before the page content is displayed?

不打扰是莪最后的温柔 提交于 2019-11-28 18:18:21
I am writing a plug-in for Firefox and using greasemonkey script to do that (I compile the user script using this tool http://arantius.com/misc/greasemonkey/script-compiler ). The issue is that the script is run after the page is fully loaded. Meaning the user would see the viewed page in its original form and then the script will apply the changes that I made. My question is there a way to run the user script before the contents of the page is displayed to the user, so the user would only the final version of the website? EDIT: This post was created prior to the implementation of the @run-at

Using arrows-keys to navigate

不问归期 提交于 2019-11-28 17:37:44
I am wondering if there was a possibility to navigate with arrow keys through a table I created with JS(using jQuery)? I mean jumping from cell to cell...The script is for Greasemonkey. The alert, however, works. I just got no idea how to make it well-functioning. $(document).keydown(function(e){ if (e.keyCode == 37) { alert( "left pressed " ); return false; } if (e.keyCode == 38) { alert( "up pressed " ); return false; } if (e.keyCode == 39) { alert( "right pressed " ); return false; } if (e.keyCode == 40) { alert( "down pressed " ); return false; } }); ; Any hint or whatever is much

How do I publish a Greasemonkey script as a Firefox add-on?

雨燕双飞 提交于 2019-11-28 17:20:34
I recently have worked on a script in Greasemonkey and would like to publish it as an add-on for Firefox. What is the easiest way to do this? Just post your script at userscripts.org 1 OpenUserJS.org (Or one of the other userscripts.org replacements). Trying to repackage it as an add-on is usually more trouble than it is worth. If you really must, you can use the Greasemonkey script compiler to turn your script into an "add-on", and then submit that add-on to Mozilla, via the normal add-on process . Note that Wladimir's answer is better than the Greasemonkey script compiler. 1 Userscripts.org

Replace remote JavaScript file with a local debugging copy using Greasemonkey or userscript

▼魔方 西西 提交于 2019-11-28 17:05:42
问题 While debugging a client app that uses a Google backend, I have added some debugging versions of the functions and inserted them using the Chrome Developer Tools script editor. However there are a number of limitations with this approach, first is that the editor doesn't seem to always work with de-minified files, and when the JS file is 35K lines long, this is a problem. Another issue is that all the initialization that is done during load time, uses the original "unpatched" functions, hence

How to replace lots of words in AJAX-driven page text, and in select attributes — using a Tampermonkey script?

爱⌒轻易说出口 提交于 2019-11-28 14:23:49
I'm translating text/words/terms inside an HTML document using a tree walker to affect only text nodes: var replaceArry = [ [/View your user account/gi, 'Tu cuenta'], // etc. ]; var numTerms = replaceArry.length; var txtWalker = document.createTreeWalker ( document.body, NodeFilter.SHOW_TEXT, { acceptNode: function (node) { //-- Skip whitespace-only nodes if (node.nodeValue.trim() ) return NodeFilter.FILTER_ACCEPT; return NodeFilter.FILTER_SKIP; } }, false ); var txtNode = null; while (txtNode = txtWalker.nextNode () ) { var oldTxt = txtNode.nodeValue; for (var J = 0; J < numTerms; J++) {

Userscript to Loop over several HTTP Requests and combine the results?

跟風遠走 提交于 2019-11-28 14:15:15
I now know how to load columns, of a table, from an external webpage . Now I want to expand on that and: Fetch tabular data from several pages (rankings by player position). Merge it into one master table. This is the URL (http:...fantasysports.yahoo.com...pos=QB) that the script currently fetches. The columns are the team name and the team's rank for the various positions. I want to have it iterate over other positions (i.e. WR, RB, TE). This is done by just changing the last 2 letters of the URL to its respective value. I then want to have all this data in a single array where first column

Greasemonkey script that removes or blocks select JavaScripts [duplicate]

谁说胖子不能爱 提交于 2019-11-28 14:10:29
This question already has an answer here: Stop execution of Javascript function (client side) or tweak it 4 answers I tried unsuccessfully to make a script that deletes another script on a page. The page loads 2 scripts in <body> that I don't want to execute: <div id="myindex"> <div class="wrap"> <div id="idone"></div> <div id="idtwo"></div> <script type="text/javascript"></script> <script type="text/javascript"></script> <script type="text/javascript"></script> //To Remove <script type="text/javascript"></script> //To Remove </div> </div> How do I block just those scripts from running? This

Replace images source for all images

三世轮回 提交于 2019-11-28 12:59:53
I want to replace the src attribute for all images matching a regex using Greasemonkey scripting. Example: Replace http://aff.kooora.com/i/z3.gif With http://example.com/aff.kooora.com/i/z3.gif I have no experience in scripting but this is what I came up with: var allImg=document.getElementsByTagName("img"), i=0, img; var pattern = aff\.kooora\.com/([A-Za-z0-9/._]*); while(img=allImg[i++]) { result = pattern.exec(img); if (result!=null) img.src=img.src.replace(result, 'http://example.com/' + result); } It doesn't work. Your regular expression is the problem, you need to wrap it in slashes

Replace text with link to that text?

主宰稳场 提交于 2019-11-28 12:56:23
问题 This is a follow up of my earlier question. I'm trying to use Greasemonkey to change the text in a <td> to a link that contains that text. So the page contains <td class="something"><div style="width: 200px;"> randomtext </div></td> And I want to change it using Greasemonkey to: <td class="something"><div style="width: 200px;"> <a href="www.somewhere.com/q?=randomtext">randomtext</a> </div></td> So far, I've cobbled together this little bit of code, but I'm sure it's the wrong approach as I'm