mirror of
https://github.com/vrana/adminer.git
synced 2025-08-05 14:17:26 +02:00
JS: Use classList instead of className
This commit is contained in:
@@ -82,7 +82,7 @@ fQIDAQAB
|
||||
echo script("mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick"
|
||||
. (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')") // $token may be empty in auth.inc.php
|
||||
. "});
|
||||
document.body.className = document.body.className.replace(/ nojs/, ' js');
|
||||
document.body.classList.replace('nojs', 'js');
|
||||
const offlineMessage = '" . js_escape(lang('You are offline.')) . "';
|
||||
const thousandsSeparator = '" . js_escape(lang(',')) . "';")
|
||||
;
|
||||
|
@@ -696,7 +696,7 @@ function schemaMousemove(event) {
|
||||
const top = (event.clientY - y) / em;
|
||||
const lineSet = { };
|
||||
for (const div of qsa('div', that)) {
|
||||
if (div.className == 'references') {
|
||||
if (div.classList.contains('references')) {
|
||||
const div2 = qs('[id="' + (/^refs/.test(div.id) ? 'refd' : 'refs') + div.id.substr(4) + '"]');
|
||||
const ref = (tablePos[div.title] || [ div2.parentNode.offsetTop / em, 0 ]);
|
||||
let left1 = -1;
|
||||
|
@@ -69,7 +69,7 @@ function mixin(target, source) {
|
||||
*/
|
||||
function alterClass(el, className, enable) {
|
||||
if (el) {
|
||||
el.className = el.className.replace(RegExp('(^|\\s)' + className + '(\\s|$)'), '$2') + (enable ? ' ' + className : '');
|
||||
el.classList[enable ? 'add' : 'remove'](className);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ function alterClass(el, className, enable) {
|
||||
*/
|
||||
function toggle(id) {
|
||||
const el = qs('#' + id);
|
||||
alterClass(el, 'hidden', !/(^|\s)hidden(\s|$)/.test(el.className));
|
||||
el && el.classList.toggle('hidden');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ function whisper(url) {
|
||||
const a = field.nextSibling.firstChild;
|
||||
if (a && a.firstChild.data == field.value) {
|
||||
field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, ''));
|
||||
a.className = 'active';
|
||||
a.classList.add('active');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -56,7 +56,7 @@ function getCmMode(el) {
|
||||
for (const el of qsa('code')) {
|
||||
const mode = getCmMode(el);
|
||||
if (mode) {
|
||||
el.className += ' cm-s-default';
|
||||
el.classList.add('cm-s-default');
|
||||
CodeMirror.runMode(el.textContent, mode, el);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user