Saturday, 31 August 2013

Tampermonkey - Call function from file in require setting

Tampermonkey - Call function from file in require setting

I am using Tampermonkey to execute some javascript, but I got some issue
and I don't undestand what is wrong...
The header file
// ==UserScript==
[...]
// @require
https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js
// @require http://website.net/functions.js
// ==/UserScript==
The first require allow me to set Cookie and in "function.js", there is
some function like :
function NextPage(){
console.log('next page');
window.location.href=$('#next-page').attr('href');
}
On my main file, when I set Cookie, it's working (thanks to the require)
but when I call NextPage(), I have an error "NextPage is not defined".
So, I think the require doesn't work but I don't know why ?
If you need more information, ask me !

No comments:

Post a Comment