add hooks for JavaScript handling

This commit is contained in:
Evan Prodromou 2009-02-09 08:24:23 -05:00
parent 60bf87bb34
commit 5d246299b6
2 changed files with 41 additions and 12 deletions

View File

@ -9,3 +9,23 @@ StartSecondaryNav: Showing the secondary nav menu
EndSecondaryNav: At the end of the secondary nav menu
- $action: the current action
StartShowScripts: Showing JavaScript links
- $action: the current action
EndShowScripts: End showing JavaScript links; good place to add custom
links like Google Analytics
- $action: the current action
StartShowJQueryScripts: Showing JQuery script links (use this to link to e.g. Google mirrors)
- $action: the current action
EndShowJQueryScripts: End showing JQuery script links
- $action: the current action
StartShowLaconicaScripts: Showing Laconica script links (use this to link to a CDN or something)
- $action: the current action
EndShowLaconicaScripts: End showing Laconica script links
- $action: the current action

View File

@ -179,18 +179,27 @@ class Action extends HTMLOutputter // lawsuit
*/
function showScripts()
{
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.min.js')),
' ');
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.form.js')),
' ');
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/xbImportNode.js')),
' ');
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
' ');
if (Event::handle('StartShowScripts', array($this))) {
if (Event::handle('StartShowJQueryScripts', array($this))) {
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.min.js')),
' ');
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/jquery.form.js')),
' ');
Event::handle('EndShowJQueryScripts', array($this));
}
if (Event::handle('StartShowLaconicaScripts', array($this))) {
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/xbImportNode.js')),
' ');
$this->element('script', array('type' => 'text/javascript',
'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
' ');
Event::handle('EndShowLaconicaScripts', array($this));
}
Event::handle('EndShowScripts', array($this));
}
}
/**