Hello,
I am using Chrome 66.0.3359.181 x64 and Tampermonkey 4.6
I can't seem to include any external files in my script.
// ==UserScript==
// @name ScriptZwei
// @namespace http://mywebsite.com
// @version 0.2
// @description try to take over the world!
// @author Me
// @match http://mywebsite.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @include https://mywebsite.com/*
// @grant none
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true); gives me the Error jQuery is not defined and
waitForKeyElements ("jNode", actionFunction); says waitForKeyElements is not defined.
How can I solve this?
In the Extension under Externals the Resources seem to be fine.
I think I am facing the same bug with the editor which reports me the "'$' is not defined" but the script runs without problems. This is really annoying for development because the script editor window is full of false warnings about missing jQuery variable.
Simply define you global variables via globals comment like this:
```JavaScript
/* globals jQuery, $, waitForKeyElements */
````
@derjanb is this documented anywhere?
@wrathofodin
Simply define you global variables via
globalscomment like this
... is this documented anywhere?
Most helpful comment
@wrathofodin
See https://jshint.com/docs/options/#globals