From 79b376f9912891a8748fcbb4580969e4dbf7fc75 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Oct 2008 20:28:18 -0400 Subject: Add an underlay for javascript, and add ikiwiki.js containing some utility code. * Add an underlay for javascript, and add ikiwiki.js containing some utility code. * toggle: Stop embedding the full toggle code on each page using it, and move it to toggle.js in the javascript underlay. --- IkiWiki/Plugin/attachment.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin/attachment.pm') diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index dcac3e820..6c1df488a 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -6,6 +6,7 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + add_underlay("javascript"); hook(type => "getsetup", id => "attachment", call => \&getsetup); hook(type => "checkconfig", id => "attachment", call => \&checkconfig); hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup); @@ -104,10 +105,10 @@ sub formbuilder_setup (@) { #{{{ $form->tmpl_param("field-upload" => ''); $form->tmpl_param("field-link" => ''); - # Add the javascript from the toggle plugin; - # the attachments interface uses it to toggle visibility. + # Add the toggle javascript; the attachments interface uses + # it to toggle visibility. require IkiWiki::Plugin::toggle; - $form->tmpl_param("javascript" => $IkiWiki::Plugin::toggle::javascript); + $form->tmpl_param("javascript" => IkiWiki::Plugin::toggle::include_javascript($params{page}, 1)); # Start with the attachments interface toggled invisible, # but if it was used, keep it open. if ($form->submitted ne "Upload Attachment" && -- cgit v1.2.3