PluginProbe
WebTotem Security / 2.2.2
WebTotem Security v2.2.2
3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 2.2.4 All 109 releases
wt-security / htdocs / js / ajax.js

ajax.js in WebTotem Security 2.2.2, at htdocs/js/ajax.js

160 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2
3 $('body').on('click','#waf_load_more', function (e) {
4 e.preventDefault();
5 lazy_ajax('ajax_firewall',$(this));
6 })
7 .on('click','#av_load_more', function (e) {
8 e.preventDefault();
9 lazy_ajax('ajax_antivirus',$(this));
10 });
11
12
13 $('#waf_period_filter').on('input', function (e) {
14 var $period = $(this).val();
15 period_filter('ajax_firewall',$period)
16 });
17
18 $('#av_period_filter').on('input', function (e) {
19 var $period = $(this).val();
20 period_filter('ajax_antivirus',$period)
21 });
22
23
24 $('#color_scheme_toggle input').on('click', function (e) {
25
26 let $checked = $(this).prop("checked");
27
28 jQuery.post(
29 ajaxurl,
30 {
31 action: 'color_scheme_toggle',
32 checked: Number($checked),
33 },
34 function (response) {
35 if(response == 'dark'){
36 $('.wtotem_body').addClass('wtotem_theme—dark');
37 } else{
38 $('.wtotem_body').removeClass('wtotem_theme—dark');
39 }
40 });
41
42 });
43
44 $('#chart_btn div').click( function (e) {
45 var $mainBox = $('#chart_wrap');
46 var $btn = $(this);
47 var $days = $btn.data('days');
48
49 $mainBox.animate({opacity: 0.5}, 300);
50
51 jQuery.post(
52 ajaxurl,
53 {
54 action: 'chart_filter',
55 days: $days,
56 },
57 function (response) {
58 $('#chart_btn div').removeClass('wtotem_chart-first__btn_active');
59 $btn.addClass('wtotem_chart-first__btn_active');
60
61 $mainBox
62 .html(response)
63 .animate({opacity: 1}, 300);
64 });
65 });
66
67 $('#map_btn div').click( function (e) {
68 var $mainBox = $('#wtotem_map_box');
69 var $btn = $(this);
70 var $days = $btn.data('days');
71
72 $mainBox.animate({opacity: 0.5}, 300);
73
74 jQuery.post(
75 ajaxurl,
76 {
77 action: 'map_filter',
78 days: $days,
79 },
80 function (response) {
81 $('#map_btn div').removeClass('wtotem_chart-first__btn_active');
82 $btn.addClass('wtotem_chart-first__btn_active');
83
84 $mainBox
85 .html(response)
86 .animate({opacity: 1}, 300);
87 attacksMap();
88 });
89 });
90
91 $('#wtotem_av_state_filter').change( function (e) {
92 var $period = $('#av_period_filter').val();
93 $period = $period.split(' to ');
94 $period = ($period[0]) ? $period : null;
95
96 var $mainBox = $('#wtotem_data_box');
97 $mainBox.animate({opacity: 0.5}, 300);
98
99 jQuery.post(
100 ajaxurl,
101 {
102 action: 'ajax_antivirus',
103 event: $(this).val(),
104 period: $period,
105
106 },
107 function (response) {
108 $mainBox
109 .html(response)
110 .animate({opacity: 1}, 300);
111 });
112 });
113
114
115 function lazy_ajax(actionName, btnMore ) {
116 var $period = $('.flatpickr-input').val();
117 $period = $period.split(' to ');
118 $period = ($period[0]) ? $period : null;
119
120 var $mainBox = $('#wtotem_data_box');
121 $mainBox.animate({opacity: 0.5}, 300);
122
123 jQuery.post(
124 ajaxurl,
125 {
126 action: actionName,
127 period: $period,
128 },
129 function (response) {
130 $('#waf_load_more, #av_load_more').remove();
131 $mainBox
132 .append(response)
133 .animate({opacity: 1}, 300);
134 });
135 }
136
137 // period filter
138 function period_filter(actionName, $period ) {
139 $period = $period.split(' to ');
140 $period = ($period[0]) ? $period : null;
141
142 var $mainBox = $('#wtotem_data_box');
143 $mainBox.animate({opacity: 0.5}, 300);
144
145 jQuery.post(
146 ajaxurl,
147 {
148 action: actionName,
149 filter: 'period_filter',
150 period: $period,
151
152 },
153 function (response) {
154 $mainBox
155 .html(response)
156 .animate({opacity: 1}, 300);
157 });
158 }
159
160 });