This code was provided to me in another question I asked but I am getting errors right at the start. Here is the part of the code causing the problem:
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
// @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css
// ==/UserScript==
var cssResource = GM_getResourceText("jqUI_CSS");
GM_addStyle(cssResource);
$("#pickMe").datepicker();
The first error I get is “GM_getResourceText is not defined”
If I comment out that, and the next line, then the next error I get is
“uncaught referenceerror $ is not defined.” And I get that on the last line.
It’s like the script is not getting the jQuery stuff from Google.
Any ideas? Thanks!
In Chrome, “Userscripts” are extensions. The easiest way to use external libraries is by configuring the code through a manifest file.
Download
jquery.min.js,jquery-ui.min.jsandjquery-ui.css, and place them in the same directory. Make sure that you resolve the paths of the images (CSS), by replacing all occurrences ofurl(...)withurl(http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/...).Create a
manifest.jsonfile, and add the following content:Create a file called
mycode.js(or any desired name), and add the following content:You can load or pack your extension via
chrome://extensions/, developer mode.