solved jQuery

Rich (SP)
Rich (SP)
@rich-sp
10 years ago
8 posts
Where would I put jQuery plugins? Let's say I have a simple jquery snippet like $('.title').hide();

Is there a designated place in the JR backend for this?

Update: I've worked out that I can add to the /skins/MYSKIN/js file, but my guess is no place on the backend admin pages.

thanks
SP

updated by @rich-sp: 02/13/15 08:15:34PM
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
That's it, in the skin or module js file, or as a link in a template.

Or you can create a really simple module with just the init function (to register the js file) and the js file itself.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
Rich (SP)
Rich (SP)
@rich-sp
10 years ago
8 posts
Thanks!
michael
@michael
10 years ago
7,797 posts
If you wanted to add another file to the skins /js directory you can get it included in the main compressed .js file by adding that file to the skins include.php file.

eg:
/skins/jrElastic/include.php contains this in the include.php files _init() function:
// Register our Javascript files with the core
jrCore_register_module_feature('jrCore', 'javascript', 'jrElastic', 'responsiveslides.min.js');
jrCore_register_module_feature('jrCore', 'javascript', 'jrElastic', 'jrElastic.js');
That tells the core to include a 'javascript' file found at
/skins/jrElastic/js/
into the main file.

So the first line includes a file called responsiveslides.min.js
/skins/jrElastic/js/responsiveslides.min.js
The second includes:
/skins/jrElastic/js/jrElastic.js

You can add whatever you need. CSS files are added the same but from the /css directory. You will see examples earlier in that _init() function.
updated by @michael: 01/13/15 05:05:24PM
Rich (SP)
Rich (SP)
@rich-sp
10 years ago
8 posts
Thanks Michael, useful to know.

Tags