Forums / Cotonti / Core Labs / Archive / Load Chili files on demand

Orkan
#1071 2008-09-16 19:26
Hi :)
Im back with an incredible solution how to load not only Chili but all jQuery plugins on demand. This is the plugin Im referring to: http://plugins.jquery.com/project/Plugin

I've made some tests with Chili and it works like a dream!
Heres the test page you can check out:
6-jquery_lazy_load.rar
(http://www.cotonti.com/datas/users/6-jquery_lazy_load.rar)

LOL, whats wrong with this bbcode parser?
http://www.cotonti.com/datas/users/6-jquery_lazy_load.rar

Also I've made a decision to change the directory structure a bit for javascript files.
You can see my idea in rar file.

mainly "dev" folder is for uncompressed javascript files - good for debugging or svn diff
and "prod" is for production

This should go to header.tpl
<script type="text/javascript">
var jQueryBase = location.host.match(/localhost/i) ? "./javascript/jquery/dev/" : "./javascript/jquery/prod/";
document.write(unescape("%3Cscript type='text/javascript' src='" + jQueryBase + "jquery.js'%3E%3C/script%3E"));
document.write(unescape("%3Cscript type='text/javascript' src='" + jQueryBase + "jquery.plugin.js'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
$.plugin.defaults.base = jQueryBase;
$.plugin.defaults.ext = ".js";
</script>

PS. use "view plain" button to see the correct code, because something wrong with Chili here (repeated lines 3 & 4)
Again problem in html.js - with recipes.js everything works as expected.
Perl - the only language that looks the same before and after RSA encryption.
This post was edited by Orkan (2008-09-16 20:06, 15 years ago)