OpenAuth_views/public/global.js

35 lines
870 B
JavaScript
Raw Normal View History

2019-08-06 15:08:07 +00:00
(() => {
const elements = new WeakSet();
function check() {
document.querySelectorAll(".floating>input").forEach(e => {
if (elements.has(e)) return;
elements.add(e);
function checkState() {
console.log("Check State");
if (e.value !== "") {
if (e.classList.contains("used")) return;
e.classList.add("used")
} else {
if (e.classList.contains("used")) e.classList.remove("used")
}
}
e.addEventListener("change", () => checkState())
checkState()
})
};
const observer = new MutationObserver((mutations) => {
check();
});
// Start observing the target node for configured mutations
observer.observe(window.document, {
childList: true,
subtree: true
});
check();
})()