From 5d246299b630c55d98cc03eeb650561defbeeff4 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 9 Feb 2009 08:24:23 -0500 Subject: add hooks for JavaScript handling --- lib/action.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'lib/action.php') diff --git a/lib/action.php b/lib/action.php index 36f598c57..0628dc70d 100644 --- a/lib/action.php +++ b/lib/action.php @@ -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)); + } } /** -- cgit v1.2.3-54-g00ecf