diff options
author | Simon McVittie <smcv@debian.org> | 2010-11-23 00:06:07 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2010-11-23 00:06:07 +0000 |
commit | 78c595736ef6903ad8e7bab232875474aedfd328 (patch) | |
tree | dd6152b028cb072e57cc69cb3c4961afd698643f /IkiWiki | |
parent | d2e3741a6f289bd25b75683990a0548f41661a85 (diff) | |
download | ikiwiki-78c595736ef6903ad8e7bab232875474aedfd328.tar ikiwiki-78c595736ef6903ad8e7bab232875474aedfd328.tar.gz |
Use local paths when including Javascript
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/relativedate.pm | 11 | ||||
-rw-r--r-- | IkiWiki/Plugin/toggle.pm | 11 | ||||
-rw-r--r-- | IkiWiki/Plugin/wmd.pm | 9 |
3 files changed, 14 insertions, 17 deletions
diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index 7296889ab..4ae0be861 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -28,18 +28,17 @@ sub format (@) { if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) { # no <body> tag, probably in preview mode - $params{content}=include_javascript($params{page}, 1).$params{content}; + $params{content}=include_javascript(undef).$params{content}; } return $params{content}; } -sub include_javascript ($;$) { - my $page=shift; - my $absolute=shift; +sub include_javascript ($) { + my $from=shift; - return '<script src="'.urlto("ikiwiki/ikiwiki.js", $page, $absolute). + return '<script src="'.urlto("ikiwiki/ikiwiki.js", $from). '" type="text/javascript" charset="utf-8"></script>'."\n". - '<script src="'.urlto("ikiwiki/relativedate.js", $page, $absolute). + '<script src="'.urlto("ikiwiki/relativedate.js", $from). '" type="text/javascript" charset="utf-8"></script>'; } diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm index 1f93f87fe..af4d2ba3a 100644 --- a/IkiWiki/Plugin/toggle.pm +++ b/IkiWiki/Plugin/toggle.pm @@ -70,19 +70,18 @@ sub format (@) { $params{content}=~s/<div class="toggleableend">//g; if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) { # no <body> tag, probably in preview mode - $params{content}=include_javascript($params{page}, 1).$params{content}; + $params{content}=include_javascript(undef).$params{content}; } } return $params{content}; } -sub include_javascript ($;$) { - my $page=shift; - my $absolute=shift; +sub include_javascript ($) { + my $from=shift; - return '<script src="'.urlto("ikiwiki/ikiwiki.js", $page, $absolute). + return '<script src="'.urlto("ikiwiki/ikiwiki.js", $from). '" type="text/javascript" charset="utf-8"></script>'."\n". - '<script src="'.urlto("ikiwiki/toggle.js", $page, $absolute). + '<script src="'.urlto("ikiwiki/toggle.js", $from). '" type="text/javascript" charset="utf-8"></script>'; } diff --git a/IkiWiki/Plugin/wmd.pm b/IkiWiki/Plugin/wmd.pm index 71d7c9d17..134cfb910 100644 --- a/IkiWiki/Plugin/wmd.pm +++ b/IkiWiki/Plugin/wmd.pm @@ -31,14 +31,13 @@ sub formbuilder_setup (@) { $form->field("do") eq "comment"; $form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n". - include_javascript(undef, 1)); + include_javascript(undef)); } -sub include_javascript ($;$) { - my $page=shift; - my $absolute=shift; +sub include_javascript ($) { + my $from=shift; - my $wmdjs=urlto("wmd/wmd.js", $page, $absolute); + my $wmdjs=urlto("wmd/wmd.js", $from); return <<"EOF" <script type="text/javascript"> wmd_options = { |