greasemonkey

How can I pop up a element from a website into a windows with Greasemonkey?

Hey, I want to pop up an image or a div/class from a website into a window with Greasemonkey, how can I do it? For example, I want to pop up the stackoverflow logo to a small window (the size of the logo) when I enter the site. ...

Problems with Too many connections

I am using GM_xmlhttpRequest (greasemonkey xmlhttpRequest) to communicate with my app. Every half second it sends some json to update the status of a page. I am running 3 pages in FireFox. Using netstat -a i got these results. This is over 200 lines. Why am i using so many ports!?! How can i... not do this? and still communicate with my...

Greasemonkey & global variables

Hello everyone! I'm noob with JavaScript and Greasemonkey and I'd like to write a simple script. I know that Greasemonkey wraps your code with an anonymous function so your variables won't exist after leaving the current page. However, I need a global variable. I tried to use the unsafeWindow and window objects something like this: i...

How to write a greasemonkey script to remove a confim dialog?

I wanted to write a very simple greasemonkey script because I hate the "are you sure?" javascript confirmation on a site I use a lot. I figured it would be pretty easy since I do use javascript a lot, this is my first greasemonkey script though. I'm just going to use it for personal use, not going to publish it or anything. After some go...

setTimeout not working in Greasemonkey user script when JS disabled in browser

I'm working on a project that requires my user script be run on pages as they are rendered without executing any of the page's JavaScript. That is to say, we need to browse with JavaScript disabled. I've encountered a problem though when I try to delay execution of a function within my script. Whenever I make a call to window.setTimeou...

can i remove the X-Requested-With header from ajax requests?

I wanted to know if anyone has had experience with trying to remove the 'X-Requested-With' header from the ajax request made by jquery (or plain JS). is it possible? 2nd part: do you know if Grease Monkey's ajax requests set this header? Thanks header looks like this: X-Requested-With XMLHttpRequest ...

Javascript / XPath error.

I was experimenting around with XPath, basically I'm trying to load a HTML page using XMLHttpRequest and select an element inside it from its XPath. Here's my code (Greasemonkey/Js): GM_xmlhttpRequest({ method: 'GET', url: url, headers: { 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey', 'Accept': 'application/atom+xml,app...

Greasemonkey, Chrome and unsafeWindow.foo()

I have the following anchor tag, which contains dynamically-generated arguments arg1,...,arg5 to the JavaScript function foo(), which runs on the web site-side. There are several of these anchor tags throughout the page in question, with unique id values and argN values: <a href="#" id="foo1234567890" onclick="javascript:foo(arg1,arg2,a...

Accessing <span> node in Javascript

I'm trying to write a greasemonkey script that only displays photos with the tags bacon. The site it runs on is written like so: <div class="photos"> <ul> ... <li> <a href="photo1"> <img src="http://somesite.co/photo1.jpg" </a> <br /> <a href="tags_photo1"> <span class="tags">&nbsp;bacon, delicious&nbsp;</span> </a> </li> ... </ul> </...

greasemonkey adding onclic event to button

I am attaching onclick event on dynamically created button but the event is not firing. var ind = location.href.indexOf('http://www.abc.com/'); function init(){ alert('h'); } if(ind != -1){ var elem = document.createElement("input"); elem.id ='btnGumb'; elem.value = 'Select Check box'; elem.type = 'button'; ...

Fetching xml with GM_xmlhttpRequest

I'm trying to retrieve a page with greasemonkey and then extract a link from it, inserting the link into the current page. I'm having some trouble with: GM_xmlhttpRequest({ method: "GET", url: "http://www.test.net/search.php?file=test", onload: function(data) { if (!data.responseXML) { data.responseXML = new DOMParser...

Implementing Google Custom Search API through Greasemonkey

Hi everyone, I want to implement the Google custom search API with Greasemonkey, and so far my trials have met with mostly failures. The goal of the code is to inject a custom search box into an existing site (I'm trying to do this for MATLAB's documentation pages, but the injected code should really work with any site). I have attempte...

safari 5 extension - javascript problem - safari seems to cache the page and the DOM state

I've written a greasemonkey javascript that works fine in NinjaKit the new Safari userscript manager, but when I try and compile the same script using the Safari 5 extension builder I get some very weird behaviour. The script gives the user an options editing screen, when you click the save button, the script saves the users preferences...

GreaseMonkey Document.Write or post HTMl at end?

I am trying to use document.write(html); in my script but it looks illegal. I would like to write some html at the end of my document in a GM script. How do i do this? ...

Detect when Gmail has finished loading using jQuery and GreaseMonkey

I'm trying to add some jQuery stuff to Gmail using a GreaseMonkey script. Adding jQuery functionality works fine, but the problem is that I can't really detect when Gmail has finished loading. This is basically what happens: I refresh Gmail The loading window starts The GM script starts 3 times, during the loading window Something in ...

XPath choking on entities in Firefox / GreaseMonkey

Hi there. I am writing a fairly basic GreaseMonkey script that locates text in a specific element and then uses that text to do things later. The relevant bits of code are as follows: In the HTML there is a span with the class 'someclass', which contains a small string of text: <span class="someclass">some text</span> Then in the Jav...

How to debug Greasemonkey script with the Firebug extension ?

Hi, I didn't find a way to debug Greasemonkey scripts with the Firebug extension. Does anyone know how to do this ? Thanks. ...

Greasemonkey: setting form values is not working in Firefox

This works flawlessly under Chrome, but in Firefox the fields don't populate until the SECOND time I hit submit on the page (after it comes back from the first time telling me invalid user/pass). What am I missing? This is my code for the Greasemonkey script: document.getElementById('loginBtn').addEventListener('click', function (even...

Duplicate greasemonkey script doesn't work - inexplicable.

This is just too bizarre. I'm new to Greasemonkey, but I downloaded a script from userscripts.org and it works fine. I then created a duplicate of that script using 'New User Script' from the GM menu and then pasted the original script into the new script. I then disable the old script and enable the new script and the new script doesn...

Event when window.location.href changes

I'm writing a greasemonkey extension for a site which at some point modifies location.href. How can I get an event (via window.addEventListener or so) when window.location.href changes on a page? I also need access to the DOM of the document pointing to the new/modified url. I've seen other solutions which involves timeouts and polling...