use addEventListener instead of on

pull/105/head
Aevann 2023-01-29 11:19:04 +02:00
parent 0b30067876
commit 70347cd609
5 changed files with 10 additions and 10 deletions

View File

@ -3,7 +3,7 @@ function banModal(link, name, fullname, cls) {
document.getElementById("ban-modal-link").value = link;
document.getElementById("banUserButton").innerHTML = `Ban @${name}`;
document.getElementById("banUserButton").onclick = function() {
document.getElementById("banUserButton").addEventListener('click', function() {
let form = new FormData(document.getElementById("banModalForm"));
const xhr = createXhrWithFormKey(`/ban_user/${fullname}?form`, "POST", form);
xhr[0].onload = function() {
@ -19,7 +19,7 @@ function banModal(link, name, fullname, cls) {
};
xhr[0].send(xhr[1]);
}
})
}
function chudModal(link, name, fullname, cls) {
@ -27,7 +27,7 @@ function chudModal(link, name, fullname, cls) {
document.getElementById("chud-modal-link").value = link;
document.getElementById("chudUserButton").innerHTML = `Chud @${name}`;
document.getElementById("chudUserButton").onclick = function() {
document.getElementById("chudUserButton").addEventListener('click', function() {
let form = new FormData(document.getElementById("chudModalForm"));
const xhr = createXhrWithFormKey(`/agendaposter/${fullname}?form`, "POST", form);
xhr[0].onload = function() {
@ -43,5 +43,5 @@ function chudModal(link, name, fullname, cls) {
};
xhr[0].send(xhr[1]);
}
})
}

View File

@ -244,7 +244,7 @@ emojiRequest.onload = async (e) => {
classSelectorLinkDOM.dataset.bsToggle = "tab";
classSelectorLinkDOM.dataset.className = className;
classSelectorLinkDOM.innerText = className;
classSelectorLinkDOM.onclick = switchEmojiTab;
classSelectorLinkDOM.addEventListener('click', switchEmojiTab);
classSelectorDOM.appendChild(classSelectorLinkDOM);
classesSelectorDOM.appendChild(classSelectorDOM);

View File

@ -110,7 +110,7 @@ async function getGifs(form) {
}
}
document.getElementById('gifs-back-btn').onclick = getGifs;
document.getElementById('gifs-back-btn').addEventListener('click', getGifs);
async function searchGifs(searchTerm) {
@ -139,4 +139,4 @@ async function searchGifs(searchTerm) {
}
}
gifSearchBar.onchange = () => {searchGifs(gifSearchBar.value)};
gifSearchBar.addEventListener('change', () => {searchGifs(gifSearchBar.value)});

View File

@ -42,4 +42,4 @@ function unblock_user(t, url) {
);
}
document.getElementById('2faToggle').onchange = () => {twoStepModal.show()}
document.getElementById('2faToggle').addEventListener('change', () => {twoStepModal.show()})

View File

@ -41,6 +41,6 @@ document.getElementById('username-register').addEventListener('input', function
});
document.getElementById('email-register').onfocus = (e) => {
document.getElementById('email-register').addEventListener('focus', (e) => {
if (e.target.hasAttribute('readonly')) {e.target.removeAttribute('readonly');e.target.blur();e.target.focus()}
};
});