2

I'm trying to modify a variable - which is created in javascript - and run a function to change some visual stuff on a page. But my greasemonkey script is - i guess - running before the javascript, i'm getting an error says function is not defined.

How can I force to run my script after the javascript runs?

Actually what I'm trying to do is very simple. There is a variable called cursort, what I want to do is change that to "data-price" and sort the list again using updateSort(). Here is the code:

var cursort = "data-price";
updateSort();
wunnle
  • 39
  • 1
  • 5

1 Answers1

0

I had to do something similar, there was a object defined at the end of the page that I wanted to just cancel out, so it's functions wouldn't run (it captured link clicks and ran some stuff). In the page it was defined like this:

var someObj = { ... }

I made a greasemonkey script (after much trial/error) that looked like this.

window.addEventListener ("load", runAfter, false);
function runAfter() {
    unsafeWindow.someObj = null;
}

Now clicking on the links does not trigger all the other actions that were in someObj.

Maybe you can do something like that?

Karen
  • 2,296
  • 3
  • 18
  • 19
  • This is exactly what i've tried. It perfectly made sense, but it does not work for some reason. – wunnle Jan 18 '14 at 08:10