]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/js/mod_admin.js
Merge branch 'bug/phpinfo-accessible-hotfix' into 2020.09-rc
[friendica.git] / view / theme / frio / js / mod_admin.js
1 /**
2  * Javascript for the admin module
3  */
4 $(function() {
5         let $body = $('body');
6         $body.on('click', '.selectall', function() {
7                 selectall($(this).data('selectAll'));
8         });
9         $body.on('click', '.selectnone', function() {
10                 selectnone($(this).data('selectNone'));
11         });
12
13         // Toggle checkbox status to all or none for all checkboxes of a specific
14         // css class.
15         $body.on('change', 'input[type=checkbox].selecttoggle', function() {
16                 $this = $(this);
17                 if ($this.prop('checked')) {
18                         selectall($this.data('selectClass'));
19                         $this.attr('title', $this.data('selectNone'));
20                 } else {
21                         selectnone($this.data('selectClass'));
22                         $this.attr('title', $this.data('selectAll'));
23                 }
24         });
25
26         // Use AJAX calls to reorder the table (so we don't need to reload the page).
27         $body.on('click', '.table-order', function(e) {
28                 e.preventDefault();
29
30                 // Get the parent table element.
31                 var table = $(this).parents('table');
32                 var orderUrl = this.getAttribute("data-order-url");
33                 table.fadeTo("fast", 0.33);
34
35                 $body.css("cursor", "wait");
36
37                 $.get(orderUrl, function(data) {
38                         // Find the table element in the html we got.
39                         var result = $(data).find('#' + table[0].id);
40                         // And add the new table html to the parent.
41                         $(table).replaceWith(result);
42
43                         $body.css("cursor", "auto");
44                 });
45         });
46
47         function selectall(cls) {
48                 $('.' + cls).prop('checked', true);
49                 return false;
50         }
51         function selectnone(cls) {
52                 $('.' + cls).prop('checked', false);
53                 return false;
54         }
55
56
57 });
58
59 // Users
60 function confirm_delete(msg, uname){
61         return confirm(msg.format(uname));
62 }
63
64 function details(uid) {
65         $("#user-" + uid + "-detail").toggleClass("hidden");
66         $("#user-" + uid).toggleClass("opened");
67         return false;
68 }