]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add hooks for JavaScript handling
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 9 Feb 2009 13:24:23 +0000 (08:24 -0500)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 9 Feb 2009 13:24:23 +0000 (08:24 -0500)
EVENTS.txt
lib/action.php

index bd511d75e1c6376830f2b2eb4526e7629be1e3da..68e25fa3b023a1e5c9ac327db6cfe89e3f9b88c0 100644 (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
+
index 36f598c57f714131e5f0a74b4a0841d600aace08..0628dc70db340f1c6457a340e96a71d905661a43 100644 (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));
+        }
     }
 
     /**