From edfbd7e1aa8f9f2cb789f45c0668a0d987e0b368 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 2 Jul 2008 16:14:18 -0400 Subject: 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. --- IkiWiki/Plugin/toggle.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki') 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!(
)
!$1!g) { $params{content}=~s/
//g; - if (! ($params{content}=~s!^<\/body>!$javascript!m)) { + if (! ($params{content}=~s!^!$javascript!m)) { # no tag, probably in preview mode - $params{content}.=$javascript; + $params{content}=$javascript.$params{content}; } } return $params{content}; -- cgit v1.2.3