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