... because it is too restrictive about the urls in css and js it can import.
Here's the patch:
--- lib/TWiki/Plugins/BrowserBoosterPlugin.pm (revision 16732)
+++ lib/TWiki/Plugins/BrowserBoosterPlugin.pm (working copy)
@@ -27,7 +27,7 @@
$NO_PREFS_IN_TOPIC = 1;
$pluginName = 'BrowserBoosterPlugin';
-sub DEBUG { 0; } # toggle me
+use constant DEBUG => 0; # toggle me
sub initPlugin {
my( $topic, $web, $user, $installWeb ) = @_;
@@ -78,7 +78,7 @@
$text =~ m/src=["'](.*?)["']/i;
my $file = $1;
my $src = $1;
- $file =~ s/($TWiki::cfg{DefaultUrlHost})?$TWiki::cfg{PubUrlPath}/$TWiki::cfg{PubDir}/ge;
+ $file =~ s/.*$TWiki::cfg{PubUrlPath}/$TWiki::cfg{PubDir}/g;
# read file
my $fileContent = readFile( $file );
@@ -87,7 +87,7 @@
return $text unless $fileContent; # just to make sure
$fileContent =~ s/<(\/?script)/<$1/go;
- return "\n" . '<!-- ' . $src . ' -->' ."\n" . '<script type="text/javascript">'."\n" . $fileContent . "\n</script>\n";
+ return "\n<!-- BrowserBoosterPlugin: $src -->\n" . '<script type="text/javascript">'."\n" . $fileContent . "\n</script>\n";
}
@@ -114,21 +114,9 @@
sub importStylesheet {
my ( $url, $prefix, $suffix ) = @_;
my $retval = "";
- my $file = "";
- my $dir = $TWiki::cfg{PubDir};
+ my $file = $url;
+ $file =~ s/.*$TWiki::cfg{PubUrlPath}/$TWiki::cfg{PubDir}/g;
- if ( $url =~ m/^http/ ) {
- # url with host
- $file = $url;
- my $twiki_pub_url = $TWiki::cfg{DefaultUrlHost} . $TWiki::cfg{PubUrlPath};
- $file =~ s/$twiki_pub_url/$dir/ge;
- } else {
- # url without host
- $file = $url;
- my $twiki_pub_url = $TWiki::cfg{PubUrlPath};
- $file =~ s/$twiki_pub_url/$dir/ge;
- }
-
if ( $file ) {
my $fileContent = readFile( $file );
@@ -141,7 +129,7 @@
# SMELL: We should maintain a list of visited urls to prevent loops
}
- return $prefix . $retval . $suffix;
+ return $prefix . "/* BrowserBoosterPlugin: $url */\n" . $retval . $suffix;
}
Oliver, could you please check?
--
TWiki:Main/MichaelDaum - 30 Apr 2008
Looks good. Thanks Michael.
--
TWiki:Main.OliverKrueger - 04 Jul 2008