Improve ignoring of messages

This commit is contained in:
Michael 2023-01-09 16:23:39 +00:00
parent 214838ea3b
commit 840f25cc5c
9 changed files with 121 additions and 21 deletions

View file

@ -202,6 +202,10 @@ function confirmBlock() {
return confirm(aStr.blockAuthor);
}
function confirmIgnore() {
return confirm(aStr.ignoreAuthor);
}
/**
* Hide and removes an item element from the DOM after the deletion url is
* successful, restore it else.
@ -258,4 +262,34 @@ function blockAuthor(url, elementId) {
});
}
}
/**
* Ignored an author and hide and removes an item element from the DOM after the block is
* successful, restore it else.
*
* @param {string} url The item removal URL
* @param {string} elementId The DOM id of the item element
* @returns {undefined}
*/
function ignoreAuthor(url, elementId) {
if (confirmIgnore()) {
$("body").css("cursor", "wait");
var $el = $(document.getElementById(elementId));
$el.fadeTo("fast", 0.33, function () {
$.get(url)
.then(function () {
$el.remove();
})
.fail(function () {
// @todo Show related error message
$el.show();
})
.always(function () {
$("body").css("cursor", "auto");
});
});
}
}
// @license-end