OpenAuth_server/FrontendLegacy/shared/inputs.js

34 lines
817 B
JavaScript
Raw Permalink Normal View History

2019-03-13 01:06:09 +00:00
(() => {
const run = () => {
2020-08-07 14:16:39 +00:00
document.querySelectorAll(".floating>input").forEach((e) => {
2019-03-13 01:06:09 +00:00
function checkState() {
if (e.value !== "") {
if (e.classList.contains("used")) return;
2020-08-07 14:16:39 +00:00
e.classList.add("used");
2019-03-13 01:06:09 +00:00
} else {
2020-08-07 14:16:39 +00:00
if (e.classList.contains("used")) e.classList.remove("used");
2019-03-13 01:06:09 +00:00
}
}
2020-08-07 14:16:39 +00:00
e.addEventListener("change", () => checkState());
checkState();
});
};
2018-11-06 19:48:50 +00:00
2019-03-13 01:06:09 +00:00
run();
var mutationObserver = new MutationObserver(() => {
2020-08-07 14:16:39 +00:00
run();
2019-03-13 01:06:09 +00:00
});
mutationObserver.observe(document.documentElement, {
attributes: false,
characterData: false,
childList: true,
subtree: true,
});
2020-08-07 14:16:39 +00:00
window.Mutt;
window.addEventListener("DOMNodeInserted", () => run());
})();