greasemonkey

Javascript aliases

Hi all, my goal is to create a sort of "Javascript library," if you could call it that. I'm intending to use it to just manipulate pages as I browse the web, dynamically loading it as a greasemonkey script. The idea is to have "win" get mapped to window, "doc" -> document, "win.loc" -> win.location, and a few other convenience mappings...

XPath or querySelector?

XPath can do everything querySelector can do, and more, so when would you ever choose the latter? I haven't seen any speed benchmarks comparing the two, so right now I'm choosing based on syntax conciseness, which seems kind of arbitrary. Edit: I probably should have stated that I'm writing Greasemonkey scripts for Firefox, so I'm not w...

JS autoscroll

Hi all, I used to use a guitar tab site and it had a feature where you'd be able to auto-scroll the page you were on. There was a control panel that was fixed regardless of where on the page the screen was scrolled to which you could use to set the scroll speed and turn it off. Now, I can't remember which site it was, nor can I find...

greasemonkey: perform GM_xmlhttpRequest() from eval

Hi, i have a little Greasemonkey script that communicates with a servlet on (my) server. The servlet is sending back javascript code, that i eval() in the onload handler of the GM_xmlhttpRequest. So far, all is working fine. Now, for some reasons, i like use send another GM_xmlhttpRequest from within that eval()ed code. and here i'm s...

Greasemonkey, XPath: find all links within table row

Given: <tr> <td><a href="http://foo.com"&gt;Keyword 1</a></td> <td><a href="http://bar.com"&gt;Keyword 2</a></td> <td><a href="http://wombat.com"&gt;Keyword 3</a></td> </tr> <tr> <td><a href="http://blah.com"&gt;Keyword 4</a></td> <td><a href="http://woof.com"&gt;Keyword 5</a></td> <td><a href="http://miaow.com"&gt;Keyword ...

How to load a greasmonkey script after AJAX-Request

I have a simple greasemonkeyscript that makes some simple dom manipulation. The greasemonkey script is loaded after the DOM is loaded, that's fine so fare and it does work for the initial Page. But on this site (it's twitter ;-) ) parts of the page get loaded after a click by xmlhttprequest and this part did not get manipulated by my gre...

How can you determine the file size in JavaScript?

I help moderate a forum online, and on this forum we restrict the size of signatures. At the moment we test this via a simple Greasemonkey script I wrote; we wrap all signatures with a <div>, the script looks for them, and then measures the div's height and width. All the script does right now is make sure the signature resides in a pa...

Find and replace in a webpage using javascript.

What I want to do is replace all instances of 'foo' in a webpage with 'bar' in a JS bookmarklet/greasemonkey script. How can I do this? I suppose jQuery works, as there're hacks to include those in both bookmarklets and greasemonkey scripts. ...

Changing Text : greasemonkey -- Newbie

Hi Geeks , I have a web page wich loads with the following code : <script src="library/js/index.php" type="text/javascript"></script> <script src="library/js/function.js" type="text/javascript"></script> <script src="library/js/template.js" type="text/javascript"></script> <script src="library/js/soundmanager.js" type="...

Log in/out of Gmail chat programmatically, clicking Gmail's span "links"

At work, I use Gmail's chat, since it's encrypted and logs chats without installing or saving anything to the hard drive. At home, I use Pidgin. When I log into GMail at home, I have to log out of chat, or messages will end up in the wrong place. When I log into GMail at work, I have to log back in to chat. In other words, when I sta...

jQuery SO Vote-Object and Scope

This is a javascript question. The fact that it mentions this website is irrelevant. This does not belong on meta. I'm working on a Greasemonkey script to auto-load additional pages of answers onto the first page of answers here at Stackoverflow as you scroll. This is working well. I want to maintain the ability to up-vote/down-vote t...

GreaseMonkey Script

Possible Duplicate: GreaseMonkey Simple Script So I have this page with the html code and I want greasemonkey to replace it by another HTML code that I have. How can it be done ? exemple I have <html> <body> <h1>Cajuda</h1> <p>Oliveira da serra</p> <p>Oliveira da serra</p> <p>Oliveira da serra</p> <p>Oliveira da serra</p> <...

GreaseMonkey editing Page

How can I change a page with this html code : <tr> <td nowrap title="7884">Ontem foi dia de</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td align="right">6,0</td></tr> <tr> to this one using greasemonkey : <tr> <td title="7884" nowrap="nowrap"...

Adding lots of CSS classes to HTML elements

I have a messageboard and one of my users has written a greasemonkey script to stylize various elements within the page. He did a great job with it but in order to make his job easier, the first step in his script is to parse the current page and add several css classes to almost all html elements on the page. most of them aren't used to...

Greasemonkey: Unset a variable

This is a question that has been plaguing me for awhile. In Greasemonkey you can use GM_getValue(name) and GM_setValue(name, value) to store persistent variables. My question is, how do I 'unset' a variable? ...

How do I attach the "select" event to every text node on the page? Is there a better way?

NOTE: Solved my own problem, it seems. See the edits. I am trying to write a greasemonkey script that will highlight all the matching texts on the page when the user selects a text, and then remove the highlighting when the selection is canceled. I am looking for a jQuery way to do this. It seems like there is a select event in the jQue...

How to simulate click on anchor with specific text using javascript in GreaseMonkey?

Suppose I load a webpage which contains the following anchor: <a class="someClass" href="#" onClick="gotoPage('http://somepage.org')"&gt;Link&lt;/a&gt; What I want is: as soon as the page is loaded, I want to generate onClick for this anchor which has text as "Link". Note that the anchor does not contains any id or name associated wi...

Greasemonkey-like Firefox plugin for automatic browsing

Is there a plug-in for Firefox that would allow user's Javascript code like Greasemonkey and be able to browse from page to page? I'd like to write a script to: Log in to a website. Follow several links. Make a GET request to that host periodically with given data and time intervals. Make a POST request based on the results of the pre...

Using jQuery plugins inside Greasemonkey scripts

I am writing a simple GreaseMonkey script that has a jQuery plugin called hoverIntent embedded in it. (I am embedding it rather than hosting it because it's a very small plugin.) My problem: after the plugin attaches its event handler to a DOM object, the event triggers an error message that says: "jQuery is not defined." Is it a scop...

In Greasemonkey/javascript, how can I handle new elements added to page?

I have written a Greasemonkey script which manipulates the contents of certain elements with the following selector: $("span.relativetime").each(function() { $(this).html("TEST"); }); However, sometimes matching elements are added to the page through AJAX, and I don't know how to handle those new elements. I have tried this, but it d...