Skip to content

Commit

Permalink
Replace JSMin by JsShrink
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Mar 11, 2012
1 parent a6f1078 commit bf4f0a1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
@@ -1,9 +1,6 @@
[submodule "jush"]
path = externals/jush
url = git://jush.git.sourceforge.net/gitroot/jush/jush
[submodule "jsmin-php"]
path = externals/jsmin-php
url = git://github.com/rgrove/jsmin-php.git
[submodule "tinymce"]
path = externals/tinymce
url = git://github.com/tinymce/tinymce.git
Expand All @@ -16,3 +13,6 @@
[submodule "wymeditor"]
path = externals/wymeditor
url = git://github.com/wymeditor/wymeditor.git
[submodule "JsShrink"]
path = externals/JsShrink
url = git://github.com/vrana/JsShrink.git
2 changes: 1 addition & 1 deletion adminer/file.inc.php
Expand Up @@ -9,7 +9,7 @@
?>compile_file('../adminer/static/default.css', 'minify_css');<?php
} elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript; charset=utf-8");
?>compile_file('../adminer/static/functions.js', 'JSMin::minify');compile_file('static/editing.js', 'JSMin::minify');<?php
?>compile_file('../adminer/static/functions.js', 'jsShrink');compile_file('static/editing.js', 'jsShrink');<?php
} else {
header("Content-Type: image/gif");
switch ($_GET["file"]) {
Expand Down
1 change: 1 addition & 0 deletions changes.txt
@@ -1,4 +1,5 @@
Adminer 3.4.0-dev:
Replace JSMin by better JavaScript minifier

Adminer 3.3.4 (released 2012-03-07):
Foreign keys default actions (bug #3397606)
Expand Down
18 changes: 4 additions & 14 deletions compile.php
@@ -1,21 +1,11 @@
<?php
error_reporting(6135); // errors and warnings
include dirname(__FILE__) . "/adminer/include/version.inc.php";
include dirname(__FILE__) . "/externals/jsmin-php/jsmin.php";
include dirname(__FILE__) . "/externals/JsShrink/jsShrink.php";

if (!class_exists("JSMin")) {
/** Simple JS minifier without full support for regex literals
* @link http://pastebin.com/2Jc2swSr
*/
class JSMin {
/*private static*/ function callback($match) {
$s = trim($match[0]);
return ($s === "" ? "\n" : ($s[0] === "/" && ($s[1] === "*" || $s[1] === "/") ? "" : $s));
}

/*static*/ function minify($input) {
return preg_replace_callback('~//[^\n]*|/\*.*?\*/|/(?!\s)(?:\\\\.|[^/\\\\])*/|\'(?:\\\\.|[^\'\\\\])*\'|"(?:\\\\.|[^"\\\\])*"|\s*[^0-9a-z_$\'"/\s]\s*|\s+~si', array('JSMin', 'callback'), $input);
}
if (!function_exists('jsShrink')) {
function jsShrink($code) {
return $code;
}
}

Expand Down
1 change: 1 addition & 0 deletions externals/JsShrink
Submodule JsShrink added at 2298c3
1 change: 0 additions & 1 deletion externals/jsmin-php
Submodule jsmin-php deleted from 868939

0 comments on commit bf4f0a1

Please sign in to comment.