1

I would like to click on this link using Greasemonkey:

<a class="bbbx-button bbbx-button-grey" id="vote-button" data-bbbx-trigger="module.vote.submit" data-bbbx-id="51526" data-bbbx-score="10" data-bbbx-vote-type="up"><img src="//du3rc6beq6sv9.cloudfront.net/release1406643004647-5-1-2-1/assets/skins/default/images/vote/heart.png"> vote! <small id="vote-count">( 14 )</small></a>

I tried this code:

// ==UserScript==
// @name        test
// @namespace   test
// @include     *
// @version     1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant       GM_addStyle
// ==/UserScript==
console.log("Start");


window.setTimeout(start, 7000);

function start()
{
    $("a#vote-button")[0].click();

    console.log("End clicktime");
}

But unfortunately I can't find the problem.

Scripter
  • 558
  • 2
  • 8
  • 20

1 Answers1

1

You don't have jQuery loaded in your GM script.

Add this:

// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js

Feel free to change the version.

Have a look at this question, it also provides some solutions for websites that already have jQuery loaded: How can I use jQuery in Greasemonkey?

Community
  • 1
  • 1
Silviu Burcea
  • 5,103
  • 1
  • 29
  • 43