aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-02 15:33:52 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-02 15:33:52 -0400
commite9982352406c2c10a8d36f8df60d44d12c2dbc3d (patch)
tree207238b3d6fe0308bca2160b1405352dc3181f79
parented25c2abf259ad1e4f307f0656175a90906b93ba (diff)
downloadikiwiki-e9982352406c2c10a8d36f8df60d44d12c2dbc3d.tar
ikiwiki-e9982352406c2c10a8d36f8df60d44d12c2dbc3d.tar.gz
export javascript, and support default-open toggles
-rw-r--r--IkiWiki/Plugin/toggle.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm
index 8089443e0..54c9a0d9a 100644
--- a/IkiWiki/Plugin/toggle.pm
+++ b/IkiWiki/Plugin/toggle.pm
@@ -9,7 +9,7 @@ use IkiWiki 2.00;
# of css to hide toggleables, to avoid any flashing on page load. The css
# is only emitted after the javascript tests that it's going to be able to
# show the toggleables.
-my $javascript=<<'EOF';
+our $javascript=<<'EOF';
<script type="text/javascript">
<!--
if (document.getElementById && document.getElementsByTagName && document.createTextNode) {
@@ -21,7 +21,8 @@ function inittoggle() {
var as = getElementsByClass('toggle');
for (var i = 0; i < as.length; i++) {
var id = as[i].href.match(/#(\w.+)/)[1];
- document.getElementById(id).style.display="none";
+ if (document.getElementById(id).className == "toggleable")
+ document.getElementById(id).style.display="none";
as[i].onclick = function() {
toggle(this);
return false;