load jQuery in firefox 2.x on local computer

in Script development
Subscribe to load jQuery in firefox 2.x on local computer 7 posts, 4 voices



bernte User
FirefoxWindows

i'm using Firefox 2.0.0.11 and Greasemonkey 0.8.x and the latest jQuery (1.3.2) version that works with Greasemonkey 0.8 (??) and try to load this Userscript:

// ==UserScript==
// @name        TEST
// @include     *
// @require     jquery.min.js
// @grant       GM_getValue
// ==/UserScript==

$(document).ready(function(){
    alert('jQuery!');
}); 

but i recieve the error:

Error: $ is not defined
Source File: file:///G:/Firefox/Data/profile/gm_scripts/huhu/huhu.user.js
Line: 8

I want to load jQuery on a local pc with no internet connection.
I can't edit the orignal local html-files to add:

<###script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script###>

I have copied jquery.min.js in the same folder where the userscript is.

G:/Firefox/Data/profile/gm_scripts/huhu/jquery.min.js

any ideas where is the problem? or what i've done wrong?

regards bernte

 
Vivre Scriptwright
FirefoxX11

Hi,
I'm also using older FF / GM.
1. I'm always having trouble with scripts that use '$' to sign variables, and have no solution for that one
2. I'm also having issues with @require stuff

My solution is to paste the whole jquery-code into the script first of all (after header / or proceeding the code which needs it) and it works fine. Mind you - I don't use auto-updating of scripts so they don't get corrupted, likewise I check on updates if the required file is still the same.

greets Vivre

 
AmpliDude Scriptwright
FirefoxWindows

You need to install the script (drag and drop onto the browser window) with valid require path, like this:

// ==UserScript==
// @name        TEST
// @include     *
// @require     file:///c:/jquery.min.js
// @grant       GM_getValue
// ==/UserScript==

$(document).ready(function(){
    alert('jQuery!');
});

Before installing make sure you have jquery.min.js on disk C:\
Note: after installing script you can delete the file from C:\, it will be loaded from the script folder.

Note2: I'm not sure if GM allows to use file:/// as require - personally I use Scriptish, which works with newer versions of jQuery.

 
ComSwitch Scriptwright
FirefoxX11

@AmpileDude wrote:
... file:///c:/ ...

@require from file:// source should not work.

But simply you put two files in a folder.
mygmscript.user.js and jquery.min.js
for your example the require is defined in this way // @require jquery.min.js
then you load the mygmscript with Datei-->Open

 
bernte User
FirefoxWindows

// ==UserScript==
// @name        TEST
// @include     *
// @require     jquery.min.js
// @grant       GM_getValue
// ==/UserScript==

$(document).ready(function(){
    alert('jQuery!');
});

does not work... i have dropped this script into firefox.. and i get a errormessage (can't install) then i removed require path and installed it.
after installing i added the line require into the file. but thats not the trick..
any other ideas?

thanks for your help

 
Vivre Scriptwright
FirefoxX11

Editing the header of the already installed file doesn't help, as this info is only read once by GM on installation.
GM has it's own 'meta-file' /gm_scripts/config.xml wherin all script-relevant settings are noted. This is read on Browser/GM start.
You can edit this file if GM is not activ (better if browser doesn't run).
Therein you'd find something like:

<Include>http://userscripts.org/scripts/*/*</Include>
<Include>https://userscripts.org/scripts/*/*</Include>
<Exclude>http://userscripts.org/scripts/version/*</Exclude>
<Require filename="69307.js"⁄>
<Require filename="61794user.js"⁄>

Find your Script filename="... and add a require line to it. The required js-file should be placed in the folder where the specific script is.

Be carefull when doing this and maybe make a complete save-copy of /gm_scripts first.

 
ComSwitch Scriptwright
FirefoxX11


@bernte wrote
... cant install ...

I can install. GM Version 1.0