forked from GNUsocial/gnu-social
add hooks for JavaScript handling
This commit is contained in:
parent
60bf87bb34
commit
5d246299b6
20
EVENTS.txt
20
EVENTS.txt
@ -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
|
||||
|
||||
|
@ -179,18 +179,27 @@ class Action extends HTMLOutputter // lawsuit
|
||||
*/
|
||||
function showScripts()
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user