Use local paths when including Javascript
parent
d2e3741a6f
commit
78c595736e
|
@ -28,18 +28,17 @@ sub format (@) {
|
||||||
|
|
||||||
if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) {
|
if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) {
|
||||||
# no <body> tag, probably in preview mode
|
# 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};
|
return $params{content};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub include_javascript ($;$) {
|
sub include_javascript ($) {
|
||||||
my $page=shift;
|
my $from=shift;
|
||||||
my $absolute=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".
|
'" 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>';
|
'" type="text/javascript" charset="utf-8"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,19 +70,18 @@ sub format (@) {
|
||||||
$params{content}=~s/<div class="toggleableend">//g;
|
$params{content}=~s/<div class="toggleableend">//g;
|
||||||
if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) {
|
if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) {
|
||||||
# no <body> tag, probably in preview mode
|
# 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};
|
return $params{content};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub include_javascript ($;$) {
|
sub include_javascript ($) {
|
||||||
my $page=shift;
|
my $from=shift;
|
||||||
my $absolute=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".
|
'" 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>';
|
'" type="text/javascript" charset="utf-8"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,13 @@ sub formbuilder_setup (@) {
|
||||||
$form->field("do") eq "comment";
|
$form->field("do") eq "comment";
|
||||||
|
|
||||||
$form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".
|
$form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".
|
||||||
include_javascript(undef, 1));
|
include_javascript(undef));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub include_javascript ($;$) {
|
sub include_javascript ($) {
|
||||||
my $page=shift;
|
my $from=shift;
|
||||||
my $absolute=shift;
|
|
||||||
|
|
||||||
my $wmdjs=urlto("wmd/wmd.js", $page, $absolute);
|
my $wmdjs=urlto("wmd/wmd.js", $from);
|
||||||
return <<"EOF"
|
return <<"EOF"
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
wmd_options = {
|
wmd_options = {
|
||||||
|
|
Loading…
Reference in New Issue