added license hints to the Frio javascript files
[friendica.git/.git] / view / theme / frio / js / mod_admin.js
1 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
2 /**
3  * Javascript for the admin module
4  */
5 $(function() {
6         let $body = $('body');
7         $body.on('click', '.selectall', function() {
8                 selectall($(this).data('selectAll'));
9         });
10         $body.on('click', '.selectnone', function() {
11                 selectnone($(this).data('selectNone'));
12         });
13
14         // Toggle checkbox status to all or none for all checkboxes of a specific
15         // css class.
16         $body.on('change', 'input[type=checkbox].selecttoggle', function() {
17                 $this = $(this);
18                 if ($this.prop('checked')) {
19                         selectall($this.data('selectClass'));
20                         $this.attr('title', $this.data('selectNone'));
21                 } else {
22                         selectnone($this.data('selectClass'));
23                         $this.attr('title', $this.data('selectAll'));
24                 }
25         });
26
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) {
29                 e.preventDefault();
30
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);
35
36                 $body.css("cursor", "wait");
37
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);
43
44                         $body.css("cursor", "auto");
45                 });
46         });
47
48         function selectall(cls) {
49                 $('.' + cls).prop('checked', true);
50                 return false;
51         }
52         function selectnone(cls) {
53                 $('.' + cls).prop('checked', false);
54                 return false;
55         }
56
57
58 });
59
60 // Users
61 function confirm_delete(msg, uname){
62         return confirm(msg.format(uname));
63 }
64
65 function details(uid) {
66         $("#user-" + uid + "-detail").toggleClass("hidden");
67         $("#user-" + uid).toggleClass("opened");
68         return false;
69 }
70 // @license-end