summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/toggle.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-02 16:14:18 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-02 16:14:18 -0400
commitedfbd7e1aa8f9f2cb789f45c0668a0d987e0b368 (patch)
tree9bf2477b03f969620baf550ef9fc6cbc2d83695f /IkiWiki/Plugin/toggle.pm
parent1289beb53ba11693cba6d74c5a7da5c29e7cf7fa (diff)
toggle: Add javascript to top of page, not to end. This avoids flicker since closed toggles will not be displayed as the page is loading.
Diffstat (limited to 'IkiWiki/Plugin/toggle.pm')
-rw-r--r--IkiWiki/Plugin/toggle.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm
index f969d7686..284eb8249 100644
--- a/IkiWiki/Plugin/toggle.pm
+++ b/IkiWiki/Plugin/toggle.pm
@@ -108,9 +108,9 @@ sub format (@) { #{{{
if ($params{content}=~s!(<div class="toggleable(?:-open)?" id="[^"]+">)</div>!$1!g) {
$params{content}=~s/<div class="toggleableend">//g;
- if (! ($params{content}=~s!^<\/body>!$javascript</body>!m)) {
+ if (! ($params{content}=~s!^<body>!<body>$javascript!m)) {
# no </body> tag, probably in preview mode
- $params{content}.=$javascript;
+ $params{content}=$javascript.$params{content};
}
}
return $params{content};