Don't use AJAX links and forms
This commit is contained in:
parent
bf54c13dfe
commit
4815c7d020
|
@ -18,7 +18,6 @@ if ($_GET["file"] == "favicon.ico") {
|
|||
case "up.gif": echo base64_decode("compile_file('../adminer/static/up.gif', 'base64_encode');"); break;
|
||||
case "down.gif": echo base64_decode("compile_file('../adminer/static/down.gif', 'base64_encode');"); break;
|
||||
case "arrow.gif": echo base64_decode("compile_file('../adminer/static/arrow.gif', 'base64_encode');"); break;
|
||||
case "loader.gif": echo base64_decode("compile_file('../adminer/static/loader.gif', 'base64_encode');"); break;
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
|
|
@ -51,7 +51,7 @@ foreach (table_status() as $name => $table_status) {
|
|||
<p>
|
||||
<?php if ($row["db"] == "" && $row["ns"] == "") { ?>
|
||||
<?php echo lang('Target table'); ?>:
|
||||
<?php echo html_select("table", $referencable, $row["table"], "this.form['change-js'].value = '1'; if (!ajaxForm(this.form)) this.form.submit();"); ?>
|
||||
<?php echo html_select("table", $referencable, $row["table"], "this.form['change-js'].value = '1'; this.form.submit();"); ?>
|
||||
<input type="hidden" name="change-js" value="">
|
||||
<noscript><p><input type="submit" name="change" value="<?php echo lang('Change'); ?>"></noscript>
|
||||
<table cellspacing="0">
|
||||
|
|
|
@ -16,10 +16,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "", $
|
|||
}
|
||||
$title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
|
||||
$title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
|
||||
if (is_ajax()) {
|
||||
header("X-AJAX-Title: " . rawurlencode($title_page));
|
||||
} else {
|
||||
?>
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html lang="<?php echo $LANG; ?>" dir="<?php echo lang('ltr'); ?>">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
@ -27,10 +24,6 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "", $
|
|||
<meta name="robots" content="noindex">
|
||||
<title><?php echo $title_page; ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="../adminer/static/default.css">
|
||||
<script type="text/javascript">
|
||||
var areYouSure = '<?php echo lang('Resend POST data?'); ?>';
|
||||
var noResponse = '<?php echo lang('No response from server.'); ?>';
|
||||
</script>
|
||||
<script type="text/javascript" src="../adminer/static/functions.js"></script>
|
||||
<script type="text/javascript" src="static/editing.js"></script>
|
||||
<?php if ($adminer->head()) { ?>
|
||||
|
@ -41,15 +34,13 @@ var noResponse = '<?php echo lang('No response from server.'); ?>';
|
|||
<?php } ?>
|
||||
<?php echo $head; ?>
|
||||
|
||||
<body class="<?php echo lang('ltr'); ?> nojs"<?php echo ($_POST ? "" : " onclick=\"return bodyClick(event, '" . h(js_escape(DB) . "', '" . js_escape($_GET["ns"])) . "');\""); // avoid re-post confirmation after refreshing the next page in Google Chrome ?> onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
|
||||
<body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
|
||||
<script type="text/javascript">
|
||||
document.body.className = document.body.className.replace(/ nojs/, ' js');
|
||||
</script>
|
||||
|
||||
<div id="loader"><img src="../adminer/static/loader.gif" alt=""></div>
|
||||
<div id="content">
|
||||
<?php
|
||||
}
|
||||
if (isset($breadcrumb)) {
|
||||
$link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
|
||||
echo '<p id="breadcrumb"><a href="' . h($link ? $link : ".") . '">' . $drivers[DRIVER] . '</a> » ';
|
||||
|
@ -100,8 +91,7 @@ document.body.className = document.body.className.replace(/ nojs/, ' js');
|
|||
*/
|
||||
function page_footer($missing = "") {
|
||||
global $adminer;
|
||||
if (!is_ajax()) {
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php switch_lang(); ?>
|
||||
|
@ -109,5 +99,4 @@ function page_footer($missing = "") {
|
|||
<?php $adminer->navigation($missing); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -452,7 +452,7 @@ function redirect($location, $message = null) {
|
|||
if ($location == "") {
|
||||
$location = ".";
|
||||
}
|
||||
header((is_ajax() ? "X-AJAX-Redirect" : "Location") . ": $location");
|
||||
header("Location: $location");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'نسخ',
|
||||
'Permanent link' => 'وصلة دائمة',
|
||||
'Edit all' => 'تعديل الكل',
|
||||
'Resend POST data?' => 'هل تود إعادة إرسال بيانات POST ؟',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Còpia',
|
||||
'Permanent link' => 'Enllaç permanent',
|
||||
'Edit all' => 'Edita-ho tot',
|
||||
'Resend POST data?' => 'Torna a enviar les dades POST?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -278,10 +278,6 @@ $translations = array(
|
|||
'Geometry' => 'Geometrie',
|
||||
'Relations' => 'Vztahy',
|
||||
|
||||
// reload confirmation in AJAX
|
||||
'Resend POST data?' => 'Znovu odeslat POST data?',
|
||||
'No response from server.' => 'Server neodpověděl.',
|
||||
|
||||
'Editor' => 'Editor',
|
||||
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
|
||||
'$1-$3-$5' => '$6.$4.$1',
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Kopieren',
|
||||
'Permanent link' => 'Dauerhafter Link',
|
||||
'Edit all' => 'Alle ändern',
|
||||
'Resend POST data?' => 'POST data noch einmal senden ?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Copiar',
|
||||
'Permanent link' => 'Enlace permanente',
|
||||
'Edit all' => 'Editar todos',
|
||||
'Resend POST data?' => 'Volver a enviar POST data?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Kopeeri',
|
||||
'Permanent link' => 'Püsilink',
|
||||
'Edit all' => 'Muuda kõiki',
|
||||
'Resend POST data?' => 'Saada POST andmed uuesti?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -277,9 +277,6 @@ $translations = array(
|
|||
'Geometry' => 'هندسه',
|
||||
'Relations' => 'رابطه ها',
|
||||
|
||||
// reload confirmation in AJAX
|
||||
'Resend POST data?' => 'ارسال مجدد داده ها؟',
|
||||
|
||||
'Editor' => 'ویرایشگر',
|
||||
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
|
||||
'$1-$3-$5' => '$1-$3-$5',
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Copier',
|
||||
'Permanent link' => 'Lien permanent',
|
||||
'Edit all' => 'Tout modifier',
|
||||
'Resend POST data?' => 'Renvoyer les données POST ?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Másolás',
|
||||
'Permanent link' => 'Hivatkozás',
|
||||
'Edit all' => 'Összes szerkesztése',
|
||||
'Resend POST data?' => 'Újraküldi a POST adatokat?',
|
||||
'HH:MM:SS' => 'óó:pp:mm',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Copia',
|
||||
'Permanent link' => 'Link permanente',
|
||||
'Edit all' => 'Modifica tutto',
|
||||
'Resend POST data?' => 'Reinvio i dati POST?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'コピー',
|
||||
'Permanent link' => 'パーマネントリンク',
|
||||
'Edit all' => 'すべて編集',
|
||||
'Resend POST data?' => '再送信しますか?',
|
||||
'HH:MM:SS' => '時:分:秒',
|
||||
);
|
||||
|
|
|
@ -277,9 +277,6 @@ $translations = array(
|
|||
'Geometry' => 'Geometrija',
|
||||
'Relations' => 'Ryšiai',
|
||||
|
||||
// reload confirmation in AJAX
|
||||
'Resend POST data?' => 'Persiųsti POST duomenis?',
|
||||
|
||||
'Editor' => 'Redaktorius',
|
||||
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
|
||||
'$1-$3-$5' => '$1-$3-$5',
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Kopieren',
|
||||
'Permanent link' => 'Permanente link',
|
||||
'Edit all' => 'Alles bewerken',
|
||||
'Resend POST data?' => 'POST data opnieuw verzenden',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -278,10 +278,6 @@ $translations = array(
|
|||
'Geometry' => 'Geometria',
|
||||
'Relations' => 'Relacje',
|
||||
|
||||
// reload confirmation in AJAX
|
||||
'Resend POST data?' => 'Wysłać dane ponownie?',
|
||||
'No response from server.' => 'Brak odpowiedzi od serwera.',
|
||||
|
||||
'Editor' => 'Edytor',
|
||||
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
|
||||
'$1-$3-$5' => '$6.$4.$1',
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Copiază',
|
||||
'Permanent link' => 'Adresă permanentă',
|
||||
'Edit all' => 'Editează tot',
|
||||
'Resend POST data?' => 'Retrimite datele POST?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Копировать',
|
||||
'Permanent link' => 'Постоянная ссылка',
|
||||
'Edit all' => 'Редактировать всё',
|
||||
'Resend POST data?' => 'Еще раз послать данные POST запроса?',
|
||||
'HH:MM:SS' => 'ЧЧ:ММ:СС',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'Kopírovať',
|
||||
'Permanent link' => 'Permanentný odkaz',
|
||||
'Edit all' => 'Upraviť všetko',
|
||||
'Resend POST data?' => 'Znovu poslať POST data?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => 'நகல்',
|
||||
'Permanent link' => 'நிரந்தர இணைப்பு',
|
||||
'Edit all' => 'அனைத்தையும் தொகு',
|
||||
'Resend POST data?' => 'POST data வை மீண்டும் அனுப்பவா?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -278,10 +278,6 @@ $translations = array(
|
|||
'Geometry' => 'Геометрія',
|
||||
'Relations' => 'Зв\'язки',
|
||||
|
||||
// reload confirmation in AJAX
|
||||
'Resend POST data?' => 'Ще раз надіслати POST-запит?',
|
||||
'No response from server.' => 'Нема відповіді від сервера.',
|
||||
|
||||
'Editor' => 'Редактор',
|
||||
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
|
||||
'$1-$3-$5' => '$5.$3.$1',
|
||||
|
|
|
@ -278,10 +278,6 @@ $translations = array(
|
|||
'Geometry' => 'xx',
|
||||
'Relations' => 'xx',
|
||||
|
||||
// reload confirmation in AJAX
|
||||
'Resend POST data?' => 'xx',
|
||||
'No response from server.' => 'xx',
|
||||
|
||||
'Editor' => 'xx',
|
||||
// date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d
|
||||
'$1-$3-$5' => 'xx',
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => '複製',
|
||||
'Permanent link' => '永久鏈接',
|
||||
'Edit all' => '編輯全部',
|
||||
'Resend POST data?' => '重新發送表單資料?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -268,6 +268,5 @@ $translations = array(
|
|||
'Copy' => '复制',
|
||||
'Permanent link' => '固定链接',
|
||||
'Edit all' => '编辑全部',
|
||||
'Resend POST data?' => '重新发送 POST 数据?',
|
||||
'HH:MM:SS' => 'HH:MM:SS',
|
||||
);
|
||||
|
|
|
@ -377,7 +377,7 @@ if (!$columns) {
|
|||
$found_rows = found_rows($table_status, $where);
|
||||
if ($found_rows < max(1e4, 2 * ($page + 1) * $limit)) {
|
||||
// slow with big tables
|
||||
ob_flush(); //! doesn't work with AJAX
|
||||
ob_flush();
|
||||
flush();
|
||||
$found_rows = $connection->result("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
|
||||
} else {
|
||||
|
|
|
@ -20,8 +20,6 @@ code { background: #eee; }
|
|||
tbody tr:hover td, tbody tr:hover th { background: #eee; }
|
||||
pre { margin: 1em 0 0; }
|
||||
input[type=image] { vertical-align: middle; }
|
||||
.loading, .loading input { cursor: progress; }
|
||||
.loading #loader { display: inline; }
|
||||
.version { color: #777; font-size: 67%; }
|
||||
.js .hidden, .nojs .jsonly { display: none; }
|
||||
.nowrap td, .nowrap th, td.nowrap { white-space: pre; }
|
||||
|
@ -49,7 +47,6 @@ input[type=image] { vertical-align: middle; }
|
|||
#content { margin: 2em 0 0 21em; padding: 10px 20px 20px 0; }
|
||||
#lang { position: absolute; top: 0; left: 0; line-height: 1.8em; padding: .3em 1em; }
|
||||
#breadcrumb { white-space: nowrap; position: absolute; top: 0; left: 21em; background: #eee; height: 2em; line-height: 1.8em; padding: 0 1em; margin: 0 0 0 -18px; }
|
||||
#loader { display: none; position: fixed; top: 2px; right: 2px; z-index: 1; }
|
||||
#h1 { color: #777; text-decoration: none; font-style: italic; }
|
||||
#version { font-size: 67%; color: red; }
|
||||
#schema { margin-left: 60px; position: relative; -moz-user-select: none; -webkit-user-select: none; }
|
||||
|
|
|
@ -6,9 +6,6 @@ var jushRoot = '../externals/jush/'; // global variable to allow simple customiz
|
|||
* @param string first three characters of database system version
|
||||
*/
|
||||
function bodyLoad(version) {
|
||||
if (history.state !== undefined) { // copied from editor/static/editing.js
|
||||
onpopstate(history);
|
||||
}
|
||||
if (jushRoot) {
|
||||
var script = document.createElement('script');
|
||||
script.src = jushRoot + 'jush.js';
|
||||
|
|
|
@ -157,9 +157,7 @@ function nodePosition(el) {
|
|||
function pageClick(href, page, event) {
|
||||
if (!isNaN(page) && page) {
|
||||
href += (page != 1 ? '&page=' + (page - 1) : '');
|
||||
if (!ajaxSend(href)) {
|
||||
location.href = href;
|
||||
}
|
||||
location.href = href;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,16 +185,6 @@ function selectAddRow(field) {
|
|||
|
||||
|
||||
|
||||
/** Abort AJAX request
|
||||
* @uses ajaxRequest
|
||||
*/
|
||||
function ajaxAbort() {
|
||||
ajaxRequest.onreadystatechange = null;
|
||||
if (ajaxRequest.abort) {
|
||||
ajaxRequest.abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Send form by Ctrl+Enter on <select> and <textarea>
|
||||
|
@ -206,22 +194,12 @@ function ajaxAbort() {
|
|||
*/
|
||||
function bodyKeydown(event, button) {
|
||||
var target = event.target || event.srcElement;
|
||||
if (event.keyCode == 27 && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) { // 27 - Esc
|
||||
ajaxAbort();
|
||||
document.body.className = document.body.className.replace(/ loading/g, '');
|
||||
onblur = function () { };
|
||||
if (originalFavicon) {
|
||||
replaceFavicon(originalFavicon);
|
||||
}
|
||||
}
|
||||
if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10) && !event.altKey && !event.metaKey && /select|textarea|input/i.test(target.tagName)) { // 13|10 - Enter, shiftKey allowed
|
||||
target.blur();
|
||||
if (!ajaxForm(target.form, (button ? button + '=1' : ''))) {
|
||||
if (button) {
|
||||
target.form[button].click();
|
||||
} else {
|
||||
target.form.submit();
|
||||
}
|
||||
if (button) {
|
||||
target.form[button].click();
|
||||
} else {
|
||||
target.form.submit();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -307,132 +285,6 @@ function ajaxSetHtml(url) {
|
|||
});
|
||||
}
|
||||
|
||||
var originalFavicon;
|
||||
|
||||
/** Replace favicon
|
||||
* @param string
|
||||
*/
|
||||
function replaceFavicon(href) {
|
||||
var favicon = document.getElementById('favicon');
|
||||
if (favicon) {
|
||||
favicon.href = href;
|
||||
favicon.parentNode.appendChild(favicon); // to replace the icon in Firefox
|
||||
}
|
||||
}
|
||||
|
||||
var ajaxRequest = {};
|
||||
|
||||
/** Safely load content to #content
|
||||
* @param string
|
||||
* @param [string]
|
||||
* @param [boolean]
|
||||
* @param [boolean]
|
||||
* @return XMLHttpRequest or false in case of an error
|
||||
* @uses ajaxRequest
|
||||
*/
|
||||
function ajaxSend(url, data, popState, noscroll) {
|
||||
if (!history.pushState) {
|
||||
return false;
|
||||
}
|
||||
ajaxAbort();
|
||||
onblur = function () {
|
||||
if (!originalFavicon) {
|
||||
originalFavicon = (document.getElementById('favicon') || {}).href;
|
||||
}
|
||||
replaceFavicon(document.getElementById('loader').firstChild.src);
|
||||
};
|
||||
document.body.className += ' loading';
|
||||
ajaxRequest = ajax(url, function (request) {
|
||||
var title = request.getResponseHeader('X-AJAX-Title');
|
||||
if (title) {
|
||||
document.title = decodeURIComponent(title);
|
||||
}
|
||||
var redirect = request.getResponseHeader('X-AJAX-Redirect');
|
||||
if (redirect) {
|
||||
return ajaxSend(redirect, '', popState);
|
||||
}
|
||||
onblur = function () { };
|
||||
if (originalFavicon) {
|
||||
replaceFavicon(originalFavicon);
|
||||
}
|
||||
if (!popState) {
|
||||
if (data || url != location.href) {
|
||||
history.pushState(data, '', url); //! remember window position
|
||||
}
|
||||
}
|
||||
if (!noscroll && !/&order/.test(url)) {
|
||||
scrollTo(0, 0);
|
||||
}
|
||||
setHtml('content', (request.status ? request.responseText : '<p class="error">' + noResponse));
|
||||
document.body.className = document.body.className.replace(/ loading/g, '');
|
||||
var content = document.getElementById('content');
|
||||
var scripts = content.getElementsByTagName('script');
|
||||
var length = scripts.length; // required to avoid infinite loop
|
||||
for (var i=0; i < length; i++) {
|
||||
var script = document.createElement('script');
|
||||
script.text = scripts[i].text;
|
||||
content.appendChild(script);
|
||||
}
|
||||
|
||||
var as = document.getElementById('menu').getElementsByTagName('a');
|
||||
var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1');
|
||||
for (var i=0; i < as.length; i++) {
|
||||
as[i].className = (href == as[i].href ? 'active' : '');
|
||||
}
|
||||
var dump = document.getElementById('dump');
|
||||
if (dump) {
|
||||
var match = /&(select|table)=([^&]+)/.exec(href);
|
||||
dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : '');
|
||||
}
|
||||
//! modify Change database hidden fields
|
||||
|
||||
if (window.jush) {
|
||||
jush.highlight_tag('code', 0);
|
||||
}
|
||||
}, data);
|
||||
return ajaxRequest;
|
||||
}
|
||||
|
||||
/** Revive page from history
|
||||
* @param PopStateEvent|history
|
||||
* @uses ajaxRequest
|
||||
*/
|
||||
onpopstate = function (event) {
|
||||
if ((ajaxRequest.send || event.state) && !/#/.test(location.href)) {
|
||||
ajaxSend(location.href, (event.state && confirm(areYouSure) ? event.state : ''), 1); // 1 - disable pushState
|
||||
} else {
|
||||
ajaxRequest.send = true; // to enable AJAX for next call of this function
|
||||
}
|
||||
};
|
||||
|
||||
/** Send form by AJAX GET
|
||||
* @param HTMLFormElement
|
||||
* @param [string]
|
||||
* @param [boolean]
|
||||
* @return XMLHttpRequest or false in case of an error
|
||||
*/
|
||||
function ajaxForm(form, data, noscroll) {
|
||||
if ((/&(database|scheme|create|view|sql|user|dump|call)=/.test(location.href) && !/\./.test(data)) || (form.onsubmit && form.onsubmit() === false)) { // . - type="image"
|
||||
return false;
|
||||
}
|
||||
var params = [ ];
|
||||
for (var i=0; i < form.elements.length; i++) {
|
||||
var el = form.elements[i];
|
||||
if (/file/i.test(el.type) && el.value) {
|
||||
return false;
|
||||
} else if (el.name && (!/checkbox|radio|submit|file/i.test(el.type) || el.checked)) {
|
||||
params.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(/select/i.test(el.tagName) ? selectValue(el) : el.value));
|
||||
}
|
||||
}
|
||||
if (data) {
|
||||
params.push(data);
|
||||
}
|
||||
if (form.method == 'post') {
|
||||
return ajaxSend((/\?/.test(form.action) ? form.action : location.href), params.join('&'), false, noscroll); // ? - always part of Adminer URL
|
||||
}
|
||||
return ajaxSend((form.action || location.href).replace(/\?.*/, '') + '?' + params.join('&'), '', false, noscroll);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Display edit field
|
||||
|
@ -499,38 +351,6 @@ function selectDblClick(td, event, text) {
|
|||
|
||||
|
||||
|
||||
/** Load link by AJAX
|
||||
* @param MouseEvent
|
||||
* @param string
|
||||
* @param string
|
||||
* @return boolean
|
||||
*/
|
||||
function bodyClick(event, db, ns) {
|
||||
if (event.button || event.shiftKey || event.altKey || event.metaKey) {
|
||||
return;
|
||||
}
|
||||
if (event.getPreventDefault ? event.getPreventDefault() : event.returnValue === false || event.defaultPrevented) {
|
||||
return false;
|
||||
}
|
||||
var el = event.target || event.srcElement;
|
||||
if (/^a$/i.test(el.parentNode.tagName)) {
|
||||
el = el.parentNode;
|
||||
}
|
||||
if (/^a$/i.test(el.tagName) && !/:|#|&download=/i.test(el.getAttribute('href')) && /[&?]username=/.test(el.href) && !event.ctrlKey) {
|
||||
var match = /&db=([^&]*)/.exec(el.href);
|
||||
var match2 = /&ns=([^&]*)/.exec(el.href);
|
||||
return !(db == (match ? decodeURIComponent(match[1]) : '') && ns == (match2 ? decodeURIComponent(match2[1]) : '') && ajaxSend(el.href));
|
||||
}
|
||||
if (/^input$/i.test(el.tagName) && /image|submit/.test(el.type)) {
|
||||
if (event.ctrlKey) {
|
||||
el.form.target = '_blank';
|
||||
} else {
|
||||
return !ajaxForm(el.form, (el.name ? encodeURIComponent(el.name) + (el.type == 'image' ? '.x' : '') + '=1' : ''), el.type == 'image');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Stop event propagation
|
||||
* @param Event
|
||||
*/
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 673 B |
|
@ -3,6 +3,7 @@ Print current time next to executed SQL queries
|
|||
Highlight code in textarea by CodeMirror
|
||||
Link to original table in EXPLAIN of SELECT * FROM table t
|
||||
Replace JSMin by better JavaScript minifier
|
||||
Don't use AJAX links and forms
|
||||
Ukrainian translation
|
||||
|
||||
Adminer 3.3.4 (released 2012-03-07):
|
||||
|
|
|
@ -262,7 +262,7 @@ foreach (array("adminer", "editor") as $project) {
|
|||
$file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
|
||||
$file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files
|
||||
$replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&version=' . $VERSION;
|
||||
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico|loader\\.gif)~', '<?php echo ' . $replace . '"; ?>', $file);
|
||||
$file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
|
||||
$file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
|
||||
$file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/'", $file);
|
||||
$file = str_replace('"../externals/CodeMirror2"', '($_SERVER["HTTPS"] ? "https" : "http") . "://www.adminer.org/static/CodeMirror2"', $file);
|
||||
|
|
|
@ -141,4 +141,3 @@ fieldset, legend, table, .error, .message {-moz-border-radius: 5px; -khtml-borde
|
|||
#breadcrumb, #lang, #menu {-moz-border-radius-bottomright: 5px; -khtml-border-bottom-right-radius: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;}
|
||||
#breadcrumb, #lang {-moz-border-radius-bottomleft: 5px; -khtml-border-bottom-left-radius: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;}
|
||||
#menu {-moz-border-radius-topright: 5px; -khtml-border-top-right-radius: 5px; -webkit-border-top-right-radius: 5px; border-bottom-top-radius: 5px;}
|
||||
#loader {margin-left: 35px;}
|
||||
|
|
|
@ -123,4 +123,3 @@ fieldset, legend, h2, table, .error, .message {-moz-border-radius: 5px; -khtml-b
|
|||
#breadcrumb, #lang, #menu {-moz-border-radius-bottomright: 5px; -khtml-border-bottom-right-radius: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;}
|
||||
#breadcrumb {-moz-border-radius-bottomleft: 5px; -khtml-border-bottom-left-radius: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;}
|
||||
#menu {-moz-border-radius-topright: 5px; -khtml-border-top-right-radius: 5px; -webkit-border-top-right-radius: 5px; border-bottom-top-radius: 5px;}
|
||||
#loader {margin-left: 35px;}
|
|
@ -288,8 +288,3 @@ fieldset {
|
|||
p {
|
||||
margin: 0.8em 0 0 0
|
||||
}
|
||||
#loader {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 16em;
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
// Editor specific functions
|
||||
|
||||
function bodyLoad(version) {
|
||||
if (history.state !== undefined) {
|
||||
onpopstate(history);
|
||||
}
|
||||
}
|
||||
|
||||
function whisperClick(event, field) {
|
||||
|
|
Loading…
Reference in a new issue