diff --git a/min/.htaccess b/min/.htaccess new file mode 100644 index 0000000..34903dc --- /dev/null +++ b/min/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine on +RewriteRule ^([a-z]=.*) index.php?$1 [L,NE] \ No newline at end of file diff --git a/min/builder/_index.js b/min/builder/_index.js index e48064a..af50a85 100644 --- a/min/builder/_index.js +++ b/min/builder/_index.js @@ -1,5 +1,23 @@ var MUB = { _uid : 0 + ,_minRoot : '/min/?' + ,checkRewrite : function () { + var testUri = location.pathname.replace(/\/[^\/]*$/, '/rewriteTest.js').substr(1); + function fail() { + $('#minRewriteFailed')[0].className = 'topNote'; + }; + $.ajax({ + url : '../f=' + testUri + '&' + (new Date()).getTime() + ,success : function (data) { + if (data === '1') { + MUB._minRoot = '/min/'; + $('#minRoot').html('/min/'); + } else + fail(); + } + ,error : fail + }); + } /** * Get markup for new source LI element */ @@ -108,7 +126,7 @@ var MUB = { ++pos; } base = base.replace(/[^\/]+$/, ''); - var uri = '/min/?f=' + sources.join(','); + var uri = MUB._minRoot + 'f=' + sources.join(','); if (base.charAt(base.length - 1) === '/') { // we have a base dir! var basedSources = sources @@ -118,7 +136,7 @@ var MUB = { basedSources[i] = sources[i].substr(base.length); } base = base.substr(0, base.length - 1); - var bUri = '/min/?b=' + base + '&f=' + basedSources.join(','); + var bUri = MUB._minRoot + 'b=' + base + '&f=' + basedSources.join(','); //window.console && console.log([uri, bUri]); uri = uri.length < bUri.length ? uri @@ -178,6 +196,7 @@ var MUB = { * Runs on DOMready */ ,init : function () { + $('#app').show(); $('#sources').html(''); $('#add button').click(MUB.addButtonClick); // make easier to copy text out of @@ -213,8 +232,10 @@ var MUB = { } ,dataType : 'text' }); + $.browser.msie && $('#getBm p:last').append(' Sorry, not supported in MSIE!'); MUB.addButtonClick(); } + MUB.checkRewrite(); } }; window.onload = MUB.init; \ No newline at end of file diff --git a/min/builder/bm.js b/min/builder/bm.js index 56a639f..10d1943 100644 --- a/min/builder/bm.js +++ b/min/builder/bm.js @@ -21,7 +21,11 @@ javascript:(function() { while (o = d.getElementsByTagName('script')[i++]) o.src && !(o.type && /vbs/i.test(o.type)) && add(o.src); i = 0; - while (o = d.styleSheets[i++]) + while (o = d.styleSheets[i++]) + /* http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-DocumentStyle-styleSheets + document.styleSheet is a list property where [0] accesses the 1st element and + [outOfRange] returns null. In IE, styleSheets is a function, and also throws an + exception when you check the out of bounds index. (sigh) */ sheet(o); if (uris.length) window.open('%BUILDER_URL%#' + uris.join(',')); diff --git a/min/builder/index.php b/min/builder/index.php index bd5a7b6..f67b4a7 100644 --- a/min/builder/index.php +++ b/min/builder/index.php @@ -9,8 +9,7 @@ if (! $min_enableBuilder) { ob_start(); ?> - +
Note: Please set $min_cachePath
+
Note: Please set $min_cachePath
in /min/config.php to improve performance.
Note: Your webserver does not seem to + support mod_rewrite (used in /min/.htaccess). Your Minify URIs will contain "?", which +may reduce the benefit of proxy cache servers.
+Create a list of Javascript or CSS files (or 1 is fine) you'd like to combine and click [Update].
@@ -47,20 +56,21 @@ and click [Update]. - + -Place this URI in your HTML to serve the files above combined, minified, compressed and with cache headers.
+Place this URI in your HTML to serve the files above combined, minified, compressed and +with cache headers.
URI | /min (opens in new window) |
---|---|
HTML |
For the best performance you can serve these files as a pre-defined group with a URI like:
-/min/?g=keyName
For the best performance you can serve these files as a pre-defined group with a URI
+like: /min/?g=keyName
To do this, add a line like this to /min/groupsConfig.php:
return array(
@@ -77,7 +87,7 @@ and click [Update].
on your site. When you active it, this page will open in a new window with a list of
available URIs to add.
-Create Minify URIs (right-click, add to favorites/bookmarks)
+Create Minify URIs (right-click, add to bookmarks)
@import
If you desire, you can use Minify URIs in imports and they will not be touched
-by Minify. E.g. @import "/min/?g=css2";
@import "/min/?g=css2";
+
+Need help? Search or post to the Minify discussion list.
-This app is minified :) view source
+Need help? Search or post to the Minify discussion list.
+This app is minified :) view +source
- +