Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.167

Version Description

Dec 06 2021 = * Fix. Comment scanner. Scanning loop fixed. * Fix. Comment scanner. Scan only not spam comments. * Mod: Launching a suitable ajax handler for checking email before POST * Upd. RC. Remote calls checking moved to the root of the main file. * New. Activation. Hook for getting key auto added. * Fix. Admin notices. Errors about getting key fixed. * Fix. Visible fields. Getting visible fields collection method moved to the Cookie class * Fix. Visible fields. Getting visible fields collection method moved * Fix. Settings. Getting key button fixed. * Fix: Removed ajax_type from apbct_email_check_before_post * Fixed Ajax.php errors with apbct_email_check_before_post
* Fix: Add integration for CalculatedFieldsForm and fixed scripts

Download this release

Release Info

Developer glomberg
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.167
Comparing to
See all releases

Code changes from version 5.166 to 5.167

cleantalk.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Anti-Spam by CleanTalk
5
  Plugin URI: https://cleantalk.org
6
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
7
- Version: 5.166
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -154,6 +154,9 @@ function apbct_alt_session__save__WP_AJAX()
154
  add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
155
  add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
156
 
 
 
 
157
  // Database prefix
158
  global $wpdb;
159
  $apbct->db_prefix = ! APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
@@ -192,6 +195,13 @@ add_action('init', function () {
192
  }
193
  });
194
 
 
 
 
 
 
 
 
195
  //Delete cookie for admin trial notice
196
  add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
197
 
@@ -294,6 +304,11 @@ $apbct_active_integrations = array(
294
  'setting' => 'forms__registrations_test',
295
  'ajax' => false
296
  ),
 
 
 
 
 
297
  );
298
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
299
 
@@ -364,11 +379,6 @@ if ( ! is_admin() && ! apbct_is_ajax() && ! apbct_is_customize_preview() ) {
364
  add_filter('get_search_query', 'apbct_forms__search__testSpam');
365
  add_action('wp_head', 'apbct_search_add_noindex', 1);
366
 
367
- // Remote calls
368
- if ( RemoteCalls::check() ) {
369
- RemoteCalls::perform();
370
- }
371
-
372
  // SpamFireWall check
373
  if ( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
374
  $apbct->settings['sfw__enabled'] == 1 &&
4
  Plugin Name: Anti-Spam by CleanTalk
5
  Plugin URI: https://cleantalk.org
6
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
7
+ Version: 5.167
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
154
  add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
155
  add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
156
 
157
+ // Checking email before POST
158
+ add_action('wp_ajax_nopriv_apbct_email_check_before_post', 'apbct_email_check_before_post');
159
+
160
  // Database prefix
161
  global $wpdb;
162
  $apbct->db_prefix = ! APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
195
  }
196
  });
197
 
198
+ if ( $apbct->settings && $apbct->key_is_ok ) {
199
+ // Remote calls
200
+ if ( RemoteCalls::check() ) {
201
+ RemoteCalls::perform();
202
+ }
203
+ }
204
+
205
  //Delete cookie for admin trial notice
206
  add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
207
 
304
  'setting' => 'forms__registrations_test',
305
  'ajax' => false
306
  ),
307
+ 'CalculatedFieldsForm' => array(
308
+ 'hook' => 'cpcff_process_data',
309
+ 'setting' => 'forms__general_contact_forms_test',
310
+ 'ajax' => false
311
+ ),
312
  );
313
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
314
 
379
  add_filter('get_search_query', 'apbct_forms__search__testSpam');
380
  add_action('wp_head', 'apbct_search_add_noindex', 1);
381
 
 
 
 
 
 
382
  // SpamFireWall check
383
  if ( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
384
  $apbct->settings['sfw__enabled'] == 1 &&
inc/cleantalk-admin.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
 
4
 
5
  require_once('cleantalk-settings.php');
6
 
@@ -313,6 +314,11 @@ function apbct_admin__init()
313
  new CleantalkSettingsTemplates($apbct->api_key);
314
  }
315
 
 
 
 
 
 
316
  // Check compatibility
317
  do_action('apbct__check_compatibility');
318
  }
@@ -1187,3 +1193,20 @@ function apbct__check_compatibility_handler()
1187
  {
1188
  new \Cleantalk\Common\Compatibility();
1189
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
4
+ use Cleantalk\Variables\Server;
5
 
6
  require_once('cleantalk-settings.php');
7
 
314
  new CleantalkSettingsTemplates($apbct->api_key);
315
  }
316
 
317
+ // Show debug tab on localhosts
318
+ if ( in_array(Server::getDomain(), array( 'lc', 'loc', 'lh', 'test' )) ) {
319
+ add_filter('apbct_settings_action_buttons', 'apbct__add_debug_tab', 50, 1);
320
+ }
321
+
322
  // Check compatibility
323
  do_action('apbct__check_compatibility');
324
  }
1193
  {
1194
  new \Cleantalk\Common\Compatibility();
1195
  }
1196
+
1197
+ /**
1198
+ * @param $links
1199
+ * Adding debug tab on the settings page
1200
+ *
1201
+ * @return array|mixed
1202
+ */
1203
+ function apbct__add_debug_tab($links)
1204
+ {
1205
+ if ( is_array($links) ) {
1206
+ $debug_link = '<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_debug_tab\')">' .
1207
+ __('Debug', 'cleantalk-spam-protect') . '</a>';
1208
+ $links[] = $debug_link;
1209
+ }
1210
+
1211
+ return $links;
1212
+ }
inc/cleantalk-ajax-handlers.php CHANGED
@@ -6,6 +6,8 @@
6
 
7
  global $apbct;
8
 
 
 
9
  // If this file is called directly, abort.
10
  if ( ! defined('DOING_AJAX') ) {
11
  http_response_code(403);
@@ -35,19 +37,6 @@ function apbct_js_keys__get()
35
  apbct_js_keys__get__ajax();
36
  }
37
 
38
- function apbct_email_check_before_post()
39
- {
40
- if ( count($_POST) && isset($_POST['data']['email']) && ! empty($_POST['data']['email']) ) {
41
- $email = trim($_POST['data']['email']);
42
- $result = \Cleantalk\ApbctWP\API::methodEmailCheck($email);
43
- if ( isset($result['data']) ) {
44
- die(json_encode(array('result' => $result['data'])));
45
- }
46
- die(json_encode(array('error' => 'ERROR_CHECKING_EMAIL')));
47
- }
48
- die(json_encode(array('error' => 'EMPTY_DATA')));
49
- }
50
-
51
  function apbct_alt_session__save__AJAX()
52
  {
53
  Cleantalk\ApbctWP\Variables\AltSessions::setFromRemote();
@@ -57,3 +46,20 @@ function apbct_alt_session__get__AJAX()
57
  {
58
  Cleantalk\ApbctWP\Variables\AltSessions::getFromRemote();
59
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  global $apbct;
8
 
9
+ use Cleantalk\Variables\Post;
10
+
11
  // If this file is called directly, abort.
12
  if ( ! defined('DOING_AJAX') ) {
13
  http_response_code(403);
37
  apbct_js_keys__get__ajax();
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  function apbct_alt_session__save__AJAX()
41
  {
42
  Cleantalk\ApbctWP\Variables\AltSessions::setFromRemote();
46
  {
47
  Cleantalk\ApbctWP\Variables\AltSessions::getFromRemote();
48
  }
49
+
50
+ /**
51
+ * Checking email before POST from Ajax.php
52
+ */
53
+ function apbct_email_check_before_post_from_custom_ajax()
54
+ {
55
+ $email = trim(Post::get('email'));
56
+
57
+ if ( $email ) {
58
+ $result = \Cleantalk\ApbctWP\API::methodEmailCheck($email);
59
+ if ( isset($result['data']) ) {
60
+ die(json_encode(array('result' => $result['data'])));
61
+ }
62
+ die(json_encode(array('error' => 'ERROR_CHECKING_EMAIL')));
63
+ }
64
+ die(json_encode(array('error' => 'EMPTY_DATA')));
65
+ }
inc/cleantalk-common.php CHANGED
@@ -10,6 +10,7 @@ use Cleantalk\ApbctWP\GetFieldsAny;
10
  use Cleantalk\ApbctWP\Helper;
11
  use Cleantalk\ApbctWP\Variables\Cookie;
12
  use Cleantalk\Common\DB;
 
13
  use Cleantalk\Variables\Server;
14
 
15
  function apbct_array($array)
@@ -422,6 +423,8 @@ function apbct_exclusions_check__ip()
422
  */
423
  function apbct_get_sender_info()
424
  {
 
 
425
  // Validate cookie from the backend
426
  $cookie_is_ok = apbct_cookies_test();
427
 
@@ -446,9 +449,9 @@ function apbct_get_sender_info()
446
  : null;
447
 
448
  // Visible fields processing
449
- $visible_fields = apbct_visible_fields__process(Cookie::get('apbct_visible_fields', array(), 'array'));
450
 
451
- global $apbct;
452
 
453
  return array(
454
  'plugin_request_id' => $apbct->plugin_request_id,
@@ -474,8 +477,6 @@ function apbct_get_sender_info()
474
  'apbct_site_landing_ts'
475
  ) : null,
476
  'page_hits' => Cookie::get('apbct_page_hits') ?: null,
477
- // JS cookies
478
- 'js_info' => Cookie::get('ct_user_info'),
479
  'mouse_cursor_positions' => Cookie::get('ct_pointer_data'),
480
  'js_timezone' => Cookie::get('ct_timezone') ?: null,
481
  'key_press_timestamp' => Cookie::get('ct_fkp_timestamp') ?: null,
@@ -526,22 +527,23 @@ function apbct_sender_info___get_page_url()
526
  function apbct_visible_fields__process($visible_fields)
527
  {
528
  $visible_fields = is_array($visible_fields)
529
- ? json_encode($visible_fields)
530
  : $visible_fields;
531
 
532
  // Do not decode if it's already decoded
533
  $fields_collection = json_decode($visible_fields, true);
534
 
535
  if ( ! empty($fields_collection) ) {
 
 
 
536
  foreach ( $fields_collection as $current_fields ) {
537
  if ( isset($current_fields['visible_fields'], $current_fields['visible_fields_count']) ) {
538
  $fields = explode(' ', $current_fields['visible_fields']);
539
 
540
- // This fields belong this request
541
- $fields_to_check = apbct_get_fields_to_check();
542
  if ( count(array_intersect(array_keys($fields_to_check), $fields)) > 0 ) {
543
  // WP Forms visible fields formatting
544
- if ( strpos($visible_fields, 'wpforms') !== false ) {
545
  $current_fields = preg_replace(
546
  array('/\[/', '/\]/'),
547
  '',
@@ -595,6 +597,23 @@ function apbct_js_keys__get__ajax()
595
  die(json_encode(array('js_key' => ct_get_checkjs_value())));
596
  }
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  /**
599
  * Get ct_get_checkjs_value
600
  *
10
  use Cleantalk\ApbctWP\Helper;
11
  use Cleantalk\ApbctWP\Variables\Cookie;
12
  use Cleantalk\Common\DB;
13
+ use Cleantalk\Variables\Post;
14
  use Cleantalk\Variables\Server;
15
 
16
  function apbct_array($array)
423
  */
424
  function apbct_get_sender_info()
425
  {
426
+ global $apbct;
427
+
428
  // Validate cookie from the backend
429
  $cookie_is_ok = apbct_cookies_test();
430
 
449
  : null;
450
 
451
  // Visible fields processing
452
+ $visible_fields_collection = Cookie::getVisibleFields();
453
 
454
+ $visible_fields = apbct_visible_fields__process($visible_fields_collection);
455
 
456
  return array(
457
  'plugin_request_id' => $apbct->plugin_request_id,
477
  'apbct_site_landing_ts'
478
  ) : null,
479
  'page_hits' => Cookie::get('apbct_page_hits') ?: null,
 
 
480
  'mouse_cursor_positions' => Cookie::get('ct_pointer_data'),
481
  'js_timezone' => Cookie::get('ct_timezone') ?: null,
482
  'key_press_timestamp' => Cookie::get('ct_fkp_timestamp') ?: null,
527
  function apbct_visible_fields__process($visible_fields)
528
  {
529
  $visible_fields = is_array($visible_fields)
530
+ ? json_encode($visible_fields, JSON_FORCE_OBJECT)
531
  : $visible_fields;
532
 
533
  // Do not decode if it's already decoded
534
  $fields_collection = json_decode($visible_fields, true);
535
 
536
  if ( ! empty($fields_collection) ) {
537
+ // These fields belong this request
538
+ $fields_to_check = apbct_get_fields_to_check();
539
+
540
  foreach ( $fields_collection as $current_fields ) {
541
  if ( isset($current_fields['visible_fields'], $current_fields['visible_fields_count']) ) {
542
  $fields = explode(' ', $current_fields['visible_fields']);
543
 
 
 
544
  if ( count(array_intersect(array_keys($fields_to_check), $fields)) > 0 ) {
545
  // WP Forms visible fields formatting
546
+ if ( strpos($current_fields['visible_fields'], 'wpforms') !== false ) {
547
  $current_fields = preg_replace(
548
  array('/\[/', '/\]/'),
549
  '',
597
  die(json_encode(array('js_key' => ct_get_checkjs_value())));
598
  }
599
 
600
+ /**
601
+ * Checking email before POST
602
+ */
603
+ function apbct_email_check_before_post()
604
+ {
605
+ $email = trim(Post::get('email'));
606
+
607
+ if ( $email ) {
608
+ $result = \Cleantalk\ApbctWP\API::methodEmailCheck($email);
609
+ if ( isset($result['data']) ) {
610
+ die(json_encode(array('result' => $result['data'])));
611
+ }
612
+ die(json_encode(array('error' => 'ERROR_CHECKING_EMAIL')));
613
+ }
614
+ die(json_encode(array('error' => 'EMPTY_DATA')));
615
+ }
616
+
617
  /**
618
  * Get ct_get_checkjs_value
619
  *
inc/cleantalk-public-validate.php CHANGED
@@ -173,6 +173,20 @@ function ct_contact_form_validate()
173
  return false;
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  $post_info['comment_type'] = 'feedback_general_contact_form';
177
 
178
  /**
173
  return false;
174
  }
175
 
176
+ // Skip CalculatedFieldsForm
177
+ if (
178
+ apbct_is_plugin_active('calculated-fields-form/cp_calculatedfieldsf.php') ||
179
+ apbct_is_plugin_active('calculated-fields-form/cp_calculatedfieldsf_free.php')
180
+ ) {
181
+ foreach ( $_POST as $key => $value ) {
182
+ if ( strpos($key, 'calculatedfields') !== false ) {
183
+ do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
184
+
185
+ return null;
186
+ }
187
+ }
188
+ }
189
+
190
  $post_info['comment_type'] = 'feedback_general_contact_form';
191
 
192
  /**
inc/cleantalk-public.php CHANGED
@@ -743,6 +743,11 @@ function ct_die($_comment_id, $_comment_status)
743
  {
744
  global $ct_comment, $ct_jp_comments;
745
 
 
 
 
 
 
746
  do_action('apbct_pre_block_page', $ct_comment);
747
 
748
  $message_title = __('Spam protection', 'cleantalk-spam-protect');
@@ -793,6 +798,11 @@ function ct_die_extended($comment_body)
793
  {
794
  global $ct_jp_comments;
795
 
 
 
 
 
 
796
  $message_title = __('Spam protection', 'cleantalk-spam-protect');
797
  if ( defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE != true ) {
798
  $message_title = '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . $message_title;
@@ -1128,33 +1138,6 @@ function ct_enqueue_scripts_public($_hook)
1128
  apbct_enqueue_and_localize_public_scripts();
1129
  }
1130
 
1131
- // ct_nocache
1132
- // @todo needs to be refactored
1133
- if (
1134
- (
1135
- ! defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ||
1136
- (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)
1137
- ) &&
1138
- $apbct->settings['data__use_ajax'] && // Use AJAX for JavaScript check
1139
- ! apbct_is_in_uri('.xml') &&
1140
- ! apbct_is_in_uri('.xsl') &&
1141
- ! apbct_is_in_uri('jm-ajax')
1142
- ) {
1143
- // Collect details about browsers
1144
- if ( $apbct->settings['misc__collect_details'] ) {
1145
- wp_enqueue_script(
1146
- 'ct_collect_details',
1147
- plugins_url('/cleantalk-spam-protect/js/cleantalk_collect_details.min.js'),
1148
- array(),
1149
- APBCT_VERSION,
1150
- false /*in header*/
1151
- );
1152
- wp_localize_script('ct_collect_details', 'ctCollectDetails', array(
1153
- 'set_cookies_flag' => $apbct->settings['data__set_cookies'] ? false : true,
1154
- ));
1155
- }
1156
- }
1157
-
1158
  // GDPR script
1159
  if ( $apbct->settings['gdpr__enabled'] ) {
1160
  wp_enqueue_script(
@@ -1292,11 +1275,12 @@ function apbct_enqueue_and_localize_public_scripts()
1292
  ($apbct->settings['data__pixel'] === '3' && apbct_is_cache_plugins_exists()),
1293
  'pixel__url' => $apbct->pixel_url,
1294
  'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'],
 
1295
  ));
1296
  }
1297
 
1298
  /**
1299
- * Reassign callbackback function for the bootom of comment output.
1300
  */
1301
  function ct_wp_list_comments_args($options)
1302
  {
743
  {
744
  global $ct_comment, $ct_jp_comments;
745
 
746
+ // JCH Optimize caching preventing
747
+ add_filter('jch_optimize_page_cache_set_caching', static function ($_is_cache_active) {
748
+ return false;
749
+ }, 999, 1);
750
+
751
  do_action('apbct_pre_block_page', $ct_comment);
752
 
753
  $message_title = __('Spam protection', 'cleantalk-spam-protect');
798
  {
799
  global $ct_jp_comments;
800
 
801
+ // JCH Optimize caching preventing
802
+ add_filter('jch_optimize_page_cache_set_caching', static function ($_is_cache_active) {
803
+ return false;
804
+ }, 999, 1);
805
+
806
  $message_title = __('Spam protection', 'cleantalk-spam-protect');
807
  if ( defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE != true ) {
808
  $message_title = '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . $message_title;
1138
  apbct_enqueue_and_localize_public_scripts();
1139
  }
1140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1141
  // GDPR script
1142
  if ( $apbct->settings['gdpr__enabled'] ) {
1143
  wp_enqueue_script(
1275
  ($apbct->settings['data__pixel'] === '3' && apbct_is_cache_plugins_exists()),
1276
  'pixel__url' => $apbct->pixel_url,
1277
  'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'],
1278
+ 'data__set_cookies' => $apbct->settings['data__set_cookies'],
1279
  ));
1280
  }
1281
 
1282
  /**
1283
+ * Reassign callback function for the bottom of comment output.
1284
  */
1285
  function ct_wp_list_comments_args($options)
1286
  {
inc/cleantalk-settings.php CHANGED
@@ -3,6 +3,7 @@
3
  use Cleantalk\ApbctWP\Helper;
4
  use Cleantalk\Variables\Post;
5
  use Cleantalk\ApbctWP\Cron;
 
6
 
7
  /**
8
  * Admin action 'admin_menu' - Add the admin options page
@@ -86,6 +87,10 @@ function apbct_settings__set_fileds()
86
  'connection_reports' => array(
87
  'callback' => 'apbct_settings__field__statistics',
88
  ),
 
 
 
 
89
  'api_key' => array(
90
  'callback' => 'apbct_settings__field__apikey',
91
  ),
@@ -674,14 +679,6 @@ function apbct_settings__set_fileds()
674
  'section' => 'hidden_section',
675
  'html_after' => '</div><div id="apbct_hidden_section_nav">{HIDDEN_SECTION_NAV}</div></div>',
676
  'fields' => array(
677
- 'misc__collect_details' => array(
678
- 'type' => 'checkbox',
679
- 'title' => __('Collect details about browsers', 'cleantalk-spam-protect'),
680
- 'description' => __(
681
- "Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.",
682
- 'cleantalk-spam-protect'
683
- ),
684
- ),
685
  'misc__send_connection_reports' => array(
686
  'type' => 'checkbox',
687
  'title' => __('Send connection reports', 'cleantalk-spam-protect'),
@@ -1154,6 +1151,8 @@ function apbct_settings__display()
1154
 
1155
  echo "</form>";
1156
 
 
 
1157
  if ( ! $apbct->white_label ) {
1158
  // Translate banner for non EN locale
1159
  if ( substr(get_locale(), 0, 2) != 'en' ) {
@@ -1527,58 +1526,61 @@ function apbct_settings__field__apikey()
1527
  echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
1528
  . __('Show the access key', 'cleantalk-spam-protect')
1529
  . '</a>';
1530
- // "Auto Get Key" buttons. License agreement
1531
- } else {
1532
- echo '<br /><br />';
1533
-
1534
- // Auto get key
1535
- if ( ! $apbct->ip_license ) {
1536
- echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" id="apbct_button__get_key_auto" name="submit" type="button" value="get_key_auto">'
1537
- . __('Get Access Key Automatically', 'cleantalk-spam-protect')
1538
- . '<img style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
1539
- . '<img style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
1540
- . '</button>';
1541
- echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
1542
- echo '<br />';
1543
- echo '<br />';
1544
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1545
 
1546
- // Warnings and GDPR
 
 
 
 
1547
  printf(
1548
- __(
1549
- 'Admin e-mail %s %s will be used for registration оr click here to %sGet Access Key Manually%s.',
1550
- 'cleantalk-spam-protect'
1551
- ),
1552
- '<span id="apbct-account-email">'
1553
- . ct_get_admin_email() .
1554
- '</span>',
1555
- apbct_settings__btn_change_account_email_html(),
1556
- '<a class="apbct_color--gray" target="__blank" id="apbct-key-manually-link" href="'
1557
- . sprintf(
1558
- 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
1559
- urlencode(ct_get_admin_email()),
1560
- urlencode(get_bloginfo('url'))
1561
- )
1562
- . '">',
1563
  '</a>'
1564
  );
1565
-
1566
- // License agreement
1567
- if ( ! $apbct->ip_license ) {
1568
- echo '<div>';
1569
- echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
1570
- echo '<label for="spbc_license_agreed">';
1571
- printf(
1572
- __('I accept %sLicense Agreement%s.', 'cleantalk-spam-protect'),
1573
- '<a class = "apbct_color--gray" href="https://cleantalk.org/publicoffer" target="_blank">',
1574
- '</a>'
1575
- );
1576
- echo "</label>";
1577
- echo '</div>';
1578
- }
1579
  }
1580
 
1581
  echo '</div>';
 
1582
  }
1583
 
1584
  function apbct_field_service_utilization()
@@ -1773,6 +1775,13 @@ function apbct_settings__field__statistics()
1773
  echo '</div>';
1774
  }
1775
 
 
 
 
 
 
 
 
1776
  function apbct_get_all_child_domains($except_main_site = false)
1777
  {
1778
  global $wpdb;
@@ -2687,3 +2696,20 @@ function apbct_settings__btn_change_account_email_html()
2687
  . __('change email', 'cleantalk-spam-protect') .
2688
  '</button>)';
2689
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  use Cleantalk\ApbctWP\Helper;
4
  use Cleantalk\Variables\Post;
5
  use Cleantalk\ApbctWP\Cron;
6
+ use Cleantalk\Variables\Server;
7
 
8
  /**
9
  * Admin action 'admin_menu' - Add the admin options page
87
  'connection_reports' => array(
88
  'callback' => 'apbct_settings__field__statistics',
89
  ),
90
+ 'debug_tab' => array(
91
+ 'callback' => 'apbct_settings__field__debug_tab',
92
+ 'display' => Server::getDomain(), array( 'lc', 'loc', 'lh', 'test' ),
93
+ ),
94
  'api_key' => array(
95
  'callback' => 'apbct_settings__field__apikey',
96
  ),
679
  'section' => 'hidden_section',
680
  'html_after' => '</div><div id="apbct_hidden_section_nav">{HIDDEN_SECTION_NAV}</div></div>',
681
  'fields' => array(
 
 
 
 
 
 
 
 
682
  'misc__send_connection_reports' => array(
683
  'type' => 'checkbox',
684
  'title' => __('Send connection reports', 'cleantalk-spam-protect'),
1151
 
1152
  echo "</form>";
1153
 
1154
+ echo '<form id="debug__cron_set" method="POST"></form>';
1155
+
1156
  if ( ! $apbct->white_label ) {
1157
  // Translate banner for non EN locale
1158
  if ( substr(get_locale(), 0, 2) != 'en' ) {
1526
  echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
1527
  . __('Show the access key', 'cleantalk-spam-protect')
1528
  . '</a>';
1529
+ }
1530
+
1531
+ // "Auto Get Key" buttons. License agreement
1532
+ echo '<div id="apbct_button__get_key_auto__wrapper">';
1533
+
1534
+ echo '<br /><br />';
1535
+
1536
+ // Auto get key
1537
+ if ( ! $apbct->ip_license ) {
1538
+ echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" id="apbct_button__get_key_auto" name="submit" type="button" value="get_key_auto">'
1539
+ . __('Get Access Key Automatically', 'cleantalk-spam-protect')
1540
+ . '<img style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
1541
+ . '<img style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
1542
+ . '</button>';
1543
+ echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
1544
+ echo '<br />';
1545
+ echo '<br />';
1546
+ }
1547
+
1548
+ // Warnings and GDPR
1549
+ printf(
1550
+ __(
1551
+ 'Admin e-mail %s %s will be used for registration оr click here to %sGet Access Key Manually%s.',
1552
+ 'cleantalk-spam-protect'
1553
+ ),
1554
+ '<span id="apbct-account-email">'
1555
+ . ct_get_admin_email() .
1556
+ '</span>',
1557
+ apbct_settings__btn_change_account_email_html(),
1558
+ '<a class="apbct_color--gray" target="__blank" id="apbct-key-manually-link" href="'
1559
+ . sprintf(
1560
+ 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
1561
+ urlencode(ct_get_admin_email()),
1562
+ urlencode(get_bloginfo('url'))
1563
+ )
1564
+ . '">',
1565
+ '</a>'
1566
+ );
1567
 
1568
+ // License agreement
1569
+ if ( ! $apbct->ip_license ) {
1570
+ echo '<div>';
1571
+ echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
1572
+ echo '<label for="spbc_license_agreed">';
1573
  printf(
1574
+ __('I accept %sLicense Agreement%s.', 'cleantalk-spam-protect'),
1575
+ '<a class = "apbct_color--gray" href="https://cleantalk.org/publicoffer" target="_blank">',
 
 
 
 
 
 
 
 
 
 
 
 
 
1576
  '</a>'
1577
  );
1578
+ echo "</label>";
1579
+ echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
1580
  }
1581
 
1582
  echo '</div>';
1583
+ echo '</div>';
1584
  }
1585
 
1586
  function apbct_field_service_utilization()
1775
  echo '</div>';
1776
  }
1777
 
1778
+ function apbct_settings__field__debug_tab()
1779
+ {
1780
+ echo '<div id="apbct_debug_tab" class="apbct_settings-field_wrapper" style="display: none;">';
1781
+ echo apbct_debug__set_sfw_update_cron();
1782
+ echo '</div>';
1783
+ }
1784
+
1785
  function apbct_get_all_child_domains($except_main_site = false)
1786
  {
1787
  global $wpdb;
2696
  . __('change email', 'cleantalk-spam-protect') .
2697
  '</button>)';
2698
  }
2699
+
2700
+ /**
2701
+ * Staff thing - set sfw_update cron task
2702
+ */
2703
+ function apbct_debug__set_sfw_update_cron()
2704
+ {
2705
+ global $apbct;
2706
+
2707
+ return '<input form="debug__cron_set" type="hidden" name="spbc_remote_call_action" value="cron_update_task" />'
2708
+ . '<input form="debug__cron_set" type="hidden" name="plugin_name" value="apbct" />'
2709
+ . '<input form="debug__cron_set" type="hidden" name="spbc_remote_call_token" value="' . md5($apbct->api_key) . '" />'
2710
+ . '<input form="debug__cron_set" type="hidden" name="task" value="sfw_update" />'
2711
+ . '<input form="debug__cron_set" type="hidden" name="handler" value="apbct_sfw_update__init" />'
2712
+ . '<input form="debug__cron_set" type="hidden" name="period" value="' . $apbct->stats['sfw']['update_period'] . '" />'
2713
+ . '<input form="debug__cron_set" type="hidden" name="first_call" value="' . (time() + 60) . '" />'
2714
+ . '<input form="debug__cron_set" type="submit" value="Set SFW update to 60 seconds from now" />';
2715
+ }
js/apbct-public--functions.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ctSetCookie(t,o,n){var e;("string"==typeof t&&"string"==typeof o||"number"==typeof o)&&(e="ct_pointer_data"===t||"ct_user_info"===t,t=[[t,o,n]]),0==+ctPublicFunctions.data__set_cookies||(1==+ctPublicFunctions.data__set_cookies?t.forEach(function(t,o,n){var e=void 0!==t[2]?"expires="+e+"; ":"",a="https:"===location.protocol?"; secure":"";document.cookie=t[0]+"="+encodeURIComponent(t[1])+"; "+e+"path=/; samesite=lax"+a}):2!=+ctPublicFunctions.data__set_cookies||e||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{apbct_ajax:1,notJson:1}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function apbct_public_sendAJAX(o,n,e){var a=n.callback||null,c=n.callback_context||null,s=n.callback_params||null,t=n.async||!0,l=n.notJson||null,r=n.timeout||15e3,e=e||null,u=n.button||null,i=n.spinner||null,_=n.progressbar||null,p=n.silent||null,b=n.no_nonce||null,d=n.apbct_ajax||null;"string"==typeof o?o=(o=!b?o+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce:o)+"&no_cache="+Math.random():(b||(o._ajax_nonce=ctPublicFunctions._ajax_nonce),o.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),i&&jQuery(i).css("display","inline"),jQuery.ajax({type:"POST",url:d?ctPublicFunctions._apbct_ajax_url:ctPublicFunctions._ajax_url,data:o,async:t,success:function(t){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),(t=!l?JSON.parse(t):t).error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):a&&(s?a.apply(c,s.concat(t,o,n,e)):a(t,o,n,e))},error:function(t,o,n){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:r})}function apbct_public_sendREST(o,n){var e=n.callback||null,t=n.data||[],a=n.method||"POST";jQuery.ajax({type:a,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+o,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):e&&e(t,o,n,null)},error:function(t,o,n){n&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}
2
  //# sourceMappingURL=apbct-public--functions.min.js.map
1
+ function ctSetCookie(t,o,n){var e;("string"==typeof t&&"string"==typeof o||"number"==typeof o)&&(e="ct_pointer_data"===t,t=[[t,o,n]]),0==+ctPublicFunctions.data__set_cookies||(1==+ctPublicFunctions.data__set_cookies?t.forEach(function(t,o,n){var e=void 0!==t[2]?"expires="+e+"; ":"",c="https:"===location.protocol?"; secure":"";document.cookie=t[0]+"="+encodeURIComponent(t[1])+"; "+e+"path=/; samesite=lax"+c}):2!=+ctPublicFunctions.data__set_cookies||e||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{apbct_ajax:1,notJson:1}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function ctDeleteCookie(t){var o;0==+ctPublicFunctions.data__set_cookies||(1==+ctPublicFunctions.data__set_cookies?(o="https:"===location.protocol?"; secure":"",document.cookie=t+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+o):ctPublicFunctions.data__set_cookies)}function apbct_public_sendAJAX(o,n,e){var c=n.callback||null,a=n.callback_context||null,s=n.callback_params||null,t=n.async||!0,l=n.notJson||null,i=n.timeout||15e3,e=e||null,u=n.button||null,r=n.spinner||null,_=n.progressbar||null,p=n.silent||null,b=n.no_nonce||null,d=n.apbct_ajax||null;"string"==typeof o?o=(o=!b?o+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce:o)+"&no_cache="+Math.random():(b||(o._ajax_nonce=ctPublicFunctions._ajax_nonce),o.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),r&&jQuery(r).css("display","inline"),jQuery.ajax({type:"POST",url:d?ctPublicFunctions._apbct_ajax_url:ctPublicFunctions._ajax_url,data:o,async:t,success:function(t){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),(t=!l?JSON.parse(t):t).error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):c&&(s?c.apply(a,s.concat(t,o,n,e)):c(t,o,n,e))},error:function(t,o,n){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:i})}function apbct_public_sendREST(o,n){var e=n.callback||null,t=n.data||[],c=n.method||"POST";jQuery.ajax({type:c,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+o,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):e&&e(t,o,n,null)},error:function(t,o,n){n&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}
2
  //# sourceMappingURL=apbct-public--functions.min.js.map
js/apbct-public--functions.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data' || cookies === 'ct_user_info';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( +ctPublicFunctions.data__set_cookies === 0 ){\n return;\n\n // Using traditional cookies\n }else if( +ctPublicFunctions.data__set_cookies === 1 ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( +ctPublicFunctions.data__set_cookies === 2 && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n }else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n apbct_ajax: 1,\n notJson: 1,\n }\n );\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n var apbct_ajax = params.apbct_ajax || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: apbct_ajax ? ctPublicFunctions._apbct_ajax_url : ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__set_cookies","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_ajax","notJson","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_apbct_ajax_url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,GAA6C,iBAAZA,EAChDA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,IAAxCE,kBAAkBC,oBAI4B,IAAxCD,kBAAkBC,kBACzBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,EAAK,IAAM,KAAOL,EAAU,uBAAyBQ,IAI/D,IAAxCN,kBAAkBC,mBAA6BF,IAGZ,SAAtCC,kBAAkBY,gBAClBC,sB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AAaA,EAAYwB,QAAQ,SAAY,KACvEC,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C7B,IACKE,EACAF,EAASkC,MAAOjC,EAAkBC,EAAgBiC,OAAQV,EAAQhC,EAAMK,EAAQC,IAEhFC,EAASyB,EAAQhC,EAAMK,EAAQC,KAI/C8B,MAAO,SAASO,EAAOC,EAAYC,GAC5BjC,IAAUA,EAAOqB,gBAAgB,YAAarB,EAAOU,MAAMC,OAAS,WACpEV,GAASW,OAAOX,GAASY,IAAI,UAAW,QACvCoB,IAAiB9B,IACjBwB,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,wCAA0CK,EAAc,yGAG5ElC,QAASA,IAIjB,SAASb,sBAAuBgD,EAAOzC,GAEnC,IAAIE,EAAWF,EAAOE,UAAY,KAC9BP,EAAWK,EAAOL,MAAQ,GAC1BD,EAAWM,EAAON,QAAU,OAEhCyB,OAAOE,KAAK,CACRC,KAAM5B,EACN6B,IAAK3C,kBAAkB8D,UAAY,yBAA2BD,EAC9D9C,KAAMA,EACNgD,WAAa,SAAWC,GACpBA,EAAIC,iBAAkB,aAAcjE,kBAAkBkE,cAE1DpB,QAAS,SAASC,GACXA,EAAOI,MACNG,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C7B,GAECA,EAASyB,EAAQc,EAAOzC,EADd,OAKtB+B,MAAO,SAASO,EAAOC,EAAYC,GAC3BA,IACAN,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc"}
1
+ {"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( +ctPublicFunctions.data__set_cookies === 0 ){\n return;\n\n // Using traditional cookies\n }else if( +ctPublicFunctions.data__set_cookies === 1 ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( +ctPublicFunctions.data__set_cookies === 2 && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n }else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n apbct_ajax: 1,\n notJson: 1,\n }\n );\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( +ctPublicFunctions.data__set_cookies === 0 ){\n return;\n\n // Using traditional cookies\n }else if( +ctPublicFunctions.data__set_cookies === 1 ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( +ctPublicFunctions.data__set_cookies === 2 ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n var apbct_ajax = params.apbct_ajax || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: apbct_ajax ? ctPublicFunctions._apbct_ajax_url : ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__set_cookies","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_ajax","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_apbct_ajax_url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,IAAxCE,kBAAkBC,oBAI4B,IAAxCD,kBAAkBC,kBACzBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,E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D,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc"}
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_collect_visible_fields(e){var t=[],n="",o=0,c="",l=0,i=[];for(var a in e.elements)isNaN(+a)||(t[a]=e.elements[a]);return(t=t.filter(function(e){return-1===i.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(i.push(e.getAttribute("name")),!1))})).forEach(function(e,t,i){"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&"ct_checkjs"!==e.getAttribute("name")&&("none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")||e.classList.contains("wp-editor-area")?(n+=" "+e.getAttribute("name"),o++):(c+=" "+e.getAttribute("name"),l++))}),c=c.trim(),{visible_fields:n=n.trim(),visible_fields_count:o,invisible_fields:c,invisible_fields_count:l}}function apbct_visible_fields_set_cookie(e){var t="object"==typeof e&&null!==e?e:{};ctSetCookie("apbct_visible_fields",JSON.stringify(t))}function apbct_js_keys__set_input_value(e,t,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var o=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<o.length;c++)o[c].value=e.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}!function(){var t=new Date,i=(new Date).getTime(),n=!0,o=[],c=0,l={},e=!1,a=!1;function s(e,t,i){"function"==typeof window.addEventListener?e.addEventListener(t,i):e.attachEvent(t,i)}function u(e,t,i){"function"==typeof window.removeEventListener?e.removeEventListener(t,i):e.detachEvent(t,i)}var r=function(){var e=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",e),u(window,"mousedown",r),u(window,"keydown",r)},d=setInterval(function(){n=!0},150),m=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),_=function(e){a||(ctSetCookie("ct_mouse_moved","true"),a=!0),!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-i)]),n=!1,50<=++c&&(u(window,"mousemove",_),clearInterval(d),clearInterval(m)))};function f(e){var t=e.target.value;!t||t in l||apbct_public_sendAJAX({action:"apbct_email_check_before_post",data:{email:t}},{apbct_ajax:1,callback:function(e){e.result&&(l[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(l)))}})}s(window,"mousemove",_),s(window,"mousedown",r),s(window,"keydown",r),s(window,"scroll",function(){e||(ctSetCookie("ct_has_scrolled","true"),e=!0)}),s(window,"DOMContentLoaded",function(){var e=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",t.getTimezoneOffset()/60*-1],["apbct_visible_fields","0"],["ct_screen_info",apbctGetScreenInfo()],["ct_has_scrolled","false"],["ct_mouse_moved","false"]];+ctPublic.pixel__setting&&(e.push(["apbct_pixel_url",ctPublic.pixel__url]),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+ctPublic.pixel__url+'">'))),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(f)),ctSetCookie(e),setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var i=document.forms[t];i.classList.contains("slp_search_form")||i.parentElement.classList.contains("mec-booking")||-1!==i.action.toString().indexOf("activehosted.com")||i.id&&"caspioform"==i.id||i.name.classList&&i.name.classList.contains("tinkoffPayRow")||i.name.classList&&i.name.classList.contains("give-form")||(e[t]=apbct_collect_visible_fields(i),i.onsubmit_prev=i.onsubmit,i.onsubmit=function(e){var t={};t[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,i){var n;!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(n=JSON.parse(t.responseText)).apbct&&(n=n.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n.comment}})),cleantalkModal.loaded=n.comment,cleantalkModal.open(),1==+n.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
1
+ function apbct_collect_visible_fields(e){var t,i=[],n="",c=0,o="",a=0,l=[];for(t in e.elements)isNaN(+t)||(i[t]=e.elements[t]);return(i=i.filter(function(e){return-1===l.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(l.push(e.getAttribute("name")),!1))})).forEach(function(e,t,i){"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&"ct_checkjs"!==e.getAttribute("name")&&("none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")||e.classList.contains("wp-editor-area")?(n+=" "+e.getAttribute("name"),c++):(o+=" "+e.getAttribute("name"),a++))}),o=o.trim(),{visible_fields:n=n.trim(),visible_fields_count:c,invisible_fields:o,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(e,t){var i="object"==typeof e&&null!==e?e:{};if(1==+ctPublic.data__set_cookies)for(var n in i)ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(i[n]));else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_js_keys__set_input_value(e,t,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var c=document.querySelectorAll("[name^=ct_checkjs]"),o=0;o<c.length;o++)c[o].value=e.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}!function(){var c=new Date,t=(new Date).getTime(),i=!0,n=[],o=0,a={},e=!1,l=!1;function s(e,t,i){"function"==typeof window.addEventListener?e.addEventListener(t,i):e.attachEvent(t,i)}function u(e,t,i){"function"==typeof window.removeEventListener?e.removeEventListener(t,i):e.detachEvent(t,i)}var d=function(e){var t=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",t),u(window,"mousedown",d),u(window,"keydown",d)},_=setInterval(function(){i=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(e){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),i=!1,50<=++o&&(u(window,"mousemove",m),clearInterval(_),clearInterval(r)))};function f(e){var t=e.target.value;!t||t in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(a[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{apbct_ajax:1,callback:function(e){e.result&&(a[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{callback:function(e){e.result&&(a[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}s(window,"mousemove",m),s(window,"mousedown",d),s(window,"keydown",d),s(window,"scroll",function(){e||(ctSetCookie("ct_has_scrolled","true"),e=!0)}),s(window,"DOMContentLoaded",function(){var e=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",c.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["ct_has_scrolled","false"],["ct_mouse_moved","false"]];if(1!=+ctPublic.data__set_cookies)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var i=0;i<t.length;i++){var n=t[i].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(e.push(["apbct_pixel_url",ctPublic.pixel__url]),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+ctPublic.pixel__url+'">'))),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(f)),ctSetCookie(e),setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var i=document.forms[t];i.classList.contains("slp_search_form")||i.parentElement.classList.contains("mec-booking")||-1!==i.action.toString().indexOf("activehosted.com")||i.id&&"caspioform"==i.id||i.name.classList&&i.name.classList.contains("tinkoffPayRow")||i.name.classList&&i.name.classList.contains("give-form")||i.id&&"ult-forgot-password-form"===i.id||i.id&&-1!==i.id.indexOf("calculatedfields")||(e[t]=apbct_collect_visible_fields(i),i.onsubmit_prev=i.onsubmit,i.ctFormIndex=t,i.onsubmit=function(e){var t;1!=+ctPublic.data__set_cookies&&void 0!==e.target.ctFormIndex&&((t={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t,e.target.ctFormIndex)),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,i){!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(t=JSON.parse(t.responseText)).apbct&&(t=t.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:t.comment}})),cleantalkModal.loaded=t.comment,cleantalkModal.open(),1==+t.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
js/apbct-public.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{action: 'apbct_email_check_before_post', data : {'email' : current_email}},\n\t\t\t\t{\n\t\t\t\t\tapbct_ajax: 1,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\t\t\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"apbct_visible_fields\", \"0\"],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t];\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + ctPublic.pixel__url + '\">' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tvar visible_fields_collection = {};\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id == 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('give-form')) // GiveWP\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields );\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["apbct_collect_visible_fields","form","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","collection","ctSetCookie","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","floor","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","target","apbct_public_sendAJAX","action","email","apbct_ajax","timestamp","now","initCookies","getTimezoneOffset","ctPublic","pixel__setting","pixel__url","pixel__enabled","getElementById","jQuery","append","data__email_check_before_post","blur","setTimeout","forms","parentElement","toString","id","name","onsubmit_prev","onsubmit","this","Function","call","ajaxComplete","xhr","settings","response","responseText","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAsLA,SAASA,6BAA8BC,GAGtC,IAAIC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAAmB,GACnBC,EAAyB,EACzBC,EAA8B,GAE/B,IAAI,IAAIC,KAAOP,EAAKQ,SACfC,OAAOF,KACVN,EAAOM,GAAOP,EAAKQ,SAASD,IAsD9B,OAlDAN,EAASA,EAAOS,OAAO,SAASC,GAG/B,OAA0E,IAAtEL,EAA4BM,QAASD,EAAKE,aAAa,YAItD,IAAM,CAAC,QAAS,YAAYD,QAASD,E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KoH,SAAW,SAAU/C,GAEzB,IAAI7C,EAAiB,GACrBA,EAAe,GAAKzB,6BAA6BsH,MACjDzF,gCAAiCJ,GAG7B6C,EAAMsB,OAAOwB,yBAAyBG,UACzCT,WAAW,WACVxC,EAAMsB,OAAOwB,cAAcI,KAAKlD,EAAMsB,OAAQtB,IAC5C,OAKNzC,gCAAiCC,IAE/B,OAhLL,GA+RqB,oBAAX4E,QAGTA,OAAOlE,UAAUiF,aAAa,SAAUnD,EAAOoD,EAAKC,GACnD,IACKC,GADDF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAahH,QAAQ,gBAElB,KAD1B+G,EAAW3F,KAAK6F,MAAMJ,EAAIG,eACVE,QACnBH,EAAWA,EAASG,OACPC,UACZxF,SAASyF,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAAST,EAASU,YAK9BC,eAAeC,OAASZ,EAASU,QACjCC,eAAeE,OAEa,IAAxBb,EAASc,aACZlE,OAAOmE"}
1
+ {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Using AJAX request and handler\n\t\t\t}else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tapbct_ajax: 1,\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t];\n\n\t\tif( + ctPublic.data__set_cookies !== 1 ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + ctPublic.pixel__url + '\">' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tvar visible_fields_collection = {};\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id == 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.indexOf('calculatedfields') !== -1) // CalculatedFieldsForm\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( + ctPublic.data__set_cookies !== 1 && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( + ctPublic.data__set_cookies === 1 ) {\n\t\tfor ( var i in collection ) {\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__set_cookies","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","floor","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","target","ctPublicFunctions","data__ajax_type","apbct_public_sendREST","method","email","timestamp","now","apbct_public_sendAJAX","action","apbct_ajax","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","pixel__url","pixel__enabled","getElementById","jQuery","append","data__email_check_before_post","blur","setTimeout","forms","parentElement","toString","id","name","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","ajaxComplete","xhr","settings","responseText","response","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAgPA,SAASA,6BAA8BC,GAGtC,IAOQC,EAPJC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAAmB,GACnBC,EAAyB,EACzBC,EAA8B,GAE/B,IAAQN,KAAOD,EAAKQ,SACfC,OAAOR,KACVC,EAAOD,GAAOD,EAAKQ,SAASP,IAsD9B,OAlDAC,EAASA,EAAOQ,OAAO,SAASC,GAG/B,OAA0E,IAAtEJ,EAA4BK,QAASD,EAAKE,aAAa,YAItD,IAAM,CAAC,QAAS,YAAYD,QAASD,EAAKE,aAAa,WAC3DN,EAA4BO,KAAMH,EAAKE,aAAa,UAC7C,OAMFE,QAAQ,SAASJ,EAAMK,EAAGR,GAGO,WAAtCG,EAAKE,aAAa,SACoB,OAAtCF,EAAKE,aAAa,SACoB,eAAtCF,EAAKE,aAAa,UAMoB,SAAtCI,iBAAiBN,GAAMO,SACe,WAAtCD,iBAAiBN,GAAMQ,YACe,MA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EAAIE,eAAwD,IAAxCF,EAAIE,aAAa5H,QAAQ,gBAElB,KAD1B6H,EAAWrG,KAAKsG,MAAMJ,EAAIE,eACVG,QACnBF,EAAWA,EAASE,OACPC,UACZjG,SAASkG,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAASR,EAASS,YAK9BC,eAAeC,OAASX,EAASS,QACjCC,eAAeE,OAEa,IAAxBZ,EAASa,aACZ3E,OAAO4E"}
js/cleantalk-admin-settings-page.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_banner_check(){var c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null===a){if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}else c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){var a;null===c&&(c=null===t.getAttribute("disabled")?0:1),1===c?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null===t.getAttribute("apbct_children")||null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){var c=function(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))};c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class= 'apbct-icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){a.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}function apbct_save_button_position(){var t,e,n,a,c,s,o,i;null!==document.getElementById("apbct_settings__before_advanced_settings")&&null!==document.getElementById("apbct_settings__after_advanced_settings")&&null!==document.getElementById("apbct_settings__button_section")&&null!==document.getElementById("apbct_settings__advanced_settings")&&null!==document.getElementById("apbct_hidden_section_nav")&&(t=window.innerHeight,n=(e=document.getElementById("apbct_settings__advanced_settings")).getBoundingClientRect().top,c=(a=document.getElementById("apbct_settings__button_section")).getBoundingClientRect().height,o=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,i=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<o+i+c?(a.style.bottom="",a.style.top=o+i+20+"px"):(a.style.bottom=0,a.style.top="")):jQuery("#apbct_settings__main_save_button").show(),s.style.top=n<=0?30-n+"px":0)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var t,c,e=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0!==e.data("id")?(t={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})):console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0!==t.data("id")){if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");var a={template_name:n}}else a={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:a},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}else console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbct_banner_check(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbct_save_button_position(),window.addEventListener("scroll",apbct_save_button_position),jQuery("#ct_adv_showhide a").on("click",apbct_save_button_position),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var e=jQuery(this),n=jQuery("#apbct-account-email"),a=n.text();e.toggleClass("active"),e.hasClass("active")?(e.text(e.data("save-text")),n.attr("contenteditable","true"),n.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),n.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:a},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),n.attr("contenteditable","false"),e.text(e.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();if(""===t||null===t.match(/^[a-z\d]{3,15}$/))return jQuery("#apbct_button__get_key_auto").show(),void jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!0);jQuery("#apbct_button__get_key_auto").hide(),jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!1)})});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
1
+ function apbct_banner_check(){var c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null===a){if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}else c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){var a;null===c&&(c=null===t.getAttribute("disabled")?0:1),1===c?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null===t.getAttribute("apbct_children")||null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){var c=function(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))};c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class= 'apbct-icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){a.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}function apbct_save_button_position(){var t,e,n,a,c,s,o,i;null!==document.getElementById("apbct_settings__before_advanced_settings")&&null!==document.getElementById("apbct_settings__after_advanced_settings")&&null!==document.getElementById("apbct_settings__button_section")&&null!==document.getElementById("apbct_settings__advanced_settings")&&null!==document.getElementById("apbct_hidden_section_nav")&&(t=window.innerHeight,n=(e=document.getElementById("apbct_settings__advanced_settings")).getBoundingClientRect().top,c=(a=document.getElementById("apbct_settings__button_section")).getBoundingClientRect().height,o=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,i=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<o+i+c?(a.style.bottom="",a.style.top=o+i+20+"px"):(a.style.bottom=0,a.style.top="")):jQuery("#apbct_settings__main_save_button").show(),s.style.top=n<=0?30-n+"px":0)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var t,c,e=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0!==e.data("id")?(t={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})):console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0!==t.data("id")){if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");var a={template_name:n}}else a={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:a},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}else console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbct_banner_check(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbct_save_button_position(),window.addEventListener("scroll",apbct_save_button_position),jQuery("#ct_adv_showhide a").on("click",apbct_save_button_position),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var e=jQuery(this),n=jQuery("#apbct-account-email"),a=n.text();e.toggleClass("active"),e.hasClass("active")?(e.text(e.data("save-text")),n.attr("contenteditable","true"),n.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),n.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:a},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),n.attr("contenteditable","false"),e.text(e.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();if(""===t||null===t.match(/^[a-z\d]{3,15}$/))return jQuery("#apbct_button__get_key_auto__wrapper").show(),void jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!0);jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!1)}),jQuery("#apbct_setting_apikey").val()&&jQuery("#apbct_button__get_key_auto__wrapper").hide()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
js/cleantalk-admin-settings-page.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\n\t\tapbct_banner_check();\n\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\tapbct_save_button_position();\n\twindow.addEventListener('scroll', apbct_save_button_position);\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\n\n\n\t/**\n\t * Change cleantalk account email\n\t */\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\n\t\te.preventDefault();\n\n\t\tvar $this = jQuery(this);\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\n\t\tvar accountEmail = accountEmailField.text();\n\n\t\t$this.toggleClass('active');\n\n\t\tif ($this.hasClass('active')) {\n\t\t\t$this.text($this.data('save-text'));\n\t\t\taccountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.on('keydown', function (e) {\n\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t\taccountEmailField.on('input', function (e) {\n\t\t\t\tif (e.inputType === 'insertParagraph') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tapbct_admin_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_update_account_email',\n\t\t\t\t\taccountEmail: accountEmail\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttimeout: 5000,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (result.error !== undefined) {\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\taccountEmailField.attr('contenteditable', 'false');\n\t\t\t$this.text($this.data('default-text'));\n\t\t}\n\t});\n\n\t/**\n\t * Validate apkikey and hide get auto btn\n\t */\n\tjQuery('#apbct_setting_apikey').on('input', function () {\n\t\tvar enteredValue = jQuery(this).val();\n\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,15}$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\n\t\t\treturn;\n\t\t}\n\n\t\tjQuery('#apbct_button__get_key_auto').hide();\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\n\t});\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction apbct_save_button_position() {\n\tif (\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\n\t) {\n\t\treturn;\n\t}\n\tvar docInnerHeight = window.innerHeight;\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\n\n\t// Set Save button position\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\n\t\tjQuery('#apbct_settings__main_save_button').hide();\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\n\t\t\tbuttonBlock.style.bottom = '';\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\n\t\t} else {\n\t\t\tbuttonBlock.style.bottom = 0;\n\t\t\tbuttonBlock.style.top = '';\n\t\t}\n\t} else {\n\t\tjQuery('#apbct_settings__main_save_button').show();\n\t}\n\n\t// Set nav position\n\tif ( advSettingsOffset <= 0 ) {\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\n\t} else {\n\t\tnavBlock.style.top = 0;\n\t}\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","apbct_save_button_position","docInnerHeight","advSettingsBlock","advSettingsOffset","buttonBlock","buttonHeight","navBlock","navBlockOffset","navBlockHeight","window","innerHeight","getBoundingClientRect","height","getComputedStyle","display","style","bottom","ready","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","width","draggable","resizable","closeText","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","template_id","template_name","settings","notJson","success","insertAfter","close","console","log","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","prop"],"mappings":"AAkSA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACpCF,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACxCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,MAErB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,GAClC,GAAY,OAARP,GAQJ,GAAY,QADZA,EAAMS,SAASE,uBAAuBJ,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIQ,KAAMb,EAAIY,WAVhBP,EAAIQ,KAAMb,EAAIY,QAgBTP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,I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FApI,OAAO,+BAA+B0B,YACtC1B,OAAO,+CAA+CqI,KAAK,YAAY,GAIxErI,OAAO,+BAA+BE,OACtCF,OAAO,+CAA+CqI,KAAK,YAAY"}
1
+ {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\n\t\tapbct_banner_check();\n\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\tapbct_save_button_position();\n\twindow.addEventListener('scroll', apbct_save_button_position);\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\n\n\n\t/**\n\t * Change cleantalk account email\n\t */\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\n\t\te.preventDefault();\n\n\t\tvar $this = jQuery(this);\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\n\t\tvar accountEmail = accountEmailField.text();\n\n\t\t$this.toggleClass('active');\n\n\t\tif ($this.hasClass('active')) {\n\t\t\t$this.text($this.data('save-text'));\n\t\t\taccountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.on('keydown', function (e) {\n\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t\taccountEmailField.on('input', function (e) {\n\t\t\t\tif (e.inputType === 'insertParagraph') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tapbct_admin_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_update_account_email',\n\t\t\t\t\taccountEmail: accountEmail\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttimeout: 5000,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (result.error !== undefined) {\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\taccountEmailField.attr('contenteditable', 'false');\n\t\t\t$this.text($this.data('default-text'));\n\t\t}\n\t});\n\n\t/**\n\t * Validate apkikey and hide get auto btn\n\t */\n\tjQuery('#apbct_setting_apikey').on('input', function () {\n\t\tvar enteredValue = jQuery(this).val();\n\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,15}$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\n\t\t\treturn;\n\t\t}\n\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() ) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction apbct_save_button_position() {\n\tif (\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\n\t) {\n\t\treturn;\n\t}\n\tvar docInnerHeight = window.innerHeight;\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\n\n\t// Set Save button position\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\n\t\tjQuery('#apbct_settings__main_save_button').hide();\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\n\t\t\tbuttonBlock.style.bottom = '';\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\n\t\t} else {\n\t\t\tbuttonBlock.style.bottom = 0;\n\t\t\tbuttonBlock.style.top = '';\n\t\t}\n\t} else {\n\t\tjQuery('#apbct_settings__main_save_button').show();\n\t}\n\n\t// Set nav position\n\tif ( advSettingsOffset <= 0 ) {\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\n\t} else {\n\t\tnavBlock.style.top = 0;\n\t}\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","apbct_save_button_position","docInnerHeight","advSettingsBlock","advSettingsOffset","buttonBlock","buttonHeight","navBlock","navBlockOffset","navBlockHeight","window","innerHeight","getBoundingClientRect","height","getComputedStyle","display","style","bottom","ready","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","width","draggable","resizable","closeText","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","template_id","template_name","settings","notJson","success","insertAfter","close","console","log","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","prop"],"mappings":"AAuSA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACpCF,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACxCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,MAErB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,GAClC,GAAY,OAARP,GAQJ,GAAY,QADZA,EAAMS,SAASE,uBAAuBJ,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIQ,KAAMb,EAAIY,WAVhBP,EAAIQ,KAAMb,EAAIY,QAgBTP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,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F,MAEhC,GAAqB,KAAjBsD,GAAiE,OAA1CA,EAAaC,MAAM,mBAG7C,OAFApI,OAAO,wCAAwC0B,YAC/C1B,OAAO,+CAA+CqI,KAAK,YAAY,GAIxErI,OAAO,wCAAwCE,OAC/CF,OAAO,+CAA+CqI,KAAK,YAAY,KAGnErI,OAAO,yBAAyB6E,OACpC7E,OAAO,wCAAwCE"}
js/cleantalk-comments-checkspam.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ct_working=!(String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctCommentsCheck.ct_prev_accurate,ct_prev_from=ctCommentsCheck.ct_prev_from,ct_prev_till=ctCommentsCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctCommentsCheck.ct_ajax_nonce,ct_comments_total=0,ct_comments_checked=0,ct_comments_spam=0,ct_comments_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_comments(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c="https:"===location.protocol?"; secure":"";document.cookie="apbct_check_comments_offset=0; path=/; samesite=lax"+c;var a={action:"ajax_clear_comments",security:ct_ajax_nonce,from:e,till:t};jQuery.ajax({type:"POST",url:ajaxurl,data:a,success:function(e){ct_show_info(),ct_send_comments()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_comments(),ct_show_info()}function ct_send_comments(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_comments",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,offset:Number(ctGetCookie("apbct_check_comments_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c,a;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_comments():(t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||!0===ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_comments_checked+=e.checked,ct_comments_spam+=e.spam,ct_comments_bad+=e.bad,ct_unchecked=ct_comments_total-ct_comments_checked-ct_comments_bad,c=(c=String(ctCommentsCheck.ct_status_string)).printf(ct_comments_checked,ct_comments_spam,ct_comments_bad),0<parseInt(ct_comments_spam)&&(c+=ctCommentsCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),+ct_comments_total<ct_comments_checked+ct_comments_bad&&(document.cookie="ct_comments_start_check=1; path=/; samesite=lax",location.href="edit-comments.php?page=ct_check_spam"),a=Number(ctGetCookie("apbct_check_comments_offset"))+100,document.cookie="apbct_check_comments_offset="+a+"; path=/",ct_send_comments()))},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_send_comments(),3e3)},timeout:25e3})}}function ct_show_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();var e;jQuery("#ct_cooling_notice").hide(),ct_comments_total||(e={action:"ajax_info_comments",security:ct_ajax_nonce},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_comments_total=e.total,ct_comments_spam=e.spam,ct_comments_checked=e.checked,ct_comments_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_show_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_trash_all(a){var e={action:"ajax_trash_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_trash_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_trash_all(a),3e3)},timeout:25e3})}function ct_spam_all(a){var e={action:"ajax_spam_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_spam_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_spam_all(a),3e3)},timeout:25e3})}function ctGetCookie(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_spam_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_spam_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_info(),ct_send_comments()):ct_clear_comments())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_spam_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),"1"===ctCommentsCheck.start&&(document.cookie="ct_comments_start_check=0; expires="+new Date(0).toUTCString()+"; path=/; samesite=lax",jQuery("#ct_check_spam_button").click()),jQuery(".ct_trash_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_trash_all)&&void ct_trash_all(e)}),jQuery(".ct_spam_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_spam_all)&&void ct_spam_all(e)})});
2
  //# sourceMappingURL=cleantalk-comments-checkspam.min.js.map
1
+ var ct_working=!(String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctCommentsCheck.ct_prev_accurate,ct_prev_from=ctCommentsCheck.ct_prev_from,ct_prev_till=ctCommentsCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctCommentsCheck.ct_ajax_nonce,ct_comments_total=0,ct_comments_checked=0,ct_comments_spam=0,ct_comments_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_comments(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c="https:"===location.protocol?"; secure":"";document.cookie="apbct_check_comments_offset=0; path=/; samesite=lax"+c;var a={action:"ajax_clear_comments",security:ct_ajax_nonce,from:e,till:t};jQuery.ajax({type:"POST",url:ajaxurl,data:a,success:function(e){ct_show_info(),ct_send_comments()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_comments(),ct_show_info()}function ct_send_comments(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_comments",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,offset:Number(ctGetCookie("apbct_check_comments_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c,a;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_comments():(t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||!0===ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_comments_checked+=e.checked,ct_comments_spam+=e.spam,ct_comments_bad+=e.bad,ct_comments_total+=e.total,ct_unchecked=ct_comments_total-ct_comments_checked-ct_comments_bad,c=(c=String(ctCommentsCheck.ct_status_string)).printf(ct_comments_checked,ct_comments_spam,ct_comments_bad),0<parseInt(ct_comments_spam)&&(c+=ctCommentsCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),+ct_comments_total<ct_comments_checked+ct_comments_bad&&(document.cookie="ct_comments_start_check=1; path=/; samesite=lax",location.href="edit-comments.php?page=ct_check_spam"),a=Number(ctGetCookie("apbct_check_comments_offset"))+100,document.cookie="apbct_check_comments_offset="+a+"; path=/",ct_send_comments()))},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_send_comments(),3e3)},timeout:25e3})}}function ct_show_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();var e;jQuery("#ct_cooling_notice").hide(),ct_comments_total||(e={action:"ajax_info_comments",security:ct_ajax_nonce},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_comments_total=e.total,ct_comments_spam=e.spam,ct_comments_checked=e.checked,ct_comments_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_show_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_trash_all(a){var e={action:"ajax_trash_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_trash_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_trash_all(a),3e3)},timeout:25e3})}function ct_spam_all(a){var e={action:"ajax_spam_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_spam_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_spam_all(a),3e3)},timeout:25e3})}function ctGetCookie(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_spam_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_spam_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_info(),ct_send_comments()):ct_clear_comments())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_spam_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),"1"===ctCommentsCheck.start&&(document.cookie="ct_comments_start_check=0; expires="+new Date(0).toUTCString()+"; path=/; samesite=lax",jQuery("#ct_check_spam_button").click()),jQuery(".ct_trash_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_trash_all)&&void ct_trash_all(e)}),jQuery(".ct_spam_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_spam_all)&&void ct_spam_all(e)})});
2
  //# sourceMappingURL=cleantalk-comments-checkspam.min.js.map
js/cleantalk-comments-checkspam.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-comments-checkspam.min.js","sources":["cleantalk-comments-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\n\tct_comments_total = 0,\n\tct_comments_checked = 0,\n\tct_comments_spam = 0,\n\tct_comments_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to==0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_comments(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\t\n\tvar data = {\n\t\t'action' : 'ajax_clear_comments',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}\n\t});\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_comments();\n\tct_show_info();\n}\n\nfunction ct_send_comments(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\t\n\tvar data = {\n\t\t'action': 'ajax_check_comments',\n\t\t'security': ct_ajax_nonce,\n\t\t'new_check': ct_new_check,\n\t\t'unchecked': ct_unchecked,\n\t\t'offset' : Number(ctGetCookie('apbct_check_comments_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_comments();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_comments_checked += msg.checked;\n\t\t\t\t\tct_comments_spam += msg.spam;\n\t\t\t\t\tct_comments_bad += msg.bad;\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_checked, ct_comments_spam, ct_comments_bad);\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\t// If DB woks not properly\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/; samesite=lax';\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\t}\n\n\t\t\t\t\tvar offset = Number(ctGetCookie('apbct_check_comments_offset')) + 100;\n\t\t\t\t\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + offset + \"; path=/\";\n\t\t\t\t\t\n\t\t\t\t\tct_send_comments();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_send_comments(), 3000); \n },\n timeout: 25000\n\t});\n}\nfunction ct_show_info(){\n\t\n\tif(ct_working){\n\t\t\n\t\tif(ct_cooling_down_flag == true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\n\t\t\tjQuery('#ct_cooling_notice').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif(!ct_comments_total){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_comments',\n\t\t\t\t'security': ct_ajax_nonce\n\t\t\t};\n\t\t\t\n\t\t\tif(ct_date_from && ct_date_till){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_comments_total = msg.total;\n\t\t\t\t\tct_comments_spam = msg.spam;\n\t\t\t\t\tct_comments_checked = msg.checked;\n\t\t\t\t\tct_comments_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\nfunction ct_trash_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_trash_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_trash_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_trash_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\nfunction ct_spam_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_spam_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_spam_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_spam_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\njQuery(document).ready(function(){\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n jQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\tfunction ct_start_check(continue_check){\n\n continue_check = continue_check || null;\n\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\t\t\t\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\t\t\t\t\t\t\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\n\t\t\t\talert('Please, specify a date range.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\t\tct_accurate_check = true;\n\t\t}\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_working_message').show();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_pause').show();\n\n\t\tct_working=true;\n\t\t\n\t\tif(continue_check){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}else\n\t\t\tct_clear_comments();\n\t\t\n\t}\n\t\n\t// Check comments\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_spam_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\n\n\tif(ctCommentsCheck.start === '1'){\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/; samesite=lax';\n\t\tjQuery('#ct_check_spam_button').click();\t\n\t}\n\n\t// Delete all spam comments\n\tjQuery(\".ct_trash_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_trash_all))\n\t\t\treturn false;\n\n\t\tct_trash_all( e );\n\n\t});\n\n\t// Mark as spam all spam comments\n\tjQuery(\".ct_spam_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_spam_all))\n\t\t\treturn false;\n\n\t\tct_spam_all( e );\n\n\t});\n\n});\n\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n\tvar matches = document.cookie.match(new RegExp(\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","from","till","is","val","ctSecure","location","protocol","document","cookie","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","offset","Number","ctGetCookie","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","href","end","hide","checked","spam","bad","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_trash_all","e","target","addClass","css","removeClass","ct_spam_all","name","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","alert","click","ct_check","accurate","JSON","stringify","start","Date","toUTCString","ct_confirm_trash_all","ct_confirm_spam_all"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,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sC,IAAhBC,cAC1BoG,MAAM,kCAKLhG,OAAO,sBAAsBK,GAAG,cAClCzB,mBAAoB,GAGrBoB,OAAO,eAAeuC,OACtBvC,OAAO,uBAAuBiD,OAC9BjD,OAAO,iBAAiBiD,OACxBjD,OAAO,aAAaiD,OAEpBrF,YAAW,EAERmI,GACF1E,eACAC,oBAEApB,qBAKFF,OAAO,yBAAyBiG,MAAM,WAErCH,IADApF,SAASC,OAAS,mDAGnBX,OAAO,4BAA4BiG,MAAM,WACxCH,GAAe,KAIhB9F,OAAO,aAAa0E,GAAG,QAAS,WAC/B7F,UAAW,EACX,IAAIqH,EAAW,CACdC,SAAYvH,kBACZuB,KAAYR,aACZS,KAAYR,cAEbc,SAASC,OAAS,wBAA0ByF,KAAKC,UAAUH,GAAY,2BAI3C,MAA1BnH,gBAAgBuH,QAClB5F,SAASC,OAAS,sCAAwC,IAAI4F,KAAK,GAAGC,cAAgB,yBACtFxG,OAAO,yBAAyBiG,SAIjCjG,OAAO,iBAAiBiG,MAAM,SAAUrC,GAEvC,QAAKzB,QAAQpD,gBAAgB0H,4BAG7B9C,aAAcC,KAKf5D,OAAO,gBAAgBiG,MAAM,SAAUrC,GAEtC,QAAKzB,QAAQpD,gBAAgB2H,2BAG7BzC,YAAaL"}
1
+ {"version":3,"file":"cleantalk-comments-checkspam.min.js","sources":["cleantalk-comments-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\n\tct_comments_total = 0,\n\tct_comments_checked = 0,\n\tct_comments_spam = 0,\n\tct_comments_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to==0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_comments(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\t\n\tvar data = {\n\t\t'action' : 'ajax_clear_comments',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}\n\t});\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_comments();\n\tct_show_info();\n}\n\nfunction ct_send_comments(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\t\n\tvar data = {\n\t\t'action': 'ajax_check_comments',\n\t\t'security': ct_ajax_nonce,\n\t\t'new_check': ct_new_check,\n\t\t'unchecked': ct_unchecked,\n\t\t'offset' : Number(ctGetCookie('apbct_check_comments_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_comments();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_comments_checked += msg.checked;\n\t\t\t\t\tct_comments_spam += msg.spam;\n\t\t\t\t\tct_comments_bad += msg.bad;\n\t\t\t\t\tct_comments_total += msg.total;\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_checked, ct_comments_spam, ct_comments_bad);\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\t// If DB woks not properly\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/; samesite=lax';\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\t}\n\n\t\t\t\t\tvar offset = Number(ctGetCookie('apbct_check_comments_offset')) + 100;\n\t\t\t\t\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + offset + \"; path=/\";\n\t\t\t\t\t\n\t\t\t\t\tct_send_comments();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_send_comments(), 3000); \n },\n timeout: 25000\n\t});\n}\nfunction ct_show_info(){\n\t\n\tif(ct_working){\n\t\t\n\t\tif(ct_cooling_down_flag == true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\n\t\t\tjQuery('#ct_cooling_notice').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif(!ct_comments_total){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_comments',\n\t\t\t\t'security': ct_ajax_nonce\n\t\t\t};\n\t\t\t\n\t\t\tif(ct_date_from && ct_date_till){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_comments_total = msg.total;\n\t\t\t\t\tct_comments_spam = msg.spam;\n\t\t\t\t\tct_comments_checked = msg.checked;\n\t\t\t\t\tct_comments_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\nfunction ct_trash_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_trash_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_trash_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_trash_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\nfunction ct_spam_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_spam_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_spam_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_spam_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\njQuery(document).ready(function(){\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n jQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\tfunction ct_start_check(continue_check){\n\n continue_check = continue_check || null;\n\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\t\t\t\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\t\t\t\t\t\t\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\n\t\t\t\talert('Please, specify a date range.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\t\tct_accurate_check = true;\n\t\t}\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_working_message').show();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_pause').show();\n\n\t\tct_working=true;\n\t\t\n\t\tif(continue_check){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}else\n\t\t\tct_clear_comments();\n\t\t\n\t}\n\t\n\t// Check comments\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_spam_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\n\n\tif(ctCommentsCheck.start === '1'){\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/; samesite=lax';\n\t\tjQuery('#ct_check_spam_button').click();\t\n\t}\n\n\t// Delete all spam comments\n\tjQuery(\".ct_trash_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_trash_all))\n\t\t\treturn false;\n\n\t\tct_trash_all( e );\n\n\t});\n\n\t// Mark as spam all spam comments\n\tjQuery(\".ct_spam_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_spam_all))\n\t\t\treturn false;\n\n\t\tct_spam_all( e );\n\n\t});\n\n});\n\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n\tvar matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","from","till","is","val","ctSecure","location","protocol","document","cookie","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","offset","Number","ctGetCookie","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","href","end","hide","checked","spam","bad","total","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_trash_all","e","target","addClass","css","removeClass","ct_spam_all","name","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","alert","click","ct_check","accurate","JSON","stringify","start","Date","toUTCString","ct_confirm_trash_all","ct_confirm_spam_all"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,gBAAgBD,iBACnCE,aAAeD,gBAAgBC,aAC/BC,aAAeF,gBAAgBE,aAE5BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,gBAAgBM,cACnCC,kBAAoB,EACpBC,oBAAsB,EACtBC,iBAAmB,EACnBC,gBAAkB,EAClBC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,KAGnBC,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,GAAIE,KAItBpB,kBAAiB,EAInB,SAASuB,oBAER,IAAIC,EAAO,EAAGC,EAAO,EAClBJ,OAAO,wBAAwBK,GAAG,cACpCF,EAAOH,OAAO,uBAAuBM,MACrCF,EAAOJ,OAAO,uBAAuB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MAAM,SAAUrC,GAEtC,QAAKzB,QAAQpD,gBAAgB2H,2BAG7BzC,YAAaL"}
js/cleantalk_external.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_protect_external(){for(let i=0;i<document.forms.length;i++)if(void 0===document.forms[i].cleantalk_hidden_action&&void 0===document.forms[i].cleantalk_hidden_method){let c=document.forms[i];if("string"==typeof c.action)if(isIntegratedForm(c)){jQuery(c).before('<i class="cleantalk_placeholder" style="display: none;"></i>');let t=jQuery(c).prev(),e=c.outerHTML,n=jQuery(c).detach();t.after(e);let a=document.createElement("input");a.name="action",a.value="cleantalk_force_ajax_check",a.type="hidden";let o=document.forms[i];if(o.appendChild(a),void 0!==o.classList&&o.classList.contains("ml-block-form")){const l=jQuery("form.ml-block-form").find('button[type="submit"]');void 0!==l&&l.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(o,t,n)})}else document.forms[i].onsubmit=function(e){e.preventDefault(),sendAjaxCheckingFormData(o,t,n)}}else{var e;-1===c.action.indexOf("http://")&&-1===c.action.indexOf("https://")||c.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((e=document.createElement("input")).name="cleantalk_hidden_action",e.value=c.action,e.type="hidden",c.appendChild(e),(e=document.createElement("input")).name="cleantalk_hidden_method",e.value=c.method,e.type="hidden",c.method="POST",c.appendChild(e),c.action=document.location)}}}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),n=jQuery(t).find("button, input, textarea, select");e.each(function(e,a){var o=jQuery(a);n.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){let t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com"))}function sendAjaxCheckingFormData(a,e,t){var n={};n[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(n);var o={},n=a.elements;(n=Array.prototype.slice.call(n)).forEach(function(e,t){""===e.name?o["input_"+t]=e.value:o[e.name]=e.value}),apbct_public_sendAJAX(o,{async:!1,callback:function(t,n,e){if(!+e.apbct.blocked){apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),n),t.after(n);let e=jQuery(n).find("button[type=submit]");0!==e.length&&e[0].click(),e=jQuery(n).find('button[data-element="submit"]'),0!==e.length&&e[0].click()}},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
1
+ function ct_protect_external(){for(var e,t,n,a,o,c,i,l,r,d=0;d<document.forms.length;d++){void 0!==document.forms[d].cleantalk_hidden_action||void 0!==document.forms[d].cleantalk_hidden_method||"string"==typeof(e=document.forms[d]).action&&(isIntegratedForm(e)?(jQuery(e).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(e).prev(),n=e.outerHTML,a=jQuery(e).detach(),t.after(n),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(c=document.forms[d]).appendChild(o),void 0!==c.classList&&c.classList.contains("ml-block-form")?void 0!==(i=jQuery("form.ml-block-form").find('button[type="submit"]'))&&i.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(c,t,a)}):document.forms[d].onsubmit=function(e){e.preventDefault(),sendAjaxCheckingFormData(c,t,a)}):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((l=document.createElement("input")).name="cleantalk_hidden_action",l.value=e.action,l.type="hidden",e.appendChild(l),(r=document.createElement("input")).name="cleantalk_hidden_method",r.value=e.method,r.type="hidden",e.method="POST",e.appendChild(r),e.action=document.location))}}function apbct_replace_inputs_values_from_other_form(e,t){var n=jQuery(e).find("button, input, textarea, select"),c=jQuery(t).find("button, input, textarea, select");n.each(function(e,a){var o=jQuery(a);c.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com"))}function sendAjaxCheckingFormData(o,e,t){var n={};n[0]=apbct_collect_visible_fields(o),apbct_visible_fields_set_cookie(n);var a={},c=o.elements;(c=Array.prototype.slice.call(c)).forEach(function(e,t){""===e.name?a["input_"+t]=e.value:a[e.name]=e.value}),apbct_public_sendAJAX(a,{async:!1,callback:function(e,t,n){var a;+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(o).detach(),t),e.after(t),0!==(a=jQuery(t).find("button[type=submit]")).length&&a[0].click(),0!==(a=jQuery(t).find('button[data-element="submit"]')).length&&a[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
js/cleantalk_external.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n\tfor(let i = 0; i < document.forms.length; i++) {\n\n\t\tif (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n let currentForm = document.forms[i];\n\n\t\t\tif(typeof(currentForm.action) == 'string') {\n\n\t\t\t\tif(isIntegratedForm(currentForm)) {\n\t\t\t\t\tjQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n\t\t\t\t\t// Deleting form to prevent submit event\n\t\t\t\t\tlet prev = jQuery(currentForm).prev(),\n\t\t\t\t\t\tform_html = currentForm.outerHTML,\n\t\t\t\t\t\tform_original = jQuery(currentForm).detach();\n\n\t\t\t\t\tprev.after( form_html );\n\n\t\t\t\t\tlet force_action = document.createElement(\"input\");\n\t\t\t\t\tforce_action.name = 'action';\n\t\t\t\t\tforce_action.value = 'cleantalk_force_ajax_check';\n\t\t\t\t\tforce_action.type = 'hidden';\n\n let reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n const mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n\n event.preventDefault();\n\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n };\n }\n\n\t\t\t\t// Common flow\n\t\t\t\t}else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n\t\t\t\t\tvar tmp = currentForm.action.split('//');\n\t\t\t\t\ttmp = tmp[1].split('/');\n\t\t\t\t\tvar host = tmp[0].toLowerCase();\n\n\t\t\t\t\tif(host !== location.hostname.toLowerCase()){\n\n\t var ct_action = document.createElement(\"input\");\n\t ct_action.name = 'cleantalk_hidden_action';\n\t\t\t\t\t\tct_action.value = currentForm.action;\n\t\t\t\t\t\tct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n\t var ct_method = document.createElement(\"input\");\n\t ct_method.name = 'cleantalk_hidden_method';\n\t\t\t\t\t\tct_method.value = currentForm.method;\n\t\t\t\t\t\tct_method.type = 'hidden';\n\n currentForm.method = 'POST';\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n\tvar\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n\t\tinputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n\tinputs_source.each( function( index, elem_source ){\n\n\t\tvar source = jQuery( elem_source );\n\n\t\tinputs_target.each( function( index2, elem_target ){\n\n\t\t\tvar target = jQuery( elem_target );\n\n\t\t\tif( elem_source.outerHTML === elem_target.outerHTML ){\n\n\t\t\t\ttarget.val( source.val() );\n\t\t\t}\n\t\t});\n\t});\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n let formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 // Mailerlite integration\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( ! +result.apbct.blocked ) {\n\n let form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n let subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","currentForm","isIntegratedForm","jQuery","before","prev","form_html","outerHTML","form_original","detach","after","force_action","createElement","name","value","type","reUseCurrentForm","appendChild","classList","contains","mailerliteSubmitButton","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","ct_method","action","indexOf","split","toLowerCase","location","hostname","ct_action","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","data","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","apbct","blocked","subm_button","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACR,IAAI,IAAIC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAEzC,QAAkDI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAASC,MAAMF,GAAGM,wBAAuC,CAG9G,IAAIC,EAAcN,SAASC,MAAMF,GAE1C,GAAiC,iBAAvBO,EAAkB,OAE3B,GAAGC,iBAAiBD,GAAc,CACjCE,OAAQF,GAAcG,OAAO,gEAG7B,IAAIC,EAAOF,OAAOF,GAAaI,OAC9BC,EAAYL,EAAYM,UACxBC,EAAgBL,OAAOF,GAAaQ,SAErCJ,EAAKK,MAAOJ,GAEZ,IAAIK,EAAehB,SAASiB,cAAc,SAC1CD,EAAaE,KAAO,SACpBF,EAAaG,MAAQ,6BACrBH,EAAaI,KAAO,SAEL,IAAIC,EAAmBrB,SAASC,MAAMF,GAKtC,GAHAsB,EAAiBC,YAAYN,QAGKb,IAA/BkB,EAAiBE,WAA2BF,EAAiBE,UAAUC,SAAS,iBAAkB,CACjG,MAAMC,EAAyBjB,OAAO,sBAAsBkB,KAAK,8BAEnCvB,IAA3BsB,GACCA,E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gD,GAE1C,IAAIC,EAAiB,GACrBA,EAAe,GAAKC,6BAA6BH,GACjDI,gCAAiCF,GAEjC,IAAIG,EAAO,GACPC,EAAQN,EAAKO,UACjBD,EAAQE,MAAMC,UAAUC,MAAMC,KAAKL,IAE7BM,QAAS,SAAUC,EAAMC,GACT,KAAdD,EAAKpD,KACL4C,EAAK,SAAWS,GAAKD,EAAKnD,MAE1B2C,EAAKQ,EAAKpD,MAAQoD,EAAKnD,QAI/BqD,sBACIV,EACA,CACIW,OAAO,EACPC,SAAU,SAAUhE,EAAMgD,EAAciB,GAEpC,KAAOA,EAAOC,MAAMC,QAAU,CAI1BpC,4CAFejC,OAAOiD,GAAM3C,SAE0B4C,GAEtDhD,EAAKK,MAAO2C,GAGZ,IAAIoB,EAActE,OAAOkD,GAAchC,KAAK,uBACjB,IAAvBoD,EAAY5E,QACZ4E,EAAY,GAAGnD,QAInBmD,EAActE,OAAOkD,GAAchC,KAAK,iCACb,IAAvBoD,EAAY5E,QACZ4E,EAAY,GAAGnD,UAK3BoD,iBAAkB,KAClBC,gBAAiB,CAACtE,EAAMgD,KA1EpCuB,OAAOC,OAAS,WACZC,WAAW,WACPrF,uBACD"}
1
+ {"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n\n event.preventDefault();\n\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST';\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 // Mailerlite integration\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","currentForm","prev","form_html","form_original","force_action","reUseCurrentForm","mailerliteSubmitButton","ct_action","ct_method","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","jQuery","before","outerHTML","detach","after","createElement","name","value","type","appendChild","classList","contains","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","action","indexOf","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","data","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","subm_button","apbct","blocked","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACL,IAAI,IAKQC,EAQQC,EACAC,EACAC,EAIAC,EAKAC,EAMIC,EA0BAC,EAMAC,EA9DhBC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAAK,MAEOI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAASC,MAAMF,GAAGM,yBAK5C,iBAF7Bf,EAAcU,SAASC,MAAMF,IAEL,SAErBO,iBAAiBhB,IAChBiB,OAAQjB,GAAckB,OAAO,gEAGzBjB,EAAOgB,OAAOjB,GAAaC,OAC3BC,EAAYF,EAAYmB,UACxBhB,EAAgBc,OAAOjB,GAAaoB,SAExCnB,EAAKoB,MAAOnB,IAERE,EAAeM,SAASY,cAAc,UAC7BC,KAAO,SACpBnB,EAAaoB,MAAQ,6BACrBpB,EAAaqB,KAAO,UAEhBpB,EAAmBK,SAASC,MAAMF,IAErBiB,YAAYtB,QAGKS,IAA/BR,EAAiBsB,WAA2BtB,EAAiBsB,UAAUC,SAAS,sBAGjDf,KAF1BP,EAAyBW,OAAO,sBAAsBY,KAAK,2BAG3DvB,EAAuBwB,MAAM,SAAUC,GACnCA,EAAMC,iBACNC,yBAAyB5B,EAAkBJ,EAAME,KAIzDO,SAASC,MAAMF,GAAGyB,SAAW,SAAWH,GAEpCA,EAAMC,iBAENC,yBAAyB5B,EAAkBJ,EAAME,MAKT,IAA3CH,EAAYmC,OAAOC,QAAQ,aAAiE,IAA5CpC,EAAYmC,OAAOC,QAAQ,aAEtEpC,EAAYmC,OAAOE,MAAM,MACzB,GAAGA,MAAM,KACJ,GAAGC,gBAENC,SAASC,SAASF,iBAEtB/B,EAAYG,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,GAEpC,IASQC,GATDD,EAAOE,MAAMC,UAIhBrC,4CAFezB,OAAOyC,GAAMtC,SAE0BuC,GAEtD1D,EAAKoB,MAAOsC,GAIe,KADvBkB,EAAc5D,OAAO0C,GAAc9B,KAAK,wBAC5BjB,QACZiE,EAAY,GAAG/C,QAKQ,KAD3B+C,EAAc5D,OAAO0C,GAAc9B,KAAK,kCACxBjB,QACZiE,EAAY,GAAG/C,UAK3BkD,iBAAkB,KAClBC,gBAAiB,CAAChF,EAAM0D,KA1EpCuB,OAAOC,OAAS,WACZC,WAAW,WACPrF,uBACD"}
lib/Cleantalk/Antispam/Integrations/CalculatedFieldsForm.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ class CalculatedFieldsForm extends IntegrationBase
6
+ {
7
+ public function getDataForChecking($argument)
8
+ {
9
+ if ( ! empty($_POST) ) {
10
+ /**
11
+ * Filter for POST
12
+ */
13
+ $input_array = apply_filters('apbct__filter_post', $_POST);
14
+
15
+ return ct_get_fields_any($input_array);
16
+ }
17
+
18
+ return null;
19
+ }
20
+
21
+ public function doBlock($message)
22
+ {
23
+ global $ct_comment;
24
+ $ct_comment = $message;
25
+ ct_die(null, null);
26
+ }
27
+
28
+ public function allow()
29
+ {
30
+ return true;
31
+ }
32
+ }
lib/Cleantalk/ApbctWP/Activator.php CHANGED
@@ -27,11 +27,13 @@ class Activator
27
  switch_to_blog($blog);
28
  $db_tables_creator->createAllTables();
29
  self::setCronJobs();
 
30
  }
31
  switch_to_blog($initial_blog);
32
  } else {
33
  self::setCronJobs();
34
  $db_tables_creator->createAllTables();
 
35
  ct_account_status_check(null, false);
36
  }
37
 
@@ -47,6 +49,7 @@ class Activator
47
 
48
  self::setCronJobs(false);
49
  $db_tables_creator->createAllTables();
 
50
  apbct_sfw_update__init(3); // Updating SFW
51
  ct_account_status_check(null, false);
52
 
@@ -105,4 +108,33 @@ class Activator
105
  ); // Clear Anti-Flood table
106
  $ct_cron->addTask('rotate_moderate', 'apbct_rotate_moderate', 86400, time() + 3500); // Rotate moderate server
107
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
27
  switch_to_blog($blog);
28
  $db_tables_creator->createAllTables();
29
  self::setCronJobs();
30
+ self::maybeGetApiKey();
31
  }
32
  switch_to_blog($initial_blog);
33
  } else {
34
  self::setCronJobs();
35
  $db_tables_creator->createAllTables();
36
+ self::maybeGetApiKey();
37
  ct_account_status_check(null, false);
38
  }
39
 
49
 
50
  self::setCronJobs(false);
51
  $db_tables_creator->createAllTables();
52
+ self::maybeGetApiKey();
53
  apbct_sfw_update__init(3); // Updating SFW
54
  ct_account_status_check(null, false);
55
 
108
  ); // Clear Anti-Flood table
109
  $ct_cron->addTask('rotate_moderate', 'apbct_rotate_moderate', 86400, time() + 3500); // Rotate moderate server
110
  }
111
+
112
+ /**
113
+ * Checking if a third party hook need to get API key automatically
114
+ *
115
+ * @return void
116
+ */
117
+ private static function maybeGetApiKey()
118
+ {
119
+ global $apbct;
120
+ if (
121
+ $apbct->api_key ||
122
+ ( ! is_main_site() && $apbct->network_settings['multisite__work_mode'] != 2 )
123
+ ) {
124
+ return;
125
+ }
126
+ /**
127
+ * Filters a getting API key flag
128
+ *
129
+ * @param bool Set true if you want to get key automatically after activation the plugin
130
+ */
131
+ $is_get_api_key = apply_filters('apbct_is_get_api_key', false);
132
+ if ( $is_get_api_key ) {
133
+ $get_key = apbct_settings__get_key_auto(true);
134
+ if ( empty($get_key['error']) ) {
135
+ $apbct->data['key_changed'] = true;
136
+ $apbct->save('data');
137
+ }
138
+ }
139
+ }
140
  }
lib/Cleantalk/ApbctWP/AdminNotices.php CHANGED
@@ -122,7 +122,7 @@ class AdminNotices
122
  $content =
123
  sprintf(
124
  __("Unable to get Access key automatically: %s", 'cleantalk-spam-protect'),
125
- $this->apbct->errors['key_get']['error']
126
  ) .
127
  '<a target="_blank" style="margin-left: 10px" href="' . $register_link . '">' .
128
  esc_html__('Get the Access key', 'cleantalk-spam-protect') .
122
  $content =
123
  sprintf(
124
  __("Unable to get Access key automatically: %s", 'cleantalk-spam-protect'),
125
+ end($this->apbct->errors['key_get'])['error']
126
  ) .
127
  '<a target="_blank" style="margin-left: 10px" href="' . $register_link . '">' .
128
  esc_html__('Get the Access key', 'cleantalk-spam-protect') .
lib/Cleantalk/ApbctWP/Ajax.php CHANGED
@@ -71,7 +71,7 @@ class Ajax
71
  break;
72
  case 'apbct_email_check_before_post':
73
  if ( $apbct->settings['data__email_check_before_post'] ) {
74
- apbct_email_check_before_post();
75
  }
76
  break;
77
  case 'apbct_alt_session__save__AJAX':
71
  break;
72
  case 'apbct_email_check_before_post':
73
  if ( $apbct->settings['data__email_check_before_post'] ) {
74
+ apbct_email_check_before_post_from_custom_ajax();
75
  }
76
  break;
77
  case 'apbct_alt_session__save__AJAX':
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -119,13 +119,14 @@ class CommentsChecker extends Checker
119
  check_ajax_referer('ct_secret_nonce', 'security');
120
 
121
  global $wpdb, $apbct;
122
- $sql_where = '';
123
 
 
 
124
  if ( isset($_POST['from'], $_POST['till']) ) {
125
  $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
126
  $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
127
 
128
- $sql_where = "WHERE comment_date_gmt > '$from_date 00:00:00' AND comment_date_gmt < '$till_date 23:59:59'";
129
  }
130
 
131
  $offset = $_COOKIE['apbct_check_comments_offset'] ?: 0;
@@ -143,7 +144,8 @@ class CommentsChecker extends Checker
143
  'checked' => 0,
144
  'spam' => 0,
145
  'bad' => 0,
146
- 'error' => 0
 
147
  );
148
 
149
  if ( count($c) > 0 ) {
119
  check_ajax_referer('ct_secret_nonce', 'security');
120
 
121
  global $wpdb, $apbct;
 
122
 
123
+ $sql_where = "WHERE NOT comment_approved = 'spam'";
124
+ $sql_where .= " AND comment_type = 'comment'";
125
  if ( isset($_POST['from'], $_POST['till']) ) {
126
  $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
127
  $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
128
 
129
+ $sql_where = " AND comment_date_gmt > '$from_date 00:00:00' AND comment_date_gmt < '$till_date 23:59:59'";
130
  }
131
 
132
  $offset = $_COOKIE['apbct_check_comments_offset'] ?: 0;
144
  'checked' => 0,
145
  'spam' => 0,
146
  'bad' => 0,
147
+ 'error' => 0,
148
+ 'total' => wp_count_comments()->total_comments,
149
  );
150
 
151
  if ( count($c) > 0 ) {
lib/Cleantalk/ApbctWP/GetFieldsAny.php CHANGED
@@ -357,7 +357,10 @@ class GetFieldsAny
357
  */
358
  private function getVisibleFields()
359
  {
360
- $visible_fields = apbct_visible_fields__process(Cookie::get('apbct_visible_fields', array(), 'array'));
 
 
 
361
 
362
  return isset($visible_fields['visible_fields']) ? explode(' ', $visible_fields['visible_fields']) : array();
363
  }
357
  */
358
  private function getVisibleFields()
359
  {
360
+ $visible_fields_collection = Cookie::getVisibleFields();
361
+
362
+ // Visible fields processing
363
+ $visible_fields = apbct_visible_fields__process($visible_fields_collection);
364
 
365
  return isset($visible_fields['visible_fields']) ? explode(' ', $visible_fields['visible_fields']) : array();
366
  }
lib/Cleantalk/ApbctWP/RemoteCalls.php CHANGED
@@ -247,4 +247,29 @@ class RemoteCalls
247
 
248
  die($out);
249
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  }
247
 
248
  die($out);
249
  }
250
+
251
+ /**
252
+ * The 'Cron::updateTask' remote call handler
253
+ */
254
+ public static function action__cron_update_task() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
255
+ {
256
+ $update_result = false;
257
+
258
+ if (
259
+ Request::get('task') &&
260
+ Request::get('handler') &&
261
+ Request::get('period') &&
262
+ Request::get('first_call')
263
+ ) {
264
+ $cron = new Cron();
265
+ $update_result = $cron->updateTask(
266
+ Request::get('task'),
267
+ Request::get('handler'),
268
+ (int)Request::get('period'),
269
+ (int)Request::get('first_call')
270
+ );
271
+ }
272
+
273
+ die($update_result ? 'OK' : 'FAIL');
274
+ }
275
  }
lib/Cleantalk/ApbctWP/RestController.php CHANGED
@@ -43,5 +43,20 @@ class RestController extends \WP_REST_Controller
43
  'permission_callback' => '__return_true',
44
  )
45
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
  }
43
  'permission_callback' => '__return_true',
44
  )
45
  ));
46
+
47
+ // REST route for checking email before POST
48
+ register_rest_route($this->namespace, "/check_email_before_post", array(
49
+ array(
50
+ 'methods' => 'POST',
51
+ 'callback' => 'apbct_email_check_before_post',
52
+ 'args' => array(
53
+ 'email' => array(
54
+ 'type' => 'email',
55
+ 'required' => true,
56
+ ),
57
+ ),
58
+ 'permission_callback' => '__return_true',
59
+ )
60
+ ));
61
  }
62
  }
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -112,9 +112,7 @@ class State extends \Cleantalk\Common\State
112
  'gdpr__enabled' => 0,
113
  'gdpr__text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
114
 
115
- // Msic
116
- 'misc__collect_details' => 0,
117
- // Collect details about browser of the visitor.
118
  'misc__send_connection_reports' => 0,
119
  // Send connection reports to Cleantalk servers
120
  'misc__async_js' => 0,
@@ -260,6 +258,9 @@ class State extends \Cleantalk\Common\State
260
  // debug
261
  'debug' => array('last_call' => 0, 'cooldown' => 0),
262
  'debug_sfw' => array('last_call' => 0, 'cooldown' => 0),
 
 
 
263
  );
264
 
265
  public $def_stats = array(
112
  'gdpr__enabled' => 0,
113
  'gdpr__text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
114
 
115
+ // Misc
 
 
116
  'misc__send_connection_reports' => 0,
117
  // Send connection reports to Cleantalk servers
118
  'misc__async_js' => 0,
258
  // debug
259
  'debug' => array('last_call' => 0, 'cooldown' => 0),
260
  'debug_sfw' => array('last_call' => 0, 'cooldown' => 0),
261
+
262
+ // cron update
263
+ 'cron_update_task' => array('last_call' => 0),
264
  );
265
 
266
  public $def_stats = array(
lib/Cleantalk/ApbctWP/Variables/Cookie.php CHANGED
@@ -141,4 +141,34 @@ class Cookie extends \Cleantalk\Variables\Cookie
141
  setcookie($name, $value, $expires, $path, $domain, $secure, $httponly);
142
  }
143
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
141
  setcookie($name, $value, $expires, $path, $domain, $secure, $httponly);
142
  }
143
  }
144
+
145
+ /**
146
+ * Getting visible fields collection
147
+ *
148
+ * @return array
149
+ *
150
+ * @psalm-suppress InvalidReturnType, InvalidReturnStatement
151
+ */
152
+ public static function getVisibleFields()
153
+ {
154
+ global $apbct;
155
+
156
+ if ( $apbct->settings['data__set_cookies'] == 1 ) {
157
+ // Get from separated native cookies and convert it to collection
158
+ $visible_fields_cookies_array = array_filter($_COOKIE, static function ($key) {
159
+ return strpos($key, 'apbct_visible_fields_') !== false;
160
+ }, ARRAY_FILTER_USE_KEY);
161
+ $visible_fields_collection = array();
162
+ foreach ( $visible_fields_cookies_array as $visible_fields_key => $visible_fields_value ) {
163
+ $prepared_key = str_replace('apbct_visible_fields_', '', $visible_fields_key);
164
+ $prepared_value = json_decode(str_replace('\\', '', $visible_fields_value), true);
165
+ $visible_fields_collection[$prepared_key] = $prepared_value;
166
+ }
167
+ } else {
168
+ // Get from alt cookies storage
169
+ $visible_fields_collection = self::get('apbct_visible_fields', array(), 'array');
170
+ }
171
+
172
+ return $visible_fields_collection;
173
+ }
174
  }
lib/Cleantalk/Common/Firewall/FirewallModule.php CHANGED
@@ -86,6 +86,10 @@ class FirewallModule extends FirewallModuleAbstract
86
  */
87
  public function diePage($result)
88
  {
 
 
 
 
89
  // Headers
90
  if (headers_sent() === false) {
91
  header('Expires: ' . date(DATE_RFC822, mktime(0, 0, 0, 1, 1, 1971)));
86
  */
87
  public function diePage($result)
88
  {
89
+ // JCH Optimize caching preventing
90
+ add_filter('jch_optimize_page_cache_set_caching', static function ($_is_cache_active) {
91
+ return false;
92
+ }, 999, 1);
93
  // Headers
94
  if (headers_sent() === false) {
95
  header('Expires: ' . date(DATE_RFC822, mktime(0, 0, 0, 1, 1, 1971)));
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 5.166
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -595,6 +595,20 @@ If your website has forms that send data to external sources, you can enable opt
595
 
596
  == Changelog ==
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  = 5.166 Nov 18 2021 =
599
  * Fix: skip ult-forgot-password action.
600
  * Fix: Uncanny toolkit skip.
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 5.167
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
595
 
596
  == Changelog ==
597
 
598
+ = 5.167 Dec 06 2021 =
599
+ * Fix. Comment scanner. Scanning loop fixed.
600
+ * Fix. Comment scanner. Scan only not spam comments.
601
+ * Mod: Launching a suitable ajax handler for checking email before POST
602
+ * Upd. RC. Remote calls checking moved to the root of the main file.
603
+ * New. Activation. Hook for getting key auto added.
604
+ * Fix. Admin notices. Errors about getting key fixed.
605
+ * Fix. Visible fields. Getting visible fields collection method moved to the Cookie class
606
+ * Fix. Visible fields. Getting visible fields collection method moved
607
+ * Fix. Settings. Getting key button fixed.
608
+ * Fix: Removed ajax_type from apbct_email_check_before_post
609
+ * Fixed Ajax.php errors with apbct_email_check_before_post
610
+ * Fix: Add integration for CalculatedFieldsForm and fixed scripts
611
+
612
  = 5.166 Nov 18 2021 =
613
  * Fix: skip ult-forgot-password action.
614
  * Fix: Uncanny toolkit skip.