-1

I am trying to create a script that automatically votes a photo for a contest when I load the page (no illicit stuff, I can vote once per day :D).

The script is as follows:

window.onload = function() {

  var jq = document.createElement('script');
  jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
  document.getElementsByTagName('head')[0].appendChild(jq);

  console.log("Enters here");


  $link = $('.photo_vote'); 
  $link[0].click();
  console.log("Enters here too");
}

If i run this script on the Mozilla console, it works perfectly. However, if I try to autorun it using greasemonkey or scriptish, it doesn't click on the vote button. Also the second echo isn't printed either.

Can someone help me with that?

1

1 Answer 1

0

You should include jQuery directly into the Greasemonkey @require container - I don't think you can run that code directly in the GM sandbox. http://wiki.greasespot.net/Third-Party_Libraries

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.