aboutsummaryrefslogtreecommitdiff
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
parent1289beb53ba11693cba6d74c5a7da5c29e7cf7fa (diff)
downloadikiwiki-edfbd7e1aa8f9f2cb789f45c0668a0d987e0b368.tar
ikiwiki-edfbd7e1aa8f9f2cb789f45c0668a0d987e0b368.tar.gz
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.
-rw-r--r--IkiWiki/Plugin/toggle.pm4
-rw-r--r--debian/changelog2
-rw-r--r--templates/editpage.tmpl3
3 files changed, 5 insertions, 4 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};
diff --git a/debian/changelog b/debian/changelog
index 314415788..e6ffa17de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ ikiwiki (2.52) UNRELEASED; urgency=low
uploads by default. (An anti-DOS measure.)
* toggle: Add support for toggles that are open by default.
* toggle: Fix to work in preview mode.
+ * 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.
-- Joey Hess <joeyh@debian.org> Mon, 30 Jun 2008 19:56:28 -0400
diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl
index 42d61c188..f8eda1b47 100644
--- a/templates/editpage.tmpl
+++ b/templates/editpage.tmpl
@@ -1,3 +1,4 @@
+<TMPL_VAR JAVASCRIPT>
<TMPL_IF NAME="PAGE_CONFLICT">
<p>
<b>Your changes conflict with other changes made to the page.</b>
@@ -85,5 +86,3 @@ Optional comment about this change:<br />
<TMPL_VAR PAGE_PREVIEW>
</div>
</TMPL_IF>
-
-<TMPL_VAR JAVASCRIPT>