alert
, confirm
and prompt
JS-005258 if(data.responseJSON !== undefined && data.responseJSON.message !== undefined) {
59 alert(`Error updating thread /${board}/${op} lock status: ${data.responseJSON.message}`);
60 } else {
61 alert("Unable to send request: " + xhr);62 }
63 });
64}
56 }
57 }).catch((data: any, _status: any, xhr: any) => {
58 if(data.responseJSON !== undefined && data.responseJSON.message !== undefined) {
59 alert(`Error updating thread /${board}/${op} lock status: ${data.responseJSON.message}`);60 } else {
61 alert("Unable to send request: " + xhr);
62 }
37 url: webroot + "manage/threadattrs",
38 data: data
39 }).then((_data) => {
40 alert("Thread " + (lock?"locked":"unlocked") + " successfully");41 const $lockOpt = $(`select#op${op} option`)
42 .filter((_i, el) => el.textContent === "Lock thread" || el.textContent === "Unlock thread");
43 if(lock) {
JavaScript's alert
, confirm
and prompt
functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation.
Furthermore, alert
is often used while debugging code, which should be removed before deployment to production.
alert("here!");
confirm("Are you sure?");
prompt("What is your name?", "John Doe");
customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
const alert = myCustomLib.customAlert;
alert();
}