[Rt-commit] rt branch, no-prototype, updated. rt-3.8.8-188-g349075d
? sunnavy
sunnavy at bestpractical.com
Fri Jul 30 00:11:26 EDT 2010
The branch, no-prototype has been updated
via 349075df69fa5fe4d448e73b0c4c5c1df70553eb (commit)
from 4a6a094d945cbcd8004f5009acbd14a8fcad3dd6 (commit)
Summary of changes:
sbin/rt-test-dependencies.in | 1 +
share/html/Elements/HeaderJavascript | 11 ++++++-
share/html/NoAuth/{css => js}/dhandler | 44 ++++++++++++++++++-------------
3 files changed, 35 insertions(+), 21 deletions(-)
copy share/html/NoAuth/{css => js}/dhandler (73%)
- Log -----------------------------------------------------------------
commit 349075df69fa5fe4d448e73b0c4c5c1df70553eb
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jul 30 12:12:28 2010 +0800
minify js
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 06a958d..1e4ab91 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -254,6 +254,7 @@ Text::WikiFormat 0.76
CSS::Squish 0.06
Devel::StackTrace 1.19
JSON
+JavaScript::Minifier
.
$deps{'STANDALONE'} = [ text_to_hash( << '.') ];
diff --git a/share/html/Elements/HeaderJavascript b/share/html/Elements/HeaderJavascript
index 6f37521..cc4f1b4 100644
--- a/share/html/Elements/HeaderJavascript
+++ b/share/html/Elements/HeaderJavascript
@@ -49,13 +49,20 @@
$focus => undef
$onload => undef
</%args>
-<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/util.js"></script>
-<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/titlebox-state.js"></script>
+
+% if ( RT->Config->Get('DevelMode' ) ) {
<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/jquery_noconflict.js"></script>
<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/jquery.autocomplete-min.js"></script>
<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/jquery.timepickr.js"></script>
+<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/util.js"></script>
+<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/titlebox-state.js"></script>
+% }
+% else {
+<script type="text/javascript" src="<%RT->Config->Get('WebPath')%>/NoAuth/js/squished.js"></script>
+% }
+
<script type="text/javascript">
jQuery(function() {
jQuery(".ui-datepicker").datepicker( {
diff --git a/share/html/NoAuth/js/dhandler b/share/html/NoAuth/js/dhandler
new file mode 100644
index 0000000..a057fcd
--- /dev/null
+++ b/share/html/NoAuth/js/dhandler
@@ -0,0 +1,83 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%ONCE>
+my $content = '';
+</%ONCE>
+
+<%INIT>
+my $arg = $m->dhandler_arg;
+my $path;
+if ( $arg =~ m{squished\.js$} ) {
+ $path = $m->current_comp->dir_path;
+ unless ( $content ) {
+ my $no_minify;
+ eval { require JavaScript::Minifier; };
+ $no_minify = 1 if $@;
+
+ require File::Spec;
+ my @js =
+ qw/jquery-1.4.2.min.js jquery_noconflict.js jquery.autocomplete-min.js jquery-ui-1.7.3.custom.min.js jquery.timepickr.js titlebox-state.js util.js/;
+
+ for my $js (@js) {
+ my $file = File::Spec->catfile( $path, $js );
+ if ( $no_minify ) {
+ $content .= $m->scomp( $file );
+ }
+ else {
+ $content .= JavaScript::Minifier::minify( input => $m->scomp($file));
+ }
+ }
+ }
+
+ $m->out( $content );
+}
+else {
+ return $m->decline;
+}
+
+</%INIT>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list