1 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
3 * Javascript for the admin module
7 $body.on('click', '.selectall', function() {
8 selectall($(this).data('selectAll'));
10 $body.on('click', '.selectnone', function() {
11 selectnone($(this).data('selectNone'));
14 // Toggle checkbox status to all or none for all checkboxes of a specific
16 $body.on('change', 'input[type=checkbox].selecttoggle', function() {
18 if ($this.prop('checked')) {
19 selectall($this.data('selectClass'));
20 $this.attr('title', $this.data('selectNone'));
22 selectnone($this.data('selectClass'));
23 $this.attr('title', $this.data('selectAll'));
27 // Use AJAX calls to reorder the table (so we don't need to reload the page).
28 $body.on('click', '.table-order', function(e) {
31 // Get the parent table element.
32 var table = $(this).parents('table');
33 var orderUrl = this.getAttribute("data-order-url");
34 table.fadeTo("fast", 0.33);
36 $body.css("cursor", "wait");
38 $.get(orderUrl, function(data) {
39 // Find the table element in the html we got.
40 var result = $(data).find('#' + table[0].id);
41 // And add the new table html to the parent.
42 $(table).replaceWith(result);
44 $body.css("cursor", "auto");
48 function selectall(cls) {
49 $('.' + cls).prop('checked', true);
52 function selectnone(cls) {
53 $('.' + cls).prop('checked', false);
61 function confirm_delete(msg, uname){
62 return confirm(msg.format(uname));
65 function details(uid) {
66 $("#user-" + uid + "-detail").toggleClass("hidden");
67 $("#user-" + uid).toggleClass("opened");