$Footer->AddScript('javascript.js'); in addition to the $Head->AddScript('javascript.js'); we already have. That way, scripts that can be deferred until the content has loaded could be specified to go in the footer. Then we'd have 2 big JS files, one set in the head and one set in the footer. Thoughts? $Head->AddScript('js/jquery.js', '~', 190);
$Head->AddScript('extensions/MyExtension/functions.js', '~', 350);
If you are using MooTools, you have to guess since the framework or the plugins Vanilla 1.2 includes don't use MooTools.$Context->RegisterScript('extension/Myextension/function.js', ['js/jquery.js']);
$Page->Require(''extension/Myextension/function.js'')
About js and themes, there are patterns that allow default settings to be customised:
(function($){
$.askConfirmation = {
selector: definition('askConfirmation.selector', 'form.important'),
prompt: definition('askConfirmation.prompt', 'Are you sure?'),
init: function() {
var self = $.askConfirmation,
e = $.Event("askConfirmationInitStarting");
$(window).trigger(e);
if ( e.isDefaultPrevented() ) {
return;
}
$(self.selector).submit(self.onSubmit);
},
onSubmit: function() {
return confirm($.askConfirmation.prompt);
}
};
$().ready($.askConfirmation.init);
})(jQuery.noConflict());
To overwrite the selector, the theme can add the following script at the end of the head element:
jQuery(window).bind('askConfirmationInitStarting', function() {
jQuery.askConfirmation.selector = 'form.very.import';
});
Or If I understand what Garden's "definition()" can be used for, it can just add an entry for the "askConfirmation.selector" definition. It looks like you're new here. If you want to get involved, click one of these buttons!