Index: lib/TWiki/Plugins/FirefoxBoosterPlugin.pm
===================================================================
--- lib/TWiki/Plugins/FirefoxBoosterPlugin.pm (revision 16405)
+++ lib/TWiki/Plugins/FirefoxBoosterPlugin.pm (working copy)
@@ -16,7 +16,7 @@
package TWiki::Plugins::FirefoxBoosterPlugin;
use strict;
-use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION $debug $pluginName $NO_PREFS_IN_TOPIC );
+use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION $pluginName $NO_PREFS_IN_TOPIC );
$VERSION = '$Rev$';
$RELEASE = 'TWiki-4.2';
@@ -24,6 +24,7 @@
$NO_PREFS_IN_TOPIC = 1;
$pluginName = 'FirefoxBoosterPlugin';
+sub DEBUG { 0; } # toggle me
sub initPlugin {
my( $topic, $web, $user, $installWeb ) = @_;
@@ -34,38 +35,26 @@
return 0;
}
- $debug = $TWiki::cfg{Plugins}{FirefoxBoosterPlugin}{Debug} || 0;
-
# Plugin correctly initialized
return 1;
}
sub completePageHandler {
- my ( $text, $header ) = @_;
+ #my ( $text, $header ) = @_;
- TWiki::Func::writeDebug( "- ${pluginName}::completePageHandler()" ) if $debug;
+ TWiki::Func::writeDebug( "- ${pluginName}::completePageHandler()" ) if DEBUG;
- # only do magic if there is a Firefox on the other side
- if ( $ENV{"HTTP_USER_AGENT"} =~ m/firefox.2/i ) {
+ # import javascript
+ $_[0] =~ s/(\n";
+ return $text unless $fileContent; # just to make sure
+
+ $fileContent =~ s/<(\/?script)/<$1/go;
+ return '\n";
+
}
sub parseStylesheet {
@@ -117,7 +108,7 @@
}
sub importStylesheet {
- my ( $url, $praefix, $suffix ) = @_;
+ my ( $url, $prefix, $suffix ) = @_;
my $retval = "";
my $file = "";
my $dir = $TWiki::cfg{PubDir};
@@ -146,16 +137,16 @@
# SMELL: We should maintain a list of visited urls to prevent loops
}
- return $praefix . $retval . $suffix;
+ return $prefix . $retval . $suffix;
}
sub doStyleContainer {
- my ( $content, $praefix, $suffix ) = @_;
+ my ( $content, $prefix, $suffix ) = @_;
# import css via @import
$content =~ s/\@import\s+url\(["']?(.*?)["']?\).*?;/&importStylesheet($1,"","")/gei;
- return $praefix . $content . $suffix;
+ return $prefix . $content . $suffix;
}
1;