2009-05-29 16:51:21 +00:00
|
|
|
document.body.className = 'js';
|
|
|
|
|
2009-05-29 16:14:54 +00:00
|
|
|
function toggle(id) {
|
|
|
|
var el = document.getElementById(id);
|
|
|
|
el.className = (el.className == 'hidden' ? '' : 'hidden');
|
|
|
|
return true;
|
2009-06-03 18:32:23 +00:00
|
|
|
}
|
|
|
|
|
2009-07-29 15:01:47 +00:00
|
|
|
function load_script(src, onload) {
|
2009-05-29 16:14:54 +00:00
|
|
|
var script = document.createElement('script');
|
2009-07-29 15:01:47 +00:00
|
|
|
script.src = src;
|
|
|
|
script.onload = onload;
|
|
|
|
script.onreadystatechange = function () {
|
|
|
|
if (script.readyState == 'loaded' || script.readyState == 'complete') {
|
|
|
|
onload();
|
|
|
|
}
|
|
|
|
}
|
2009-05-29 16:14:54 +00:00
|
|
|
document.body.appendChild(script);
|
|
|
|
}
|
|
|
|
|
2009-07-29 15:01:47 +00:00
|
|
|
function verify_version(version) {
|
|
|
|
document.cookie = 'adminer_version=0';
|
|
|
|
load_script('https://adminer.svn.sourceforge.net/svnroot/adminer/released.js', function () {
|
|
|
|
document.cookie = 'adminer_version=' + released;
|
|
|
|
var re = /^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)/;
|
|
|
|
var v1 = re.exec(version);
|
|
|
|
var v2 = re.exec(released);
|
|
|
|
if (v1 && v2 && (+v1[1] < +v2[1]
|
|
|
|
|| (v1[1] == v2[1] && (+v1[2] < +v2[2]
|
|
|
|
|| (v1[2] == v2[2] && (+v1[3] < +v2[3]
|
|
|
|
|| (v1[3] == v2[3] && v1[4]
|
|
|
|
))))))) {
|
|
|
|
document.getElementById('version').innerHTML = released;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-06-01 13:06:11 +00:00
|
|
|
function form_check(el, name) {
|
2009-05-29 16:14:54 +00:00
|
|
|
var elems = el.form.elements;
|
|
|
|
for (var i=0; i < elems.length; i++) {
|
2009-06-01 13:06:11 +00:00
|
|
|
if (name.test(elems[i].name)) {
|
2009-05-29 16:14:54 +00:00
|
|
|
elems[i].checked = el.checked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-01 13:06:11 +00:00
|
|
|
function form_uncheck(id) {
|
|
|
|
document.getElementById(id).checked = false;
|
|
|
|
}
|
|
|
|
|
2009-05-29 16:51:21 +00:00
|
|
|
|
|
|
|
|
2009-05-29 16:14:54 +00:00
|
|
|
function select_add_row(field) {
|
|
|
|
var row = field.parentNode.cloneNode(true);
|
|
|
|
var selects = row.getElementsByTagName('select');
|
|
|
|
for (var i=0; i < selects.length; i++) {
|
|
|
|
selects[i].name = selects[i].name.replace(/[a-z]\[[0-9]+/, '$&1');
|
|
|
|
selects[i].selectedIndex = 0;
|
|
|
|
}
|
|
|
|
var inputs = row.getElementsByTagName('input');
|
|
|
|
if (inputs.length) {
|
|
|
|
inputs[0].name = inputs[0].name.replace(/[a-z]\[[0-9]+/, '$&1');
|
|
|
|
inputs[0].value = '';
|
|
|
|
inputs[0].className = '';
|
|
|
|
}
|
|
|
|
field.parentNode.parentNode.appendChild(row);
|
|
|
|
field.onchange = function () { };
|
|
|
|
}
|