greasemonkey

Checkbox values to textfield using JQuery & Greasemonkey

Hi all, I have a setup looking like this: <div id="problem"> <table id="incident"> <tr> <td><input type="checkbox" value="value1"></td><td>value1</td> <td><input type="checkbox" value="value2"></td><td>value2</td> </tr> </table> </div> ... <input type="text" value="" id="textfield_a01" ma...

How can I mimic Greasemonkey/Firefox's unsafeWindow functionality in Chrome?

I'm just fiddling around with user scripts in chrome right now, so please bear with my potential ignorance/idiocy. In the page I'm writing a script for, there is a <script> element that declares a variable x. Does this mean that, in my user script, I can just access x from the global namespace? For example, if the only line in my users...

Replace some text from any HTML page before it is displayed

I would like to hide any text matching a pattern from any HTML page, before it is displayed. I tried something like that with Greasemonkey : var html = document.body.innerHTML; html = html.replace( /some pattern/g, '???' ); document.body.innerHTML = html; The text I want to hide is correctly replaced with '???', but for a brief momen...

Adding a new script file to a page using GreaseMonkey

My employer is blocking the Google CDN domain that provides the jQuery file to so many websites: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js I want to use GreaseMonkey to provide that jQuery reference from a different domain. Is this possible? Can I use a GreaseMonkey script to tell a page to load it's jQuery refer...

JavaScript iframe busting

In certain conditions, I have a web page that gets opened in an iframe. When it's loaded into that iframe, I need it to set the window location to a resource to download a file (all of this in an attempt to make an update for a GreaseMonkey script... all legit, btw). Unfortunately, when I do: top.location.href = "http://userscripts.org/...

jQuery.getJSON inside a greasemonkey user script

I am attempting to write a user script that makes a cross domain AJAX request. I have included jQuery inside my script using @require and everything seems to be working fine up until the point where I try to run jQuery.getJSON. The API I am accessing supports jsonp, however I keep getting an error stating jsonp123456789 is not defined....

Greasemonkey Storage

Is there any limit on how much data can be stored using GM_setValue? ...

Why the js code works in a web page but fails in GreaseMonkey?

I created a hidden frame as follows: var oHiddenFrame = null; if(oHiddenFrame == null){ oHiddenFrame = document.createElement("iframe"); oHiddenFrame.name = "hiddenFrame"; oHiddenFrame.id = "hiddenFrame"; oHiddenFrame.style.height = "0px"; oHiddenFrame.style.width = "0px"; oHiddenFrame.style.position = "absolute"; oHiddenFrame.style.vis...

How to use hidden iframe connect to the server in GreaseMonky

First,I created a hidden frame like this: var oHiddenFrame = null; if(oHiddenFrame == null){ oHiddenFrame = document.createElement("iframe"); oHiddenFrame.name = "hiddenFrame"; oHiddenFrame.id = "hiddenFrame"; oHiddenFrame.style.height = "0px"; oHiddenFrame.style.width = "0px"; oHiddenFrame.style.position = "absolute"; oHi...

Greasemonkey against an iframe using @include - does this work?

I'm wondering if you can have Greasemonkey execute against an iframe only and not it's parent window. The parent window is domain A, the iframe is domain B, and the include in the script would be @include http://domain-B.com/path/*. I don't need any interaction with the parent. I've tried this a couple of times without success. Is there...

Greasemonkey how to apply a CSS rule only for @media print?

I'm using Greasemonkey and JQuerys #css method to add css styles to a page. Script so far: // ==UserScript== // @name www.al-anon.dk Remove inline scroll so that page content prints properly // @namespace http://userscripts.org/users/103819 // @description remove scroll from al-anon pages // @include http://al-a...

Insert link with text from another link greasemonkey

What I want to do is insert a link and img for every thread of this forum I use. The href of the link should be based on the href of a child of the element. Here is a partial view of the HTML, I've taken out some things for clarity, let me know if I've taken too much. The very last tag repeats 20 or so times, depending how much threads ...

Using greasemonkey and/or gmail API to reduce width of mail pane.

Hi there. I'm on my way to creating a greasemonkey script for gmail. The first thing I want to play with is reducing the size of 'main' pane. This is where either the list of emails are or where the email message is being displayed. Using Firebug, I can find two separate instances of a "<div class="nH nn" style="width: 1013px;">" tag....

Execute Function On First Run Of Greasemonkey Script

How can I run a function upon the first run of a greasemonkey script? ...

GreaseMonkey onclick binding

When I write a GreaseMonkey script, if I create a div and set onclick to alert it works: var btn = document.createElement('div'); btn.setAttribute('onclick',"alert('clicked!');"); However, if I ask it to do something else that was defined earlier then it fails: function graphIt() {...}; var btn = document.createElement('div'); btn....

Replacing text only within the within the specified node, and not within child nodes.

I found a GreaseMonkey script on Userscripts which corrects spelling and some grammar which I'm trying to improve for use on Reddit etc. I've had some help from there improving it, and this is my current version which does work quite well. There is, however, a problem in that it capitalises italics, bold and links. I would like to have...

Closure in Javascript

I have 100 elements with ids divNum0,...,divNum99. Each when clicked should call doTask with the right parameter. The code below unfortunately does not close i, and hence doTask is called with 100 for all the elements. function doTask(x) {alert(x);} for (var i=0; i<100; ++i) { document.getElementById('divNum'+i).addEventListener('c...

Problem with jQuery data() function in GreaseMonkey

I'm trying to use jQuery's data() function to store and retrieve data on an element. I want to retrieve the data stored in a textarea whenever the user enters the space bar1. However, everytime I do this I get undefined back from data(). Now, if I define exactly the same Javascript in the HTML, it works as expected. Is there some "go...

Is nested XMLHttpRequests with multiple closures a good idea?

I have a Greasemonkey script which operates on a search results page at a video site. The function of the script is to take a javascript link that opens a new window with a flash player, jump through some redirection hoops, and insert a regular link to the desired FLV file. I have changed the script to do silly but structurally equival...

Cloning a css style from a style sheet using jquery/greasemonkey

I am writing a Greasemonkey script using jquery, and I want to add information from multiple pages, but the object i want to load is a div with an Id, is there any way I can retrieve the style information, so that I can apply it to the added sections? ...