friendica-github/view/theme/frio/js/mod_admin.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
/**
* JavaScript for the admin module
*/
2021-01-22 13:38:44 +00:00
$(function () {
let $body = $("body");
$body.on("click", ".selectall", function () {
selectall($(this).data("selectAll"));
});
2021-01-22 13:38:44 +00:00
$body.on("click", ".selectnone", function () {
selectnone($(this).data("selectNone"));
});
// Toggle checkbox status to all or none for all checkboxes of a specific
// css class.
2021-01-22 13:38:44 +00:00
$body.on("change", "input[type=checkbox].selecttoggle", function () {
$this = $(this);
2021-01-22 13:38:44 +00:00
if ($this.prop("checked")) {
selectall($this.data("selectClass"));
$this.attr("title", $this.data("selectNone"));
} else {
2021-01-22 13:38:44 +00:00
selectnone($this.data("selectClass"));
$this.attr("title", $this.data("selectAll"));
}
});
function selectall(cls) {
2021-01-22 13:38:44 +00:00
$("." + cls).prop("checked", true);
return false;
}
function selectnone(cls) {
2021-01-22 13:38:44 +00:00
$("." + cls).prop("checked", false);
return false;
}
});
// Users
2021-01-22 13:38:44 +00:00
function confirm_delete(msg, uname) {
return confirm(msg.format(uname));
}
function details(uid) {
$("#user-" + uid + "-detail").toggleClass("hidden");
$("#user-" + uid).toggleClass("opened");
return false;
}
// @license-end