Tampermonkey: required Scripts not being included

Created on 3 Jun 2018  路  4Comments  路  Source: Tampermonkey/tampermonkey

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.

Most helpful comment

@wrathofodin

Simply define you global variables via globals comment like this

... is this documented anywhere?

See https://jshint.com/docs/options/#globals

All 4 comments

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.

https://s3.sbarnea.com/ss/180831-Gerrit_Zuul_Status_.png

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 globals comment like this

... is this documented anywhere?

See https://jshint.com/docs/options/#globals

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tick97115115 picture tick97115115  路  3Comments

selevo picture selevo  路  5Comments

RussiaVk picture RussiaVk  路  4Comments

AlfonsoML picture AlfonsoML  路  4Comments

devnoname120 picture devnoname120  路  7Comments