17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1679 Views |
-
Disableing javaScript Libraries?

24 July 2008 at 7:49pm
How can I disable the the following javaScript libraries:
<script type="text/javascript" src="jsparty/loader.js"></script>
<script type="text/javascript" src="jsparty/prototype.js"></script>
<script type="text/javascript" src="jsparty/behaviour.js"></script>
<script type="text/javascript" src="jsparty/prototype_improvements.js"></script>
<script type="text/javascript" src="jsparty/tabstrip/tabstrip.js"></script>
<script type="text/javascript" src="jsparty/scriptaculous/effects.js"></script>In my site, but obviously leave them for the CMS backend?
Cheers
-
Re: Disableing javaScript Libraries?

24 July 2008 at 10:15pm
You need to use a method called Requirements::block(the file name);. You would put this in your in the init() function Page_Controller class in Page.php.
So you would need
Requirements::block("jsparty/loader.js");
..for each JS file you want to block on the front end.
-
Re: Disableing javaScript Libraries?

6 December 2008 at 11:54pm Last edited: 6 December 2008 11:59pm
Hi, so if I want to add a js, or a new css to load, do I just add in a requirement?
I want to load
slider.css
and
slider.jse.g.
Requirements::themedCSS("slider");
Requirements:
"jsparty/slider.js"); -
Re: Disableing javaScript Libraries?

6 December 2008 at 11:57pm Last edited: 6 December 2008 11:59pm
This is what my page.php looks like at the moment
<?php
class Page extends SiteTree {
static $db = array(
);
static $has_one = array(
);
}class Page_Controller extends ContentController {
function init() {
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}
}?>
So can I add to the list
Requirements::themedCSS("slider");
Requirements:
"jsparty/slider.js");thanks!
-
Re: Disableing javaScript Libraries?

7 December 2008 at 12:11am
The best way to to keep your own JS in themes/yourthemename/javascript. And you would include it like
Requirements::javascript("themes/yourthemename/javascript/slider.js");
in the function init() just like the rest of the Requirements
-
Re: Disableing javaScript Libraries?

7 December 2008 at 12:26am
Thanks for the quick reply! this helps. I tried coding it into the template, and it also works, but I think coding it in page.php sounds like a better way to do it.
Another quick question, any idea why my log-in page login name/openID tabs doesn't hide in Firefox anymore?
http://www.kudesign.co.nz/studio/Security/login
I looked at the tabstrip.js, and tabstrip.css, they seem to be working fine... just won't hide in Firefox. Any tip will be much appreciated!!
| 1679 Views | ||
|
Page:
1
|
Go to Top |



