|
|
@ -90,42 +90,60 @@ $.ready(function () { |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// populate the form errors box from GET arg ?err=...
|
|
|
|
do { |
|
|
|
// (a way to pass errors back from server via redirect)
|
|
|
|
let msgAt, box |
|
|
|
let errAt = window.location.search.indexOf('err=') |
|
|
|
// populate the form errors box from GET arg ?err=...
|
|
|
|
if (errAt !== -1 && qs('.Box.errors')) { |
|
|
|
// (a way to pass errors back from server via redirect)
|
|
|
|
let errs = decodeURIComponent(window.location.search.substr(errAt + 4)).split(',') |
|
|
|
msgAt = window.location.search.indexOf('err=') |
|
|
|
let humanReadableErrors = [] |
|
|
|
if (msgAt !== -1 && qs('.Box.errors')) { |
|
|
|
errs.forEach(function (er) { |
|
|
|
let errs = decodeURIComponent(window.location.search.substr(msgAt + 4)).split(',') |
|
|
|
let lbls = qsa('label[for="' + er + '"]') |
|
|
|
let humanReadableErrors = [] |
|
|
|
if (lbls) { |
|
|
|
errs.forEach(function (er) { |
|
|
|
for (let i = 0; i < lbls.length; i++) { |
|
|
|
let lbls = qsa('label[for="' + er + '"]') |
|
|
|
let lbl = lbls[i] |
|
|
|
if (lbls) { |
|
|
|
lbl.classList.add('error') |
|
|
|
for (let i = 0; i < lbls.length; i++) { |
|
|
|
if (i === 0) humanReadableErrors.push(lbl.childNodes[0].textContent.trim().replace(/: ?$/, '')) |
|
|
|
let lbl = lbls[i] |
|
|
|
|
|
|
|
lbl.classList.add('error') |
|
|
|
|
|
|
|
if (i === 0) humanReadableErrors.push(lbl.childNodes[0].textContent.trim().replace(/: ?$/, '')) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
humanReadableErrors.push(er) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
}) |
|
|
|
humanReadableErrors.push(er) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qs('.Box.errors .list').innerHTML = humanReadableErrors.join(', ') |
|
|
|
qs('.Box.errors .list').innerHTML = humanReadableErrors.join(', ') |
|
|
|
qs('.Box.errors').classList.remove('hidden') |
|
|
|
qs('.Box.errors').classList.remove('hidden') |
|
|
|
} |
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let msgAt = window.location.search.indexOf('msg=') |
|
|
|
let fademsgbox = function (box, time) { |
|
|
|
if (msgAt !== -1 && qs('.Box.message')) { |
|
|
|
box.classList.remove('hidden') |
|
|
|
let msg = decodeURIComponent(window.location.search.substr(msgAt + 4)) |
|
|
|
|
|
|
|
let box = qs('.Box.message') |
|
|
|
|
|
|
|
box.innerHTML = msg |
|
|
|
|
|
|
|
box.classList.remove('hidden') |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
box.classList.add('hiding') |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
box.classList.add('hidden') |
|
|
|
box.classList.add('hiding') |
|
|
|
}, 1000) |
|
|
|
setTimeout(() => { |
|
|
|
}, 2000) |
|
|
|
box.classList.add('hidden') |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
}, time) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msgAt = window.location.search.indexOf('errmsg=') |
|
|
|
|
|
|
|
box = qs('.Box.errmessage') |
|
|
|
|
|
|
|
if (msgAt !== -1 && box) { |
|
|
|
|
|
|
|
let msg = decodeURIComponent(window.location.search.substr(msgAt + 7)) |
|
|
|
|
|
|
|
box.innerHTML = msg |
|
|
|
|
|
|
|
fademsgbox(box, 3000) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msgAt = window.location.search.indexOf('msg=') |
|
|
|
|
|
|
|
box = qs('.Box.message') |
|
|
|
|
|
|
|
if (msgAt !== -1 && box) { |
|
|
|
|
|
|
|
let msg = decodeURIComponent(window.location.search.substr(msgAt + 4)) |
|
|
|
|
|
|
|
box.innerHTML = msg |
|
|
|
|
|
|
|
fademsgbox(box, 2000) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} while (0) |
|
|
|
|
|
|
|
|
|
|
|
modal.init() |
|
|
|
modal.init() |
|
|
|
notify.init() |
|
|
|
notify.init() |
|
|
|