aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-11-23 00:06:07 +0000
committerSimon McVittie <smcv@debian.org>2010-11-23 00:06:07 +0000
commit78c595736ef6903ad8e7bab232875474aedfd328 (patch)
treedd6152b028cb072e57cc69cb3c4961afd698643f
parentd2e3741a6f289bd25b75683990a0548f41661a85 (diff)
downloadikiwiki-78c595736ef6903ad8e7bab232875474aedfd328.tar
ikiwiki-78c595736ef6903ad8e7bab232875474aedfd328.tar.gz
Use local paths when including Javascript
-rw-r--r--IkiWiki/Plugin/relativedate.pm11
-rw-r--r--IkiWiki/Plugin/toggle.pm11
-rw-r--r--IkiWiki/Plugin/wmd.pm9
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 = {