Skip to content

Instantly share code, notes, and snippets.

@Ventero
Created January 26, 2014 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ventero/8640014 to your computer and use it in GitHub Desktop.
Save Ventero/8640014 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GM_getResourceText ScriptChannel behavior
// @namespace test
// @version 1.0
// @include *
// @grant GM_getResourceText
// @grant GM_getResourceURL
// @resource script.user.js http://dump.ventero.de/greasemonkey/resource
// ==/UserScript==
if (typeof GM_getResourceText === "undefined") {
console.log("in content scope");
} else {
console.log(GM_getResourceText("script.user.js"));
var s = document.createElement("script");
s.src = GM_getResourceURL("script.user.js");
// Expected result: the resource content will be evaluated, which would log
// "Example resource text" to the console.
// Actual result: this script's content will be evaluated, logging
// "in content scope"
document.body.appendChild(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment