summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-09-23 23:23:13 -0400
committerEvan Prodromou <evan@status.net>2009-09-23 23:23:13 -0400
commita5ed805aeabab3930d066b2777dbab9663bc487f (patch)
tree873304b61be066cc33df4cf1b0bc97dc222826e5
parent543e3e797277526ac0f0c6ac99be64897955258a (diff)
move scripts to just before </body>, add event for scripts that need to be in <head>
-rw-r--r--EVENTS.txt6
-rw-r--r--lib/action.php19
2 files changed, 17 insertions, 8 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index 68cb28603..dfaf34a66 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -134,3 +134,9 @@ StartAddressData: Allows the site owner to provide additional information about
EndAddressData: At the end of <address>
- $action: the current action
+
+StartShowHeadElements: Right after the <head> tag
+- $action: the current action
+
+EndShowHeadElements: Right before the </head> tag; put <script>s here if you need them in <head>
+- $action: the current action
diff --git a/lib/action.php b/lib/action.php
index 670eb498c..ebc812aca 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -120,14 +120,16 @@ class Action extends HTMLOutputter // lawsuit
{
// XXX: attributes (profile?)
$this->elementStart('head');
- $this->showTitle();
- $this->showShortcutIcon();
- $this->showStylesheets();
- $this->showScripts();
- $this->showOpenSearch();
- $this->showFeeds();
- $this->showDescription();
- $this->extraHead();
+ if (Event::handle('StartShowHeadElements', array($this))) {
+ $this->showTitle();
+ $this->showShortcutIcon();
+ $this->showStylesheets();
+ $this->showOpenSearch();
+ $this->showFeeds();
+ $this->showDescription();
+ $this->extraHead();
+ Event::handle('EndShowHeadElements', array($this));
+ }
$this->elementEnd('head');
}
@@ -352,6 +354,7 @@ class Action extends HTMLOutputter // lawsuit
Event::handle('EndShowFooter', array($this));
}
$this->elementEnd('div');
+ $this->showScripts();
$this->elementEnd('body');
}