Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Defer loading of JUSH

  • Loading branch information...
commit adae922f36075fb8ce8e5b69a806fa3686f7bac5 1 parent 81037ca
@vrana authored
View
5 adminer/file.inc.php
@@ -15,7 +15,10 @@
echo lzw_decompress(compile_file('../adminer/static/default.css;../externals/jush/jush.css', 'minify_css'));
} elseif ($_GET["file"] == "functions.js") {
header("Content-Type: text/javascript; charset=utf-8");
- echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js;../externals/jush/modules/jush.js;../externals/jush/modules/jush-textarea.js;../externals/jush/modules/jush-txt.js;../externals/jush/modules/jush-sql.js;../externals/jush/modules/jush-pgsql.js;../externals/jush/modules/jush-sqlite.js;../externals/jush/modules/jush-mssql.js;../externals/jush/modules/jush-oracle.js;../externals/jush/modules/jush-simpledb.js', 'minify_js'));
+ echo lzw_decompress(compile_file('../adminer/static/functions.js;static/editing.js', 'minify_js'));
+} elseif ($_GET["file"] == "jush.js") {
+ header("Content-Type: text/javascript; charset=utf-8");
+ echo lzw_decompress(compile_file('../externals/jush/modules/jush.js;../externals/jush/modules/jush-textarea.js;../externals/jush/modules/jush-txt.js;../externals/jush/modules/jush-sql.js;../externals/jush/modules/jush-pgsql.js;../externals/jush/modules/jush-sqlite.js;../externals/jush/modules/jush-mssql.js;../externals/jush/modules/jush-oracle.js;../externals/jush/modules/jush-simpledb.js', 'minify_js'));
} else {
header("Content-Type: image/gif");
switch ($_GET["file"]) {
View
18 adminer/include/adminer.inc.php
@@ -68,16 +68,9 @@ function headers() {
* @return bool true to link adminer.css if exists
*/
function head() {
- global $jush;
- if (support("sql")) {
- ?>
+ ?>
<link rel="stylesheet" type="text/css" href="../externals/jush/jush.css">
-<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>
-<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>
-<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>
-<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>
<?php
- }
return true;
}
@@ -794,6 +787,14 @@ function navigation($missing) {
}
}
} else {
+ if (support("sql")) {
+ ?>
+<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>
+<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>
+<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>
+<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>
+<?php
+ }
$this->databasesPrint($missing);
if (DB == "" || !$missing) {
echo "<p class='links'>" . (support("sql") ? "<a href='" . h(ME) . "sql='" . bold(isset($_GET["sql"]) && !isset($_GET["import"])) . ">" . lang('SQL command') . "</a>\n<a href='" . h(ME) . "import='" . bold(isset($_GET["import"])) . ">" . lang('Import') . "</a>\n" : "") . "";
@@ -814,7 +815,6 @@ function navigation($missing) {
$links[] = preg_quote($table, '/');
}
echo "<script type='text/javascript'>\n";
- echo "var jushLang = '$jush';\n";
echo "var jushLinks = { $jush: [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
echo "jushLinks.$val = jushLinks.$jush;\n";
View
15 compile.php
@@ -287,11 +287,14 @@ function minify_js($file) {
function compile_file($match) {
global $project;
$file = "";
- foreach (explode(";", $match[1]) as $filename) {
- $file .= file_get_contents(dirname(__FILE__) . "/$project/$filename");
+ list(, $filenames, $callback) = $match;
+ if ($filenames != "") {
+ foreach (explode(";", $filenames) as $filename) {
+ $file .= file_get_contents(dirname(__FILE__) . "/$project/$filename");
+ }
}
- if ($match[2]) {
- $file = call_user_func($match[2], $file);
+ if ($callback) {
+ $file = call_user_func($callback, $file);
}
return '"' . add_quo_slashes($file) . '"';
}
@@ -378,7 +381,7 @@ function compile_file($match) {
}
if ($project == "editor") {
$file = preg_replace('~;../externals/jush/jush.css~', '', $file);
- $file = preg_replace('~;../externals/jush/modules/jush[^.]*.js~', '', $file);
+ $file = preg_replace('~;?../externals/jush/modules/jush[^.]*.js~', '', $file);
}
$file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
$file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
@@ -390,7 +393,6 @@ function compile_file($match) {
$file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file);
}
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
-$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-textarea.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-txt.js"></script>' . "\n", "", $file);
$file = str_replace('<script type="text/javascript" src="../externals/jush/modules/jush-<?php echo $jush; ?>.js"></script>' . "\n", "", $file);
@@ -399,6 +401,7 @@ function compile_file($match) {
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION . ($driver ? '&amp;driver=' . $driver : '');
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
+$file = preg_replace('~\\.\\./externals/jush/modules/(jush\\.js)~', '<?php echo ' . $replace . '"; ?>', $file);
$file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
$file = php_shrink($file);
Please sign in to comment.
Something went wrong with that request. Please try again.