[frio] Add Mute Author Server button to post actions

This commit is contained in:
Hypolite Petovan 2023-07-09 16:14:53 -04:00
parent 9bbb55b2bb
commit 4c6334ea13
9 changed files with 180 additions and 15 deletions

View file

@ -210,6 +210,10 @@ function confirmCollapse() {
return confirm(aStr.collapseAuthor);
}
function confirmIgnoreServer() {
return confirm(aStr.ignoreServer + "\n" + aStr.ignoreServerDesc);
}
/**
* Hide and removes an item element from the DOM after the deletion url is
* successful, restore it else.
@ -325,4 +329,34 @@ function collapseAuthor(url, elementId) {
});
}
}
/**
* Ignore author server
*
* @param {string} url The server ignore URL
* @param {string} elementId The DOM id of the item element
* @returns {undefined}
*/
function ignoreServer(url, elementId) {
if (confirmIgnoreServer()) {
$("body").css("cursor", "wait");
var $el = $(document.getElementById(elementId));
$el.fadeTo("fast", 0.33, function () {
$.post(url)
.then(function () {
$el.remove();
})
.fail(function () {
// @todo Show related error message
$el.fadeTo("fast", 1);
})
.always(function () {
$("body").css("cursor", "auto");
});
});
}
}
// @license-end