Version Description
Sep 22 2022 =
NoCookie data collection, new admin notices style, external forms logic improved and many minor issues fixed.
- New. NoCookie data collection.
- New style admin notices
- Upd. Settings. Email encoder setting duplicated on the top level place.
- Fix: Fixed SFW looping with alternative cookies
- Fix: Changed hook for EventsManager
- Fix: Changed option description
- Fix. External forms. JS logic fixed.
- Fix. Cookies. Skip cookies setup on favicon loading.
- Fix. HttpRequest. Error string offset fix due request error handling.
- Fix: Fixed AdminNotices->is_cleantalk_page
- Fix. Common. Rotating moderate-server via cron job fixed.
- Fix. Common. Moderate servers details updated.
- Fix. Email encoder. An ability to decode again implemented if an error was occurred.
- Fix. GDPR. Contact form 7 integration fixed and upgraded.
- Fix. ct_ajax_hook(). ProfileGrid AJAX actions skipped.
- Fix. Connection report. Option implemented.
- Fix. Integrations. Formidable forms item_meta handling.
- Mod: Added clearing AC table from AC logs once a day
- Fix. Debugging logic. Now drops debug data correct.
- Mod. AltSessions. Now sends and parse cookies data as JSON.
- Fix. AltCookies. Getting some parameters fixed.
- New. MemberPress integration.
- Fix. Cookie. Mouse/scrolling cookie storing fixed.
- Fix. AltCookies. Correct handle types before save to DB when value is false.
- Mod. Ajax/Rest selection. Now check if REST route provide a JSON string.
- Fix. AltCookies. AltSession JSON handling fix.
- Fix. Common. 'no_cookie_data_taken' notice fixed.
Download this release
Release Info
Developer | glomberg |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.185 |
Comparing to | |
See all releases |
Code changes from version 5.184 to 5.185
- cleantalk.php +24 -13
- css/cleantalk-admin.min.css +1 -1
- inc/cleantalk-ajax.php +3 -1
- inc/cleantalk-common.php +101 -52
- inc/cleantalk-pluggable.php +3 -1
- inc/cleantalk-public-integrations.php +3 -1
- inc/cleantalk-public.php +6 -0
- inc/cleantalk-settings.php +59 -18
- inc/cleantalk-updater.php +9 -0
- js/apbct-public-bundle.min.js +1 -1
- js/apbct-public-bundle.min.js.map +1 -1
- js/cleantalk-admin-settings-page.min.js +1 -1
- js/cleantalk-admin-settings-page.min.js.map +1 -1
- lib/Cleantalk/Antispam/Cleantalk.php +9 -1
- lib/Cleantalk/ApbctWP/AdminNotices.php +4 -4
- lib/Cleantalk/ApbctWP/Deactivator.php +1 -0
- lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php +18 -1
- lib/Cleantalk/ApbctWP/Helper.php +19 -0
- lib/Cleantalk/ApbctWP/RestController.php +1 -1
- lib/Cleantalk/ApbctWP/State.php +5 -0
- lib/Cleantalk/ApbctWP/Variables/AltSessions.php +30 -5
- lib/Cleantalk/ApbctWP/Variables/Cookie.php +15 -6
- lib/Cleantalk/ApbctWP/Variables/NoCookie.php +210 -0
- lib/Cleantalk/Common/Helper.php +5 -4
- lib/Cleantalk/Common/Schema.php +9 -0
- readme.txt +31 -1
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.
|
8 |
Author: СleanTalk <welcome@cleantalk.org>
|
9 |
Author URI: https://cleantalk.org
|
10 |
Text Domain: cleantalk-spam-protect
|
@@ -228,6 +228,7 @@ if ( ! is_admin() && ! apbct_is_ajax() && ! defined('DOING_CRON')
|
|
228 |
&& empty(Post::get('ct_checkjs_register_form')) // Buddy press registration fix
|
229 |
&& empty(Get::get('ct_checkjs_search_default')) // Search form fix
|
230 |
&& empty(Post::get('action')) //bbPress
|
|
|
231 |
) {
|
232 |
if ( $apbct->data['cookies_type'] !== 'alternative' ) {
|
233 |
add_action('template_redirect', 'apbct_cookie', 2);
|
@@ -351,7 +352,7 @@ $apbct_active_integrations = array(
|
|
351 |
'ajax' => false
|
352 |
),
|
353 |
'EventsManager' => array(
|
354 |
-
'hook' => '
|
355 |
'setting' => 'forms__contact_forms_test',
|
356 |
'ajax' => false
|
357 |
),
|
@@ -1770,6 +1771,15 @@ function apbct_antiflood__clear_table()
|
|
1770 |
$anti_flood->setDb(DB::getInstance());
|
1771 |
$anti_flood->clearTable();
|
1772 |
unset($anti_flood);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1773 |
}
|
1774 |
}
|
1775 |
|
@@ -2190,7 +2200,6 @@ function apbct_store__urls()
|
|
2190 |
global $apbct;
|
2191 |
|
2192 |
if (
|
2193 |
-
$apbct->data['cookies_type'] === 'none' || // Do not set cookies if option is disabled (for Varnish cache).
|
2194 |
! empty($apbct->headers_sent) // Headers sent
|
2195 |
) {
|
2196 |
return false;
|
@@ -2218,7 +2227,7 @@ function apbct_store__urls()
|
|
2218 |
$urls = count($urls) > 5 ? array_slice($urls, 1, 5) : $urls;
|
2219 |
|
2220 |
// Saving
|
2221 |
-
Cookie::set('apbct_urls', json_encode($urls, JSON_UNESCAPED_SLASHES), time() + 86400 * 3, '/', $site_url, null, true, 'Lax');
|
2222 |
|
2223 |
// REFERER
|
2224 |
// Get current referer
|
@@ -2236,7 +2245,7 @@ function apbct_store__urls()
|
|
2236 |
parse_url($new_site_referer, PHP_URL_HOST) !== Server::get('HTTP_HOST')
|
2237 |
)
|
2238 |
) {
|
2239 |
-
Cookie::set('apbct_site_referer', $new_site_referer, time() + 86400 * 3, '/', $site_url, null, true, 'Lax');
|
2240 |
}
|
2241 |
|
2242 |
$apbct->flags__url_stored = true;
|
@@ -2254,7 +2263,6 @@ function apbct_cookie()
|
|
2254 |
global $apbct;
|
2255 |
|
2256 |
if (
|
2257 |
-
$apbct->data['cookies_type'] === 'none' || // Do not set cookies if option is disabled (for Varnish cache).
|
2258 |
! empty($apbct->flags__cookies_setuped) || // Cookies already set
|
2259 |
! empty($apbct->headers_sent) // Headers sent
|
2260 |
) {
|
@@ -2283,23 +2291,24 @@ function apbct_cookie()
|
|
2283 |
// Submit time
|
2284 |
if ( empty(Post::get('ct_multipage_form')) ) { // Do not start/reset page timer if it is multi page form (Gravity forms))
|
2285 |
$apbct_timestamp = time();
|
2286 |
-
Cookie::set('apbct_timestamp', (string)$apbct_timestamp, 0, '/', $domain, null, true);
|
2287 |
$cookie_test_value['cookies_names'][] = 'apbct_timestamp';
|
2288 |
$cookie_test_value['check_value'] .= $apbct_timestamp;
|
2289 |
}
|
2290 |
|
2291 |
// Previous referer
|
2292 |
if ( Server::get('HTTP_REFERER') ) {
|
2293 |
-
Cookie::set('apbct_prev_referer', Server::get('HTTP_REFERER'), 0, '/', $domain, null, true);
|
2294 |
$cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
|
2295 |
$cookie_test_value['check_value'] .= Server::get('HTTP_REFERER');
|
2296 |
}
|
2297 |
|
2298 |
// Landing time
|
|
|
2299 |
$site_landing_timestamp = Cookie::get('apbct_site_landing_ts');
|
2300 |
if ( ! $site_landing_timestamp ) {
|
2301 |
$site_landing_timestamp = time();
|
2302 |
-
Cookie::set('apbct_site_landing_ts', (string)$site_landing_timestamp, 0, '/', $domain, null, true);
|
2303 |
}
|
2304 |
$cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
|
2305 |
$cookie_test_value['check_value'] .= $site_landing_timestamp;
|
@@ -2307,17 +2316,19 @@ function apbct_cookie()
|
|
2307 |
// Page hits
|
2308 |
// Get
|
2309 |
$page_hits = Cookie::get('apbct_page_hits');
|
|
|
2310 |
// Set / Increase
|
|
|
2311 |
$page_hits = (int)$page_hits ? (int)$page_hits + 1 : 1;
|
2312 |
|
2313 |
-
Cookie::set('apbct_page_hits', (string)$page_hits, 0, '/', $domain, null, true);
|
2314 |
|
2315 |
$cookie_test_value['cookies_names'][] = 'apbct_page_hits';
|
2316 |
$cookie_test_value['check_value'] .= $page_hits;
|
2317 |
|
2318 |
// Cookies test
|
2319 |
$cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
|
2320 |
-
if ( $apbct->data['cookies_type']
|
2321 |
Cookie::set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, null, true);
|
2322 |
}
|
2323 |
|
@@ -2336,7 +2347,7 @@ function apbct_cookies_test()
|
|
2336 |
{
|
2337 |
global $apbct;
|
2338 |
|
2339 |
-
if ( $apbct->data['cookies_type']
|
2340 |
return 1;
|
2341 |
}
|
2342 |
|
@@ -2438,7 +2449,7 @@ function ct_mail_send_connection_report()
|
|
2438 |
{
|
2439 |
global $apbct;
|
2440 |
|
2441 |
-
if ( ( isset($apbct->connection_reports['negative']) && $apbct->connection_reports['negative'] > 0 ) || !empty(Get::get('ct_send_connection_report')) ) {
|
2442 |
//skip empty reports for cron job
|
2443 |
$unsent_exist = false;
|
2444 |
foreach ( $apbct->connection_reports['negative_report'] as $_key => $report ) {
|
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.185
|
8 |
Author: СleanTalk <welcome@cleantalk.org>
|
9 |
Author URI: https://cleantalk.org
|
10 |
Text Domain: cleantalk-spam-protect
|
228 |
&& empty(Post::get('ct_checkjs_register_form')) // Buddy press registration fix
|
229 |
&& empty(Get::get('ct_checkjs_search_default')) // Search form fix
|
230 |
&& empty(Post::get('action')) //bbPress
|
231 |
+
&& ! \Cleantalk\Variables\Server::inUri('/favicon.ico') // /favicon request rewritten cookies fix
|
232 |
) {
|
233 |
if ( $apbct->data['cookies_type'] !== 'alternative' ) {
|
234 |
add_action('template_redirect', 'apbct_cookie', 2);
|
352 |
'ajax' => false
|
353 |
),
|
354 |
'EventsManager' => array(
|
355 |
+
'hook' => 'em_booking_validate_after',
|
356 |
'setting' => 'forms__contact_forms_test',
|
357 |
'ajax' => false
|
358 |
),
|
1771 |
$anti_flood->setDb(DB::getInstance());
|
1772 |
$anti_flood->clearTable();
|
1773 |
unset($anti_flood);
|
1774 |
+
|
1775 |
+
// Clear table APBCT_TBL_AC_LOG once a day
|
1776 |
+
$anticrawler = new AntiCrawler(
|
1777 |
+
APBCT_TBL_FIREWALL_LOG,
|
1778 |
+
APBCT_TBL_AC_LOG
|
1779 |
+
);
|
1780 |
+
$anticrawler->setDb(DB::getInstance());
|
1781 |
+
$anticrawler->clearTable();
|
1782 |
+
unset($anticrawler);
|
1783 |
}
|
1784 |
}
|
1785 |
|
2200 |
global $apbct;
|
2201 |
|
2202 |
if (
|
|
|
2203 |
! empty($apbct->headers_sent) // Headers sent
|
2204 |
) {
|
2205 |
return false;
|
2227 |
$urls = count($urls) > 5 ? array_slice($urls, 1, 5) : $urls;
|
2228 |
|
2229 |
// Saving
|
2230 |
+
Cookie::set('apbct_urls', json_encode($urls, JSON_UNESCAPED_SLASHES), time() + 86400 * 3, '/', $site_url, null, true, 'Lax', true);
|
2231 |
|
2232 |
// REFERER
|
2233 |
// Get current referer
|
2245 |
parse_url($new_site_referer, PHP_URL_HOST) !== Server::get('HTTP_HOST')
|
2246 |
)
|
2247 |
) {
|
2248 |
+
Cookie::set('apbct_site_referer', $new_site_referer, time() + 86400 * 3, '/', $site_url, null, true, 'Lax', true);
|
2249 |
}
|
2250 |
|
2251 |
$apbct->flags__url_stored = true;
|
2263 |
global $apbct;
|
2264 |
|
2265 |
if (
|
|
|
2266 |
! empty($apbct->flags__cookies_setuped) || // Cookies already set
|
2267 |
! empty($apbct->headers_sent) // Headers sent
|
2268 |
) {
|
2291 |
// Submit time
|
2292 |
if ( empty(Post::get('ct_multipage_form')) ) { // Do not start/reset page timer if it is multi page form (Gravity forms))
|
2293 |
$apbct_timestamp = time();
|
2294 |
+
Cookie::set('apbct_timestamp', (string)$apbct_timestamp, 0, '/', $domain, null, false, 'Lax', true);
|
2295 |
$cookie_test_value['cookies_names'][] = 'apbct_timestamp';
|
2296 |
$cookie_test_value['check_value'] .= $apbct_timestamp;
|
2297 |
}
|
2298 |
|
2299 |
// Previous referer
|
2300 |
if ( Server::get('HTTP_REFERER') ) {
|
2301 |
+
Cookie::set('apbct_prev_referer', Server::get('HTTP_REFERER'), 0, '/', $domain, null, true, 'Lax', true);
|
2302 |
$cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
|
2303 |
$cookie_test_value['check_value'] .= Server::get('HTTP_REFERER');
|
2304 |
}
|
2305 |
|
2306 |
// Landing time
|
2307 |
+
// todo if cookies disabled there is no way to keep this data without DB:( always will be overwriteen
|
2308 |
$site_landing_timestamp = Cookie::get('apbct_site_landing_ts');
|
2309 |
if ( ! $site_landing_timestamp ) {
|
2310 |
$site_landing_timestamp = time();
|
2311 |
+
Cookie::set('apbct_site_landing_ts', (string)$site_landing_timestamp, 0, '/', $domain, null, true, 'Lax', true);
|
2312 |
}
|
2313 |
$cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
|
2314 |
$cookie_test_value['check_value'] .= $site_landing_timestamp;
|
2316 |
// Page hits
|
2317 |
// Get
|
2318 |
$page_hits = Cookie::get('apbct_page_hits');
|
2319 |
+
|
2320 |
// Set / Increase
|
2321 |
+
// todo if cookies disabled there is no way to keep this data without DB:( always will be 1
|
2322 |
$page_hits = (int)$page_hits ? (int)$page_hits + 1 : 1;
|
2323 |
|
2324 |
+
Cookie::set('apbct_page_hits', (string)$page_hits, 0, '/', $domain, null, true, 'Lax', true);
|
2325 |
|
2326 |
$cookie_test_value['cookies_names'][] = 'apbct_page_hits';
|
2327 |
$cookie_test_value['check_value'] .= $page_hits;
|
2328 |
|
2329 |
// Cookies test
|
2330 |
$cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
|
2331 |
+
if ( $apbct->data['cookies_type'] !== 'alternative' ) {
|
2332 |
Cookie::set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, null, true);
|
2333 |
}
|
2334 |
|
2347 |
{
|
2348 |
global $apbct;
|
2349 |
|
2350 |
+
if ( $apbct->data['cookies_type'] !== 'native' ) {
|
2351 |
return 1;
|
2352 |
}
|
2353 |
|
2449 |
{
|
2450 |
global $apbct;
|
2451 |
|
2452 |
+
if ( ( $apbct->settings['misc__send_connection_reports'] == 1 && isset($apbct->connection_reports['negative']) && $apbct->connection_reports['negative'] > 0 ) || !empty(Get::get('ct_send_connection_report')) ) {
|
2453 |
//skip empty reports for cron job
|
2454 |
$unsent_exist = false;
|
2455 |
foreach ( $apbct->connection_reports['negative_report'] as $_key => $report ) {
|
css/cleantalk-admin.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}
|
1 |
+
.cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}.apbct-plugin-errors{margin-left:0;margin-bottom:20px}
|
inc/cleantalk-ajax.php
CHANGED
@@ -404,7 +404,9 @@ function ct_ajax_hook($message_obj = null)
|
|
404 |
'nf_preview_update',
|
405 |
'nf_save_form',
|
406 |
// WPUserMeta registration plugin exclusion
|
407 |
-
'pf_ajax_request'
|
|
|
|
|
408 |
);
|
409 |
|
410 |
global $apbct;
|
404 |
'nf_preview_update',
|
405 |
'nf_save_form',
|
406 |
// WPUserMeta registration plugin exclusion
|
407 |
+
'pf_ajax_request',
|
408 |
+
//profilegrid addon
|
409 |
+
'pm_check_user_exist'
|
410 |
);
|
411 |
|
412 |
global $apbct;
|
inc/cleantalk-common.php
CHANGED
@@ -106,6 +106,8 @@ function apbct_base_call($params = array(), $reg_flag = false)
|
|
106 |
return array('ct_result' => new CleantalkResponse());
|
107 |
}
|
108 |
|
|
|
|
|
109 |
// URL, IP, Role exclusions
|
110 |
if ( apbct_exclusions_check() ) {
|
111 |
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
|
@@ -346,6 +348,7 @@ function apbct_add_connection_report(
|
|
346 |
function apbct_rotate_moderate()
|
347 |
{
|
348 |
$ct = new Cleantalk();
|
|
|
349 |
$ct->rotateModerate();
|
350 |
if ( $ct->server_change ) {
|
351 |
update_option(
|
@@ -526,68 +529,105 @@ function apbct_get_sender_info()
|
|
526 |
: null;
|
527 |
|
528 |
// Visible fields processing
|
529 |
-
$visible_fields_collection =
|
530 |
-
if (
|
531 |
-
$visible_fields_collection = Cookie::getVisibleFields();
|
532 |
-
} elseif ( Post::get('apbct_visible_fields') ) {
|
533 |
$visible_fields_collection = stripslashes(Post::get('apbct_visible_fields'));
|
534 |
}
|
535 |
|
536 |
$visible_fields = apbct_visible_fields__process($visible_fields_collection);
|
537 |
|
538 |
-
|
539 |
-
|
540 |
-
'
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
// Raw data to validated JavaScript test in the cloud
|
550 |
-
'checkjs_data_cookies'
|
551 |
-
'checkjs_data_post'
|
552 |
// PHP cookies
|
553 |
-
'cookies_enabled'
|
554 |
-
'data__set_cookies'
|
555 |
-
'data__cookies_type'
|
556 |
-
'
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
'
|
564 |
-
'
|
565 |
-
'
|
566 |
-
'
|
567 |
-
'
|
568 |
-
'
|
569 |
-
|
570 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
// Misc
|
572 |
-
'site_referer'
|
573 |
-
'source_url'
|
574 |
-
|
575 |
-
|
|
|
|
|
576 |
// Debug stuff
|
577 |
-
'amp_detected'
|
578 |
-
'hook'
|
579 |
-
'headers_sent'
|
580 |
-
'headers_sent__hook'
|
581 |
-
'headers_sent__where'
|
582 |
-
'request_type'
|
583 |
-
'email_check'
|
584 |
-
|
585 |
-
)
|
586 |
-
|
587 |
-
|
588 |
-
'mouse_moved'
|
589 |
-
|
|
|
|
|
|
|
|
|
|
|
590 |
);
|
|
|
|
|
591 |
}
|
592 |
|
593 |
function apbct_sender_info___get_page_url()
|
@@ -1358,3 +1398,12 @@ function apbct_get_honeypot_filled_fields()
|
|
1358 |
|
1359 |
return $result;
|
1360 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
return array('ct_result' => new CleantalkResponse());
|
107 |
}
|
108 |
|
109 |
+
apbct_form__get_no_cookie_data();
|
110 |
+
|
111 |
// URL, IP, Role exclusions
|
112 |
if ( apbct_exclusions_check() ) {
|
113 |
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
|
348 |
function apbct_rotate_moderate()
|
349 |
{
|
350 |
$ct = new Cleantalk();
|
351 |
+
$ct->server_url = APBCT_MODERATE_URL;
|
352 |
$ct->rotateModerate();
|
353 |
if ( $ct->server_change ) {
|
354 |
update_option(
|
529 |
: null;
|
530 |
|
531 |
// Visible fields processing
|
532 |
+
$visible_fields_collection = Cookie::getVisibleFields();
|
533 |
+
if ( !$visible_fields_collection || is_array($visible_fields_collection) && !$visible_fields_collection[0] ) {
|
|
|
|
|
534 |
$visible_fields_collection = stripslashes(Post::get('apbct_visible_fields'));
|
535 |
}
|
536 |
|
537 |
$visible_fields = apbct_visible_fields__process($visible_fields_collection);
|
538 |
|
539 |
+
// preparation of some parameters when cookies are disabled and data is received from localStorage
|
540 |
+
$param_email_check = Cookie::get('ct_checked_emails') ? json_encode(
|
541 |
+
Cookie::get('ct_checked_emails')
|
542 |
+
) : null;
|
543 |
+
$param_mouse_cursor_positions = Cookie::get('ct_pointer_data');
|
544 |
+
$param_pixel_url = Cookie::get('apbct_pixel_url');
|
545 |
+
$param_screen_info = Cookie::get('ct_screen_info')
|
546 |
+
? json_encode(Cookie::get('ct_screen_info'))
|
547 |
+
: null;
|
548 |
+
|
549 |
+
if ($apbct->data['cookies_type'] === 'none') {
|
550 |
+
$param_email_check = Cookie::get('ct_checked_emails') ? urldecode(
|
551 |
+
Cookie::get('ct_checked_emails')
|
552 |
+
) : null;
|
553 |
+
$param_mouse_cursor_positions = urldecode(Cookie::get('ct_pointer_data'));
|
554 |
+
$param_pixel_url = urldecode(Cookie::get('apbct_pixel_url'));
|
555 |
+
$param_screen_info = Cookie::get('ct_screen_info')
|
556 |
+
? urldecode(Cookie::get('ct_screen_info'))
|
557 |
+
: null;
|
558 |
+
}
|
559 |
+
|
560 |
+
//Let's keep $data_array for debugging
|
561 |
+
$data_array = array(
|
562 |
+
'plugin_request_id' => $apbct->plugin_request_id,
|
563 |
+
'wpms' => is_multisite() ? 'yes' : 'no',
|
564 |
+
'remote_addr' => \Cleantalk\ApbctWP\Helper::ipGet('remote_addr', false),
|
565 |
+
'USER_AGENT' => Server::get('HTTP_USER_AGENT'),
|
566 |
+
'page_url' => apbct_sender_info___get_page_url(),
|
567 |
+
'cms_lang' => substr(get_locale(), 0, 2),
|
568 |
+
'ct_options' => json_encode($apbct->settings, JSON_UNESCAPED_SLASHES),
|
569 |
+
'fields_number' => sizeof($_POST),
|
570 |
+
'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
|
571 |
// Raw data to validated JavaScript test in the cloud
|
572 |
+
'checkjs_data_cookies' => Cookie::get('ct_checkjs') ?: null,
|
573 |
+
'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
|
574 |
// PHP cookies
|
575 |
+
'cookies_enabled' => $cookie_is_ok,
|
576 |
+
'data__set_cookies' => $apbct->settings['data__set_cookies'],
|
577 |
+
'data__cookies_type' => $apbct->data['cookies_type'],
|
578 |
+
'REFFERRER' => Server::get('HTTP_REFERER'),
|
579 |
+
'REFFERRER_PREVIOUS' => Cookie::get('apbct_prev_referer') && $cookie_is_ok
|
580 |
+
? Cookie::get('apbct_prev_referer')
|
581 |
+
: null,
|
582 |
+
'site_landing_ts' => Cookie::get('apbct_site_landing_ts') && $cookie_is_ok
|
583 |
+
? Cookie::get('apbct_site_landing_ts')
|
584 |
+
: null,
|
585 |
+
'page_hits' => Cookie::get('apbct_page_hits') ?: null,
|
586 |
+
'mouse_cursor_positions' => $param_mouse_cursor_positions,
|
587 |
+
'js_timezone' => Cookie::get('ct_timezone') ?: null,
|
588 |
+
'key_press_timestamp' => Cookie::get('ct_fkp_timestamp') ?: null,
|
589 |
+
'page_set_timestamp' => Cookie::get('ct_ps_timestamp') ?: null,
|
590 |
+
'form_visible_inputs' => !empty($visible_fields['visible_fields_count'])
|
591 |
+
? $visible_fields['visible_fields_count']
|
592 |
+
: null,
|
593 |
+
'apbct_visible_fields' => !empty($visible_fields['visible_fields'])
|
594 |
+
? $visible_fields['visible_fields']
|
595 |
+
: null,
|
596 |
+
'form_invisible_inputs' => !empty($visible_fields['invisible_fields_count'])
|
597 |
+
? $visible_fields['invisible_fields_count']
|
598 |
+
: null,
|
599 |
+
'apbct_invisible_fields' => !empty($visible_fields['invisible_fields'])
|
600 |
+
? $visible_fields['invisible_fields']
|
601 |
+
: null,
|
602 |
// Misc
|
603 |
+
'site_referer' => Cookie::get('apbct_site_referer') ?: null,
|
604 |
+
'source_url' => Cookie::get('apbct_urls')
|
605 |
+
? json_encode(json_decode(Cookie::get('apbct_urls'), true))
|
606 |
+
: null,
|
607 |
+
'pixel_url' => $param_pixel_url,
|
608 |
+
'pixel_setting' => $apbct->settings['data__pixel'],
|
609 |
// Debug stuff
|
610 |
+
'amp_detected' => $amp_detected,
|
611 |
+
'hook' => current_filter() ? current_filter() : 'no_hook',
|
612 |
+
'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
|
613 |
+
'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : 'no_hook',
|
614 |
+
'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
|
615 |
+
'request_type' => Server::get('REQUEST_METHOD') ?: 'UNKNOWN',
|
616 |
+
'email_check' => $param_email_check,
|
617 |
+
'screen_info' => $param_screen_info,
|
618 |
+
'has_scrolled' => Cookie::get('ct_has_scrolled') !== ''
|
619 |
+
? json_encode(Cookie::get('ct_has_scrolled'))
|
620 |
+
: null,
|
621 |
+
'mouse_moved' => Cookie::get('ct_mouse_moved') !== ''
|
622 |
+
? json_encode(Cookie::get('ct_mouse_moved'))
|
623 |
+
: null,
|
624 |
+
'emulations_headless_mode' => Cookie::get('apbct_headless') !== ''
|
625 |
+
? json_encode(Cookie::get('apbct_headless'))
|
626 |
+
: null,
|
627 |
+
'no_cookie_data_taken' => isset($apbct->stats['no_cookie_data_taken']) ? $apbct->stats['no_cookie_data_taken'] : null,
|
628 |
);
|
629 |
+
|
630 |
+
return $data_array;
|
631 |
}
|
632 |
|
633 |
function apbct_sender_info___get_page_url()
|
1398 |
|
1399 |
return $result;
|
1400 |
}
|
1401 |
+
|
1402 |
+
function apbct_form__get_no_cookie_data()
|
1403 |
+
{
|
1404 |
+
global $apbct;
|
1405 |
+
if ( $apbct->data['cookies_type'] === 'none' ) {
|
1406 |
+
$apbct->stats['no_cookie_data_taken'] = \Cleantalk\ApbctWP\Variables\NoCookie::setDataFromHiddenField();
|
1407 |
+
$apbct->save('stats');
|
1408 |
+
}
|
1409 |
+
}
|
inc/cleantalk-pluggable.php
CHANGED
@@ -964,7 +964,9 @@ function apbct_settings__get_ajax_type()
|
|
964 |
{
|
965 |
// Check rest availability
|
966 |
$res_rest = Helper::httpRequestGetResponseCode(esc_url(apbct_get_rest_url()));
|
967 |
-
|
|
|
|
|
968 |
return 'rest';
|
969 |
}
|
970 |
|
964 |
{
|
965 |
// Check rest availability
|
966 |
$res_rest = Helper::httpRequestGetResponseCode(esc_url(apbct_get_rest_url()));
|
967 |
+
$res_body = Helper::httpRequestGetContent(esc_url(apbct_get_rest_url()));
|
968 |
+
|
969 |
+
if ( $res_rest == 200 && Helper::isJson($res_body) ) {
|
970 |
return 'rest';
|
971 |
}
|
972 |
|
inc/cleantalk-public-integrations.php
CHANGED
@@ -740,7 +740,9 @@ function apbct_form__formidable__testSpam($errors, $_form)
|
|
740 |
// Replacing key to input_meta[NUM] for scalar values
|
741 |
$tmp_message = array_flip($tmp_message);
|
742 |
foreach ( $tmp_message as &$value ) {
|
743 |
-
$value
|
|
|
|
|
744 |
}
|
745 |
unset($value);
|
746 |
// @ToDO Need to be solved psalm notice about InvalidScalarArgument
|
740 |
// Replacing key to input_meta[NUM] for scalar values
|
741 |
$tmp_message = array_flip($tmp_message);
|
742 |
foreach ( $tmp_message as &$value ) {
|
743 |
+
if ( strpos($value, 'item_meta[') === false ) {
|
744 |
+
$value = 'item_meta[' . $value . ']';
|
745 |
+
}
|
746 |
}
|
747 |
unset($value);
|
748 |
// @ToDO Need to be solved psalm notice about InvalidScalarArgument
|
inc/cleantalk-public.php
CHANGED
@@ -107,6 +107,11 @@ function apbct_init()
|
|
107 |
ct_ajax_hook();
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
110 |
/**hooks for cm answers pro */
|
111 |
if ( defined('CMA_PLUGIN_FILE') ) {
|
112 |
add_action('wp', 'ct_ajax_hook', 1);
|
@@ -1357,6 +1362,7 @@ function apbct_enqueue_and_localize_public_scripts()
|
|
1357 |
'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'],
|
1358 |
'data__cookies_type' => $apbct->data['cookies_type'],
|
1359 |
'data__visible_fields_required' => ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1,
|
|
|
1360 |
));
|
1361 |
|
1362 |
wp_enqueue_style(
|
107 |
ct_ajax_hook();
|
108 |
}
|
109 |
|
110 |
+
// MemberPress integration
|
111 |
+
if ( $apbct->settings['forms__contact_forms_test'] == 1 && Post::get('mepr_process_signup_form') ) {
|
112 |
+
add_action('mepr-signup', 'ct_contact_form_validate');
|
113 |
+
}
|
114 |
+
|
115 |
/**hooks for cm answers pro */
|
116 |
if ( defined('CMA_PLUGIN_FILE') ) {
|
117 |
add_action('wp', 'ct_ajax_hook', 1);
|
1362 |
'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'],
|
1363 |
'data__cookies_type' => $apbct->data['cookies_type'],
|
1364 |
'data__visible_fields_required' => ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1,
|
1365 |
+
'data__to_local_storage' => \Cleantalk\ApbctWP\Variables\NoCookie::preloadForScripts()
|
1366 |
));
|
1367 |
|
1368 |
wp_enqueue_style(
|
inc/cleantalk-settings.php
CHANGED
@@ -173,6 +173,12 @@ function apbct_settings__set_fields()
|
|
173 |
'long_description' => true,
|
174 |
'display' => ! $apbct->white_label,
|
175 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
),
|
177 |
),
|
178 |
|
@@ -240,7 +246,7 @@ function apbct_settings__set_fields()
|
|
240 |
'forms__check_external__capture_buffer' => array(
|
241 |
'title' => __('Capture buffer', 'cleantalk-spam-protect'),
|
242 |
'description' => __(
|
243 |
-
'This
|
244 |
'cleantalk-spam-protect'
|
245 |
),
|
246 |
'class' => 'apbct_settings-field_wrapper--sub',
|
@@ -711,6 +717,14 @@ function apbct_settings__set_fields()
|
|
711 |
'section' => 'hidden_section',
|
712 |
'html_after' => '</div><div id="apbct_hidden_section_nav">{HIDDEN_SECTION_NAV}</div></div>',
|
713 |
'fields' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
'misc__async_js' => array(
|
715 |
'type' => 'checkbox',
|
716 |
'title' => __('Async JavaScript loading', 'cleantalk-spam-protect'),
|
@@ -1220,31 +1234,31 @@ function apbct_settings__error__output($return = false)
|
|
1220 |
|
1221 |
$error_texts = array(
|
1222 |
// Misc
|
1223 |
-
'key_invalid' => __('Error occurred while Access key validating.
|
1224 |
'key_get' => __(
|
1225 |
-
'Error occurred while automatically get Access key.
|
1226 |
'cleantalk-spam-protect'
|
1227 |
),
|
1228 |
'sfw_send_logs' => __(
|
1229 |
-
'Error occurred while sending SpamFireWall logs.
|
1230 |
'cleantalk-spam-protect'
|
1231 |
),
|
1232 |
'sfw_update' => __(
|
1233 |
-
'Error occurred while updating SpamFireWall local base.
|
1234 |
'cleantalk-spam-protect'
|
1235 |
),
|
1236 |
'ua_update' => __(
|
1237 |
-
'Error occurred while updating User-Agents local base.
|
1238 |
'cleantalk-spam-protect'
|
1239 |
),
|
1240 |
'account_check' => __(
|
1241 |
-
'Error occurred while checking account status.
|
1242 |
'cleantalk-spam-protect'
|
1243 |
),
|
1244 |
-
'api' => __('Error occurred while executing API call.
|
1245 |
-
'cron' => __('Error occurred while executing CleanTalk Cron job.
|
1246 |
'sfw_outdated' => __(
|
1247 |
-
'Error occurred on last SpamFireWall check.
|
1248 |
'cleantalk-spam-protect'
|
1249 |
),
|
1250 |
|
@@ -1274,10 +1288,10 @@ function apbct_settings__error__output($return = false)
|
|
1274 |
|
1275 |
$errors_out[$sub_type] = '';
|
1276 |
if ( isset($sub_error['error_time']) ) {
|
1277 |
-
$errors_out[$sub_type] .= date('
|
1278 |
}
|
1279 |
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
1280 |
-
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : ( $error_texts['unknown'] . $sub_type . ' '
|
1281 |
}
|
1282 |
}
|
1283 |
|
@@ -1297,7 +1311,7 @@ function apbct_settings__error__output($return = false)
|
|
1297 |
$errors_out[$type] = '';
|
1298 |
|
1299 |
if ( isset($error['error_time']) ) {
|
1300 |
-
$errors_out[$type] .= date('
|
1301 |
}
|
1302 |
|
1303 |
$errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
|
@@ -1305,10 +1319,20 @@ function apbct_settings__error__output($return = false)
|
|
1305 |
}
|
1306 |
|
1307 |
if ( ! empty($errors_out) ) {
|
1308 |
-
$out .= '<div id="apbctTopWarning" class="
|
1309 |
-
. '<h3 style="display: inline-block;">' . __('
|
1310 |
-
foreach ( $errors_out as $value ) {
|
1311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1312 |
}
|
1313 |
$out .= ! $apbct->white_label
|
1314 |
? '<h4 style="text-align: unset;">' . sprintf(
|
@@ -1339,6 +1363,10 @@ function apbct_settings__error__output($return = false)
|
|
1339 |
'a' => array(
|
1340 |
'target' => true,
|
1341 |
'href' => true,
|
|
|
|
|
|
|
|
|
1342 |
)
|
1343 |
)
|
1344 |
);
|
@@ -1845,9 +1873,17 @@ function apbct_settings__field__statistics()
|
|
1845 |
. ' name="submit"'
|
1846 |
. ' class="cleantalk_link cleantalk_link-manual"'
|
1847 |
. ' value="ct_send_connection_report"'
|
|
|
1848 |
. '>'
|
1849 |
. __('Send new report', 'cleantalk-spam-protect')
|
1850 |
. '</button>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1851 |
}
|
1852 |
}
|
1853 |
}
|
@@ -2266,8 +2302,8 @@ function apbct_settings__validate($settings)
|
|
2266 |
|
2267 |
// Drop debug data
|
2268 |
if ( Post::get('submit') === 'debug_drop' ) {
|
2269 |
-
$apbct->debug = false;
|
2270 |
$apbct->deleteOption('debug', true);
|
|
|
2271 |
return $settings;
|
2272 |
}
|
2273 |
|
@@ -2346,6 +2382,11 @@ function apbct_settings__validate($settings)
|
|
2346 |
\Cleantalk\ApbctWP\Variables\AltSessions::wipe();
|
2347 |
}
|
2348 |
|
|
|
|
|
|
|
|
|
|
|
2349 |
/**
|
2350 |
* Triggered before returning the settings
|
2351 |
*/
|
173 |
'long_description' => true,
|
174 |
'display' => ! $apbct->white_label,
|
175 |
),
|
176 |
+
'data__email_decoder' => array(
|
177 |
+
'type' => 'checkbox',
|
178 |
+
'title' => __('Encode contact data', 'cleantalk-spam-protect'),
|
179 |
+
'description' => __('Turn on this option to prevent crawlers grab contact data (emails) from website content.', 'cleantalk-spam-protect'),
|
180 |
+
'long_description' => true,
|
181 |
+
),
|
182 |
),
|
183 |
),
|
184 |
|
246 |
'forms__check_external__capture_buffer' => array(
|
247 |
'title' => __('Capture buffer', 'cleantalk-spam-protect'),
|
248 |
'description' => __(
|
249 |
+
'This option provides more sophisticated and enhanced protection for external forms. However, it can break other plugins that use the webserver buffer like Ninja Forms, and moreover, it can also cause issues with cache plugins.',
|
250 |
'cleantalk-spam-protect'
|
251 |
),
|
252 |
'class' => 'apbct_settings-field_wrapper--sub',
|
717 |
'section' => 'hidden_section',
|
718 |
'html_after' => '</div><div id="apbct_hidden_section_nav">{HIDDEN_SECTION_NAV}</div></div>',
|
719 |
'fields' => array(
|
720 |
+
'misc__send_connection_reports' => array(
|
721 |
+
'type' => 'checkbox',
|
722 |
+
'title' => __('Send connection reports', 'cleantalk-spam-protect'),
|
723 |
+
'description' => __(
|
724 |
+
"Checking this box you allow plugin to send the information about your connection.",
|
725 |
+
'cleantalk-spam-protect'
|
726 |
+
),
|
727 |
+
),
|
728 |
'misc__async_js' => array(
|
729 |
'type' => 'checkbox',
|
730 |
'title' => __('Async JavaScript loading', 'cleantalk-spam-protect'),
|
1234 |
|
1235 |
$error_texts = array(
|
1236 |
// Misc
|
1237 |
+
'key_invalid' => __('Error occurred while Access key validating. ', 'cleantalk-spam-protect'),
|
1238 |
'key_get' => __(
|
1239 |
+
'Error occurred while automatically get Access key. ',
|
1240 |
'cleantalk-spam-protect'
|
1241 |
),
|
1242 |
'sfw_send_logs' => __(
|
1243 |
+
'Error occurred while sending SpamFireWall logs. ',
|
1244 |
'cleantalk-spam-protect'
|
1245 |
),
|
1246 |
'sfw_update' => __(
|
1247 |
+
'Error occurred while updating SpamFireWall local base. ',
|
1248 |
'cleantalk-spam-protect'
|
1249 |
),
|
1250 |
'ua_update' => __(
|
1251 |
+
'Error occurred while updating User-Agents local base. ',
|
1252 |
'cleantalk-spam-protect'
|
1253 |
),
|
1254 |
'account_check' => __(
|
1255 |
+
'Error occurred while checking account status. ',
|
1256 |
'cleantalk-spam-protect'
|
1257 |
),
|
1258 |
+
'api' => __('Error occurred while executing API call. ', 'cleantalk-spam-protect'),
|
1259 |
+
'cron' => __('Error occurred while executing CleanTalk Cron job. ', 'cleantalk-spam-protect'),
|
1260 |
'sfw_outdated' => __(
|
1261 |
+
'Error occurred on last SpamFireWall check. ',
|
1262 |
'cleantalk-spam-protect'
|
1263 |
),
|
1264 |
|
1288 |
|
1289 |
$errors_out[$sub_type] = '';
|
1290 |
if ( isset($sub_error['error_time']) ) {
|
1291 |
+
$errors_out[$sub_type] .= date('M d Y H:i:s', $sub_error['error_time']) . ': ';
|
1292 |
}
|
1293 |
$errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
|
1294 |
+
$errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : ( $error_texts['unknown'] . $sub_type . ' ' ) . ' ' . $sub_error['error'] );
|
1295 |
}
|
1296 |
}
|
1297 |
|
1311 |
$errors_out[$type] = '';
|
1312 |
|
1313 |
if ( isset($error['error_time']) ) {
|
1314 |
+
$errors_out[$type] .= date('M d Y H:i:s', $error['error_time']) . ': ';
|
1315 |
}
|
1316 |
|
1317 |
$errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
|
1319 |
}
|
1320 |
|
1321 |
if ( ! empty($errors_out) ) {
|
1322 |
+
$out .= '<div id="apbctTopWarning" class="notice apbct-plugin-errors" style="position: relative;">'
|
1323 |
+
. '<h3 style="display: inline-block;">' . __('Notifications', 'cleantalk-spam-protect') . '</h3>';
|
1324 |
+
foreach ( $errors_out as $key => $value ) {
|
1325 |
+
switch ($key) {
|
1326 |
+
case 'sfw_outdated':
|
1327 |
+
$icon = '<span class="dashicons dashicons-update" style="color: steelblue;"></span>';
|
1328 |
+
break;
|
1329 |
+
case 'key_invalid':
|
1330 |
+
$icon = '<span class="dashicons dashicons-post-status" style="color: orange;"></span>';
|
1331 |
+
break;
|
1332 |
+
default:
|
1333 |
+
$icon = '<span class="dashicons dashicons-hammer" style="color: red;"></span>';
|
1334 |
+
}
|
1335 |
+
$out .= '<h4>' . $icon . ' ' . Escape::escHtml($value) . '</h4>';
|
1336 |
}
|
1337 |
$out .= ! $apbct->white_label
|
1338 |
? '<h4 style="text-align: unset;">' . sprintf(
|
1363 |
'a' => array(
|
1364 |
'target' => true,
|
1365 |
'href' => true,
|
1366 |
+
),
|
1367 |
+
'span' => array(
|
1368 |
+
'class' => true,
|
1369 |
+
'style' => true
|
1370 |
)
|
1371 |
)
|
1372 |
);
|
1873 |
. ' name="submit"'
|
1874 |
. ' class="cleantalk_link cleantalk_link-manual"'
|
1875 |
. ' value="ct_send_connection_report"'
|
1876 |
+
. (! $apbct->settings['misc__send_connection_reports'] ? ' disabled="disabled"' : '')
|
1877 |
. '>'
|
1878 |
. __('Send new report', 'cleantalk-spam-protect')
|
1879 |
. '</button>';
|
1880 |
+
if ( ! $apbct->settings['misc__send_connection_reports'] ) {
|
1881 |
+
echo '<br><br>';
|
1882 |
+
_e(
|
1883 |
+
'Please, enable "Send connection reports" setting to be able to send reports',
|
1884 |
+
'cleantalk-spam-protect'
|
1885 |
+
);
|
1886 |
+
}
|
1887 |
}
|
1888 |
}
|
1889 |
}
|
2302 |
|
2303 |
// Drop debug data
|
2304 |
if ( Post::get('submit') === 'debug_drop' ) {
|
|
|
2305 |
$apbct->deleteOption('debug', true);
|
2306 |
+
$apbct->debug = false;
|
2307 |
return $settings;
|
2308 |
}
|
2309 |
|
2382 |
\Cleantalk\ApbctWP\Variables\AltSessions::wipe();
|
2383 |
}
|
2384 |
|
2385 |
+
// NoCookie table clearing
|
2386 |
+
if ( $apbct->data['cookies_type'] !== 'none' ) {
|
2387 |
+
\Cleantalk\ApbctWP\Variables\NoCookie::wipe();
|
2388 |
+
}
|
2389 |
+
|
2390 |
/**
|
2391 |
* Triggered before returning the settings
|
2392 |
*/
|
inc/cleantalk-updater.php
CHANGED
@@ -1165,3 +1165,12 @@ function apbct_update_to_5_182_0()
|
|
1165 |
|
1166 |
update_option('cleantalk_connection_reports', $connection_reports, false);
|
1167 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1165 |
|
1166 |
update_option('cleantalk_connection_reports', $connection_reports, false);
|
1167 |
}
|
1168 |
+
|
1169 |
+
function apbct_update_to_5_184_2()
|
1170 |
+
{
|
1171 |
+
global $apbct;
|
1172 |
+
if ( ! isset($apbct->settings['misc__send_connection_reports']) ) {
|
1173 |
+
$apbct->settings['misc__send_connection_reports'] = 1;
|
1174 |
+
$apbct->saveSettings();
|
1175 |
+
}
|
1176 |
+
}
|
js/apbct-public-bundle.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
class ApbctCore{ajax_parameters={};rest_parameters={};#selector=null;elements=[];#eventCallback;#eventSelector;#event;constructor(e){this.select(e)}select(e){return e instanceof HTMLCollection?(this.#selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"==typeof e?(this.#selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.#selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.#deselect(),this}#addElement(e){"object"==typeof e?this.elements.push(e):"string"==typeof e?(this.#selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.#deselect()}#push(e){this.elements.push(e)}#reduce(){this.elements=this.elements.slice(0,-1)}#deselect(){this.elements=[]}css(o,t){if(t|=!1,"object"==typeof o){for(let t in o){var n=t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""));for(let e=0;e<this.elements.length;e++)this.elements[e].style[n]=o[t]}return this}if("string"==typeof o){let e=getComputedStyle(this.elements[0])[o];return(console.log(e),void 0===e||t)?e:(e=e.replace(/(\d)(em|pt|%|px){1,2}$/,"$1"),e=Number(e)==e?Number(e):e)}}hide(){this.prop("prev-display",this.css("display")),this.css({display:"none"})}show(){this.css({display:this.prop("prev-display")})}addClass(){for(let e=0;e<this.elements.length;e++)this.elements[e].classList.add(className)}removeClass(){for(let e=0;e<this.elements.length;e++)this.elements[e].classList.remove(className)}toggleClass(t){for(let e=0;e<this.elements.length;e++)this.elements[e].classList.toggle(t)}ajax(e){return this.ajax_parameters=e,new ApbctAjax(e)}rest(e){return this.rest_parameters=e,new ApbctRest(e)}on(...e){this.#event=e[0],this.#eventCallback=e[2]||e[1],this.#eventSelector="string"==typeof e[1]?e[1]:null;for(let e=0;e<this.elements.length;e++)this.elements[e].addEventListener(this.#event,null!==this.#eventSelector?this.#onChecker.bind(this):this.#eventCallback)}#onChecker(e){if(e.target===document.querySelector(this.#eventSelector))return e.stopPropagation(),this.#eventCallback(e)}ready(e){document.addEventListener("DOMContentLoaded",e)}change(e){this.on("change",e)}attr(t){let o=[];for(let e=0;e<this.elements.length;e++)this.elements[e][t],o.push(this.elements[e][t]);return 1===o.length?o[0]:o}prop(o,t){if(void 0!==t){for(let e=0;e<this.elements.length;e++)this.elements[e][o]=t;return this}{let t=[];for(let e=0;e<this.elements.length;e++)t.push(this.elements[e][o]);return 1===t.length?t[0]:t}}html(e){return void 0!==e?this.prop("innerHTML",e):this.prop("innerHTML")}val(e){return void 0!==e?this.prop("value",e):this.prop("value")}data(e,t){return void 0!==t?this.prop("apbct-data",e,t):this.prop("apbct-data")}is(e){let t=!1;for(var o of this.elements)t||=this.#isElem(o,e);return t}#isElem(e,t){let o=!1;return"function"==typeof t&&(o||=t.call(this,e)),"string"==typeof t&&(t.match(/^[a-z]/)&&function(e){e=document.createElement(e).constructor;return!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))}(t)?o||=e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||=Boolean(e[t]):o||=null!==this.#selector?null!==document.querySelector(this.#selector+t):this.#isWithoutSelector(e,t)),o}#isWithoutSelector(e,t){var o;let n=!1;for(o of document.querySelectorAll(t))n||=e===o;return n}filter(t){this.#selector=null;for(let e=this.elements.length-1;0<=e;e--)this.#isElem(this.elements[e],t)||this.elements.splice(Number(e),1);return this}parent(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.#deselect(),this}parents(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.#push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}children(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}siblings(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}remove(){for(var e of this.elements)e.remove()}after(e){for(var t of this.elements)t.after(e)}append(e){for(var t of this.elements)t.append(e)}fadeIn(o){for(let t of this.elements){t.style.opacity=0,t.style.display="block";let e=+new Date;const n=function(){t.style.opacity=+t.style.opacity+(new Date-e)/o,e=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(n)||setTimeout(n,16))};n()}}fadeOut(o){for(let t of this.elements){t.style.opacity=1;let e=+new Date;const n=function(){t.style.opacity=+t.style.opacity-(new Date-e)/o,e=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(n)||setTimeout(n,16):t.style.display="none"};n()}}}function apbct(e){return(new ApbctCore).select(e)}class ApbctXhr{#xhr=new XMLHttpRequest;method="POST";url="";async=!0;user=null;password=null;data={};button=null;spinner=null;progressbar=null;context=this;callback=null;responseType="json";headers={};timeout=15e3;#methods_to_convert_data_to_URL=["GET","HEAD"];#body=null;#http_code=0;#status_text="";constructor(e){for(var t in console.log("%cXHR%c started","color: red; font-weight: bold;","color: grey; font-weight: normal;"),e)void 0!==this[t]&&(this[t]=e[t]);if(this.#prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.#xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.#xhr.responseType=this.responseType,this.#xhr.timeout=this.timeout,this.#xhr.onreadystatechange=function(){this.onReadyStateChange()}.bind(this),this.#xhr.onload=function(){this.onLoad()}.bind(this),this.#xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.#xhr.onerror=function(){this.onError()}.bind(this),this.#xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.#xhr.send(this.#body)}#prepare(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}#complete(){this.#http_code=this.#xhr.status,this.#status_text=this.#xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}onReadyStateChange(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}onProgress(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}onError(){console.log("error"),this.#complete(),this.#error(this.#http_code,this.#status_text),null!==this.on_error&&"function"==typeof this.on_error&&this.on_error()}onTimeout(){this.#complete(),this.#error(0,"timeout"),null!==this.on_error&&"function"==typeof this.on_error&&this.on_error()}onLoad(){if(this.#complete(),"json"===this.responseType){if(null===this.#xhr.response)return this.#error(this.#http_code,this.#status_text,"No response"),!1;if(void 0!==this.#xhr.response.error)return this.#error(this.#http_code,this.#status_text,this.#xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.#xhr.response,this.data)}#error(e,t,o){let n="";"timeout"===t?n+="Server response timeout":200===e?"parsererror"===t?n+="Unexpected response from server. See console for details.":(n+="Unexpected error. Status: "+t+".",void 0!==o&&(n+=" Additional error info: "+o)):n+=500===e?"Internal server error.":"Unexpected response code:"+e,this.errorOutput(n)}errorOutput(e){console.log("%c ctXHR error: %c"+e,"color: red;","color: grey;")}setHeaders(){for(var e in this.headers)void 0!==this.headers[e]&&this.#xhr.setRequestHeader(e,this.headers[e])}convertData(){return~this.#methods_to_convert_data_to_URL.indexOf(this.method)?this.convertDataToURL():this.convertDataToBody()}convertDataToURL(){var e=new URLSearchParams(this.data).toString(),t=this.url.match(/^(https?:\/{2})?[a-z0-9.]+\?/)?"&":"?";return this.url+=t+e,this.url}convertDataToBody(){for(var e in this.#body=new FormData,this.data)this.#body.append(e,"object"==typeof this.data[e]?JSON.stringify(this.data[e]):this.data[e]);return this.#body}deleteDoubleJSONEncoding(e){if("object"==typeof e)for(var t in e){var o;"object"==typeof e[t]&&(e[t]=this.deleteDoubleJSONEncoding(e[t])),"string"!=typeof e[t]||null===e[t].match(/^[\[{].*?[\]}]$/)||"object"==typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}}class ApbctAjax extends ApbctXhr{constructor(...e){super(e[0])}}class ApbctRest extends ApbctXhr{static default_route=ctPublicFunctions._rest_url+"cleantalk-antispam/v1/";route="";constructor(...e){(e=e[0]).url=ApbctRest.default_route+e.route,e.headers={"X-WP-Nonce":ctPublicFunctions._rest_nonce},super(e)}}function ctSetCookie(e,t,o){var n;("string"==typeof e&&"string"==typeof t||"number"==typeof t)&&(n="ct_pointer_data"===e,e=[[e,t,o]]),"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?e.forEach(function(e,t,o){var n=void 0!==e[2]?"expires="+n+"; ":"",i="https:"===location.protocol?"; secure":"";document.cookie=ctPublicFunctions.cookiePrefix+e[0]+"="+encodeURIComponent(e[1])+"; "+n+"path=/; samesite=lax"+i}):"alternative"!==ctPublicFunctions.data__cookies_type||n||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:e}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:e},{notJson:1})))}function ctGetCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ctDeleteCookie(e){var t;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(t="https:"===location.protocol?"; secure":"",document.cookie=e+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+t):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(e,t,o){let n=[];n.callback=t.callback||null,n.callback_context=t.callback_context||null,n.callback_params=t.callback_params||null,n.async=t.async||!0,n.notJson=t.notJson||null,n.timeout=t.timeout||15e3,n.obj=o||null,n.button=t.button||null,n.progressbar=t.progressbar||null,n.silent=t.silent||null,n.no_nonce=t.no_nonce||null,n.data=e,n.url=ctPublicFunctions._ajax_url,"string"==typeof e?(n.no_nonce||(n.data=n.data+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce),n.data=n.data+"&no_cache="+Math.random()):(n.no_nonce||(n.data._ajax_nonce=ctPublicFunctions._ajax_nonce),n.data.no_cache=Math.random()),(new ApbctCore).ajax(n)}function apbct_public_sendREST(e,t){let o=[];o.route=e,o.callback=t.callback||null,o.data=t.data||[],o.method=t.method||"POST",(new ApbctCore).rest(o)}apbctLocalStorage={get:function(e,t){void 0===t&&(t="value");e=localStorage.getItem(e);if(null!==e)try{const o=JSON.parse(e);return o.hasOwnProperty(t)?JSON.parse(o[t]):o}catch(e){return new Error(e)}return!1},set:function(e,t,o=!0){o?(o={value:JSON.stringify(t),timestamp:Math.floor((new Date).getTime()/1e3)},localStorage.setItem(e,JSON.stringify(o))):localStorage.setItem(e,t)},isAlive:function(e,t){return void 0===t&&(t=86400),this.get(e,"timestamp")+t>Math.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)}};var ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0,ctCheckedEmails={};function apbct_attach_event_handler(e,t,o){"function"==typeof window.addEventListener?e.addEventListener(t,o):e.attachEvent(t,o)}function apbct_remove_event_handler(e,t,o){"function"==typeof window.removeEventListener?e.removeEventListener(t,o):e.detachEvent(t,o)}var ctFunctionFirstKey=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(ctMouseData))},1200),ctFunctionMouseMove=function(e){ctSetMouseMoved(),!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter&&ctMouseStopData())};function ctMouseStopData(){apbct_remove_event_handler(window,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(window,"keydown",ctFunctionFirstKey)}function checkEmail(e){var t=e.target.value;!t||t in ctCheckedEmails||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}))}function ctSetPixelImg(t){if(ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")){let e=document.createElement("img");e.setAttribute("alt","CleanTalk Pixel"),e.setAttribute("id","apbct_pixel"),e.setAttribute("style","display: none; left: 99999px;"),e.setAttribute("src",t),apbct("body").append(e)}}function ctGetPixelUrl(){var e=ctGetPixelUrlLocalstorage();if(!1!==e){if(!ctIsOutdatedPixelUrlLocalstorage(e))return void ctSetPixelImg(e);ctCleaPixelUrlLocalstorage(e)}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(e){e&&(ctGetPixelUrlLocalstorage()||ctSetPixelUrlLocalstorage(e),ctSetPixelImg(e))}}):apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{notJson:!0,callback:function(e){e&&(ctGetPixelUrlLocalstorage()||ctSetPixelUrlLocalstorage(e),ctSetPixelImg(e))}})}function ctSetHasScrolled(){apbctLocalStorage.isSet("ct_has_scrolled")&&apbctLocalStorage.get("ct_has_scrolled")||(ctSetCookie("ct_has_scrolled","true"),apbctLocalStorage.set("ct_has_scrolled",!0))}function ctSetMouseMoved(){apbctLocalStorage.isSet("ct_mouse_moved")&&apbctLocalStorage.get("ct_mouse_moved")||(ctSetCookie("ct_mouse_moved","true"),apbctLocalStorage.set("ct_mouse_moved",!0))}function apbct_ready(){var e=apbctLocalStorage.get("ct_cookies_type"),e=(e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled")),[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",ct_date.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["apbct_headless",navigator.webdriver]]);if("native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var o=0;o<t.length;o++){var n=t[o].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?ctGetPixelUrl():e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),apbct("input[type = 'email'], #email").on("blur",checkEmail)),apbctLocalStorage.isSet("ct_checkjs")?e.push(["ct_checkjs",apbctLocalStorage.get("ct_checkjs")]):e.push(["ct_checkjs",0]),ctSetCookie(e),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t,o,n=document.forms[e];0==+ctPublic.data__visible_fields_required||"get"===n.method.toString().toLowerCase()||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("sac-form")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||n.name&&-1!==n.name.toString().indexOf("tribe-bar-form")||((t=document.createElement("input")).setAttribute("type","hidden"),t.setAttribute("id","apbct_visible_fields_"+e),t.setAttribute("name","apbct_visible_fields"),(o={})[0]=apbct_collect_visible_fields(n),t.value=JSON.stringify(o),n.append(t),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=e,n.onsubmit=function(e){var t;"native"!==ctPublic.data__cookies_type&&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)})}},1e3);let i=document.querySelectorAll("[data-original-string]");if(i.length)for(let e=0;e<i.length;++e)i[e].parentElement.href||i[e].parentElement.parentElement.href||i[e].addEventListener("click",function e(t){this.removeEventListener("click",e),apbctAjaxEmailDecode(t,this)})}function apbctAjaxEmailDecode(e,n){const i=e.target;let t={event_javascript_data:getJavascriptClientData(),post_url:document.location.href,referrer:document.referrer};if(void 0!==n.href&&0===n.href.indexOf("mailto:"))e.preventDefault();else{i.setAttribute("title",ctPublicFunctions.text__wait_for_decoding),i.style.cursor="progress";let e=document.createElement("div"),t=(e.setAttribute("class","apbct-tooltip"),document.createElement("div")),o=(t.setAttribute("class","apbct-tooltip--text"),document.createElement("div"));o.setAttribute("class","apbct-tooltip--arrow"),apbct(i).append(e),apbct(e).append(t),apbct(e).append(o),ctShowDecodeComment(i,ctPublicFunctions.text__wait_for_decoding)}let o=e.target.dataset.originalString;void 0!==n.href&&0===n.href.indexOf("mailto:")&&(o=n.dataset.originalString),t.encodedEmail=o,"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_decode_email",{data:t,method:"POST",callback:function(t){if(t.success)if(void 0!==n.href&&0===n.href.indexOf("mailto:")){var o=n.href.replace("mailto:","");let e=n.innerHTML;n.innerHTML=e.replace(o,t.data.decoded_email),n.href="mailto:"+t.data.decoded_email,n.click()}else setTimeout(function(){ctProcessDecodedDataResult(t.data,e.target)},3e3);setTimeout(function(){apbct(i.getElementsByClassName("apbct-tooltip")).fadeOut(700)},4e3)}}):(t.action="apbct_decode_email",apbct_public_sendAJAX(t,{notJson:!0,callback:function(t){if(t.success)if(void 0!==n.href&&0===n.href.indexOf("mailto:")){var o=n.href.replace("mailto:","");let e=n.innerHTML;n.innerHTML=e.replace(o,t.data.decoded_email),n.href="mailto:"+t.data.decoded_email,n.click()}else setTimeout(function(){ctProcessDecodedDataResult(t.data,e.target)},3e3);setTimeout(function(){apbct(i.getElementsByClassName("apbct-tooltip")).fadeOut(700)},4e3)}}))}function getJavascriptClientData(){let e={};e.apbct_headless=ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_headless"),e.apbct_pixel_url=ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_pixel_url"),e.ct_checked_emails=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checked_emails"),e.ct_checkjs=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checkjs"),e.ct_fkp_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_fkp_timestamp"),e.ct_pointer_data=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_pointer_data"),e.ct_ps_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_ps_timestamp"),e.ct_screen_info=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_screen_info"),e.ct_timezone=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_timezone");var t=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_mouse_moved"),o=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),n=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_cookies_type"),i=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_mouse_moved"),c=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),a=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_cookies_type");return e.ct_mouse_moved=void 0!==t?t:i,e.ct_has_scrolled=void 0!==o?o:c,e.ct_cookies_type=void 0!==n?n:a,e=removeDoubleJsonEncoding(e),JSON.stringify(e)}function removeDoubleJsonEncoding(e){if("object"==typeof e)for(var t in e){var o;"object"==typeof e[t]&&(e[t]=removeDoubleJsonEncoding(e[t])),"string"!=typeof e[t]||null===e[t].match(/^[\[{].*?[\]}]$/)||"object"==typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),e.is_allowed&&ctFillDecodedEmail(t,e.decoded_email),e.show_comment&&ctShowDecodeComment(t,e.comment)}function ctFillDecodedEmail(e,t){apbct(e).html(apbct(e).html().replace(/.+?(<div class=["']apbct-tooltip["'].+?<\/div>)/,t+"$1"))}function ctShowDecodeComment(e,t){t&&(apbct(e.getElementsByClassName("apbct-tooltip")).fadeIn(300),apbct(e.getElementsByClassName("apbct-tooltip--text")).html(t),setTimeout(function(){apbct(e.getElementsByClassName("apbct-tooltip")).fadeOut(700)},5e3))}function apbct_collect_visible_fields(e){var t,o=[],n="",i=0,c="",a=0,s=[];for(t in e.elements)isNaN(+t)||(o[t]=e.elements[t]);return(o=o.filter(function(e){return-1===s.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(s.push(e.getAttribute("name")),!1))})).forEach(function(e,t,o){"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"),i++):(c+=" "+e.getAttribute("name"),a++))}),c=c.trim(),{visible_fields:n=n.trim(),visible_fields_count:i,invisible_fields:c,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(e,t){var o="object"==typeof e&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(o[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(o))}function apbct_js_keys__set_input_value(e,t,o,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var i=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<i.length;c++)i[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 ctSetPixelUrlLocalstorage(e){localStorage.setItem("session_pixel_url",e),localStorage.setItem(e,Math.floor(Date.now()/1e3).toString())}function ctGetPixelUrlLocalstorage(){var e=localStorage.getItem("session_pixel_url");return null!==e&&e}function ctIsOutdatedPixelUrlLocalstorage(e){e=Number(localStorage.getItem(e));return 10800<Math.floor(Date.now()/1e3).toString()-e}function ctCleaPixelUrlLocalstorage(e){localStorage.removeItem(e),localStorage.removeItem("session_pixel_url")}function ct_protect_external(){for(var e=0;e<document.forms.length;e++)if(void 0===document.forms[e].cleantalk_hidden_action&&void 0===document.forms[e].cleantalk_hidden_method){var t,n=document.forms[e];if(n.parentElement&&0<n.parentElement.classList.length&&-1!==n.parentElement.classList[0].indexOf("mewtwo"))return;if("string"==typeof n.action)if(isIntegratedForm(n)){var i=n.previousSibling,c=n.outerHTML,a=n;n.parentElement.removeChild(n);const s=document.createElement("div");s.innerHTML=c,i.after(s.firstElementChild);var c=document.createElement("input");c.name="action",c.value="cleantalk_force_ajax_check",c.type="hidden";let t=document.forms[e],o=(t.appendChild(c),!1);if(void 0!==t.classList){let e=["newsletterform","ml-block-form"];e.forEach(function(e){t.classList.contains(e)&&(o=e)})}if(o){let e=jQuery("form."+o).find('button[type="submit"]');void 0!==e&&e.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(t,i,a)})}else document.forms[e].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),o=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,o)}}else-1===n.action.indexOf("http://")&&-1===n.action.indexOf("https://")||n.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((c=document.createElement("input")).name="cleantalk_hidden_action",c.value=n.action,c.type="hidden",n.appendChild(c),(t=document.createElement("input")).name="cleantalk_hidden_method",t.value=n.method,t.type="hidden",n.method="POST",n.appendChild(t),n.action=document.location)}}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),o=jQuery(t).find("button, input, textarea, select");e.each(function(e,n){var i=jQuery(n);o.each(function(e,t){var o=jQuery(t);n.outerHTML===t.outerHTML&&o.val(i.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")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com")||-1!==t.indexOf("sendfox.com")||-1!==t.indexOf("aweber.com")||-1!==t.indexOf("secure.payu.com"))}function sendAjaxCheckingFormData(a,e,t){var o={},n=(o[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(o),{}),o=a.elements;(o=Array.prototype.slice.call(o)).forEach(function(e,t){""===e.name?n["input_"+t]=e.value:n[e.name]=e.value}),apbct_public_sendAJAX(n,{async:!1,callback:function(e,t,o,n,i,c){void 0!==e.apbct&&+e.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),c),i.after(c),c.find('input[name="apbct_visible_fields"]').remove(),c.find('input[value="cleantalk_force_ajax_check"]').remove(),0===(e=jQuery(c).find("button[type=submit]")).length&&0===(e=jQuery(c).find("input[type=submit]")).length&&0===(e=jQuery(c).find('button[data-element="submit"]')).length&&0===(e=jQuery(c).find('input[type="image"][name="submit"]')).length||e[0].click())},callback_context:null,callback_params:[e,t]})}function ct_check_internal(t){var e,o={},n=t.elements;for(e in n)"submit"!=n[e].type&&null!=n[e].value&&""!=n[e].value&&(o[n[e].name]=t.elements[e].value);o.action="ct_check_internal",apbct_public_sendAJAX(o,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.submit()}})}function ct_check_internal__is_exclude_form(t){let e=[ctPublic.blog_home+"wp-login.php",ctPublic.blog_home+"wp-comments-post.php"];return e.some(e=>null!==t.match(new RegExp("^"+e)))}apbct_attach_event_handler(window,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(window,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(window,"scroll",ctSetHasScrolled),apbct_attach_event_handler(window,"DOMContentLoaded",apbct_ready),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,o){if(t.responseText&&-1!==t.responseText.indexOf('"apbct')){try{var n=JSON.parse(t.responseText)}catch(e){return void console.log(e.toString())}void 0!==n.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())}}),cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,o,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},o={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},i={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},c={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},a={styles:{overflow:"hidden"},toString:e},s=document.createElement("style"),a=(s.setAttribute("id","cleantalk-modal-styles"),s.innerHTML="body.cleantalk-modal-opened{"+a+"}",s.innerHTML+="#cleantalk-modal-overlay{"+t+"}",s.innerHTML+="#cleantalk-modal-close{"+n+"}",s.innerHTML+="#cleantalk-modal-close:before{"+i+"}",s.innerHTML+="#cleantalk-modal-close:after{"+c+"}",document.body.append(s),document.createElement("div")),t=(a.setAttribute("id","cleantalk-modal-overlay"),document.body.append(a),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),n=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",o),a.append(t),document.createElement("div")),i=(n.setAttribute("id","cleantalk-modal-close"),t.append(n),document.createElement("div"));this.loaded?i.innerHTML=this.loaded:(i.innerHTML="Loading...",this.load("get_options_template")),i.setAttribute("id","cleantalk-modal-content"),t.append(i),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)}),document.addEventListener("DOMContentLoaded",function(){"undefined"!=typeof ctPublicGDPR&&ctPublicGDPR.gdpr_forms.length&&"undefined"!=typeof jQuery&&ctPublicGDPR.gdpr_forms.forEach(function(e,t,o){var n=jQuery("#"+e+", ."+e);n.is("form")||(n.find("form")[0]?n=n.children("form").first():jQuery(".wpcf7[role=form]")[0]&&-1!==jQuery(".wpcf7[role=form]").attr("id").indexOf("wpcf7-f"+e)?n=jQuery(".wpcf7[role=form]"):jQuery(".frm_forms")[0]&&-1!==jQuery(".frm_forms").first().attr("id").indexOf("frm_form_"+e)?n=jQuery(".frm_forms").first().children("form"):jQuery(".wpforms-form")[0]&&-1!==jQuery(".wpforms-form").first().attr("id").indexOf("wpforms-form-"+e)&&(n=jQuery(".wpforms-form"))),!n.is("form")&&"form"!==n.attr("role")||n.append('<input id="apbct_gdpr_'+t+'" type="checkbox" required="required " style="display: inline; margin-right: 10px;">').append('<label style="display: inline;" for="apbct_gdpr_'+t+'">'+ctPublicGDPR.gdpr_text+"</label>")})}),window.onload=function(){+ctPublic.settings__forms__check_external&&"undefined"!=typeof jQuery&&setTimeout(function(){ct_protect_external()},1500)},document.addEventListener("DOMContentLoaded",function(){let t="",o;if(+ctPublic.settings__forms__check_internal)for(let e=0;e<document.forms.length;e++)"string"==typeof document.forms[e].action&&(o=document.forms[e],null===(t=o.action).indexOf("https?://")||null===t.match(ctPublic.blog_home+".*?.php")||ct_check_internal__is_exclude_form(t)||(ctPrevHandler=o.click,"undefined"!=typeof jQuery&&(jQuery(o).off("**"),jQuery(o).off(),jQuery(o).on("submit",function(e){return ct_check_internal(e.target),!1}))))});
|
1 |
+
class ApbctCore{ajax_parameters={};rest_parameters={};#selector=null;elements=[];#eventCallback;#eventSelector;#event;constructor(e){this.select(e)}select(e){return e instanceof HTMLCollection?(this.#selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"==typeof e?(this.#selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.#selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.#deselect(),this}#addElement(e){"object"==typeof e?this.elements.push(e):"string"==typeof e?(this.#selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.#deselect()}#push(e){this.elements.push(e)}#reduce(){this.elements=this.elements.slice(0,-1)}#deselect(){this.elements=[]}css(o,t){if(t|=!1,"object"==typeof o){for(let t in o){var n=t.replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_",""));for(let e=0;e<this.elements.length;e++)this.elements[e].style[n]=o[t]}return this}if("string"==typeof o){let e=getComputedStyle(this.elements[0])[o];return(console.log(e),void 0===e||t)?e:(e=e.replace(/(\d)(em|pt|%|px){1,2}$/,"$1"),e=Number(e)==e?Number(e):e)}}hide(){this.prop("prev-display",this.css("display")),this.css({display:"none"})}show(){this.css({display:this.prop("prev-display")})}addClass(){for(let e=0;e<this.elements.length;e++)this.elements[e].classList.add(className)}removeClass(){for(let e=0;e<this.elements.length;e++)this.elements[e].classList.remove(className)}toggleClass(t){for(let e=0;e<this.elements.length;e++)this.elements[e].classList.toggle(t)}ajax(e){return this.ajax_parameters=e,new ApbctAjax(e)}rest(e){return this.rest_parameters=e,new ApbctRest(e)}on(...e){this.#event=e[0],this.#eventCallback=e[2]||e[1],this.#eventSelector="string"==typeof e[1]?e[1]:null;for(let e=0;e<this.elements.length;e++)this.elements[e].addEventListener(this.#event,null!==this.#eventSelector?this.#onChecker.bind(this):this.#eventCallback)}#onChecker(e){if(e.target===document.querySelector(this.#eventSelector))return e.stopPropagation(),this.#eventCallback(e)}ready(e){document.addEventListener("DOMContentLoaded",e)}change(e){this.on("change",e)}attr(t){let o=[];for(let e=0;e<this.elements.length;e++)this.elements[e][t],o.push(this.elements[e][t]);return 1===o.length?o[0]:o}prop(o,t){if(void 0!==t){for(let e=0;e<this.elements.length;e++)this.elements[e][o]=t;return this}{let t=[];for(let e=0;e<this.elements.length;e++)t.push(this.elements[e][o]);return 1===t.length?t[0]:t}}html(e){return void 0!==e?this.prop("innerHTML",e):this.prop("innerHTML")}val(e){return void 0!==e?this.prop("value",e):this.prop("value")}data(e,t){return void 0!==t?this.prop("apbct-data",e,t):this.prop("apbct-data")}is(e){let t=!1;for(var o of this.elements)t||=this.#isElem(o,e);return t}#isElem(e,t){let o=!1;return"function"==typeof t&&(o||=t.call(this,e)),"string"==typeof t&&(t.match(/^[a-z]/)&&function(e){e=document.createElement(e).constructor;return!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))}(t)?o||=e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||=Boolean(e[t]):o||=null!==this.#selector?null!==document.querySelector(this.#selector+t):this.#isWithoutSelector(e,t)),o}#isWithoutSelector(e,t){var o;let n=!1;for(o of document.querySelectorAll(t))n||=e===o;return n}filter(t){this.#selector=null;for(let e=this.elements.length-1;0<=e;e--)this.#isElem(this.elements[e],t)||this.elements.splice(Number(e),1);return this}parent(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.#deselect(),this}parents(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.#push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}children(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}siblings(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}remove(){for(var e of this.elements)e.remove()}after(e){for(var t of this.elements)t.after(e)}append(e){for(var t of this.elements)t.append(e)}fadeIn(o){for(let t of this.elements){t.style.opacity=0,t.style.display="block";let e=+new Date;const n=function(){t.style.opacity=+t.style.opacity+(new Date-e)/o,e=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(n)||setTimeout(n,16))};n()}}fadeOut(o){for(let t of this.elements){t.style.opacity=1;let e=+new Date;const n=function(){t.style.opacity=+t.style.opacity-(new Date-e)/o,e=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(n)||setTimeout(n,16):t.style.display="none"};n()}}}function apbct(e){return(new ApbctCore).select(e)}class ApbctXhr{#xhr=new XMLHttpRequest;method="POST";url="";async=!0;user=null;password=null;data={};button=null;spinner=null;progressbar=null;context=this;callback=null;onErrorCallback=null;responseType="json";headers={};timeout=15e3;#methods_to_convert_data_to_URL=["GET","HEAD"];#body=null;#http_code=0;#status_text="";constructor(e){for(var t in console.log("%cXHR%c started","color: red; font-weight: bold;","color: grey; font-weight: normal;"),e)void 0!==this[t]&&(this[t]=e[t]);if(this.#prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.#xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.#xhr.responseType=this.responseType,this.#xhr.timeout=this.timeout,this.#xhr.onreadystatechange=function(){this.onReadyStateChange()}.bind(this),this.#xhr.onload=function(){this.onLoad()}.bind(this),this.#xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.#xhr.onerror=function(){this.onError()}.bind(this),this.#xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.#xhr.send(this.#body)}#prepare(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}#complete(){this.#http_code=this.#xhr.status,this.#status_text=this.#xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}onReadyStateChange(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}onProgress(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}onError(){console.log("error"),this.#complete(),this.#error(this.#http_code,this.#status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.#status_text)}onTimeout(){this.#complete(),this.#error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}onLoad(){if(this.#complete(),"json"===this.responseType){if(null===this.#xhr.response)return this.#error(this.#http_code,this.#status_text,"No response"),!1;if(void 0!==this.#xhr.response.error)return this.#error(this.#http_code,this.#status_text,this.#xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.#xhr.response,this.data)}#error(e,t,o){let n="";"timeout"===t?n+="Server response timeout":200===e?"parsererror"===t?n+="Unexpected response from server. See console for details.":(n+="Unexpected error. Status: "+t+".",void 0!==o&&(n+=" Additional error info: "+o)):n+=500===e?"Internal server error.":"Unexpected response code:"+e,this.errorOutput(n)}errorOutput(e){console.log("%c ctXHR error: %c"+e,"color: red;","color: grey;")}setHeaders(){for(var e in this.headers)void 0!==this.headers[e]&&this.#xhr.setRequestHeader(e,this.headers[e])}convertData(){return~this.#methods_to_convert_data_to_URL.indexOf(this.method)?this.convertDataToURL():this.convertDataToBody()}convertDataToURL(){var e=new URLSearchParams(this.data).toString(),t=this.url.match(/^(https?:\/{2})?[a-z0-9.]+\?/)?"&":"?";return this.url+=t+e,this.url}convertDataToBody(){for(var e in this.#body=new FormData,this.data)this.#body.append(e,"object"==typeof this.data[e]?JSON.stringify(this.data[e]):this.data[e]);return this.#body}deleteDoubleJSONEncoding(e){if("object"==typeof e)for(var t in e){var o;"object"==typeof e[t]&&(e[t]=this.deleteDoubleJSONEncoding(e[t])),"string"!=typeof e[t]||null===e[t].match(/^[\[{].*?[\]}]$/)||"object"==typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}}class ApbctAjax extends ApbctXhr{constructor(...e){super(e[0])}}class ApbctRest extends ApbctXhr{static default_route=ctPublicFunctions._rest_url+"cleantalk-antispam/v1/";route="";constructor(...e){(e=e[0]).url=ApbctRest.default_route+e.route,e.headers={"X-WP-Nonce":ctPublicFunctions._rest_nonce},super(e)}}function ctSetCookie(e,t,o){var n;if(("string"==typeof e&&"string"==typeof t||"number"==typeof t)&&(n="ct_pointer_data"===e,e=[[e,t,o]]),"none"===ctPublicFunctions.data__cookies_type)e.forEach(function(e,t,o){apbctLocalStorage.set(e[0],encodeURIComponent(e[1]))}),ctNoCookieAttachHiddenFieldsToForms();else if("native"===ctPublicFunctions.data__cookies_type)e.forEach(function(e,t,o){var n=void 0!==e[2]?"expires="+n+"; ":"",i="https:"===location.protocol?"; secure":"";document.cookie=ctPublicFunctions.cookiePrefix+e[0]+"="+encodeURIComponent(e[1])+"; "+n+"path=/; samesite=lax"+i});else if("alternative"===ctPublicFunctions.data__cookies_type&&!n){"function"==typeof getJavascriptClientData?e=getJavascriptClientData(e):console.log("APBCT ERROR: getJavascriptClientData() is not loaded");try{JSON.parse(e)}catch(e){return void console.log("APBCT ERROR: JSON parse error:"+e)}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:e}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:e},{notJson:1})}}function ctGetCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ctDeleteCookie(e){var t;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(t="https:"===location.protocol?"; secure":"",document.cookie=e+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+t):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(e,t,o){let n=[];n.callback=t.callback||null,n.onErrorCallback=t.onErrorCallback||null,n.callback_context=t.callback_context||null,n.callback_params=t.callback_params||null,n.async=t.async||!0,n.notJson=t.notJson||null,n.timeout=t.timeout||15e3,n.obj=o||null,n.button=t.button||null,n.progressbar=t.progressbar||null,n.silent=t.silent||null,n.no_nonce=t.no_nonce||null,n.data=e,n.url=ctPublicFunctions._ajax_url,"string"==typeof e?(n.no_nonce||(n.data=n.data+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce),n.data=n.data+"&no_cache="+Math.random()):(n.no_nonce||(n.data._ajax_nonce=ctPublicFunctions._ajax_nonce),n.data.no_cache=Math.random()),(new ApbctCore).ajax(n)}function apbct_public_sendREST(e,t){let o=[];o.route=e,o.callback=t.callback||null,o.onErrorCallback=t.onErrorCallback||null,o.data=t.data||[],o.method=t.method||"POST",(new ApbctCore).rest(o)}apbctLocalStorage={get:function(t,e){void 0===e&&(e="value");t=localStorage.getItem(t);if(null!==t)try{const o=JSON.parse(t);return o.hasOwnProperty(e)?JSON.parse(o[e]):o}catch(e){return t}return!1},set:function(e,t,o=!0){o?(o={value:JSON.stringify(t),timestamp:Math.floor((new Date).getTime()/1e3)},localStorage.setItem(e,JSON.stringify(o))):localStorage.setItem(e,t)},isAlive:function(e,t){return void 0===t&&(t=86400),this.get(e,"timestamp")+t>Math.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){let o={};for(let t=0;t<localStorage.length;t++){let e=localStorage.key(t);-1===e.indexOf("ct_")&&-1===e.indexOf("apbct_")||(o[e.toString()]=apbctLocalStorage.get(e))}return o}};var ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0,ctCheckedEmails={};function apbct_attach_event_handler(e,t,o){"function"==typeof window.addEventListener?e.addEventListener(t,o):e.attachEvent(t,o)}function apbct_remove_event_handler(e,t,o){"function"==typeof window.removeEventListener?e.removeEventListener(t,o):e.detachEvent(t,o)}var ctFunctionFirstKey=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(ctMouseData))},1200),ctFunctionMouseMove=function(e){ctSetMouseMoved(),!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter&&ctMouseStopData())};function ctMouseStopData(){apbct_remove_event_handler(window,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(window,"keydown",ctFunctionFirstKey)}function checkEmail(e){var t=e.target.value;!t||t in ctCheckedEmails||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}))}function ctSetPixelImg(t){if(ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")){let e=document.createElement("img");e.setAttribute("alt","CleanTalk Pixel"),e.setAttribute("id","apbct_pixel"),e.setAttribute("style","display: none; left: 99999px;"),e.setAttribute("src",t),apbct("body").append(e)}}function ctGetPixelUrl(){var e=apbctLocalStorage.get("apbct_pixel_url");if(!1!==e){if(!apbctLocalStorage.isAlive("apbct_pixel_url",10800))return void ctSetPixelImg(e);apbctLocalStorage.delete("apbct_pixel_url")}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(e){e&&(apbctLocalStorage.get("apbct_pixel_url")||(apbctLocalStorage.set("apbct_pixel_url",e),ctNoCookieAttachHiddenFieldsToForms()),ctSetPixelImg(e))}}):apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{notJson:!0,callback:function(e){e&&(apbctLocalStorage.get("apbct_pixel_url")||(apbctLocalStorage.set("apbct_pixel_url",e),ctNoCookieAttachHiddenFieldsToForms()),ctSetPixelImg(e))}})}function ctSetHasScrolled(){apbctLocalStorage.isSet("ct_has_scrolled")&&apbctLocalStorage.get("ct_has_scrolled")||(ctSetCookie("ct_has_scrolled","true"),apbctLocalStorage.set("ct_has_scrolled",!0))}function ctSetMouseMoved(){apbctLocalStorage.isSet("ct_mouse_moved")&&apbctLocalStorage.get("ct_mouse_moved")||(ctSetCookie("ct_mouse_moved","true"),apbctLocalStorage.set("ct_mouse_moved",!0))}function ctPreloadLocalStorage(){if(ctPublic.data__to_local_storage){let e=Object.entries(ctPublic.data__to_local_storage);e.forEach(([e,t])=>{apbctLocalStorage.set(e,t)})}}function apbct_ready(){ctPreloadLocalStorage();var e=apbctLocalStorage.get("ct_cookies_type"),e=(e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled")),[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",ct_date.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["apbct_headless",navigator.webdriver]]);if(apbctLocalStorage.set("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),apbctLocalStorage.set("ct_fkp_timestamp","0"),apbctLocalStorage.set("ct_pointer_data","0"),apbctLocalStorage.set("ct_timezone",ct_date.getTimezoneOffset()/60*-1),apbctLocalStorage.set("ct_screen_info",apbctGetScreenInfo()),apbctLocalStorage.set("apbct_headless",navigator.webdriver),"native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var o=0;o<t.length;o++){var n=t[o].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?ctGetPixelUrl():e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),apbct("input[type = 'email'], #email").on("blur",checkEmail)),apbctLocalStorage.isSet("ct_checkjs")?e.push(["ct_checkjs",apbctLocalStorage.get("ct_checkjs")]):e.push(["ct_checkjs",0]),ctSetCookie(e),setTimeout(function(){ctNoCookieAttachHiddenFieldsToForms();for(var e=0;e<document.forms.length;e++){var t,o,n=document.forms[e];0==+ctPublic.data__visible_fields_required||"get"===n.method.toString().toLowerCase()||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("sac-form")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||n.name&&-1!==n.name.toString().indexOf("tribe-bar-form")||((t=document.createElement("input")).setAttribute("type","hidden"),t.setAttribute("id","apbct_visible_fields_"+e),t.setAttribute("name","apbct_visible_fields"),(o={})[0]=apbct_collect_visible_fields(n),t.value=JSON.stringify(o),n.append(t),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=e,n.onsubmit=function(e){var t;"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&((t={})[0]=apbct_collect_visible_fields(this),console.log("visible_fields[0]"+t[0]),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)})}},1e3);let i=document.querySelectorAll("[data-original-string]");if(i.length)for(let e=0;e<i.length;++e)i[e].parentElement.href||i[e].parentElement.parentElement.href||i[e].addEventListener("click",ctFillDecodedEmailHandler)}function ctFillDecodedEmailHandler(e){this.removeEventListener("click",ctFillDecodedEmailHandler),apbctAjaxEmailDecode(e,this)}function apbctAjaxEmailDecode(e,n){const i=e.target;let t={event_javascript_data:getJavascriptClientData(),post_url:document.location.href,referrer:document.referrer};if(void 0!==n.href&&0===n.href.indexOf("mailto:"))e.preventDefault();else{i.setAttribute("title",ctPublicFunctions.text__wait_for_decoding),i.style.cursor="progress";let e=document.createElement("div"),t=(e.setAttribute("class","apbct-tooltip"),document.createElement("div")),o=(t.setAttribute("class","apbct-tooltip--text"),document.createElement("div"));o.setAttribute("class","apbct-tooltip--arrow"),apbct(i).append(e),apbct(e).append(t),apbct(e).append(o),ctShowDecodeComment(i,ctPublicFunctions.text__wait_for_decoding)}let o=e.target.dataset.originalString;void 0!==n.href&&0===n.href.indexOf("mailto:")&&(o=n.dataset.originalString),t.encodedEmail=o,"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_decode_email",{data:t,method:"POST",callback:function(t){if(t.success)if(void 0!==n.href&&0===n.href.indexOf("mailto:")){var o=n.href.replace("mailto:","");let e=n.innerHTML;n.innerHTML=e.replace(o,t.data.decoded_email),n.href="mailto:"+t.data.decoded_email,n.click()}else setTimeout(function(){ctProcessDecodedDataResult(t.data,e.target)},3e3);setTimeout(function(){apbct(i.getElementsByClassName("apbct-tooltip")).fadeOut(700)},4e3)},onErrorCallback:function(e){i.addEventListener("click",ctFillDecodedEmailHandler),i.removeAttribute("style"),ctShowDecodeComment(i,"Error occurred: "+e)}}):(t.action="apbct_decode_email",apbct_public_sendAJAX(t,{notJson:!0,callback:function(t){if(t.success)if(void 0!==n.href&&0===n.href.indexOf("mailto:")){var o=n.href.replace("mailto:","");let e=n.innerHTML;n.innerHTML=e.replace(o,t.data.decoded_email),n.href="mailto:"+t.data.decoded_email,n.click()}else setTimeout(function(){ctProcessDecodedDataResult(t.data,e.target)},3e3);setTimeout(function(){apbct(i.getElementsByClassName("apbct-tooltip")).fadeOut(700)},4e3)},onErrorCallback:function(e){i.addEventListener("click",ctFillDecodedEmailHandler),i.removeAttribute("style"),ctShowDecodeComment(i,"Error occurred: "+e)}}))}function getJavascriptClientData(t=[]){let o={};o.apbct_headless=ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_headless"),o.apbct_pixel_url=ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_pixel_url"),o.ct_checked_emails=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checked_emails"),o.ct_checkjs=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checkjs"),o.ct_fkp_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_fkp_timestamp"),o.ct_pointer_data=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_pointer_data"),o.ct_ps_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_ps_timestamp"),o.ct_screen_info=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_screen_info"),o.ct_timezone=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_timezone");var e=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_mouse_moved"),n=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),i=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_cookies_type"),c=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_mouse_moved"),a=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),l=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_cookies_type");if(o.ct_mouse_moved=void 0!==e?e:c,o.ct_has_scrolled=void 0!==n?n:a,o.ct_cookies_type=void 0!==i?i:l,"object"==typeof t&&t!==[])for(let e=0;e<t.length;++e)"object"==typeof t[e][1]?o[t[e][1][0]]=t[e][1][1]:o[t[e][0]]=t[e][1];else console.log("APBCT JS ERROR: Collecting data type mismatch");return o=removeDoubleJsonEncoding(o),JSON.stringify(o)}function removeDoubleJsonEncoding(e){if("object"==typeof e)for(var t in e){var o;"object"==typeof e[t]&&(e[t]=removeDoubleJsonEncoding(e[t])),"string"!=typeof e[t]||null===e[t].match(/^[\[{].*?[\]}]$/)||"object"==typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),e.is_allowed&&ctFillDecodedEmail(t,e.decoded_email),e.show_comment&&ctShowDecodeComment(t,e.comment)}function ctFillDecodedEmail(e,t){apbct(e).html(apbct(e).html().replace(/.+?(<div class=["']apbct-tooltip["'].+?<\/div>)/,t+"$1"))}function ctShowDecodeComment(e,t){t&&(apbct(e.getElementsByClassName("apbct-tooltip")).fadeIn(300),apbct(e.getElementsByClassName("apbct-tooltip--text")).html(t),setTimeout(function(){apbct(e.getElementsByClassName("apbct-tooltip")).fadeOut(700)},5e3))}function apbct_collect_visible_fields(e){var t,o=[],n="",i=0,c="",a=0,l=[];for(t in e.elements)isNaN(+t)||(o[t]=e.elements[t]);return(o=o.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,o){"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"),i++):(c+=" "+e.getAttribute("name"),a++))}),c=c.trim(),{visible_fields:n=n.trim(),visible_fields_count:i,invisible_fields:c,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(e,t){var o="object"==typeof e&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(o[n]))}else"none"===ctPublic.data__cookies_type?ctSetCookie("apbct_visible_fields",JSON.stringify(o[0])):ctSetCookie("apbct_visible_fields",JSON.stringify(o))}function apbct_js_keys__set_input_value(e,t,o,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var i=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<i.length;c++)i[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 ctParseBlockMessage(e){void 0!==e.apbct&&(e=e.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:e.comment}})),cleantalkModal.loaded=e.comment,cleantalkModal.open(),1==+e.stop_script&&window.stop())}function ctSetPixelUrlLocalstorage(e){ctSetCookie("apbct_pixel_url",e)}function ctNoCookieConstructHiddenField(){let e="";var t=apbctLocalStorage.getCleanTalkData(),t=JSON.stringify(t);return t=btoa(t),(e=document.createElement("input")).setAttribute("id","ct_no_cookie_hidden_field"),e.setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",t),e.setAttribute("type","hidden"),e}function ctNoCookieGetForms(){var e=document.forms;return e||!1}function ctNoCookieAttachHiddenFieldsToForms(){if("none"===ctPublic.data__cookies_type){var t=ctNoCookieGetForms();if(t)for(let e=0;e<t.length;e++)if(null===document.forms[e].getAttribute("method")||"post"===document.forms[e].getAttribute("method").toLowerCase()){let t=document.getElementsByName("ct_no_cookie_hidden_field");if(t)for(let e=0;e<t.length;e++)t[e].parentNode.removeChild(t[e]);document.forms[e].append(ctNoCookieConstructHiddenField())}}}apbct_attach_event_handler(window,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(window,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(window,"scroll",ctSetHasScrolled),apbct_attach_event_handler(window,"DOMContentLoaded",apbct_ready),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,o){if(t.responseText&&-1!==t.responseText.indexOf('"apbct')){try{var n=JSON.parse(responseText)}catch(e){return void console.log(e.toString())}ctParseBlockMessage(n)}}),cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,o,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},o={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},i={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},c={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},a={styles:{overflow:"hidden"},toString:e},l=document.createElement("style"),a=(l.setAttribute("id","cleantalk-modal-styles"),l.innerHTML="body.cleantalk-modal-opened{"+a+"}",l.innerHTML+="#cleantalk-modal-overlay{"+t+"}",l.innerHTML+="#cleantalk-modal-close{"+n+"}",l.innerHTML+="#cleantalk-modal-close:before{"+i+"}",l.innerHTML+="#cleantalk-modal-close:after{"+c+"}",document.body.append(l),document.createElement("div")),t=(a.setAttribute("id","cleantalk-modal-overlay"),document.body.append(a),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),n=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",o),a.append(t),document.createElement("div")),i=(n.setAttribute("id","cleantalk-modal-close"),t.append(n),document.createElement("div"));this.loaded?i.innerHTML=this.loaded:(i.innerHTML="Loading...",this.load("get_options_template")),i.setAttribute("id","cleantalk-modal-content"),t.append(i),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});let buttons_to_handle=[],gdpr_notice_for_button="Please, apply the GDPR agreement.";function apbct_gdpr_handle_buttons(){try{if(buttons_to_handle===[])return;buttons_to_handle.forEach(e=>{var t='[id="apbct_gdpr_'+e.index+'"]',t=jQuery(t);jQuery(t).prop("checked")?(e.button.disabled=!1,jQuery(e.button).prop("title",e.old_notice)):(e.button.disabled=!0,jQuery(e.button).prop("title",gdpr_notice_for_button))})}catch(e){console.info("APBCT GDPR JS ERROR: Can not handle form buttons "+e)}}function ct_protect_external(){for(var e=0;e<document.forms.length;e++)if(void 0===document.forms[e].cleantalk_hidden_action&&void 0===document.forms[e].cleantalk_hidden_method){var n=document.forms[e];if(n.parentElement&&0<n.parentElement.classList.length&&-1!==n.parentElement.classList[0].indexOf("mewtwo"))return;if("string"==typeof n.action)if(isIntegratedForm(n)){var i=document.createElement("i"),i=(i.className="cleantalk_placeholder",i.style="display: none",n.parentElement.insertBefore(i,n),n.previousSibling),c=n.outerHTML,a=n;n.parentElement.removeChild(n);const l=document.createElement("div");l.innerHTML=c,i.after(l.firstElementChild);var c=document.createElement("input");c.name="action",c.value="cleantalk_force_ajax_check",c.type="hidden";let t=document.forms[e],o=(t.appendChild(c),t.apbctPrev=i,t.apbctFormOriginal=a,!1);if(void 0!==t.classList){let e=["newsletterform","ml-block-form"];e.forEach(function(e){t.classList.contains(e)&&(o=e)})}if(o){let e=jQuery("form."+o).find('button[type="submit"]');void 0!==e&&e.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(e.currentTarget)})}else document.forms[e].onsubmit=function(e){e.preventDefault();jQuery(e.currentTarget).prev(),jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget)}}else-1===n.action.indexOf("http://")&&-1===n.action.indexOf("https://")||n.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((c=document.createElement("input")).name="cleantalk_hidden_action",c.value=n.action,c.type="hidden",n.appendChild(c),(i=document.createElement("input")).name="cleantalk_hidden_method",i.value=n.method,i.type="hidden",n.method="POST",n.appendChild(i),n.action=document.location)}}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),o=jQuery(t).find("button, input, textarea, select");e.each(function(e,n){var i=jQuery(n);o.each(function(e,t){var o=jQuery(t);n.outerHTML===t.outerHTML&&o.val(i.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")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com")||-1!==t.indexOf("sendfox.com")||-1!==t.indexOf("aweber.com")||-1!==t.indexOf("secure.payu.com"))}function sendAjaxCheckingFormData(a,e,t){var o={},n=(o[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(o),{}),o=a.elements;(o=Array.prototype.slice.call(o)).forEach(function(e,t){""===e.name?n["input_"+t]=e.value:n[e.name]=e.value}),apbct_public_sendAJAX(n,{async:!1,callback:function(e,t,o,n){if(void 0===e.apbct||!+e.apbct.blocked){var i=jQuery(a).detach();let e=a.apbctPrev;var c=a.apbctFormOriginal,i=(apbct_replace_inputs_values_from_other_form(i,c),e.after(c),jQuery(c).find('input[name="apbct_visible_fields"]').remove(),jQuery(c).find('input[value="cleantalk_force_ajax_check"]').remove(),jQuery(c).find("button[type=submit]"));if(0!==i.length)return void i[0].click();if(0!==(i=jQuery(c).find("input[type=submit]")).length)return void i[0].click();if(0!==(i=jQuery(c).find('button[data-element="submit"]')).length)return void i[0].click();0!==(i=jQuery(c).find('input[type="image"][name="submit"]')).length&&i[0].click()}void 0!==e.apbct&&+e.apbct.blocked&&ctParseBlockMessage(e)}})}function ct_check_internal(t){var e,o={},n=t.elements;for(e in n)"submit"!=n[e].type&&null!=n[e].value&&""!=n[e].value&&(o[n[e].name]=t.elements[e].value);o.action="ct_check_internal",apbct_public_sendAJAX(o,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.submit()}})}function ct_check_internal__is_exclude_form(t){let e=[ctPublic.blog_home+"wp-login.php",ctPublic.blog_home+"wp-comments-post.php"];return e.some(e=>null!==t.match(new RegExp("^"+e)))}document.addEventListener("DOMContentLoaded",function(){if(buttons_to_handle=[],"undefined"!=typeof ctPublicGDPR&&ctPublicGDPR.gdpr_forms.length&&"undefined"!=typeof jQuery)try{ctPublicGDPR.gdpr_forms.forEach(function(e,t){let o=jQuery("#"+e+", ."+e),n=(o.is("form")||(o.find("form")[0]?o=o.children("form").first():jQuery(".wpcf7[role=form]")[0]&&-1!==jQuery(".wpcf7[role=form]").attr("id").indexOf("wpcf7-f"+e)?o=jQuery(".wpcf7[role=form]").children("form"):jQuery(".frm_forms")[0]&&-1!==jQuery(".frm_forms").first().attr("id").indexOf("frm_form_"+e)?o=jQuery(".frm_forms").first().children("form"):jQuery(".wpforms-form")[0]&&-1!==jQuery(".wpforms-form").first().attr("id").indexOf("wpforms-form-"+e)&&(o=jQuery(".wpforms-form"))),!1);var e=o.find('input[type|="submit"]');e.length&&(!1!==(n=e[0])&&(console.log(e),n.disabled=!0,e=jQuery(n).prop("title")?jQuery(n).prop("title"):"",buttons_to_handle.push({index:t,button:n,old_notice:e}),jQuery(n).prop("title",gdpr_notice_for_button)),!o.is("form")&&"form"!==o.attr("role")||o.append('<input id="apbct_gdpr_'+t+'" type="checkbox" required="required" style=" margin-right: 10px;" onchange="apbct_gdpr_handle_buttons()">').append('<label style="display: inline;" for="apbct_gdpr_'+t+'">'+ctPublicGDPR.gdpr_text+"</label>"))})}catch(e){console.info("APBCT GDPR JS ERROR: Can not add GDPR notice"+e)}}),window.onload=function(){+ctPublic.settings__forms__check_external&&"undefined"!=typeof jQuery&&setTimeout(function(){ct_protect_external()},1500)},document.addEventListener("DOMContentLoaded",function(){let t="",o;if(+ctPublic.settings__forms__check_internal)for(let e=0;e<document.forms.length;e++)"string"==typeof document.forms[e].action&&(o=document.forms[e],null===(t=o.action).indexOf("https?://")||null===t.match(ctPublic.blog_home+".*?.php")||ct_check_internal__is_exclude_form(t)||(ctPrevHandler=o.click,"undefined"!=typeof jQuery&&(jQuery(o).off("**"),jQuery(o).off(),jQuery(o).on("submit",function(e){return ct_check_internal(e.target),!1}))))});
|
js/apbct-public-bundle.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"apbct-public-bundle.min.js","sources":["apbct-public-bundle.js"],"sourcesContent":["class ApbctCore{\n\n ajax_parameters = {};\n rest_parameters = {};\n\n #selector = null;\n elements = [];\n\n // Event properties\n #eventCallback;\n #eventSelector;\n #event;\n\n /**\n * Default constructor\n */\n constructor(selector){\n this.select(selector);\n }\n\n /**\n * Get elements by CSS selector\n *\n * @param selector\n * @returns {*}\n */\n select(selector) {\n\n if(selector instanceof HTMLCollection){\n this.#selector = null;\n this.elements = [];\n this.elements = Array.prototype.slice.call(selector);\n }else if( typeof selector === 'object' ){\n this.#selector = null;\n this.elements = [];\n this.elements[0] = selector;\n }else if( typeof selector === 'string' ){\n this.#selector = selector;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(selector));\n // this.elements = document.querySelectorAll(selector)[0];\n }else{\n this.#deselect();\n }\n\n return this;\n }\n\n #addElement(elemToAdd){\n if( typeof elemToAdd === 'object' ){\n this.elements.push(elemToAdd);\n }else if( typeof elemToAdd === 'string' ){\n this.#selector = elemToAdd;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(elemToAdd));\n }else{\n this.#deselect();\n }\n }\n\n #push(elem){\n this.elements.push(elem);\n }\n\n #reduce(){\n this.elements = this.elements.slice(0,-1);\n }\n\n #deselect(){\n this.elements = [];\n }\n\n /**\n * Set or get CSS for/of currently selected element\n *\n * @param style\n * @param getRaw\n *\n * @returns {boolean|*}\n */\n css(style, getRaw){\n\n getRaw = getRaw | false;\n\n // Set style\n if(typeof style === \"object\"){\n\n const stringToCamelCase = str =>\n str.replace(/([-_][a-z])/g, group =>\n group\n .toUpperCase()\n .replace('-', '')\n .replace('_', '')\n );\n\n // Apply multiple styles\n for(let style_name in style){\n let DOM_style_name = stringToCamelCase(style_name);\n\n // Apply to multiple elements (currently selected)\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].style[DOM_style_name] = style[style_name];\n }\n }\n\n return this;\n }\n\n // Get style of first currently selected element\n if(typeof style === 'string'){\n\n let computedStyle = getComputedStyle(this.elements[0])[style];\n\n console.log(computedStyle);\n\n // Process\n if( typeof computedStyle !== 'undefined' && ! getRaw){\n computedStyle = computedStyle.replace(/(\\d)(em|pt|%|px){1,2}$/, '$1'); // Cut of units\n computedStyle = Number(computedStyle) == computedStyle ? Number(computedStyle) : computedStyle; // Cast to INT\n return computedStyle;\n }\n\n // Return unprocessed\n return computedStyle;\n }\n }\n\n hide(){\n this.prop('prev-display', this.css('display'));\n this.css({'display': 'none'});\n }\n\n show(){\n this.css({'display': this.prop('prev-display')});\n }\n\n addClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.add(className);\n }\n }\n\n removeClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.remove(className);\n }\n }\n\n toggleClass(className){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.toggle(className);\n }\n }\n\n /**\n * Wrapper for apbctAJAX class\n *\n * @param ajax_parameters\n * @returns {ApbctAjax}\n */\n ajax(ajax_parameters){\n this.ajax_parameters = ajax_parameters;\n return new ApbctAjax(ajax_parameters);\n }\n\n /**\n * Wrapper for apbctREST class\n *\n * @param rest_parameters\n * @returns {ApbctRest}\n */\n rest(rest_parameters){\n this.rest_parameters = rest_parameters;\n return new ApbctRest(rest_parameters);\n }\n\n /************** EVENTS **************/\n\n /**\n *\n * Why the mess with arguments?\n *\n * Because we need to support the following function signatures:\n * on('click', function(){ alert('some'); });\n * on('click', 'inner_selector', function(){ alert('some'); });\n *\n * @param args\n */\n on(...args){\n\n this.#event = args[0];\n this.#eventCallback = args[2] || args[1];\n this.#eventSelector = typeof args[1] === \"string\" ? args[1] : null;\n\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].addEventListener(\n this.#event,\n this.#eventSelector !== null\n ? this.#onChecker.bind(this)\n : this.#eventCallback\n );\n }\n }\n\n /**\n * Check if a selector of an event matches current target\n *\n * @param event\n * @returns {*}\n */\n #onChecker(event){\n if(event.target === document.querySelector(this.#eventSelector)){\n event.stopPropagation();\n return this.#eventCallback(event);\n }\n }\n\n ready(callback){\n document.addEventListener('DOMContentLoaded', callback);\n }\n\n change(callback){\n this.on('change', callback);\n }\n\n /************** ATTRIBUTES **************/\n\n /**\n * Get an attribute or property of an element\n *\n * @param attrName\n * @returns {*|*[]}\n */\n attr(attrName){\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n\n // Use property instead of attribute if possible\n if(typeof this.elements[i][attrName] !== undefined){\n outputValue.push(this.elements[i][attrName]);\n }else{\n outputValue.push(this.elements[i].getAttribute(attrName));\n }\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n\n prop(propName, value){\n\n // Setting values\n if(typeof value !== \"undefined\"){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i][propName] = value;\n }\n\n return this;\n\n // Getting values\n }else{\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n outputValue.push(this.elements[i][propName]);\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n }\n\n /**\n * Set or get inner HTML\n *\n * @param value\n * @returns {*|*[]}\n */\n html(value){\n return typeof value !== 'undefined'\n ? this.prop('innerHTML', value)\n : this.prop('innerHTML');\n }\n\n /**\n * Set or get value of input tags\n *\n * @param value\n * @returns {*|*[]|undefined}\n */\n val(value){\n return typeof value !== 'undefined'\n ? this.prop('value', value)\n : this.prop('value');\n }\n\n data(name, value){\n return typeof value !== 'undefined'\n ? this.prop('apbct-data', name, value)\n : this.prop('apbct-data');\n }\n\n /************** END OF ATTRIBUTES **************/\n\n /************** FILTERS **************/\n\n /**\n * Check if the current elements are corresponding to filter\n *\n * @param filter\n * @returns {boolean}\n */\n is(filter){\n\n let outputValue = false;\n\n for(let elem of this.elements){\n outputValue ||= this.#isElem(elem, filter);\n }\n\n return outputValue;\n }\n\n #isElem(elemToCheck, filter){\n\n let is = false;\n let isRegisteredTagName = function(name){\n let newlyCreatedElement = document.createElement(name).constructor;\n return ! Boolean( ~[HTMLElement, HTMLUnknownElement].indexOf(newlyCreatedElement) );\n };\n\n // Check for filter function\n if(typeof filter === 'function') {\n is ||= filter.call(this, elemToCheck);\n }\n\n // Check for filter function\n if(typeof filter === 'string') {\n\n // Filter is tag name\n if( filter.match(/^[a-z]/) && isRegisteredTagName(filter) ){\n is ||= elemToCheck.tagName.toLowerCase() === filter.toLowerCase();\n\n // Filter is property\n }else if( filter.match(/^[a-z]/) ){\n is ||= Boolean(elemToCheck[filter]);\n\n // Filter is CSS selector\n }else {\n is ||= this.#selector !== null\n ? document.querySelector(this.#selector + filter) !== null // If possible\n : this.#isWithoutSelector(elemToCheck, filter); // Search through all elems with such selector\n }\n }\n\n return is;\n }\n\n #isWithoutSelector(elemToCheck, filter){\n\n let elems = document.querySelectorAll(filter);\n let outputValue = false;\n\n for(let elem of elems){\n outputValue ||= elemToCheck === elem;\n }\n\n return outputValue;\n }\n\n filter(filter){\n\n this.#selector = null;\n\n for( let i = this.elements.length - 1; i >= 0; i-- ){\n if( ! this.#isElem(this.elements[i], filter) ){\n this.elements.splice(Number(i), 1);\n }\n }\n\n return this;\n }\n\n /************** NODES **************/\n\n parent(filter){\n\n this.select(this.elements[0].parentElement);\n\n if( typeof filter !== 'undefined' && ! this.is(filter) ){\n this.#deselect();\n }\n\n return this;\n }\n\n parents(filter){\n\n this.select(this.elements[0]);\n\n for ( ; this.elements[ this.elements.length - 1].parentElement !== null ; ) {\n this.#push(this.elements[ this.elements.length - 1].parentElement);\n }\n\n this.elements.splice(0,1); // Deleting initial element from the set\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n children(filter){\n\n this.select(this.elements[0].children);\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n siblings(filter){\n\n let current = this.elements[0]; // Remember current to delete it later\n\n this.parent();\n this.children(filter);\n this.elements.splice(this.elements.indexOf(current), 1); // Remove current element\n\n return this;\n }\n\n /************** DOM MANIPULATIONS **************/\n remove(){\n for(let elem of this.elements){\n elem.remove();\n }\n }\n\n after(content){\n for(let elem of this.elements){\n elem.after(content);\n }\n }\n\n append(content){\n for(let elem of this.elements){\n elem.append(content);\n }\n }\n\n /** ANIMATION **/\n fadeIn(time) {\n for(let elem of this.elements){\n elem.style.opacity = 0;\n elem.style.display = 'block';\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity + (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity < 1) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n }\n };\n\n tick();\n }\n }\n\n fadeOut(time) {\n for(let elem of this.elements){\n elem.style.opacity = 1;\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity - (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity > 0) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n } else {\n elem.style.display = 'none';\n }\n };\n\n tick();\n }\n }\n\n}\n\n/**\n * Hack\n *\n * Make a proxy to keep both properties and methods from:\n * - the native object and\n * - the new one from ApbctCore for selected element.\n *\n * For example:\n * apbct('#id).innerHTML = 'some';\n * apbct('#id).css({'backgorund-color': 'black'});\n */\n// apbct = new Proxy(\n// apbct,\n// {\n// get(target, prop) {\n// if (target.elements.length) {\n// return target.elements[0][prop];\n// } else {\n// return null;\n// }\n// },\n// set(target, prop, value){\n// if (target.elements.length) {\n// target.elements[0][prop] = value;\n// return true;\n// } else {\n// return false;\n// }\n// },\n// apply(target, thisArg, argArray) {\n//\n// }\n// }\n// );\n\n/**\n * Enter point to ApbctCore class\n *\n * @param params\n * @returns {*}\n */\nfunction apbct(params){\n return new ApbctCore()\n .select(params);\n}\nclass ApbctXhr{\n\n #xhr = new XMLHttpRequest();\n\n // Base parameters\n method = 'POST'; // HTTP-request type\n url = ''; // URL to send the request\n async = true;\n user = null; // HTTP-authorization username\n password = null; // HTTP-authorization password\n data = {}; // Data to send\n\n\n // Optional params\n button = null; // Button that should be disabled when request is performing\n spinner = null; // Spinner that should appear when request is in process\n progressbar = null; // Progress bar for the current request\n context = this; // Context\n callback = null;\n\n responseType = 'json'; // Expected data type from server\n headers = {};\n timeout = 15000; // Request timeout in milliseconds\n\n #methods_to_convert_data_to_URL = [\n 'GET',\n 'HEAD',\n ];\n\n #body = null;\n #http_code = 0;\n #status_text = '';\n\n constructor(parameters){\n\n console.log('%cXHR%c started', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;');\n\n // Set class properties\n for( let key in parameters ){\n if( typeof this[key] !== 'undefined' ){\n this[key] = parameters[key];\n }\n }\n\n // Modifying DOM-elements\n this.#prepare();\n\n // Modify URL with data for GET and HEAD requests\n if ( Object.keys(this.data).length ) {\n this.deleteDoubleJSONEncoding(this.data);\n this.convertData();\n }\n\n if( ! this.url ){\n console.log('%cXHR%c not URL provided', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;')\n return false;\n }\n\n // Configure the request\n this.#xhr.open(this.method, this.url, this.async, this.user, this.password);\n this.setHeaders();\n\n this.#xhr.responseType = this.responseType;\n this.#xhr.timeout = this.timeout;\n\n /* EVENTS */\n // Monitoring status\n this.#xhr.onreadystatechange = function(){\n this.onReadyStateChange();\n }.bind(this);\n\n // Run callback\n this.#xhr.onload = function(){\n this.onLoad();\n }.bind(this);\n\n // On progress\n this.#xhr.onprogress = function(event){\n this.onProgress(event);\n }.bind(this);\n\n // On error\n this.#xhr.onerror = function(){\n this.onError();\n }.bind(this);\n\n this.#xhr.ontimeout = function(){\n this.onTimeout();\n }.bind(this);\n\n // Send the request\n this.#xhr.send(this.#body);\n }\n\n #prepare(){\n\n // Disable button\n if(this.button){\n this.button.setAttribute('disabled', 'disabled');\n this.button.style.cursor = 'not-allowed';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'inline';\n }\n }\n\n #complete(){\n\n this.#http_code = this.#xhr.status;\n this.#status_text = this.#xhr.statusText;\n\n // Disable button\n if(this.button){\n this.button.removeAttribute('disabled');\n this.button.style.cursor = 'auto';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'none';\n }\n\n if( this.progressbar ) {\n this.progressbar.fadeOut('slow');\n }\n }\n\n onReadyStateChange(){\n if (this.on_ready_state_change !== null && typeof this.on_ready_state_change === 'function'){\n this.on_ready_state_change();\n }\n }\n\n onProgress(event) {\n if (this.on_progress !== null && typeof this.on_progress === 'function'){\n this.on_progress();\n }\n }\n\n onError(){\n\n console.log('error');\n\n this.#complete();\n this.#error(\n this.#http_code,\n this.#status_text\n );\n\n if (this.on_error !== null && typeof this.on_error === 'function'){\n this.on_error();\n }\n }\n\n onTimeout(){\n this.#complete();\n this.#error(\n 0,\n 'timeout'\n );\n\n if (this.on_error !== null && typeof this.on_error === 'function'){\n this.on_error();\n }\n }\n\n onLoad(){\n\n this.#complete();\n\n if (this.responseType === 'json' ){\n if(this.#xhr.response === null){\n this.#error(this.#http_code, this.#status_text, 'No response');\n return false;\n }else if( typeof this.#xhr.response.error !== 'undefined') {\n this.#error(this.#http_code, this.#status_text, this.#xhr.response.error);\n return false;\n }\n }\n\n if (this.callback !== null && typeof this.callback === 'function') {\n this.callback.call(this.context, this.#xhr.response, this.data);\n }\n }\n\n #error(http_code, status_text, additional_msg){\n\n let error_string = '';\n\n if( status_text === 'timeout' ){\n error_string += 'Server response timeout'\n\n }else if( http_code === 200 ){\n\n if( status_text === 'parsererror' ){\n error_string += 'Unexpected response from server. See console for details.';\n }else {\n error_string += 'Unexpected error. Status: ' + status_text + '.';\n if( typeof additional_msg !== 'undefined' )\n error_string += ' Additional error info: ' + additional_msg;\n }\n\n }else if(http_code === 500){\n error_string += 'Internal server error.';\n\n }else {\n error_string += 'Unexpected response code:' + http_code;\n }\n\n this.errorOutput( error_string );\n }\n\n errorOutput(error_msg){\n console.log( '%c ctXHR error: %c' + error_msg, 'color: red;', 'color: grey;' );\n }\n\n setHeaders(){\n // Set headers if passed\n for( let header_name in this.headers ){\n if( typeof this.headers[header_name] !== 'undefined' ){\n this.#xhr.setRequestHeader(header_name, this.headers[header_name]);\n }\n }\n }\n\n convertData()\n {\n // GET, HEAD request-type\n if( ~this.#methods_to_convert_data_to_URL.indexOf( this.method ) ){\n return this.convertDataToURL();\n\n // POST request-type\n }else{\n return this.convertDataToBody()\n }\n }\n\n convertDataToURL(){\n let params_appendix = new URLSearchParams(this.data).toString();\n let params_prefix = this.url.match(/^(https?:\\/{2})?[a-z0-9.]+\\?/) ? '&' : '?';\n this.url += params_prefix + params_appendix;\n\n return this.url;\n }\n\n /**\n *\n * @returns {null}\n */\n convertDataToBody()\n {\n this.#body = new FormData();\n\n for (let dataKey in this.data) {\n this.#body.append(\n dataKey,\n typeof this.data[dataKey] === 'object'\n ? JSON.stringify(this.data[dataKey])\n : this.data[dataKey]\n );\n }\n\n return this.#body;\n }\n\n /**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\n deleteDoubleJSONEncoding(object){\n\n if( typeof object === 'object'){\n\n for (let objectKey in object) {\n\n // Recursion\n if( typeof object[objectKey] === 'object'){\n object[objectKey] = this.deleteDoubleJSONEncoding(object[objectKey]);\n }\n\n // Common case (out)\n if(\n typeof object[objectKey] === 'string' &&\n object[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n ){\n let parsedValue = JSON.parse(object[objectKey]);\n if( typeof parsedValue === 'object' ){\n object[objectKey] = parsedValue;\n }\n }\n }\n }\n\n return object;\n }\n}\nclass ApbctAjax extends ApbctXhr{\n\n constructor(...args) {\n super(args[0]);\n }\n}\nclass ApbctRest extends ApbctXhr{\n\n static default_route = ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/';\n route = '';\n\n constructor(...args) {\n args = args[0];\n args.url = ApbctRest.default_route + args.route;\n args.headers = {\n \"X-WP-Nonce\": ctPublicFunctions._rest_nonce\n };\n super(args);\n }\n}\n\nfunction 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__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\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 = ctPublicFunctions.cookiePrefix + item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! 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 === '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\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\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__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n let _params = [];\n _params[\"callback\"] = params.callback || null;\n _params[\"callback_context\"] = params.callback_context || null;\n _params[\"callback_params\"] = params.callback_params || null;\n _params[\"async\"] = params.async || true;\n _params[\"notJson\"] = params.notJson || null;\n _params[\"timeout\"] = params.timeout || 15000;\n _params[\"obj\"] = obj || null;\n _params[\"button\"] = params.button || null;\n _params[\"progressbar\"] = params.progressbar || null;\n _params[\"silent\"] = params.silent || null;\n _params[\"no_nonce\"] = params.no_nonce || null;\n _params[\"data\"] = data;\n _params[\"url\"] = ctPublicFunctions._ajax_url;\n\n if(typeof (data) === 'string') {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"] = _params[\"data\"] + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"] = _params[\"data\"] + '&no_cache=' + Math.random()\n } else {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"]._ajax_nonce = ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"].no_cache = Math.random();\n }\n\n new ApbctCore().ajax(_params);\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n let _params = [];\n _params[\"route\"] = route;\n _params[\"callback\"] = params.callback || null;\n _params[\"data\"] = params.data || [];\n _params[\"method\"] = params.method || 'POST';\n\n new ApbctCore().rest(_params);\n}\n\napbctLocalStorage = {\n get : function(key, property) {\n if ( typeof property === 'undefined' ) {\n property = 'value';\n }\n const storageValue = localStorage.getItem(key);\n if ( storageValue !== null ) {\n try {\n const json = JSON.parse(storageValue);\n return json.hasOwnProperty(property) ? JSON.parse(json[property]) : json;\n } catch (e) {\n return new Error(e);\n }\n }\n return false;\n },\n set : function(key, value, is_json = true) {\n if (is_json){\n let objToSave = {'value': JSON.stringify(value), 'timestamp': Math.floor(new Date().getTime() / 1000)};\n localStorage.setItem(key, JSON.stringify(objToSave));\n } else {\n localStorage.setItem(key, value);\n }\n },\n isAlive : function(key, maxLifetime) {\n if ( typeof maxLifetime === 'undefined' ) {\n maxLifetime = 86400;\n }\n const keyTimestamp = this.get(key, 'timestamp');\n return keyTimestamp + maxLifetime > Math.floor(new Date().getTime() / 1000);\n },\n isSet : function(key) {\n return localStorage.getItem(key) !== null;\n },\n delete : function (key) {\n localStorage.removeItem(key);\n }\n}\nvar ct_date = new Date(),\n\tctTimeMs = new Date().getTime(),\n\tctMouseEventTimerFlag = true, //Reading interval flag\n\tctMouseData = [],\n\tctMouseDataCounter = 0,\n\tctCheckedEmails = {};\n\nfunction apbct_attach_event_handler(elem, event, callback){\n\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\telse elem.attachEvent(event, callback);\n}\n\nfunction apbct_remove_event_handler(elem, event, callback){\n\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\telse elem.detachEvent(event, callback);\n}\n\n//Writing first key press timestamp\nvar ctFunctionFirstKey = function output(event){\n\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\tctKeyStopStopListening();\n};\n\n//Reading interval\nvar ctMouseReadInterval = setInterval(function(){\n\tctMouseEventTimerFlag = true;\n}, 150);\n\n//Writting interval\nvar ctMouseWriteDataInterval = setInterval(function(){\n\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n}, 1200);\n\n//Logging mouse position each 150 ms\nvar ctFunctionMouseMove = function output(event){\n\tctSetMouseMoved();\n\tif(ctMouseEventTimerFlag === true){\n\n\t\tctMouseData.push([\n\t\t\tMath.round(event.clientY),\n\t\t\tMath.round(event.clientX),\n\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t]);\n\n\t\tctMouseDataCounter++;\n\t\tctMouseEventTimerFlag = false;\n\t\tif(ctMouseDataCounter >= 50){\n\t\t\tctMouseStopData();\n\t\t}\n\t}\n};\n\n//Stop mouse observing function\nfunction ctMouseStopData(){\n\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tclearInterval(ctMouseReadInterval);\n\tclearInterval(ctMouseWriteDataInterval);\n}\n\n//Stop key listening function\nfunction ctKeyStopStopListening(){\n\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n}\n\nfunction checkEmail(e) {\n\tvar current_email = e.target.value;\n\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'check_email_before_post',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {'email' : current_email},\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);\n\t\t\t// Using AJAX request and handler\n\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\temail : current_email,\n\t\t\t\t},\n\t\t\t\t{\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);\n\t\t}\n\t}\n}\n\nfunction ctSetPixelImg(pixelUrl) {\n\tctSetCookie('apbct_pixel_url', pixelUrl);\n\tif( +ctPublic.pixel__enabled ){\n\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\tlet insertedImg = document.createElement('img');\n\t\t\tinsertedImg.setAttribute('alt', 'CleanTalk Pixel');\n\t\t\tinsertedImg.setAttribute('id', 'apbct_pixel');\n\t\t\tinsertedImg.setAttribute('style', 'display: none; left: 99999px;');\n\t\t\tinsertedImg.setAttribute('src', pixelUrl);\n\t\t\tapbct('body').append(insertedImg);\n\t\t}\n\t}\n}\n\nfunction ctGetPixelUrl() {\n\t// Check if pixel is already in localstorage and is not outdated\n\tlet local_storage_pixel_url = ctGetPixelUrlLocalstorage();\n\tif ( local_storage_pixel_url !== false ) {\n\t\tif ( ctIsOutdatedPixelUrlLocalstorage(local_storage_pixel_url) ) {\n\t\t\tctCleaPixelUrlLocalstorage(local_storage_pixel_url)\n\t\t} else {\n\t\t\t//if so - load pixel from localstorage and draw it skipping AJAX\n\t\t\tctSetPixelImg(local_storage_pixel_url);\n\t\t\treturn;\n\t\t}\n\t}\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_get_pixel_url',\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! ctGetPixelUrlLocalstorage() ){\n\t\t\t\t\t\t\tctSetPixelUrlLocalstorage(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tapbct_public_sendAJAX(\n\t\t\t{\n\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! ctGetPixelUrlLocalstorage() ){\n\t\t\t\t\t\t\tctSetPixelUrlLocalstorage(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction ctSetHasScrolled() {\n\tif( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\tapbctLocalStorage.set('ct_has_scrolled', true);\n\t}\n}\n\nfunction ctSetMouseMoved() {\n\tif( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\tapbctLocalStorage.set('ct_mouse_moved', true);\n\t}\n}\n\napbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\napbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\napbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\napbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n// Ready function\nfunction apbct_ready(){\n\n\tlet cookiesType = apbctLocalStorage.get('ct_cookies_type');\n\tif ( ! cookiesType || cookiesType !== ctPublic.data__cookies_type ) {\n\t\tapbctLocalStorage.set('ct_cookies_type', ctPublic.data__cookies_type);\n\t\tapbctLocalStorage.delete('ct_mouse_moved');\n\t\tapbctLocalStorage.delete('ct_has_scrolled');\n\t}\n\n\t// Collect scrolling info\n\tvar initCookies = [\n\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t[\"ct_pointer_data\", \"0\"],\n\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t[\"apbct_headless\", navigator.webdriver],\n\t];\n\n\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t} else {\n\t\t// Delete all visible fields cookies on load the page\n\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\tif( cookiesArray.length !== 0 ) {\n\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif( +ctPublic.pixel__setting ){\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tctGetPixelUrl()\n\t\t} else {\n\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t}\n\t}\n\n\tif ( +ctPublic.data__email_check_before_post) {\n\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\tapbct(\"input[type = 'email'], #email\").on('blur', checkEmail);\n\t}\n\n\tif (apbctLocalStorage.isSet('ct_checkjs')) {\n\t\tinitCookies.push(['ct_checkjs', apbctLocalStorage.get('ct_checkjs')]);\n\t} else {\n\t\tinitCookies.push(['ct_checkjs', 0]);\n\t}\n\n\tctSetCookie(initCookies);\n\n\tsetTimeout(function(){\n\n\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\tvar form = document.forms[i];\n\n\t\t\t//Exclusion for forms\n\t\t\tif (\n\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' || // Custom form\n\t\t\t\t(form.name && form.name.toString().indexOf('tribe-bar-form') !== -1) // The Events Calendar\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\tvar visibleFieldsToInput = {};\n\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\tform.append( hiddenInput );\n\n\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\tform.ctFormIndex = i;\n\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\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, event.target.ctFormIndex );\n\t\t\t\t}\n\n\t\t\t\t// Call previous submit action\n\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t}, 500);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t}, 1000);\n\n\t// Listen clicks on encoded emails\n\tlet decodedEmailNodes = document.querySelectorAll(\"[data-original-string]\");\n\tif (decodedEmailNodes.length) {\n\t\tfor (let i = 0; i < decodedEmailNodes.length; ++i) {\n\t\t\tif (\n\t\t\t\tdecodedEmailNodes[i].parentElement.href ||\n\t\t\t\tdecodedEmailNodes[i].parentElement.parentElement.href\n\t\t\t) {\n\t\t\t\t// Skip listening click on hyperlinks\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdecodedEmailNodes[i].addEventListener('click', function ctFillDecodedEmailHandler(event) {\n\t\t\t\tthis.removeEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\tapbctAjaxEmailDecode(event, this);\n\t\t\t});\n\t\t}\n\t}\n}\napbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\nfunction apbctAjaxEmailDecode(event, baseElement){\n\tconst element = event.target;\n\tconst javascriptClientData = getJavascriptClientData();\n\tlet data = {\n\t\tevent_javascript_data: javascriptClientData,\n\t\tpost_url: document.location.href,\n\t\treferrer: document.referrer,\n\t};\n\n\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\tevent.preventDefault();\n\t} else {\n\t\telement.setAttribute('title', ctPublicFunctions.text__wait_for_decoding);\n\t\telement.style.cursor = 'progress';\n\n\t\t// Adding a tooltip\n\t\tlet apbctTooltip = document.createElement('div');\n\t\tapbctTooltip.setAttribute('class', 'apbct-tooltip');\n\t\tlet apbctTooltipText = document.createElement('div');\n\t\tapbctTooltipText.setAttribute('class', 'apbct-tooltip--text');\n\t\tlet apbctTooltipArrow = document.createElement('div');\n\t\tapbctTooltipArrow.setAttribute('class', 'apbct-tooltip--arrow');\n\t\tapbct(element).append(apbctTooltip);\n\t\tapbct(apbctTooltip).append(apbctTooltipText);\n\t\tapbct(apbctTooltip).append(apbctTooltipArrow);\n\t\tctShowDecodeComment(element, ctPublicFunctions.text__wait_for_decoding);\n\t}\n\n\tlet encodedEmail = event.target.dataset.originalString;\n\n\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\tencodedEmail = baseElement.dataset.originalString;\n\t}\n\n\tdata.encodedEmail = encodedEmail;\n\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_decode_email',\n\t\t\t{\n\t\t\t\tdata: data,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\t\t\t\t\t\tlet encodedEmail = baseElement.href.replace('mailto:', '');\n\t\t\t\t\t\t\tlet baseElementContent = baseElement.innerHTML;\n\t\t\t\t\t\t\tbaseElement.innerHTML = baseElementContent.replace(encodedEmail, result.data.decoded_email);\n\t\t\t\t\t\t\tbaseElement.href = 'mailto:' + result.data.decoded_email;\n\t\t\t\t\t\t\tbaseElement.click();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\tctProcessDecodedDataResult(result.data, event.target);\n\t\t\t\t\t\t\t}, 3000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tapbct(element.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t\t\t\t\t}, 4000);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\n\t// Using AJAX request and handler\n\t}else{\n\t\tdata.action = 'apbct_decode_email';\n\t\tapbct_public_sendAJAX(\n\t\t\tdata,\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\t\t\t\t\t\tlet encodedEmail = baseElement.href.replace('mailto:', '');\n\t\t\t\t\t\t\tlet baseElementContent = baseElement.innerHTML;\n\t\t\t\t\t\t\tbaseElement.innerHTML = baseElementContent.replace(encodedEmail, result.data.decoded_email);\n\t\t\t\t\t\t\tbaseElement.href = 'mailto:' + result.data.decoded_email;\n\t\t\t\t\t\t\tbaseElement.click();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\tctProcessDecodedDataResult(result.data, event.target);\n\t\t\t\t\t\t\t}, 3000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tapbct(element.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t\t\t\t\t}, 4000);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction getJavascriptClientData() {\n\tlet resultDataJson = {};\n\n\tresultDataJson.apbct_headless = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n\tresultDataJson.apbct_pixel_url = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n\tresultDataJson.ct_checked_emails = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails');\n\tresultDataJson.ct_checkjs = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checkjs');\n\tresultDataJson.ct_fkp_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_fkp_timestamp');\n\tresultDataJson.ct_pointer_data = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_pointer_data');\n\tresultDataJson.ct_ps_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_ps_timestamp');\n\tresultDataJson.ct_screen_info = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_screen_info');\n\tresultDataJson.ct_timezone = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_timezone');\n\n\t// collecting data from localstorage\n\tconst ctMouseMovedLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\t// collecting data from cookies\n\tconst ctMouseMovedCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\tresultDataJson.ct_mouse_moved = ctMouseMovedLocalStorage !== undefined ? ctMouseMovedLocalStorage : ctMouseMovedCookie;\n\tresultDataJson.ct_has_scrolled = ctHasScrolledLocalStorage !== undefined ? ctHasScrolledLocalStorage : ctHasScrolledCookie;\n\tresultDataJson.ct_cookies_type = ctCookiesTypeLocalStorage !== undefined ? ctCookiesTypeLocalStorage : ctCookiesTypeCookie;\n\n\t// Parse JSON properties to prevent double JSON encoding\n\tresultDataJson = removeDoubleJsonEncoding(resultDataJson);\n\n\treturn JSON.stringify(resultDataJson);\n}\n\n/**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\nfunction removeDoubleJsonEncoding(object){\n\n\tif( typeof object === 'object'){\n\n\t\tfor (let objectKey in object) {\n\n\t\t\t// Recursion\n\t\t\tif( typeof object[objectKey] === 'object'){\n\t\t\t\tobject[objectKey] = removeDoubleJsonEncoding(object[objectKey]);\n\t\t\t}\n\n\t\t\t// Common case (out)\n\t\t\tif(\n\t\t\t\ttypeof object[objectKey] === 'string' &&\n\t\t\t\tobject[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n\t\t\t){\n\t\t\t\tlet parsedValue = JSON.parse(object[objectKey]);\n\t\t\t\tif( typeof parsedValue === 'object' ){\n\t\t\t\t\tobject[objectKey] = parsedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn object;\n}\n\nfunction ctProcessDecodedDataResult(response, targetElement) {\n\n\ttargetElement.setAttribute('title', '');\n\ttargetElement.removeAttribute('style');\n\n\tif( !! response.is_allowed) {\n\t\tctFillDecodedEmail(targetElement, response.decoded_email);\n\t}\n\n\tif( !! response.show_comment ){\n\t\tctShowDecodeComment(targetElement, response.comment);\n\t}\n}\n\nfunction ctFillDecodedEmail(target, email){\n\tapbct(target).html(\n\t\tapbct(target)\n\t\t\t.html()\n\t\t\t.replace(/.+?(<div class=[\"']apbct-tooltip[\"'].+?<\\/div>)/, email + \"$1\")\n\t);\n}\n\nfunction ctShowDecodeComment(target, comment){\n\n\tif( ! comment ){\n\t\treturn;\n\t}\n\n\tapbct(target.getElementsByClassName('apbct-tooltip')).fadeIn(300);\n\tapbct(target.getElementsByClassName('apbct-tooltip--text')).html(comment);\n\tsetTimeout(function(){\n\t\tapbct(target.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t}, 5000);\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__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\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\ttry {\n\t\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e.toString());\n\t\t\t\treturn;\n\t\t\t}\n\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}\n\nfunction ctSetPixelUrlLocalstorage(ajax_pixel_url) {\n\t//set pixel to the storage\n\tlocalStorage.setItem('session_pixel_url', ajax_pixel_url)\n\t//set pixel timestamp to the storage\n\tlocalStorage.setItem(ajax_pixel_url, Math.floor(Date.now() / 1000).toString())\n}\n\nfunction ctGetPixelUrlLocalstorage() {\n\tlet local_storage_pixel = localStorage.getItem('session_pixel_url');\n\tif ( local_storage_pixel !== null ) {\n\t\treturn local_storage_pixel;\n\t} else {\n\t\treturn false;\n\t}\n}\n\nfunction ctIsOutdatedPixelUrlLocalstorage(local_storage_pixel_url) {\n\tlet local_storage_pixel_timestamp = Number(localStorage.getItem(local_storage_pixel_url));\n\tlet current_timestamp = Math.floor(Date.now() / 1000).toString()\n\tlet timestamp_difference = current_timestamp - local_storage_pixel_timestamp;\n\treturn timestamp_difference > 3600 * 3;\n}\n\nfunction ctCleaPixelUrlLocalstorage(local_storage_pixel_url) {\n\t//remove timestamp\n\tlocalStorage.removeItem(local_storage_pixel_url)\n\t//remove pixel itself\n\tlocalStorage.removeItem('session_pixel_url')\n}\n/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n \"box-sizing\" : \"content-box\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});\ndocument.addEventListener('DOMContentLoaded', function(){\n\n\tif(\n\t\ttypeof ctPublicGDPR === 'undefined' ||\n\t\t! ctPublicGDPR.gdpr_forms.length\n\t) {\n\t\treturn;\n\t}\n\n\tif ( typeof jQuery === 'undefined' ) {\n\t\treturn;\n\t}\n\n\tctPublicGDPR.gdpr_forms.forEach(function(item, i, arr){\n\n\t\tvar elem = jQuery('#'+item+', .'+item);\n\n\t\t// Filter forms\n\t\tif(!elem.is('form')){\n\t\t\t// Caldera\n\t\t\tif(elem.find('form')[0])\n\t\t\t\telem = elem.children('form').first();\n\t\t\t// Contact Form 7\n\t\t\telse if(jQuery('.wpcf7[role=form]')[0] && jQuery('.wpcf7[role=form]').attr('id').indexOf('wpcf7-f'+item) !== -1)\n\t\t\t\telem = jQuery('.wpcf7[role=form]');\n\t\t\t// Formidable\n\t\t\telse if(jQuery('.frm_forms')[0] && jQuery('.frm_forms').first().attr('id').indexOf('frm_form_'+item) !== -1)\n\t\t\t\telem = jQuery('.frm_forms').first().children('form');\n\t\t\t// WPForms\n\t\t\telse if(jQuery('.wpforms-form')[0] && jQuery('.wpforms-form').first().attr('id').indexOf('wpforms-form-'+item) !== -1)\n\t\t\t\telem = jQuery('.wpforms-form');\n\t\t}\n\n\t\t// Adding notice\n\t\tif(elem.is('form') || elem.attr('role') === 'form'){\n\t\t\telem.append('<input id=\"apbct_gdpr_'+i+'\" type=\"checkbox\" required=\"required \" style=\"display: inline; margin-right: 10px;\">')\n\t\t\t\t.append('<label style=\"display: inline;\" for=\"apbct_gdpr_'+i+'\">'+ctPublicGDPR.gdpr_text+'</label>');\n\t\t}\n\t});\n\n});\n/**\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 (currentForm.parentElement && currentForm.parentElement.classList.length > 0 && currentForm.parentElement.classList[0].indexOf('mewtwo') !== -1){\n return\n }\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n\n // Deleting form to prevent submit event\n var prev = currentForm.previousSibling,\n form_html = currentForm.outerHTML,\n form_original = currentForm;\n\n // Remove the original form\n currentForm.parentElement.removeChild(currentForm);\n\n // Insert a clone\n const placeholder = document.createElement(\"div\");\n placeholder.innerHTML = form_html;\n prev.after(placeholder.firstElementChild);\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 let reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n let mailerlite_detected_class = false\n if (reUseCurrentForm.classList !== undefined) {\n //list there all the mailerlite classes\n let mailerlite_classes = ['newsletterform', 'ml-block-form']\n mailerlite_classes.forEach(function(mailerlite_class) {\n if (reUseCurrentForm.classList.contains(mailerlite_class)){\n mailerlite_detected_class = mailerlite_class\n }\n });\n }\n if ( mailerlite_detected_class ) {\n let mailerliteSubmitButton = jQuery('form.' + mailerlite_detected_class).find('button[type=\"submit\"]');\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 event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget, 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\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\n if( ! +ctPublic.settings__forms__check_external ) {\n return;\n }\n\n if ( typeof jQuery === 'undefined' ) {\n return;\n }\n\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 formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1 ||\n formAction.indexOf('sendfox.com') !== -1 ||\n formAction.indexOf('aweber.com') !== -1 ||\n formAction.indexOf('secure.payu.com') !== -1\n\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( result, data, params, obj, prev, formOriginal ){\n\n if( result.apbct === undefined || ! +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 // Clear visible_fields input\n formOriginal.find('input[name=\"apbct_visible_fields\"]').remove();\n formOriginal.find('input[value=\"cleantalk_force_ajax_check\"]').remove();\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 return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\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 return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"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\nfunction ct_check_internal(currForm){\n \n//Gathering data\n var ct_data = {},\n elems = currForm.elements;\n\n for (var key in elems) {\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\n continue;\n ct_data[elems[key].name] = currForm.elements[key].value;\n }\n ct_data['action'] = 'ct_check_internal';\n\n //AJAX Request\n apbct_public_sendAJAX(\n ct_data,\n {\n url: ctPublicFunctions._ajax_url,\n callback: function (data) {\n if(data.success === true){\n currForm.submit();\n }else{\n alert(data.data);\n return false;\n }\n }\n }\n );\n}\n\ndocument.addEventListener('DOMContentLoaded',function(){\n let ct_currAction = '',\n ct_currForm = '';\n\n if( ! +ctPublic.settings__forms__check_internal ) {\n return;\n }\n\n\tfor( let i=0; i<document.forms.length; i++ ){\n\t\tif ( typeof(document.forms[i].action) == 'string' ){\n ct_currForm = document.forms[i];\n\t\t\tct_currAction = ct_currForm.action;\n if (\n ct_currAction.indexOf('https?://') !== null && // The protocol is obligatory\n ct_currAction.match(ctPublic.blog_home + '.*?\\.php') !== null && // Main check\n ! ct_check_internal__is_exclude_form(ct_currAction) // Exclude WordPress native scripts from processing\n ) {\n ctPrevHandler = ct_currForm.click;\n if ( typeof jQuery !== 'undefined' ) {\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(event){\n ct_check_internal(event.target);\n return false;\n });\n }\n }\n\t\t}\n\t}\n});\n\n/**\n * Check by action to exclude the form checking\n * @param action string\n * @return boolean\n */\nfunction ct_check_internal__is_exclude_form(action) {\n // An array contains forms action need to be excluded.\n let ct_internal_script_exclusions = [\n ctPublic.blog_home + 'wp-login.php', // WordPress login page\n ctPublic.blog_home + 'wp-comments-post.php', // WordPress Comments Form\n ];\n\n return ct_internal_script_exclusions.some((item) => {\n return action.match(new RegExp('^' + item)) !== null;\n });\n}"],"names":["ApbctCore","ajax_parameters","rest_parameters","#selector","elements","#eventCallback","#eventSelector","#event","constructor","selector","this","select","HTMLCollection","Array","prototype","slice","call","document","querySelectorAll","#deselect","#addElement","elemToAdd","push","#push","elem","#reduce","css","style","getRaw","let","style_name","DOM_style_name","replace","group","toUpperCase","i","length","computedStyle","getComputedStyle","console","log","Number","hide","prop","display","show","addClass","classList","add","className","removeClass","remove","toggleClass","toggle","ajax","ApbctAjax","rest","ApbctRest","on","args","addEventListener","#onChecker","bind","event","target","querySelector","stopPropagation","ready","callback","change","attr","attrName","outputValue","propName","value","html","val","data","name","is","filter","#isElem","elemToCheck","match","newlyCreatedElement","createElement","Boolean","HTMLElement","HTMLUnknownElement","indexOf","isRegisteredTagName","tagName","toLowerCase","#isWithoutSelector","splice","parent","parentElement","parents","children","siblings","current","after","content","append","fadeIn","time","opacity","last","Date","tick","window","requestAnimationFrame","setTimeout","fadeOut","apbct","params","ApbctXhr","#xhr","XMLHttpRequest","method","url","async","user","password","button","spinner","progressbar","context","responseType","headers","timeout","#methods_to_convert_data_to_URL","#body","#http_code","#status_text","parameters","key","#prepare","Object","keys","deleteDoubleJSONEncoding","convertData","open","setHeaders","onreadystatechange","onReadyStateChange","onload","onLoad","onprogress","onProgress","onerror","onError","ontimeout","onTimeout","send","setAttribute","cursor","#complete","status","statusText","removeAttribute","on_ready_state_change","on_progress","#error","on_error","response","error","http_code","status_text","additional_msg","error_string","errorOutput","error_msg","header_name","setRequestHeader","convertDataToURL","convertDataToBody","params_appendix","URLSearchParams","toString","params_prefix","dataKey","FormData","JSON","stringify","object","objectKey","parsedValue","parse","super","default_route","ctPublicFunctions","_rest_url","route","X-WP-Nonce","_rest_nonce","ctSetCookie","cookies","expires","skip_alt","data__cookies_type","forEach","item","arr","ctSecure","location","protocol","cookie","cookiePrefix","encodeURIComponent","data__ajax_type","apbct_public_sendREST","apbct_public_sendAJAX","action","notJson","ctGetCookie","matches","RegExp","decodeURIComponent","undefined","ctDeleteCookie","cookieName","obj","_params","callback_context","callback_params","silent","no_nonce","_ajax_url","_ajax_nonce","Math","random","no_cache","apbctLocalStorage","get","property","storageValue","localStorage","getItem","json","hasOwnProperty","e","Error","set","is_json","objToSave","timestamp","floor","getTime","setItem","isAlive","maxLifetime","isSet","delete","removeItem","ct_date","ctTimeMs","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","apbct_attach_event_handler","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","ctKeyStopStopListening","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","ctSetMouseMoved","round","clientY","clientX","ctMouseStopData","clearInterval","checkEmail","current_email","email","result","now","ctSetPixelImg","pixelUrl","ctPublic","pixel__enabled","getElementById","insertedImg","ctGetPixelUrl","local_storage_pixel_url","ctGetPixelUrlLocalstorage","ctIsOutdatedPixelUrlLocalstorage","ctCleaPixelUrlLocalstorage","ctSetPixelUrlLocalstorage","ctSetHasScrolled","apbct_ready","cookiesType","initCookies","getTimezoneOffset","apbctGetScreenInfo","navigator","webdriver","cookiesArray","split","trim","pixel__setting","pixel__url","data__email_check_before_post","forms","hiddenInput","visibleFieldsToInput","form","data__visible_fields_required","contains","id","apbct_collect_visible_fields","onsubmit_prev","onsubmit","ctFormIndex","visible_fields","apbct_visible_fields_set_cookie","Function","decodedEmailNodes","href","ctFillDecodedEmailHandler","apbctAjaxEmailDecode","baseElement","element","event_javascript_data","getJavascriptClientData","post_url","referrer","preventDefault","text__wait_for_decoding","apbctTooltip","apbctTooltipText","apbctTooltipArrow","ctShowDecodeComment","encodedEmail","dataset","originalString","success","baseElementContent","innerHTML","decoded_email","click","ctProcessDecodedDataResult","getElementsByClassName","resultDataJson","apbct_headless","apbct_pixel_url","ct_checked_emails","ct_checkjs","ct_fkp_timestamp","ct_pointer_data","ct_ps_timestamp","ct_screen_info","ct_timezone","ctMouseMovedLocalStorage","ctHasScrolledLocalStorage","ctCookiesTypeLocalStorage","ctMouseMovedCookie","ctHasScrolledCookie","ctCookiesTypeCookie","ct_mouse_moved","ct_has_scrolled","ct_cookies_type","removeDoubleJsonEncoding","targetElement","is_allowed","ctFillDecodedEmail","show_comment","comment","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","isNaN","getAttribute","visibility","visible_fields_count","invisible_fields","invisible_fields_count","visible_fields_collection","form_id","collection","apbct_js_keys__set_input_value","js_key","fullWidth","documentElement","scrollWidth","fullHeight","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ajax_pixel_url","local_storage_pixel","local_storage_pixel_timestamp","ct_protect_external","cleantalk_hidden_action","cleantalk_hidden_method","ct_method","currentForm","isIntegratedForm","prev","previousSibling","form_html","outerHTML","form_original","removeChild","placeholder","firstElementChild","force_action","type","reUseCurrentForm","mailerlite_detected_class","appendChild","mailerlite_classes","mailerlite_class","mailerliteSubmitButton","jQuery","find","sendAjaxCheckingFormData","currentTarget","clone","hostname","ct_action","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","formObj","formAction","firstChild","formOriginal","elems","y","blocked","detach","subm_button","ct_check_internal","currForm","ct_data","alert","submit","ct_check_internal__is_exclude_form","ct_internal_script_exclusions","blog_home","some","ajaxComplete","xhr","settings","responseText","dispatchEvent","CustomEvent","bubbles","detail","message","cleantalkModal","loaded","stop_script","stop","loading","opened","opening","load","apbct_admin_sendAJAX","renderCss","cssStr","styles","overlayCss","z-index","position","top","left","width","height","background","justify-content","align-items","innerCss","padding","border","border-radius","box-shadow","closeCss","right","box-sizing","closeCssBefore","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","overlay","inner","close","ctPublicGDPR","gdpr_forms","first","gdpr_text","settings__forms__check_external","ct_currAction","ct_currForm","settings__forms__check_internal","ctPrevHandler","off"],"mappings":"MAAMA,UAEFC,gBAAkB,GAClBC,gBAAkB,GAElBC,UAAY,KACZC,SAAW,GAGXC,eACAC,eACAC,OAKAC,YAAYC,GACRC,KAAKC,OAAOF,GAShBE,OAAOF,GAkBH,OAhBGA,aAAoBG,gBACnB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"version":3,"file":"apbct-public-bundle.min.js","sources":["apbct-public-bundle.js"],"sourcesContent":["class ApbctCore{\n\n ajax_parameters = {};\n rest_parameters = {};\n\n #selector = null;\n elements = [];\n\n // Event properties\n #eventCallback;\n #eventSelector;\n #event;\n\n /**\n * Default constructor\n */\n constructor(selector){\n this.select(selector);\n }\n\n /**\n * Get elements by CSS selector\n *\n * @param selector\n * @returns {*}\n */\n select(selector) {\n\n if(selector instanceof HTMLCollection){\n this.#selector = null;\n this.elements = [];\n this.elements = Array.prototype.slice.call(selector);\n }else if( typeof selector === 'object' ){\n this.#selector = null;\n this.elements = [];\n this.elements[0] = selector;\n }else if( typeof selector === 'string' ){\n this.#selector = selector;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(selector));\n // this.elements = document.querySelectorAll(selector)[0];\n }else{\n this.#deselect();\n }\n\n return this;\n }\n\n #addElement(elemToAdd){\n if( typeof elemToAdd === 'object' ){\n this.elements.push(elemToAdd);\n }else if( typeof elemToAdd === 'string' ){\n this.#selector = elemToAdd;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(elemToAdd));\n }else{\n this.#deselect();\n }\n }\n\n #push(elem){\n this.elements.push(elem);\n }\n\n #reduce(){\n this.elements = this.elements.slice(0,-1);\n }\n\n #deselect(){\n this.elements = [];\n }\n\n /**\n * Set or get CSS for/of currently selected element\n *\n * @param style\n * @param getRaw\n *\n * @returns {boolean|*}\n */\n css(style, getRaw){\n\n getRaw = getRaw | false;\n\n // Set style\n if(typeof style === \"object\"){\n\n const stringToCamelCase = str =>\n str.replace(/([-_][a-z])/g, group =>\n group\n .toUpperCase()\n .replace('-', '')\n .replace('_', '')\n );\n\n // Apply multiple styles\n for(let style_name in style){\n let DOM_style_name = stringToCamelCase(style_name);\n\n // Apply to multiple elements (currently selected)\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].style[DOM_style_name] = style[style_name];\n }\n }\n\n return this;\n }\n\n // Get style of first currently selected element\n if(typeof style === 'string'){\n\n let computedStyle = getComputedStyle(this.elements[0])[style];\n\n console.log(computedStyle);\n\n // Process\n if( typeof computedStyle !== 'undefined' && ! getRaw){\n computedStyle = computedStyle.replace(/(\\d)(em|pt|%|px){1,2}$/, '$1'); // Cut of units\n computedStyle = Number(computedStyle) == computedStyle ? Number(computedStyle) : computedStyle; // Cast to INT\n return computedStyle;\n }\n\n // Return unprocessed\n return computedStyle;\n }\n }\n\n hide(){\n this.prop('prev-display', this.css('display'));\n this.css({'display': 'none'});\n }\n\n show(){\n this.css({'display': this.prop('prev-display')});\n }\n\n addClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.add(className);\n }\n }\n\n removeClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.remove(className);\n }\n }\n\n toggleClass(className){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.toggle(className);\n }\n }\n\n /**\n * Wrapper for apbctAJAX class\n *\n * @param ajax_parameters\n * @returns {ApbctAjax}\n */\n ajax(ajax_parameters){\n this.ajax_parameters = ajax_parameters;\n return new ApbctAjax(ajax_parameters);\n }\n\n /**\n * Wrapper for apbctREST class\n *\n * @param rest_parameters\n * @returns {ApbctRest}\n */\n rest(rest_parameters){\n this.rest_parameters = rest_parameters;\n return new ApbctRest(rest_parameters);\n }\n\n /************** EVENTS **************/\n\n /**\n *\n * Why the mess with arguments?\n *\n * Because we need to support the following function signatures:\n * on('click', function(){ alert('some'); });\n * on('click', 'inner_selector', function(){ alert('some'); });\n *\n * @param args\n */\n on(...args){\n\n this.#event = args[0];\n this.#eventCallback = args[2] || args[1];\n this.#eventSelector = typeof args[1] === \"string\" ? args[1] : null;\n\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].addEventListener(\n this.#event,\n this.#eventSelector !== null\n ? this.#onChecker.bind(this)\n : this.#eventCallback\n );\n }\n }\n\n /**\n * Check if a selector of an event matches current target\n *\n * @param event\n * @returns {*}\n */\n #onChecker(event){\n if(event.target === document.querySelector(this.#eventSelector)){\n event.stopPropagation();\n return this.#eventCallback(event);\n }\n }\n\n ready(callback){\n document.addEventListener('DOMContentLoaded', callback);\n }\n\n change(callback){\n this.on('change', callback);\n }\n\n /************** ATTRIBUTES **************/\n\n /**\n * Get an attribute or property of an element\n *\n * @param attrName\n * @returns {*|*[]}\n */\n attr(attrName){\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n\n // Use property instead of attribute if possible\n if(typeof this.elements[i][attrName] !== undefined){\n outputValue.push(this.elements[i][attrName]);\n }else{\n outputValue.push(this.elements[i].getAttribute(attrName));\n }\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n\n prop(propName, value){\n\n // Setting values\n if(typeof value !== \"undefined\"){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i][propName] = value;\n }\n\n return this;\n\n // Getting values\n }else{\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n outputValue.push(this.elements[i][propName]);\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n }\n\n /**\n * Set or get inner HTML\n *\n * @param value\n * @returns {*|*[]}\n */\n html(value){\n return typeof value !== 'undefined'\n ? this.prop('innerHTML', value)\n : this.prop('innerHTML');\n }\n\n /**\n * Set or get value of input tags\n *\n * @param value\n * @returns {*|*[]|undefined}\n */\n val(value){\n return typeof value !== 'undefined'\n ? this.prop('value', value)\n : this.prop('value');\n }\n\n data(name, value){\n return typeof value !== 'undefined'\n ? this.prop('apbct-data', name, value)\n : this.prop('apbct-data');\n }\n\n /************** END OF ATTRIBUTES **************/\n\n /************** FILTERS **************/\n\n /**\n * Check if the current elements are corresponding to filter\n *\n * @param filter\n * @returns {boolean}\n */\n is(filter){\n\n let outputValue = false;\n\n for(let elem of this.elements){\n outputValue ||= this.#isElem(elem, filter);\n }\n\n return outputValue;\n }\n\n #isElem(elemToCheck, filter){\n\n let is = false;\n let isRegisteredTagName = function(name){\n let newlyCreatedElement = document.createElement(name).constructor;\n return ! Boolean( ~[HTMLElement, HTMLUnknownElement].indexOf(newlyCreatedElement) );\n };\n\n // Check for filter function\n if(typeof filter === 'function') {\n is ||= filter.call(this, elemToCheck);\n }\n\n // Check for filter function\n if(typeof filter === 'string') {\n\n // Filter is tag name\n if( filter.match(/^[a-z]/) && isRegisteredTagName(filter) ){\n is ||= elemToCheck.tagName.toLowerCase() === filter.toLowerCase();\n\n // Filter is property\n }else if( filter.match(/^[a-z]/) ){\n is ||= Boolean(elemToCheck[filter]);\n\n // Filter is CSS selector\n }else {\n is ||= this.#selector !== null\n ? document.querySelector(this.#selector + filter) !== null // If possible\n : this.#isWithoutSelector(elemToCheck, filter); // Search through all elems with such selector\n }\n }\n\n return is;\n }\n\n #isWithoutSelector(elemToCheck, filter){\n\n let elems = document.querySelectorAll(filter);\n let outputValue = false;\n\n for(let elem of elems){\n outputValue ||= elemToCheck === elem;\n }\n\n return outputValue;\n }\n\n filter(filter){\n\n this.#selector = null;\n\n for( let i = this.elements.length - 1; i >= 0; i-- ){\n if( ! this.#isElem(this.elements[i], filter) ){\n this.elements.splice(Number(i), 1);\n }\n }\n\n return this;\n }\n\n /************** NODES **************/\n\n parent(filter){\n\n this.select(this.elements[0].parentElement);\n\n if( typeof filter !== 'undefined' && ! this.is(filter) ){\n this.#deselect();\n }\n\n return this;\n }\n\n parents(filter){\n\n this.select(this.elements[0]);\n\n for ( ; this.elements[ this.elements.length - 1].parentElement !== null ; ) {\n this.#push(this.elements[ this.elements.length - 1].parentElement);\n }\n\n this.elements.splice(0,1); // Deleting initial element from the set\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n children(filter){\n\n this.select(this.elements[0].children);\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n siblings(filter){\n\n let current = this.elements[0]; // Remember current to delete it later\n\n this.parent();\n this.children(filter);\n this.elements.splice(this.elements.indexOf(current), 1); // Remove current element\n\n return this;\n }\n\n /************** DOM MANIPULATIONS **************/\n remove(){\n for(let elem of this.elements){\n elem.remove();\n }\n }\n\n after(content){\n for(let elem of this.elements){\n elem.after(content);\n }\n }\n\n append(content){\n for(let elem of this.elements){\n elem.append(content);\n }\n }\n\n /** ANIMATION **/\n fadeIn(time) {\n for(let elem of this.elements){\n elem.style.opacity = 0;\n elem.style.display = 'block';\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity + (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity < 1) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n }\n };\n\n tick();\n }\n }\n\n fadeOut(time) {\n for(let elem of this.elements){\n elem.style.opacity = 1;\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity - (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity > 0) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n } else {\n elem.style.display = 'none';\n }\n };\n\n tick();\n }\n }\n\n}\n\n/**\n * Hack\n *\n * Make a proxy to keep both properties and methods from:\n * - the native object and\n * - the new one from ApbctCore for selected element.\n *\n * For example:\n * apbct('#id).innerHTML = 'some';\n * apbct('#id).css({'backgorund-color': 'black'});\n */\n// apbct = new Proxy(\n// apbct,\n// {\n// get(target, prop) {\n// if (target.elements.length) {\n// return target.elements[0][prop];\n// } else {\n// return null;\n// }\n// },\n// set(target, prop, value){\n// if (target.elements.length) {\n// target.elements[0][prop] = value;\n// return true;\n// } else {\n// return false;\n// }\n// },\n// apply(target, thisArg, argArray) {\n//\n// }\n// }\n// );\n\n/**\n * Enter point to ApbctCore class\n *\n * @param params\n * @returns {*}\n */\nfunction apbct(params){\n return new ApbctCore()\n .select(params);\n}\nclass ApbctXhr{\n\n #xhr = new XMLHttpRequest();\n\n // Base parameters\n method = 'POST'; // HTTP-request type\n url = ''; // URL to send the request\n async = true;\n user = null; // HTTP-authorization username\n password = null; // HTTP-authorization password\n data = {}; // Data to send\n\n\n // Optional params\n button = null; // Button that should be disabled when request is performing\n spinner = null; // Spinner that should appear when request is in process\n progressbar = null; // Progress bar for the current request\n context = this; // Context\n callback = null;\n onErrorCallback = null;\n\n responseType = 'json'; // Expected data type from server\n headers = {};\n timeout = 15000; // Request timeout in milliseconds\n\n #methods_to_convert_data_to_URL = [\n 'GET',\n 'HEAD',\n ];\n\n #body = null;\n #http_code = 0;\n #status_text = '';\n\n constructor(parameters){\n\n console.log('%cXHR%c started', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;');\n\n // Set class properties\n for( let key in parameters ){\n if( typeof this[key] !== 'undefined' ){\n this[key] = parameters[key];\n }\n }\n\n // Modifying DOM-elements\n this.#prepare();\n\n // Modify URL with data for GET and HEAD requests\n if ( Object.keys(this.data).length ) {\n this.deleteDoubleJSONEncoding(this.data);\n this.convertData();\n }\n\n if( ! this.url ){\n console.log('%cXHR%c not URL provided', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;')\n return false;\n }\n\n // Configure the request\n this.#xhr.open(this.method, this.url, this.async, this.user, this.password);\n this.setHeaders();\n\n this.#xhr.responseType = this.responseType;\n this.#xhr.timeout = this.timeout;\n\n /* EVENTS */\n // Monitoring status\n this.#xhr.onreadystatechange = function(){\n this.onReadyStateChange();\n }.bind(this);\n\n // Run callback\n this.#xhr.onload = function(){\n this.onLoad();\n }.bind(this);\n\n // On progress\n this.#xhr.onprogress = function(event){\n this.onProgress(event);\n }.bind(this);\n\n // On error\n this.#xhr.onerror = function(){\n this.onError();\n }.bind(this);\n\n this.#xhr.ontimeout = function(){\n this.onTimeout();\n }.bind(this);\n\n // Send the request\n this.#xhr.send(this.#body);\n }\n\n #prepare(){\n\n // Disable button\n if(this.button){\n this.button.setAttribute('disabled', 'disabled');\n this.button.style.cursor = 'not-allowed';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'inline';\n }\n }\n\n #complete(){\n\n this.#http_code = this.#xhr.status;\n this.#status_text = this.#xhr.statusText;\n\n // Disable button\n if(this.button){\n this.button.removeAttribute('disabled');\n this.button.style.cursor = 'auto';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'none';\n }\n\n if( this.progressbar ) {\n this.progressbar.fadeOut('slow');\n }\n }\n\n onReadyStateChange(){\n if (this.on_ready_state_change !== null && typeof this.on_ready_state_change === 'function'){\n this.on_ready_state_change();\n }\n }\n\n onProgress(event) {\n if (this.on_progress !== null && typeof this.on_progress === 'function'){\n this.on_progress();\n }\n }\n\n onError(){\n\n console.log('error');\n\n this.#complete();\n this.#error(\n this.#http_code,\n this.#status_text\n );\n\n if (this.onErrorCallback !== null && typeof this.onErrorCallback === 'function'){\n this.onErrorCallback(this.#status_text);\n }\n }\n\n onTimeout(){\n this.#complete();\n this.#error(\n 0,\n 'timeout'\n );\n\n if (this.onErrorCallback !== null && typeof this.onErrorCallback === 'function'){\n this.onErrorCallback('Timeout');\n }\n }\n\n onLoad(){\n\n this.#complete();\n\n if (this.responseType === 'json' ){\n if(this.#xhr.response === null){\n this.#error(this.#http_code, this.#status_text, 'No response');\n return false;\n }else if( typeof this.#xhr.response.error !== 'undefined') {\n this.#error(this.#http_code, this.#status_text, this.#xhr.response.error);\n return false;\n }\n }\n\n if (this.callback !== null && typeof this.callback === 'function') {\n this.callback.call(this.context, this.#xhr.response, this.data);\n }\n }\n\n #error(http_code, status_text, additional_msg){\n\n let error_string = '';\n\n if( status_text === 'timeout' ){\n error_string += 'Server response timeout'\n\n }else if( http_code === 200 ){\n\n if( status_text === 'parsererror' ){\n error_string += 'Unexpected response from server. See console for details.';\n }else {\n error_string += 'Unexpected error. Status: ' + status_text + '.';\n if( typeof additional_msg !== 'undefined' )\n error_string += ' Additional error info: ' + additional_msg;\n }\n\n }else if(http_code === 500){\n error_string += 'Internal server error.';\n\n }else {\n error_string += 'Unexpected response code:' + http_code;\n }\n\n this.errorOutput( error_string );\n }\n\n errorOutput(error_msg){\n console.log( '%c ctXHR error: %c' + error_msg, 'color: red;', 'color: grey;' );\n }\n\n setHeaders(){\n // Set headers if passed\n for( let header_name in this.headers ){\n if( typeof this.headers[header_name] !== 'undefined' ){\n this.#xhr.setRequestHeader(header_name, this.headers[header_name]);\n }\n }\n }\n\n convertData()\n {\n // GET, HEAD request-type\n if( ~this.#methods_to_convert_data_to_URL.indexOf( this.method ) ){\n return this.convertDataToURL();\n\n // POST request-type\n }else{\n return this.convertDataToBody()\n }\n }\n\n convertDataToURL(){\n let params_appendix = new URLSearchParams(this.data).toString();\n let params_prefix = this.url.match(/^(https?:\\/{2})?[a-z0-9.]+\\?/) ? '&' : '?';\n this.url += params_prefix + params_appendix;\n\n return this.url;\n }\n\n /**\n *\n * @returns {null}\n */\n convertDataToBody()\n {\n this.#body = new FormData();\n\n for (let dataKey in this.data) {\n this.#body.append(\n dataKey,\n typeof this.data[dataKey] === 'object'\n ? JSON.stringify(this.data[dataKey])\n : this.data[dataKey]\n );\n }\n\n return this.#body;\n }\n\n /**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\n deleteDoubleJSONEncoding(object){\n\n if( typeof object === 'object'){\n\n for (let objectKey in object) {\n\n // Recursion\n if( typeof object[objectKey] === 'object'){\n object[objectKey] = this.deleteDoubleJSONEncoding(object[objectKey]);\n }\n\n // Common case (out)\n if(\n typeof object[objectKey] === 'string' &&\n object[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n ){\n let parsedValue = JSON.parse(object[objectKey]);\n if( typeof parsedValue === 'object' ){\n object[objectKey] = parsedValue;\n }\n }\n }\n }\n\n return object;\n }\n}\nclass ApbctAjax extends ApbctXhr{\n\n constructor(...args) {\n super(args[0]);\n }\n}\nclass ApbctRest extends ApbctXhr{\n\n static default_route = ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/';\n route = '';\n\n constructor(...args) {\n args = args[0];\n args.url = ApbctRest.default_route + args.route;\n args.headers = {\n \"X-WP-Nonce\": ctPublicFunctions._rest_nonce\n };\n super(args);\n }\n}\n\nfunction 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__cookies_type === 'none' ){\n cookies.forEach( function (item, i, arr\t) {\n apbctLocalStorage.set(item[0], encodeURIComponent(item[1]))\n });\n ctNoCookieAttachHiddenFieldsToForms()\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\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 = ctPublicFunctions.cookiePrefix + item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! skip_alt ){\n\n if (typeof (getJavascriptClientData) === \"function\"){\n //reprocess already gained cookies data\n cookies = getJavascriptClientData(cookies);\n } else {\n console.log('APBCT ERROR: getJavascriptClientData() is not loaded')\n }\n\n try {\n JSON.parse(cookies)\n } catch (e){\n console.log('APBCT ERROR: JSON parse error:' + e)\n return\n }\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 === '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\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\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__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n let _params = [];\n _params[\"callback\"] = params.callback || null;\n _params[\"onErrorCallback\"] = params.onErrorCallback || null;\n _params[\"callback_context\"] = params.callback_context || null;\n _params[\"callback_params\"] = params.callback_params || null;\n _params[\"async\"] = params.async || true;\n _params[\"notJson\"] = params.notJson || null;\n _params[\"timeout\"] = params.timeout || 15000;\n _params[\"obj\"] = obj || null;\n _params[\"button\"] = params.button || null;\n _params[\"progressbar\"] = params.progressbar || null;\n _params[\"silent\"] = params.silent || null;\n _params[\"no_nonce\"] = params.no_nonce || null;\n _params[\"data\"] = data;\n _params[\"url\"] = ctPublicFunctions._ajax_url;\n\n if(typeof (data) === 'string') {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"] = _params[\"data\"] + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"] = _params[\"data\"] + '&no_cache=' + Math.random()\n } else {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"]._ajax_nonce = ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"].no_cache = Math.random();\n }\n\n new ApbctCore().ajax(_params);\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n let _params = [];\n _params[\"route\"] = route;\n _params[\"callback\"] = params.callback || null;\n _params[\"onErrorCallback\"] = params.onErrorCallback || null;\n _params[\"data\"] = params.data || [];\n _params[\"method\"] = params.method || 'POST';\n\n new ApbctCore().rest(_params);\n}\n\napbctLocalStorage = {\n get : function(key, property) {\n if ( typeof property === 'undefined' ) {\n property = 'value';\n }\n const storageValue = localStorage.getItem(key);\n if ( storageValue !== null ) {\n try {\n const json = JSON.parse(storageValue);\n return json.hasOwnProperty(property) ? JSON.parse(json[property]) : json;\n } catch (e) {\n return storageValue;\n }\n }\n return false;\n },\n set : function(key, value, is_json = true) {\n if (is_json){\n let objToSave = {'value': JSON.stringify(value), 'timestamp': Math.floor(new Date().getTime() / 1000)};\n localStorage.setItem(key, JSON.stringify(objToSave));\n } else {\n localStorage.setItem(key, value);\n }\n },\n isAlive : function(key, maxLifetime) {\n if ( typeof maxLifetime === 'undefined' ) {\n maxLifetime = 86400;\n }\n const keyTimestamp = this.get(key, 'timestamp');\n return keyTimestamp + maxLifetime > Math.floor(new Date().getTime() / 1000);\n },\n isSet : function(key) {\n return localStorage.getItem(key) !== null;\n },\n delete : function (key) {\n localStorage.removeItem(key);\n },\n getCleanTalkData : function () {\n let data = {}\n for(let i=0; i<localStorage.length; i++) {\n let key = localStorage.key(i);\n if (key.indexOf('ct_') !==-1 || key.indexOf('apbct_') !==-1){\n data[key.toString()] = apbctLocalStorage.get(key)\n }\n }\n return data\n },\n\n}\nvar ct_date = new Date(),\n\tctTimeMs = new Date().getTime(),\n\tctMouseEventTimerFlag = true, //Reading interval flag\n\tctMouseData = [],\n\tctMouseDataCounter = 0,\n\tctCheckedEmails = {};\n\nfunction apbct_attach_event_handler(elem, event, callback){\n\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\telse elem.attachEvent(event, callback);\n}\n\nfunction apbct_remove_event_handler(elem, event, callback){\n\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\telse elem.detachEvent(event, callback);\n}\n\n//Writing first key press timestamp\nvar ctFunctionFirstKey = function output(event){\n\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\tctKeyStopStopListening();\n};\n\n//Reading interval\nvar ctMouseReadInterval = setInterval(function(){\n\tctMouseEventTimerFlag = true;\n}, 150);\n\n//Writting interval\nvar ctMouseWriteDataInterval = setInterval(function(){\n\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n}, 1200);\n\n//Logging mouse position each 150 ms\nvar ctFunctionMouseMove = function output(event){\n\tctSetMouseMoved();\n\tif(ctMouseEventTimerFlag === true){\n\n\t\tctMouseData.push([\n\t\t\tMath.round(event.clientY),\n\t\t\tMath.round(event.clientX),\n\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t]);\n\n\t\tctMouseDataCounter++;\n\t\tctMouseEventTimerFlag = false;\n\t\tif(ctMouseDataCounter >= 50){\n\t\t\tctMouseStopData();\n\t\t}\n\t}\n};\n\n//Stop mouse observing function\nfunction ctMouseStopData(){\n\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tclearInterval(ctMouseReadInterval);\n\tclearInterval(ctMouseWriteDataInterval);\n}\n\n//Stop key listening function\nfunction ctKeyStopStopListening(){\n\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n}\n\nfunction checkEmail(e) {\n\tvar current_email = e.target.value;\n\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'check_email_before_post',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {'email' : current_email},\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);\n\t\t\t// Using AJAX request and handler\n\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\temail : current_email,\n\t\t\t\t},\n\t\t\t\t{\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);\n\t\t}\n\t}\n}\n\nfunction ctSetPixelImg(pixelUrl) {\n\tctSetCookie('apbct_pixel_url', pixelUrl);\n\tif( +ctPublic.pixel__enabled ){\n\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\tlet insertedImg = document.createElement('img');\n\t\t\tinsertedImg.setAttribute('alt', 'CleanTalk Pixel');\n\t\t\tinsertedImg.setAttribute('id', 'apbct_pixel');\n\t\t\tinsertedImg.setAttribute('style', 'display: none; left: 99999px;');\n\t\t\tinsertedImg.setAttribute('src', pixelUrl);\n\t\t\tapbct('body').append(insertedImg);\n\t\t}\n\t}\n}\n\nfunction ctGetPixelUrl() {\n\t// Check if pixel is already in localstorage and is not outdated\n\tlet local_storage_pixel_url = apbctLocalStorage.get('apbct_pixel_url');\n\tif ( local_storage_pixel_url !== false ) {\n\t\tif ( apbctLocalStorage.isAlive('apbct_pixel_url', 3600 * 3) ) {\n\t\t\tapbctLocalStorage.delete('apbct_pixel_url')\n\t\t} else {\n\t\t\t//if so - load pixel from localstorage and draw it skipping AJAX\n\t\t\tctSetPixelImg(local_storage_pixel_url);\n\t\t\treturn;\n\t\t}\n\t}\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_get_pixel_url',\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! apbctLocalStorage.get('apbct_pixel_url') ){\n\t\t\t\t\t\t\t//set pixel to the storage\n\t\t\t\t\t\t\tapbctLocalStorage.set('apbct_pixel_url', result)\n\t\t\t\t\t\t\t//update pixel data in the hidden fields\n\t\t\t\t\t\t\tctNoCookieAttachHiddenFieldsToForms()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tapbct_public_sendAJAX(\n\t\t\t{\n\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! apbctLocalStorage.get('apbct_pixel_url') ){\n\t\t\t\t\t\t\t//set pixel to the storage\n\t\t\t\t\t\t\tapbctLocalStorage.set('apbct_pixel_url', result)\n\t\t\t\t\t\t\t//update pixel data in the hidden fields\n\t\t\t\t\t\t\tctNoCookieAttachHiddenFieldsToForms()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction ctSetHasScrolled() {\n\tif( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\tapbctLocalStorage.set('ct_has_scrolled', true);\n\t}\n}\n\nfunction ctSetMouseMoved() {\n\tif( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\tapbctLocalStorage.set('ct_mouse_moved', true);\n\t}\n}\n\nfunction ctPreloadLocalStorage(){\n\tif (ctPublic.data__to_local_storage){\n\t\tlet data = Object.entries(ctPublic.data__to_local_storage)\n\t\tdata.forEach(([key, value]) => {\n\t\t\tapbctLocalStorage.set(key,value)\n\t\t});\n\t}\n}\n\napbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\napbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\napbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\napbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n// Ready function\nfunction apbct_ready(){\n\n\tctPreloadLocalStorage()\n\n\tlet cookiesType = apbctLocalStorage.get('ct_cookies_type');\n\tif ( ! cookiesType || cookiesType !== ctPublic.data__cookies_type ) {\n\t\tapbctLocalStorage.set('ct_cookies_type', ctPublic.data__cookies_type);\n\t\tapbctLocalStorage.delete('ct_mouse_moved');\n\t\tapbctLocalStorage.delete('ct_has_scrolled');\n\t}\n\n\t// Collect scrolling info\n\tvar initCookies = [\n\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t[\"ct_pointer_data\", \"0\"],\n\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t[\"apbct_headless\", navigator.webdriver],\n\t];\n\n\tapbctLocalStorage.set('ct_ps_timestamp', Math.floor(new Date().getTime() / 1000));\n\tapbctLocalStorage.set('ct_fkp_timestamp', \"0\");\n\tapbctLocalStorage.set('ct_pointer_data', \"0\");\n\tapbctLocalStorage.set('ct_timezone', ct_date.getTimezoneOffset()/60*(-1) );\n\tapbctLocalStorage.set('ct_screen_info', apbctGetScreenInfo());\n\tapbctLocalStorage.set('apbct_headless', navigator.webdriver);\n\n\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t} else {\n\t\t// Delete all visible fields cookies on load the page\n\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\tif( cookiesArray.length !== 0 ) {\n\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif( +ctPublic.pixel__setting ){\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tctGetPixelUrl()\n\t\t} else {\n\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t}\n\t}\n\n\tif ( +ctPublic.data__email_check_before_post) {\n\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\tapbct(\"input[type = 'email'], #email\").on('blur', checkEmail);\n\t}\n\n\tif (apbctLocalStorage.isSet('ct_checkjs')) {\n\t\tinitCookies.push(['ct_checkjs', apbctLocalStorage.get('ct_checkjs')]);\n\t} else {\n\t\tinitCookies.push(['ct_checkjs', 0]);\n\t}\n\n\tctSetCookie(initCookies);\n\n\tsetTimeout(function(){\n\n\t\tctNoCookieAttachHiddenFieldsToForms()\n\n\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\tvar form = document.forms[i];\n\n\t\t\t//Exclusion for forms\n\t\t\tif (\n\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' || // Custom form\n\t\t\t\t(form.name && form.name.toString().indexOf('tribe-bar-form') !== -1) // The Events Calendar\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\tvar visibleFieldsToInput = {};\n\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\tform.append( hiddenInput );\n\n\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\tform.ctFormIndex = i;\n\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\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\tconsole.log(\"visible_fields[0]\" + visible_fields[0])\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t}\n\n\t\t\t\t// Call previous submit action\n\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t}, 500);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t}, 1000);\n\n\t// Listen clicks on encoded emails\n\tlet decodedEmailNodes = document.querySelectorAll(\"[data-original-string]\");\n\tif (decodedEmailNodes.length) {\n\t\tfor (let i = 0; i < decodedEmailNodes.length; ++i) {\n\t\t\tif (\n\t\t\t\tdecodedEmailNodes[i].parentElement.href ||\n\t\t\t\tdecodedEmailNodes[i].parentElement.parentElement.href\n\t\t\t) {\n\t\t\t\t// Skip listening click on hyperlinks\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdecodedEmailNodes[i].addEventListener('click', ctFillDecodedEmailHandler);\n\t\t}\n\t}\n}\napbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\nfunction ctFillDecodedEmailHandler(event) {\n\tthis.removeEventListener('click', ctFillDecodedEmailHandler);\n\tapbctAjaxEmailDecode(event, this);\n}\n\nfunction apbctAjaxEmailDecode(event, baseElement){\n\tconst element = event.target;\n\tconst javascriptClientData = getJavascriptClientData();\n\tlet data = {\n\t\tevent_javascript_data: javascriptClientData,\n\t\tpost_url: document.location.href,\n\t\treferrer: document.referrer,\n\t};\n\n\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\tevent.preventDefault();\n\t} else {\n\t\telement.setAttribute('title', ctPublicFunctions.text__wait_for_decoding);\n\t\telement.style.cursor = 'progress';\n\n\t\t// Adding a tooltip\n\t\tlet apbctTooltip = document.createElement('div');\n\t\tapbctTooltip.setAttribute('class', 'apbct-tooltip');\n\t\tlet apbctTooltipText = document.createElement('div');\n\t\tapbctTooltipText.setAttribute('class', 'apbct-tooltip--text');\n\t\tlet apbctTooltipArrow = document.createElement('div');\n\t\tapbctTooltipArrow.setAttribute('class', 'apbct-tooltip--arrow');\n\t\tapbct(element).append(apbctTooltip);\n\t\tapbct(apbctTooltip).append(apbctTooltipText);\n\t\tapbct(apbctTooltip).append(apbctTooltipArrow);\n\t\tctShowDecodeComment(element, ctPublicFunctions.text__wait_for_decoding);\n\t}\n\n\tlet encodedEmail = event.target.dataset.originalString;\n\n\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\tencodedEmail = baseElement.dataset.originalString;\n\t}\n\n\tdata.encodedEmail = encodedEmail;\n\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_decode_email',\n\t\t\t{\n\t\t\t\tdata: data,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\t\t\t\t\t\tlet encodedEmail = baseElement.href.replace('mailto:', '');\n\t\t\t\t\t\t\tlet baseElementContent = baseElement.innerHTML;\n\t\t\t\t\t\t\tbaseElement.innerHTML = baseElementContent.replace(encodedEmail, result.data.decoded_email);\n\t\t\t\t\t\t\tbaseElement.href = 'mailto:' + result.data.decoded_email;\n\t\t\t\t\t\t\tbaseElement.click();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\tctProcessDecodedDataResult(result.data, event.target);\n\t\t\t\t\t\t\t}, 3000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tapbct(element.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t\t\t\t\t}, 4000);\n\t\t\t\t},\n\t\t\t\tonErrorCallback: function (res) {\n\t\t\t\t\telement.addEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\tctShowDecodeComment(element, 'Error occurred: ' + res);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\n\t// Using AJAX request and handler\n\t}else{\n\t\tdata.action = 'apbct_decode_email';\n\t\tapbct_public_sendAJAX(\n\t\t\tdata,\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\t\t\t\t\t\tlet encodedEmail = baseElement.href.replace('mailto:', '');\n\t\t\t\t\t\t\tlet baseElementContent = baseElement.innerHTML;\n\t\t\t\t\t\t\tbaseElement.innerHTML = baseElementContent.replace(encodedEmail, result.data.decoded_email);\n\t\t\t\t\t\t\tbaseElement.href = 'mailto:' + result.data.decoded_email;\n\t\t\t\t\t\t\tbaseElement.click();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\tctProcessDecodedDataResult(result.data, event.target);\n\t\t\t\t\t\t\t}, 3000);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tapbct(element.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t\t\t\t\t}, 4000);\n\t\t\t\t},\n\t\t\t\tonErrorCallback: function (res) {\n\t\t\t\t\telement.addEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\tctShowDecodeComment(element, 'Error occurred: ' + res);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction getJavascriptClientData(common_cookies = []) {\n\tlet resultDataJson = {};\n\n\tresultDataJson.apbct_headless = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n\tresultDataJson.apbct_pixel_url = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n\tresultDataJson.ct_checked_emails = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails');\n\tresultDataJson.ct_checkjs = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checkjs');\n\tresultDataJson.ct_fkp_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_fkp_timestamp');\n\tresultDataJson.ct_pointer_data = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_pointer_data');\n\tresultDataJson.ct_ps_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_ps_timestamp');\n\tresultDataJson.ct_screen_info = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_screen_info');\n\tresultDataJson.ct_timezone = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_timezone');\n\n\t// collecting data from localstorage\n\tconst ctMouseMovedLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\t// collecting data from cookies\n\tconst ctMouseMovedCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\tresultDataJson.ct_mouse_moved = ctMouseMovedLocalStorage !== undefined ? ctMouseMovedLocalStorage : ctMouseMovedCookie;\n\tresultDataJson.ct_has_scrolled = ctHasScrolledLocalStorage !== undefined ? ctHasScrolledLocalStorage : ctHasScrolledCookie;\n\tresultDataJson.ct_cookies_type = ctCookiesTypeLocalStorage !== undefined ? ctCookiesTypeLocalStorage : ctCookiesTypeCookie;\n\n\tif (\n\t\ttypeof (common_cookies) === \"object\"\n\t\t&& common_cookies !== []\n\t){\n\t\tfor (let i = 0; i < common_cookies.length; ++i){\n\t\t\tif ( typeof (common_cookies[i][1]) === \"object\" ){\n\t\t\t\t//this is for handle SFW cookies\n\t\t\t\tresultDataJson[common_cookies[i][1][0]] = common_cookies[i][1][1]\n\t\t\t} else {\n\t\t\t\tresultDataJson[common_cookies[i][0]] = common_cookies[i][1]\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconsole.log('APBCT JS ERROR: Collecting data type mismatch')\n\t}\n\n\t// Parse JSON properties to prevent double JSON encoding\n\tresultDataJson = removeDoubleJsonEncoding(resultDataJson);\n\n\treturn JSON.stringify(resultDataJson);\n}\n\n/**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\nfunction removeDoubleJsonEncoding(object){\n\n\tif( typeof object === 'object'){\n\n\t\tfor (let objectKey in object) {\n\n\t\t\t// Recursion\n\t\t\tif( typeof object[objectKey] === 'object'){\n\t\t\t\tobject[objectKey] = removeDoubleJsonEncoding(object[objectKey]);\n\t\t\t}\n\n\t\t\t// Common case (out)\n\t\t\tif(\n\t\t\t\ttypeof object[objectKey] === 'string' &&\n\t\t\t\tobject[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n\t\t\t){\n\t\t\t\tlet parsedValue = JSON.parse(object[objectKey]);\n\t\t\t\tif( typeof parsedValue === 'object' ){\n\t\t\t\t\tobject[objectKey] = parsedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn object;\n}\n\nfunction ctProcessDecodedDataResult(response, targetElement) {\n\n\ttargetElement.setAttribute('title', '');\n\ttargetElement.removeAttribute('style');\n\n\tif( !! response.is_allowed) {\n\t\tctFillDecodedEmail(targetElement, response.decoded_email);\n\t}\n\n\tif( !! response.show_comment ){\n\t\tctShowDecodeComment(targetElement, response.comment);\n\t}\n}\n\nfunction ctFillDecodedEmail(target, email){\n\tapbct(target).html(\n\t\tapbct(target)\n\t\t\t.html()\n\t\t\t.replace(/.+?(<div class=[\"']apbct-tooltip[\"'].+?<\\/div>)/, email + \"$1\")\n\t);\n}\n\nfunction ctShowDecodeComment(target, comment){\n\n\tif( ! comment ){\n\t\treturn;\n\t}\n\n\tapbct(target.getElementsByClassName('apbct-tooltip')).fadeIn(300);\n\tapbct(target.getElementsByClassName('apbct-tooltip--text')).html(comment);\n\tsetTimeout(function(){\n\t\tapbct(target.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t}, 5000);\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__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\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\tif (ctPublic.data__cookies_type === 'none'){\n\t\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection[0] ) );\n\t\t} else {\n\t\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t\t}\n\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\ttry {\n\t\t\t\tvar response = JSON.parse(responseText);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e.toString());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tctParseBlockMessage(response);\n\t\t}\n\t});\n}\n\nfunction ctParseBlockMessage(response) {\n\n\tif (typeof response.apbct !== 'undefined') {\n\t\tresponse = response.apbct;\n\t\tif (response.blocked) {\n\t\t\tdocument.dispatchEvent(\n\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\t// Show the result by modal\n\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\tcleantalkModal.open();\n\n\t\t\tif(+response.stop_script == 1)\n\t\t\t\twindow.stop();\n\t\t}\n\t}\n}\n\nfunction ctSetPixelUrlLocalstorage(ajax_pixel_url) {\n\t//set pixel to the storage\n\tctSetCookie('apbct_pixel_url', ajax_pixel_url)\n}\n\nfunction ctNoCookieConstructHiddenField(){\n\tlet field = ''\n\tlet no_cookie_data = apbctLocalStorage.getCleanTalkData()\n\tno_cookie_data = JSON.stringify(no_cookie_data)\n\tno_cookie_data = btoa(no_cookie_data)\n\tfield = document.createElement('input')\n\tfield.setAttribute('id','ct_no_cookie_hidden_field')\n\tfield.setAttribute('name','ct_no_cookie_hidden_field')\n\tfield.setAttribute('value', no_cookie_data)\n\tfield.setAttribute('type', 'hidden')\n\treturn field\n}\n\nfunction ctNoCookieGetForms(){\n\tlet forms = document.forms\n\tif (forms) {\n\t\treturn forms\n\t}\n\treturn false\n}\n\nfunction ctNoCookieAttachHiddenFieldsToForms(){\n\n\tif (ctPublic.data__cookies_type !== 'none'){\n\t\treturn\n\t}\n\n\tlet forms = ctNoCookieGetForms()\n\n\tif (forms){\n\t\tfor ( let i = 0; i < forms.length; i++ ){\n\t\t\t//ignore forms with get method @todo We need to think about this\n\t\t\tif (document.forms[i].getAttribute('method') === null ||\n\t\t\t\tdocument.forms[i].getAttribute('method').toLowerCase() === 'post'){\n\n\t\t\t\tlet elements = document.getElementsByName('ct_no_cookie_hidden_field')\n\t\t\t\t//clear previous hidden set\n\t\t\t\tif (elements){\n\t\t\t\t\tfor (let j = 0; j < elements.length; j++) {\n\t\t\t\t\t\telements[j].parentNode.removeChild(elements[j])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// add new set\n\t\t\t\tdocument.forms[i].append(ctNoCookieConstructHiddenField())\n\t\t\t}\n\t\t}\n\t}\n\n}\n/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n \"box-sizing\" : \"content-box\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});\nlet buttons_to_handle = []\nlet gdpr_notice_for_button = 'Please, apply the GDPR agreement.'\n\ndocument.addEventListener('DOMContentLoaded', function(){\n\tbuttons_to_handle = []\n\tif(\n\t\ttypeof ctPublicGDPR === 'undefined' ||\n\t\t! ctPublicGDPR.gdpr_forms.length\n\t) {\n\t\treturn;\n\t}\n\n\tif ( typeof jQuery === 'undefined' ) {\n\t\treturn;\n\t}\n\ttry {\n\t\tctPublicGDPR.gdpr_forms.forEach(function(item, i){\n\n\t\t\tlet elem = jQuery('#'+item+', .'+item);\n\n\t\t\t// Filter forms\n\t\t\tif (!elem.is('form')){\n\t\t\t\t// Caldera\n\t\t\t\tif (elem.find('form')[0])\n\t\t\t\t\telem = elem.children('form').first();\n\t\t\t\t// Contact Form 7\n\t\t\t\telse if(\n\t\t\t\t\tjQuery('.wpcf7[role=form]')[0] && jQuery('.wpcf7[role=form]')\n\t\t\t\t\t\t.attr('id')\n\t\t\t\t\t\t.indexOf('wpcf7-f'+item) !== -1\n\t\t\t\t) {\n\t\t\t\t\telem = jQuery('.wpcf7[role=form]').children('form');\n\t\t\t\t}\n\n\t\t\t\t// Formidable\n\t\t\t\telse if(jQuery('.frm_forms')[0] && jQuery('.frm_forms').first().attr('id').indexOf('frm_form_'+item) !== -1)\n\t\t\t\t\telem = jQuery('.frm_forms').first().children('form');\n\t\t\t\t// WPForms\n\t\t\t\telse if(jQuery('.wpforms-form')[0] && jQuery('.wpforms-form').first().attr('id').indexOf('wpforms-form-'+item) !== -1)\n\t\t\t\t\telem = jQuery('.wpforms-form');\n\t\t\t}\n\n\t\t\t//disable forms buttons\n\t\t\tlet button = false\n\t\t\tlet buttons_collection= elem.find('input[type|=\"submit\"]')\n\n\t\t\tif (!buttons_collection.length) {\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tbutton = buttons_collection[0]\n\t\t\t}\n\n\t\t\tif (button !== false){\n\t\t\t\tconsole.log(buttons_collection)\n\t\t\t\tbutton.disabled = true\n\t\t\t\tlet old_notice = jQuery(button).prop('title') ? jQuery(button).prop('title') : ''\n\t\t\t\tbuttons_to_handle.push({index:i,button:button,old_notice:old_notice})\n\t\t\t\tjQuery(button).prop('title', gdpr_notice_for_button)\n\t\t\t}\n\n\t\t\t// Adding notice and checkbox\n\t\t\tif(elem.is('form') || elem.attr('role') === 'form'){\n\t\t\t\telem.append('<input id=\"apbct_gdpr_'+i+'\" type=\"checkbox\" required=\"required\" style=\" margin-right: 10px;\" onchange=\"apbct_gdpr_handle_buttons()\">')\n\t\t\t\t\t.append('<label style=\"display: inline;\" for=\"apbct_gdpr_'+i+'\">'+ctPublicGDPR.gdpr_text+'</label>');\n\t\t\t}\n\t\t});\n\t} catch (e) {\n\t\tconsole.info('APBCT GDPR JS ERROR: Can not add GDPR notice' + e)\n\t}\n});\n\nfunction apbct_gdpr_handle_buttons(){\n\n\ttry {\n\n\t\tif (buttons_to_handle === []){\n\t\t\treturn\n\t\t}\n\n\t\tbuttons_to_handle.forEach((button) => {\n\t\t\tlet selector = '[id=\"apbct_gdpr_' + button.index + '\"]'\n\t\t\tlet apbct_gdpr_item = jQuery(selector)\n\t\t\t//chek if apbct_gdpr checkbox is set\n\t\t\tif (jQuery(apbct_gdpr_item).prop(\"checked\")){\n\t\t\t\tbutton.button.disabled = false\n\t\t\t\tjQuery(button.button).prop('title', button.old_notice)\n\t\t\t} else {\n\t\t\t\tbutton.button.disabled = true\n\t\t\t\tjQuery(button.button).prop('title', gdpr_notice_for_button)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.info('APBCT GDPR JS ERROR: Can not handle form buttons ' + e)\n\t}\n}\n/**\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 (currentForm.parentElement && currentForm.parentElement.classList.length > 0 && currentForm.parentElement.classList[0].indexOf('mewtwo') !== -1){\n return\n }\n\n if(typeof(currentForm.action) == 'string') {\n\n // Ajax checking for the integrated forms\n if(isIntegratedForm(currentForm)) {\n\n var cleantalk_placeholder = document.createElement(\"i\");\n cleantalk_placeholder.className = 'cleantalk_placeholder';\n cleantalk_placeholder.style = 'display: none';\n currentForm.parentElement.insertBefore(cleantalk_placeholder, currentForm);\n\n // Deleting form to prevent submit event\n var prev = currentForm.previousSibling,\n form_html = currentForm.outerHTML,\n form_original = currentForm;\n\n // Remove the original form\n currentForm.parentElement.removeChild(currentForm);\n\n // Insert a clone\n const placeholder = document.createElement(\"div\");\n placeholder.innerHTML = form_html;\n prev.after(placeholder.firstElementChild);\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 let reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n reUseCurrentForm.apbctPrev = prev;\n reUseCurrentForm.apbctFormOriginal = form_original;\n\n // mailerlite integration - disable click on submit button\n let mailerlite_detected_class = false\n if (reUseCurrentForm.classList !== undefined) {\n //list there all the mailerlite classes\n let mailerlite_classes = ['newsletterform', 'ml-block-form']\n mailerlite_classes.forEach(function(mailerlite_class) {\n if (reUseCurrentForm.classList.contains(mailerlite_class)){\n mailerlite_detected_class = mailerlite_class\n }\n });\n }\n if ( mailerlite_detected_class ) {\n let mailerliteSubmitButton = jQuery('form.' + mailerlite_detected_class).find('button[type=\"submit\"]');\n if ( mailerliteSubmitButton !== undefined ) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(event.currentTarget);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget);\n };\n }\n\n // Common flow - modify form's action\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\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\n if( ! +ctPublic.settings__forms__check_external ) {\n return;\n }\n\n if ( typeof jQuery === 'undefined' ) {\n return;\n }\n\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 formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1 ||\n formAction.indexOf('sendfox.com') !== -1 ||\n formAction.indexOf('aweber.com') !== -1 ||\n formAction.indexOf('secure.payu.com') !== -1\n\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( result, data, params, obj ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n let form_new = jQuery(form).detach();\n let prev = form.apbctPrev;\n let formOriginal = form.apbctFormOriginal;\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Clear visible_fields input\n jQuery(formOriginal).find('input[name=\"apbct_visible_fields\"]').remove();\n jQuery(formOriginal).find('input[value=\"cleantalk_force_ajax_check\"]').remove();\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 return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\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 return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n if (result.apbct !== undefined && +result.apbct.blocked) {\n ctParseBlockMessage(result);\n }\n }\n }\n );\n}\n\nfunction ct_check_internal(currForm){\n \n//Gathering data\n var ct_data = {},\n elems = currForm.elements;\n\n for (var key in elems) {\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\n continue;\n ct_data[elems[key].name] = currForm.elements[key].value;\n }\n ct_data['action'] = 'ct_check_internal';\n\n //AJAX Request\n apbct_public_sendAJAX(\n ct_data,\n {\n url: ctPublicFunctions._ajax_url,\n callback: function (data) {\n if(data.success === true){\n currForm.submit();\n }else{\n alert(data.data);\n return false;\n }\n }\n }\n );\n}\n\ndocument.addEventListener('DOMContentLoaded',function(){\n let ct_currAction = '',\n ct_currForm = '';\n\n if( ! +ctPublic.settings__forms__check_internal ) {\n return;\n }\n\n\tfor( let i=0; i<document.forms.length; i++ ){\n\t\tif ( typeof(document.forms[i].action) == 'string' ){\n ct_currForm = document.forms[i];\n\t\t\tct_currAction = ct_currForm.action;\n if (\n ct_currAction.indexOf('https?://') !== null && // The protocol is obligatory\n ct_currAction.match(ctPublic.blog_home + '.*?\\.php') !== null && // Main check\n ! ct_check_internal__is_exclude_form(ct_currAction) // Exclude WordPress native scripts from processing\n ) {\n ctPrevHandler = ct_currForm.click;\n if ( typeof jQuery !== 'undefined' ) {\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(event){\n ct_check_internal(event.target);\n return false;\n });\n }\n }\n\t\t}\n\t}\n});\n\n/**\n * Check by action to exclude the form checking\n * @param action string\n * @return boolean\n */\nfunction ct_check_internal__is_exclude_form(action) {\n // An array contains forms action need to be excluded.\n let ct_internal_script_exclusions = [\n ctPublic.blog_home + 'wp-login.php', // WordPress login page\n ctPublic.blog_home + 'wp-comments-post.php', // WordPress Comments Form\n ];\n\n return ct_internal_script_exclusions.some((item) => {\n return action.match(new RegExp('^' + item)) !== null;\n });\n}"],"names":["ApbctCore","ajax_parameters","rest_parameters","#selector","elements","#eventCallback","#eventSelector","#event","constructor","selector","this","select","HTMLCollection","Array","prototype","slice","call","document","querySelectorAll","#deselect","#addElement","elemToAdd","push","#push","elem","#reduce","css","style","getRaw","let","style_name","DOM_style_name","replace","group","toUpperCase","i","length","computedStyle","getComputedStyle","console","log","Number","hide","prop","display","show","addClass","classList","add","className","removeClass","remove","toggleClass","toggle","ajax","ApbctAjax","rest","ApbctRest","on","args","addEventListener","#onChecker","bind","event","target","querySelector","stopPropagation","ready","callback","change","attr","attrName","outputValue","propName","value","html","val","data","name","is","filter","#isElem","elemToCheck","match","newlyCreatedElement","createElement","Boolean","HTMLElement","HTMLUnknownElement","indexOf","isRegisteredTagName","tagName","toLowerCase","#isWithoutSelector","splice","parent","parentElement","parents","children","siblings","current","after","content","append","fadeIn","time","opacity","last","Date","tick","window","requestAnimationFrame","setTimeout","fadeOut","apbct","params","ApbctXhr","#xhr","XMLHttpRequest","method","url","async","user","password","button","spinner","progressbar","context","onErrorCallback","responseType","headers","timeout","#methods_to_convert_data_to_URL","#body","#http_code","#status_text","parameters","key","#prepare","Object","keys","deleteDoubleJSONEncoding","convertData","open","setHeaders","onreadystatechange","onReadyStateChange","onload","onLoad","onprogress","onProgress","onerror","onError","ontimeout","onTimeout","send","setAttribute","cursor","#complete","status","statusText","removeAttribute","on_ready_state_change","on_progress","#error","response","error","http_code","status_text","additional_msg","error_string","errorOutput","error_msg","header_name","setRequestHeader","convertDataToURL","convertDataToBody","params_appendix","URLSearchParams","toString","params_prefix","dataKey","FormData","JSON","stringify","object","objectKey","parsedValue","parse","super","default_route","ctPublicFunctions","_rest_url","route","X-WP-Nonce","_rest_nonce","ctSetCookie","cookies","expires","skip_alt","data__cookies_type","forEach","item","arr","apbctLocalStorage","set","encodeURIComponent","ctNoCookieAttachHiddenFieldsToForms","ctSecure","location","protocol","cookie","cookiePrefix","getJavascriptClientData","e","data__ajax_type","apbct_public_sendREST","apbct_public_sendAJAX","action","notJson","ctGetCookie","matches","RegExp","decodeURIComponent","undefined","ctDeleteCookie","cookieName","obj","_params","callback_context","callback_params","silent","no_nonce","_ajax_url","_ajax_nonce","Math","random","no_cache","get","property","storageValue","localStorage","getItem","json","hasOwnProperty","is_json","objToSave","timestamp","floor","getTime","setItem","isAlive","maxLifetime","isSet","delete","removeItem","getCleanTalkData","ct_date","ctTimeMs","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","apbct_attach_event_handler","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","ctKeyStopStopListening","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","ctSetMouseMoved","round","clientY","clientX","ctMouseStopData","clearInterval","checkEmail","current_email","email","result","now","ctSetPixelImg","pixelUrl","ctPublic","pixel__enabled","getElementById","insertedImg","ctGetPixelUrl","local_storage_pixel_url","ctSetHasScrolled","ctPreloadLocalStorage","data__to_local_storage","entries","apbct_ready","cookiesType","initCookies","getTimezoneOffset","apbctGetScreenInfo","navigator","webdriver","cookiesArray","split","trim","pixel__setting","pixel__url","data__email_check_before_post","forms","hiddenInput","visibleFieldsToInput","form","data__visible_fields_required","contains","id","apbct_collect_visible_fields","onsubmit_prev","onsubmit","ctFormIndex","visible_fields","apbct_visible_fields_set_cookie","Function","decodedEmailNodes","href","ctFillDecodedEmailHandler","apbctAjaxEmailDecode","baseElement","element","event_javascript_data","post_url","referrer","preventDefault","text__wait_for_decoding","apbctTooltip","apbctTooltipText","apbctTooltipArrow","ctShowDecodeComment","encodedEmail","dataset","originalString","success","baseElementContent","innerHTML","decoded_email","click","ctProcessDecodedDataResult","getElementsByClassName","res","common_cookies","resultDataJson","apbct_headless","apbct_pixel_url","ct_checked_emails","ct_checkjs","ct_fkp_timestamp","ct_pointer_data","ct_ps_timestamp","ct_screen_info","ct_timezone","ctMouseMovedLocalStorage","ctHasScrolledLocalStorage","ctCookiesTypeLocalStorage","ctMouseMovedCookie","ctHasScrolledCookie","ctCookiesTypeCookie","ct_mouse_moved","ct_has_scrolled","ct_cookies_type","removeDoubleJsonEncoding","targetElement","is_allowed","ctFillDecodedEmail","show_comment","comment","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","isNaN","getAttribute","visibility","visible_fields_count","invisible_fields","invisible_fields_count","visible_fields_collection","form_id","collection","apbct_js_keys__set_input_value","js_key","fullWidth","documentElement","scrollWidth","fullHeight","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ctParseBlockMessage","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","cleantalkModal","loaded","stop_script","stop","ctSetPixelUrlLocalstorage","ajax_pixel_url","ctNoCookieConstructHiddenField","field","no_cookie_data","btoa","ctNoCookieGetForms","getElementsByName","j","parentNode","removeChild","jQuery","ajaxComplete","xhr","settings","responseText","loading","opened","opening","load","apbct_admin_sendAJAX","renderCss","cssStr","styles","overlayCss","z-index","position","top","left","width","height","background","justify-content","align-items","innerCss","padding","border","border-radius","box-shadow","closeCss","right","box-sizing","closeCssBefore","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","overlay","inner","close","buttons_to_handle","gdpr_notice_for_button","apbct_gdpr_handle_buttons","index","apbct_gdpr_item","disabled","old_notice","info","ct_protect_external","cleantalk_hidden_action","cleantalk_hidden_method","currentForm","isIntegratedForm","cleantalk_placeholder","prev","insertBefore","previousSibling","form_html","outerHTML","form_original","placeholder","firstElementChild","force_action","type","reUseCurrentForm","mailerlite_detected_class","appendChild","apbctPrev","apbctFormOriginal","mailerlite_classes","mailerlite_class","mailerliteSubmitButton","find","sendAjaxCheckingFormData","currentTarget","clone","hostname","ct_action","ct_method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","elem_source","source","index2","elem_target","formObj","formAction","firstChild","formOriginal","elems","y","form_new","detach","subm_button","ct_check_internal","currForm","ct_data","alert","submit","ct_check_internal__is_exclude_form","ct_internal_script_exclusions","blog_home","some","ctPublicGDPR","gdpr_forms","first","buttons_collection","gdpr_text","settings__forms__check_external","ct_currAction","ct_currForm","settings__forms__check_internal","ctPrevHandler","off"],"mappings":"MAAMA,UAEFC,gBAAkB,GAClBC,gBAAkB,GAElBC,UAAY,KACZC,SAAW,GAGXC,eACAC,eACAC,OAKAC,YAAYC,GACRC,KAAKC,OAAOF,GAShBE,OAAOF,GAkBH,OAhBGA,aAAoBG,gBACnBF,KAAKP,UAAe,KACpBO,KAAKN,SAAc,GACnBM,KAAKN,SAAWS,MAAMC,UAAUC,MAAMC,KAAKP,IACjB,iBAAbA,GACbC,KAAKP,UAAe,KACpBO,KAAKN,SAAc,GACnBM,KAAKN,SAAS,GAAKK,GACO,iBAAbA,GACbC,KAAKP,UAAYM,EACjBC,KAAKN,SAAWS,MAAMC,UAAUC,MAAMC,KAAKC,SAASC,iBAAiBT,KAGrEC,KAAKS,YAGFT,KAGXU,YAAYC,GACiB,iBAAdA,EACPX,KAAKN,SAASkB,KAAKD,GACQ,iBAAdA,GACbX,KAAKP,UAAYkB,EACjBX,KAAKN,SAAWS,MAAMC,UAAUC,MAAMC,KAAKC,SAASC,iBAAiBG,KAErEX,KAAKS,YAIbI,MAAMC,GACFd,KAAKN,SAASkB,KAAKE,GAGvBC,UACIf,KAAKN,SAAWM,KAAKN,SAASW,MAAM,GAAG,GAG3CI,YACIT,KAAKN,SAAW,GAWpBsB,IAAIC,EAAOC,GAKP,GAHAA,IAAkB,EAGE,iBAAVD,EAAmB,CAWzB,IAAIE,IAAIC,KAAcH,EAAM,CACxBE,IAAIE,EAAmCD,EATnCE,QAAQ,eAAgBC,GACxBA,EACKC,cACAF,QAAQ,IAAK,IACbA,QAAQ,IAAK,KA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jgB,IAAIM,EAAE,EAAGA,EAAElB,SAASqS,MAAMlR,OAAQD,IACG,iBAA7BlB,SAASqS,MAAMnR,GAAS,SAC1B0f,EAAc5gB,SAASqS,MAAMnR,GAGc,QAFpDyf,EAAgBC,EAAYnU,QAEDjI,QAAQ,cACmC,OAAzDmc,EAAczc,MAAM4M,SAASqP,UAAY,YACvCF,mCAAmCU,KAErCG,cAAgBF,EAAYnM,MACL,oBAAXiF,SACRA,OAAOkH,GAAaG,IAAI,MACxBrH,OAAOkH,GAAaG,MACpBrH,OAAOkH,GAAane,GAAG,SAAU,SAASK,GAEtC,OADA8c,kBAAkB9c,EAAMC,SACjB"}
|
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)c.push(a[key]);else if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&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;1===(c=null===c?null===t.getAttribute("disabled")?0: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){function c(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,i,o;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,i=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,o=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<i+o+c?(a.style.bottom="",a.style.top=i+o+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)}function apbct_highlight_element(t,e){e=e-1||0;let n=jQuery("#"+t);jQuery("html, body").animate({scrollTop:n.offset().top-100},"slow"),n.addClass("apbct_highlighted"),n.animate({opacity:0},400,"linear",function(){n.animate({opacity:1},400,"linear",function(){0<e?apbct_highlight_element(t,e):n.removeClass("apbct_highlighted")})})}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_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 c,t=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0===t.data("id")?console.log('Attribute "data-id" not set for the option.'):(t={template_id:t.data("id"),template_name:t.data("name"),settings:t.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))}}))}),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"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");n={template_name:n}}else n={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{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))}})}}),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(){apbct_settings__showDescription(self=jQuery(this),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 t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{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")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();jQuery('button.cleantalk_link[value="save_changes"]').off("click"),""!==t&&null===t.match(/^[a-z\d]{3,30}\s*$/)&&(jQuery("#apbct_button__get_key_auto__wrapper").show(),jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#apbct_bad_key_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>Please, insert a correct access key before saving changes!</h4></div>").insertAfter(jQuery("#apbct_setting_apikey")),apbct_highlight_element("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>Synchronization process failed. Please, check the acces key and restart the synch.<h4></div>").insertAfter(jQuery("#apbct_button__sync")),apbct_highlight_element("apbct_setting_apikey",3),apbct_highlight_element("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()})});
|
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)c.push(a[key]);else if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&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;1===(c=null===c?null===t.getAttribute("disabled")?0: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){function c(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,i,o;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,i=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,o=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<i+o+c?(a.style.bottom="",a.style.top=i+o+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)}function apbct_highlight_element(t,e){e=e-1||0;let n=jQuery("#"+t);jQuery("html, body").animate({scrollTop:n.offset().top-100},"slow"),n.addClass("apbct_highlighted"),n.animate({opacity:0},400,"linear",function(){n.animate({opacity:1},400,"linear",function(){0<e?apbct_highlight_element(t,e):n.removeClass("apbct_highlighted")})})}jQuery(document).ready(function(){jQuery(".apbct_setting---data__email_decoder").on("click",t=>{var e;"checkbox"===t.target.type?(e=t.target.checked?"__On":"__Off",document.getElementById("apbct_setting_data__email_decoder"+e).checked=!0):document.getElementById("apbct_setting_data__email_decoder").checked=1===parseInt(t.target.value)}),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_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 c,t=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0===t.data("id")?console.log('Attribute "data-id" not set for the option.'):(t={template_id:t.data("id"),template_name:t.data("name"),settings:t.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))}}))}),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"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");n={template_name:n}}else n={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{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))}})}}),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(){apbct_settings__showDescription(self=jQuery(this),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 t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{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")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();jQuery('button.cleantalk_link[value="save_changes"]').off("click"),""!==t&&null===t.match(/^[a-z\d]{3,30}\s*$/)&&(jQuery("#apbct_button__get_key_auto__wrapper").show(),jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#apbct_bad_key_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>Please, insert a correct access key before saving changes!</h4></div>").insertAfter(jQuery("#apbct_setting_apikey")),apbct_highlight_element("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>Synchronization process failed. Please, check the acces key and restart the synch.<h4></div>").insertAfter(jQuery("#apbct_button__sync")),apbct_highlight_element("apbct_setting_apikey",3),apbct_highlight_element("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()})});
|
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\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\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').off('click')\n\t\tif (enteredValue !== '' && enteredValue.match(/^[a-z\\d]{3,30}\\s*$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\t\t\tfunction (e) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tif (!jQuery('#apbct_bad_key_notice').length){\n\t\t\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>\" +\n\t\t\t\t\t\t\t\t\"Please, insert a correct access key before saving changes!\" +\n\t\t\t\t\t\t\t\t\"</h4></div>\" ).insertAfter( jQuery('#apbct_setting_apikey') );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\treturn;\n\t\t}\n\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n\t/**\n\t * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n\t */\n\tif( !ctSettingsPage.key_is_ok ){\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\tfunction (e) {\n\t\t\t\te.preventDefault()\n\t\t\t\tif (!jQuery('#sync_required_notice').length){\n\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>\" +\n\t\t\t\t\t\t\"Synchronization process failed. Please, check the acces key and restart the synch.\" +\n\t\t\t\t\t\t\"<h4></div>\" ).insertAfter( jQuery('#apbct_button__sync') );\n\t\t\t\t}\n\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\t\t\t\tapbct_highlight_element('apbct_button__sync',3)\n\t\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\t}\n\t\t)\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}\n\n// Hightlights element\nfunction apbct_highlight_element(id, times){\n\ttimes = times-1 || 0;\n\tlet key_field = jQuery('#'+id)\n\tjQuery(\"html, body\").animate({ scrollTop: key_field.offset().top - 100 }, \"slow\");\n\tkey_field.addClass('apbct_highlighted');\n\tkey_field.animate({opacity: 0 }, 400, 'linear', function(){\n\t\tkey_field.animate({opacity: 1 }, 400, 'linear', function(){\n\t\t\tif(times>0){\n\t\t\t\tapbct_highlight_element(id, times);\n\t\t\t}else{\n\t\t\t\tkey_field.removeClass('apbct_highlighted');\n\t\t\t}\n\t\t});\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","push","key","getElementsByClassName","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","apbct_highlight_element","id","times","let","key_field","animate","scrollTop","offset","addClass","opacity","removeClass","ready","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","key_is_ok"],"mappings":"AAoTA,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,EACHK,EAAIM,KAAMX,EAAIY,WAOf,GAAY,QADZZ,EAAMS,SAASI,uBAAuBN,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIM,KAAMX,EAAIY,QAMXP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,IACvCF,EAAME,GAAGc,KAAK,SAAUd,EAAGM,GAEvB,IAAIS,GADJT,EAAOb,OAAOa,IACGU,KAAK,UAAYV,EAAKW,KAAK,UAAY,KACpDX,EAAKY,GAAG,aACRZ,EA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,iBACG1H,OAAO,yBAAyBC,QACpCD,OAAQ,6IAESiH,YAAajH,OAAO,0BAEtC2E,wBAAwB,uBAAuB,QAS/C3E,OAAO,yBAAyBwF,OAAS6B,eAAekB,WAC5DvI,OAAO,wCAAwCE,OAM3CmH,eAAekB,WACnBvI,OAAO,+CAA+CyD,GAAG,QACxD,SAAUjB,GACTA,EAAEkF,iBACG1H,OAAO,yBAAyBC,QACpCD,OAAQ,oKAEQiH,YAAajH,OAAO,wBAErC2E,wBAAwB,uBAAuB,GAC/CA,wBAAwB,qBAAqB,GAC7C3E,OAAO,wCAAwC0B"}
|
1 |
+
{"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Top level settings\n\tjQuery('.apbct_setting---data__email_decoder').on('click', (event) => {\n\t\tif ( event.target.type === 'checkbox' ) {\n\t\t\tconst postFix = event.target.checked ? '__On' : '__Off';\n\t\t\tdocument.getElementById('apbct_setting_data__email_decoder' + postFix).checked = true;\n\t\t} else {\n\t\t\tdocument.getElementById('apbct_setting_data__email_decoder').checked = parseInt(event.target.value) === 1;\n\t\t}\n\t});\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\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\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').off('click')\n\t\tif (enteredValue !== '' && enteredValue.match(/^[a-z\\d]{3,30}\\s*$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\t\t\tfunction (e) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tif (!jQuery('#apbct_bad_key_notice').length){\n\t\t\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>\" +\n\t\t\t\t\t\t\t\t\"Please, insert a correct access key before saving changes!\" +\n\t\t\t\t\t\t\t\t\"</h4></div>\" ).insertAfter( jQuery('#apbct_setting_apikey') );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\treturn;\n\t\t}\n\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n\t/**\n\t * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n\t */\n\tif( !ctSettingsPage.key_is_ok ){\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\tfunction (e) {\n\t\t\t\te.preventDefault()\n\t\t\t\tif (!jQuery('#sync_required_notice').length){\n\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>\" +\n\t\t\t\t\t\t\"Synchronization process failed. Please, check the acces key and restart the synch.\" +\n\t\t\t\t\t\t\"<h4></div>\" ).insertAfter( jQuery('#apbct_button__sync') );\n\t\t\t\t}\n\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\t\t\t\tapbct_highlight_element('apbct_button__sync',3)\n\t\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\t}\n\t\t)\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}\n\n// Hightlights element\nfunction apbct_highlight_element(id, times){\n\ttimes = times-1 || 0;\n\tlet key_field = jQuery('#'+id)\n\tjQuery(\"html, body\").animate({ scrollTop: key_field.offset().top - 100 }, \"slow\");\n\tkey_field.addClass('apbct_highlighted');\n\tkey_field.animate({opacity: 0 }, 400, 'linear', function(){\n\t\tkey_field.animate({opacity: 1 }, 400, 'linear', function(){\n\t\t\tif(times>0){\n\t\t\t\tapbct_highlight_element(id, times);\n\t\t\t}else{\n\t\t\t\tkey_field.removeClass('apbct_highlighted');\n\t\t\t}\n\t\t});\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","push","key","getElementsByClassName","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","apbct_highlight_element","id","times","let","key_field","animate","scrollTop","offset","addClass","opacity","removeClass","ready","postFix","event","type","parseInt","value","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","key_is_ok"],"mappings":"AA8TA,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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|
|
|
|
475 |
|
476 |
$response = null;
|
477 |
$response['errno'] = 1;
|
471 |
$response->errno = 0;
|
472 |
$response->errstr = $errstr;
|
473 |
} else {
|
474 |
+
if ( isset($result['error']) ) {
|
475 |
+
$error = $result['error'];
|
476 |
+
} else if ( is_string($result) ) {
|
477 |
+
$error = $result;
|
478 |
+
} else {
|
479 |
+
$error = '';
|
480 |
+
}
|
481 |
+
|
482 |
+
$errstr = 'Unknown response from ' . $url . ': ' . $error;
|
483 |
|
484 |
$response = null;
|
485 |
$response['errno'] = 1;
|
lib/Cleantalk/ApbctWP/AdminNotices.php
CHANGED
@@ -56,7 +56,7 @@ class AdminNotices
|
|
56 |
global $apbct;
|
57 |
$this->apbct = $apbct;
|
58 |
$this->is_cleantalk_page = Get::get('page') &&
|
59 |
-
in_array(
|
60 |
$this->user_token = $this->apbct->user_token ? '&user_token=' . $this->apbct->user_token : '';
|
61 |
|
62 |
$self_owned_key = $this->apbct->moderate_ip == 0 && ! defined('CLEANTALK_ACCESS_KEY');
|
@@ -166,7 +166,7 @@ class AdminNotices
|
|
166 |
);
|
167 |
$additional_content =
|
168 |
'<h4 style = "color: gray">' .
|
169 |
-
esc_html__('Account status updates every 24 hours.', 'cleantalk-spam-protect') .
|
170 |
'</h4>';
|
171 |
$id = 'cleantalk_' . __FUNCTION__;
|
172 |
$this->generateNoticeHtml($content, $id, $additional_content);
|
@@ -185,7 +185,7 @@ class AdminNotices
|
|
185 |
$renew_link = "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%%20backend%%20renew$this->user_token&cp_mode=antispam\" target=\"_blank\">%s</a>";
|
186 |
$button_html = sprintf(
|
187 |
$renew_link,
|
188 |
-
'<input type="button" class="button button-primary" value="' . __(
|
189 |
'RENEW ANTI-SPAM',
|
190 |
'cleantalk-spam-protect'
|
191 |
) . '" />'
|
@@ -198,7 +198,7 @@ class AdminNotices
|
|
198 |
);
|
199 |
$additional_content =
|
200 |
'<h4 style = "color: gray">' .
|
201 |
-
esc_html__('Account status updates every 24 hours.', 'cleantalk-spam-protect') .
|
202 |
'</h4>' .
|
203 |
$button_html;
|
204 |
$id = 'cleantalk_' . __FUNCTION__;
|
56 |
global $apbct;
|
57 |
$this->apbct = $apbct;
|
58 |
$this->is_cleantalk_page = Get::get('page') &&
|
59 |
+
in_array(Get::get('page'), array('cleantalk', 'ct_check_spam', 'ct_check_users'));
|
60 |
$this->user_token = $this->apbct->user_token ? '&user_token=' . $this->apbct->user_token : '';
|
61 |
|
62 |
$self_owned_key = $this->apbct->moderate_ip == 0 && ! defined('CLEANTALK_ACCESS_KEY');
|
166 |
);
|
167 |
$additional_content =
|
168 |
'<h4 style = "color: gray">' .
|
169 |
+
esc_html__('Account status updates every 24 hours or click Settings -> Anti-Spam by CleanTalk -> Synchronize with Cloud.', 'cleantalk-spam-protect') .
|
170 |
'</h4>';
|
171 |
$id = 'cleantalk_' . __FUNCTION__;
|
172 |
$this->generateNoticeHtml($content, $id, $additional_content);
|
185 |
$renew_link = "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%%20backend%%20renew$this->user_token&cp_mode=antispam\" target=\"_blank\">%s</a>";
|
186 |
$button_html = sprintf(
|
187 |
$renew_link,
|
188 |
+
'<input type="button" class="button button-primary" style="margin-bottom:20px" value="' . __(
|
189 |
'RENEW ANTI-SPAM',
|
190 |
'cleantalk-spam-protect'
|
191 |
) . '" />'
|
198 |
);
|
199 |
$additional_content =
|
200 |
'<h4 style = "color: gray">' .
|
201 |
+
esc_html__('Account status updates every 24 hours or click Settings -> Anti-Spam by CleanTalk -> Synchronize with Cloud.', 'cleantalk-spam-protect') .
|
202 |
'</h4>' .
|
203 |
$button_html;
|
204 |
$id = 'cleantalk_' . __FUNCTION__;
|
lib/Cleantalk/ApbctWP/Deactivator.php
CHANGED
@@ -83,6 +83,7 @@ class Deactivator
|
|
83 |
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_sfw__flood_logs`;'); // Deleting SFW logs
|
84 |
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_ac_log`;'); // Deleting SFW logs
|
85 |
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_sessions`;'); // Deleting session table
|
|
|
86 |
$wpdb->query(
|
87 |
'DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_spamscan_logs`;'
|
88 |
); // Deleting user/comments scan result table
|
83 |
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_sfw__flood_logs`;'); // Deleting SFW logs
|
84 |
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_ac_log`;'); // Deleting SFW logs
|
85 |
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_sessions`;'); // Deleting session table
|
86 |
+
$wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_no_cookie_data`;'); // Deleting no cookie table
|
87 |
$wpdb->query(
|
88 |
'DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_spamscan_logs`;'
|
89 |
); // Deleting user/comments scan result table
|
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php
CHANGED
@@ -23,7 +23,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
|
|
23 |
private $db__table__ac_ua_bl;
|
24 |
private $api_key = '';
|
25 |
private $apbct;
|
26 |
-
private $store_interval =
|
27 |
private $sign; //Signature - User-Agent + Protocol
|
28 |
private $ua_id = 'null'; //User-Agent
|
29 |
|
@@ -580,4 +580,21 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
|
|
580 |
{
|
581 |
return Server::get('HTTP_CF_RAY') && Server::get('HTTP_CF_CONNECTING_IP') && Server::get('HTTP_CF_REQUEST_ID');
|
582 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
}
|
23 |
private $db__table__ac_ua_bl;
|
24 |
private $api_key = '';
|
25 |
private $apbct;
|
26 |
+
private $store_interval = 86400;
|
27 |
private $sign; //Signature - User-Agent + Protocol
|
28 |
private $ua_id = 'null'; //User-Agent
|
29 |
|
580 |
{
|
581 |
return Server::get('HTTP_CF_RAY') && Server::get('HTTP_CF_CONNECTING_IP') && Server::get('HTTP_CF_REQUEST_ID');
|
582 |
}
|
583 |
+
|
584 |
+
/**
|
585 |
+
* Clear table APBCT_TBL_AC_LOG
|
586 |
+
* once a day
|
587 |
+
*/
|
588 |
+
public function clearTable()
|
589 |
+
{
|
590 |
+
$interval_start = \Cleantalk\ApbctWP\Helper::timeGetIntervalStart($this->store_interval);
|
591 |
+
|
592 |
+
$this->db->execute(
|
593 |
+
'DELETE
|
594 |
+
FROM ' . $this->db__table__ac_logs . '
|
595 |
+
WHERE interval_start < ' . $interval_start . '
|
596 |
+
AND ua <> ""
|
597 |
+
LIMIT 100000;'
|
598 |
+
);
|
599 |
+
}
|
600 |
}
|
lib/Cleantalk/ApbctWP/Helper.php
CHANGED
@@ -261,4 +261,23 @@ class Helper extends \Cleantalk\Common\Helper
|
|
261 |
|
262 |
return array_map('static::arrayObjectToArray', (array)$object);
|
263 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
261 |
|
262 |
return array_map('static::arrayObjectToArray', (array)$object);
|
263 |
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Validate if arg is valid JSON string
|
267 |
+
*
|
268 |
+
* @param string $string
|
269 |
+
*
|
270 |
+
* @return bool
|
271 |
+
* @psalm-suppress UnusedFunctionCall
|
272 |
+
*/
|
273 |
+
public static function isJson($string)
|
274 |
+
{
|
275 |
+
try {
|
276 |
+
$out = json_decode($string);
|
277 |
+
unset($out);
|
278 |
+
return (json_last_error() === JSON_ERROR_NONE);
|
279 |
+
} catch (\Exception $e) {
|
280 |
+
return false;
|
281 |
+
}
|
282 |
+
}
|
283 |
}
|
lib/Cleantalk/ApbctWP/RestController.php
CHANGED
@@ -36,7 +36,7 @@ class RestController extends \WP_REST_Controller
|
|
36 |
'callback' => array(AltSessions::class, 'setFromRemote'),
|
37 |
'args' => array(
|
38 |
'cookies' => array(
|
39 |
-
'type' => '
|
40 |
'required' => true,
|
41 |
),
|
42 |
),
|
36 |
'callback' => array(AltSessions::class, 'setFromRemote'),
|
37 |
'args' => array(
|
38 |
'cookies' => array(
|
39 |
+
'type' => 'string',
|
40 |
'required' => true,
|
41 |
),
|
42 |
),
|
lib/Cleantalk/ApbctWP/State.php
CHANGED
@@ -99,6 +99,7 @@ class State extends \Cleantalk\Common\State
|
|
99 |
'gdpr__text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
|
100 |
|
101 |
// Misc
|
|
|
102 |
'misc__async_js' => 0,
|
103 |
'misc__store_urls' => 1,
|
104 |
'misc__complete_deactivation' => 0,
|
@@ -342,6 +343,10 @@ class State extends \Cleantalk\Common\State
|
|
342 |
// Table with session data.
|
343 |
define('APBCT_TBL_SESSIONS', $db_prefix . 'cleantalk_sessions');
|
344 |
}
|
|
|
|
|
|
|
|
|
345 |
if ( ! defined('APBCT_SPAMSCAN_LOGS')) {
|
346 |
// Table with session data.
|
347 |
define('APBCT_SPAMSCAN_LOGS', $db_prefix . 'cleantalk_spamscan_logs');
|
99 |
'gdpr__text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
|
100 |
|
101 |
// Misc
|
102 |
+
'misc__send_connection_reports' => 0, // Send connection reports to Cleantalk servers
|
103 |
'misc__async_js' => 0,
|
104 |
'misc__store_urls' => 1,
|
105 |
'misc__complete_deactivation' => 0,
|
343 |
// Table with session data.
|
344 |
define('APBCT_TBL_SESSIONS', $db_prefix . 'cleantalk_sessions');
|
345 |
}
|
346 |
+
if ( ! defined('APBCT_TBL_NO_COOKIE')) {
|
347 |
+
// Table with session data.
|
348 |
+
define('APBCT_TBL_NO_COOKIE', $db_prefix . 'cleantalk_no_cookie_data');
|
349 |
+
}
|
350 |
if ( ! defined('APBCT_SPAMSCAN_LOGS')) {
|
351 |
// Table with session data.
|
352 |
define('APBCT_SPAMSCAN_LOGS', $db_prefix . 'cleantalk_spamscan_logs');
|
lib/Cleantalk/ApbctWP/Variables/AltSessions.php
CHANGED
@@ -22,10 +22,13 @@ class AltSessions
|
|
22 |
self::cleanFromOld();
|
23 |
|
24 |
// Bad incoming data
|
25 |
-
if ( ! $name ||
|
26 |
return;
|
27 |
}
|
28 |
|
|
|
|
|
|
|
29 |
global $wpdb;
|
30 |
|
31 |
$session_id = self::getID();
|
@@ -50,14 +53,36 @@ class AltSessions
|
|
50 |
|
51 |
public static function setFromRemote($request = null)
|
52 |
{
|
53 |
-
if (
|
54 |
-
$cookies_to_set =
|
55 |
} else {
|
56 |
$cookies_to_set = $request->get_param('cookies');
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
wp_send_json(array('success' => true));
|
22 |
self::cleanFromOld();
|
23 |
|
24 |
// Bad incoming data
|
25 |
+
if ( ! $name || (empty($value) && $value !== false) ) {
|
26 |
return;
|
27 |
}
|
28 |
|
29 |
+
//fix if value is strictly false
|
30 |
+
$value = $value === false ? 0 : $value;
|
31 |
+
|
32 |
global $wpdb;
|
33 |
|
34 |
$session_id = self::getID();
|
53 |
|
54 |
public static function setFromRemote($request = null)
|
55 |
{
|
56 |
+
if ( !$request ) {
|
57 |
+
$cookies_to_set = Post::get('cookies');
|
58 |
} else {
|
59 |
$cookies_to_set = $request->get_param('cookies');
|
60 |
}
|
61 |
|
62 |
+
//clear from double slashes
|
63 |
+
$cookies_to_set = str_replace('\\', '', $cookies_to_set);
|
64 |
+
|
65 |
+
//hanlde php8+ JSON throws
|
66 |
+
try {
|
67 |
+
$cookies_array = json_decode($cookies_to_set, true);
|
68 |
+
} catch ( \Exception $e ) {
|
69 |
+
$cookies_array = array();
|
70 |
+
unset($e);
|
71 |
+
wp_send_json(array(
|
72 |
+
'success' => false,
|
73 |
+
'error' => 'AltSessions: Internal JSON error:' . json_last_error_msg()));
|
74 |
+
}
|
75 |
+
|
76 |
+
//other versions json errors if json_decode returns null
|
77 |
+
if ( is_null($cookies_array) ) {
|
78 |
+
$cookies_array = array();
|
79 |
+
wp_send_json(array(
|
80 |
+
'success' => false,
|
81 |
+
'error' => 'AltSessions: Internal JSON error:' . json_last_error_msg()));
|
82 |
+
}
|
83 |
+
|
84 |
+
foreach ( $cookies_array as $cookie_to_set => $value ) {
|
85 |
+
Cookie::set($cookie_to_set, $value);
|
86 |
}
|
87 |
|
88 |
wp_send_json(array('success' => true));
|
lib/Cleantalk/ApbctWP/Variables/Cookie.php
CHANGED
@@ -25,8 +25,11 @@ class Cookie extends \Cleantalk\Variables\Cookie
|
|
25 |
$value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
|
26 |
}
|
27 |
// The old way
|
28 |
-
}
|
29 |
$value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
|
|
|
|
|
|
|
30 |
} else {
|
31 |
$value = '';
|
32 |
}
|
@@ -42,7 +45,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
|
|
42 |
|
43 |
/**
|
44 |
* Universal method to adding cookies
|
45 |
-
* Using Alternative Sessions or native cookies depends on settings
|
46 |
*
|
47 |
* @param string $name
|
48 |
* @param string $value
|
@@ -52,6 +55,10 @@ class Cookie extends \Cleantalk\Variables\Cookie
|
|
52 |
* @param bool|null $secure
|
53 |
* @param bool $httponly
|
54 |
* @param string $samesite
|
|
|
|
|
|
|
|
|
55 |
*/
|
56 |
public static function set(
|
57 |
$name,
|
@@ -61,17 +68,19 @@ class Cookie extends \Cleantalk\Variables\Cookie
|
|
61 |
$domain = '',
|
62 |
$secure = null,
|
63 |
$httponly = false,
|
64 |
-
$samesite = 'Lax'
|
|
|
65 |
) {
|
66 |
global $apbct;
|
67 |
-
|
68 |
if ($apbct->data['cookies_type'] === 'none' && ! is_admin()) {
|
69 |
-
return;
|
70 |
} elseif ($apbct->data['cookies_type'] === 'alternative') {
|
71 |
AltSessions::set($name, $value);
|
72 |
} else {
|
73 |
self::setNativeCookie(apbct__get_cookie_prefix() . $name, $value, $expires, $path, $domain, $secure, $httponly, $samesite);
|
74 |
}
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -151,7 +160,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
|
|
151 |
$visible_fields_collection[$prepared_key] = $prepared_value;
|
152 |
}
|
153 |
} else {
|
154 |
-
// Get from alt cookies storage
|
155 |
$visible_fields_collection = (array) self::get('apbct_visible_fields');
|
156 |
}
|
157 |
|
25 |
$value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
|
26 |
}
|
27 |
// The old way
|
28 |
+
} else if ( isset($_COOKIE[$name]) ) {
|
29 |
$value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
|
30 |
+
//NoCookies
|
31 |
+
} else if ( $apbct->data['cookies_type'] === 'none' ) {
|
32 |
+
$value = NoCookie::get($name);
|
33 |
} else {
|
34 |
$value = '';
|
35 |
}
|
45 |
|
46 |
/**
|
47 |
* Universal method to adding cookies
|
48 |
+
* Using Alternative Sessions or native cookies or NoCookie handler depends on settings
|
49 |
*
|
50 |
* @param string $name
|
51 |
* @param string $value
|
55 |
* @param bool|null $secure
|
56 |
* @param bool $httponly
|
57 |
* @param string $samesite
|
58 |
+
* @param bool $no_cookie_to_db
|
59 |
+
* @psalm-suppress PossiblyUnusedReturnValue
|
60 |
+
* @psalm-suppress ImplementedReturnTypeMismatch
|
61 |
+
* @return bool
|
62 |
*/
|
63 |
public static function set(
|
64 |
$name,
|
68 |
$domain = '',
|
69 |
$secure = null,
|
70 |
$httponly = false,
|
71 |
+
$samesite = 'Lax',
|
72 |
+
$no_cookie_to_db = false
|
73 |
) {
|
74 |
global $apbct;
|
75 |
+
//select handling way to set cookie data in dependence of cookie type in the settings
|
76 |
if ($apbct->data['cookies_type'] === 'none' && ! is_admin()) {
|
77 |
+
return NoCookie::set($name, $value, $no_cookie_to_db);
|
78 |
} elseif ($apbct->data['cookies_type'] === 'alternative') {
|
79 |
AltSessions::set($name, $value);
|
80 |
} else {
|
81 |
self::setNativeCookie(apbct__get_cookie_prefix() . $name, $value, $expires, $path, $domain, $secure, $httponly, $samesite);
|
82 |
}
|
83 |
+
return true;
|
84 |
}
|
85 |
|
86 |
/**
|
160 |
$visible_fields_collection[$prepared_key] = $prepared_value;
|
161 |
}
|
162 |
} else {
|
163 |
+
// Get from alt cookies storage or NoCookie storage
|
164 |
$visible_fields_collection = (array) self::get('apbct_visible_fields');
|
165 |
}
|
166 |
|
lib/Cleantalk/ApbctWP/Variables/NoCookie.php
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Cleantalk\ApbctWP\Variables;
|
4 |
+
|
5 |
+
use Cleantalk\ApbctWP\Helper;
|
6 |
+
use Cleantalk\Variables\Post;
|
7 |
+
use Cleantalk\Variables\Server;
|
8 |
+
|
9 |
+
class NoCookie
|
10 |
+
{
|
11 |
+
public static $sessions_already_cleaned = false;
|
12 |
+
|
13 |
+
public static $no_cookies_data = array();
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get the session ID for saving data to the DB.
|
17 |
+
* @return false|string
|
18 |
+
*/
|
19 |
+
public static function getID()
|
20 |
+
{
|
21 |
+
$id = Helper::ipGet()
|
22 |
+
. Server::get('HTTP_USER_AGENT')
|
23 |
+
. Server::get('HTTP_ACCEPT_LANGUAGE');
|
24 |
+
|
25 |
+
return hash('sha256', $id);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Set value of NoCookie data. If $save_to_db flag is set then save it to NoCookie database,
|
30 |
+
* else just save to the static prop $no_cookies_data. Returns result of operation.
|
31 |
+
* @param $name
|
32 |
+
* @param $value
|
33 |
+
* @param bool $save_to_db
|
34 |
+
* @return bool
|
35 |
+
*/
|
36 |
+
public static function set($name, $value, $save_to_db = false)
|
37 |
+
{
|
38 |
+
|
39 |
+
if ( is_int($value) ) {
|
40 |
+
$value = (string)$value;
|
41 |
+
}
|
42 |
+
|
43 |
+
// Bad incoming data
|
44 |
+
if ( !$name
|
45 |
+
|| ( empty($value) && $value !== "0" )
|
46 |
+
|| is_array($value)
|
47 |
+
|| is_array($name)
|
48 |
+
) {
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( !$save_to_db ) {
|
53 |
+
self::$no_cookies_data[$name] = $value;
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
|
57 |
+
self::cleanFromOld();
|
58 |
+
|
59 |
+
global $wpdb;
|
60 |
+
|
61 |
+
$session_id = self::getID();
|
62 |
+
|
63 |
+
$previous_value = self::get($name);
|
64 |
+
|
65 |
+
return $wpdb->query(
|
66 |
+
$wpdb->prepare(
|
67 |
+
'INSERT INTO ' . APBCT_TBL_NO_COOKIE . '
|
68 |
+
(id, name, value, last_update, prev_value)
|
69 |
+
VALUES (%s, %s, %s, %s, %s)
|
70 |
+
ON DUPLICATE KEY UPDATE
|
71 |
+
value = %s,
|
72 |
+
last_update = %s,
|
73 |
+
prev_value =%s',
|
74 |
+
$session_id,
|
75 |
+
$name,
|
76 |
+
$value,
|
77 |
+
date('Y-m-d H:i:s'),
|
78 |
+
$previous_value,
|
79 |
+
$value,
|
80 |
+
date('Y-m-d H:i:s'),
|
81 |
+
$previous_value
|
82 |
+
)
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Get NoCookie data from static prop $no_cookies_data,
|
88 |
+
* if there is no such $name found try to search this in the DB.
|
89 |
+
* @param $name string
|
90 |
+
* @return false|mixed|string
|
91 |
+
*/
|
92 |
+
public static function get($name)
|
93 |
+
{
|
94 |
+
|
95 |
+
// Bad incoming data
|
96 |
+
if ( !$name
|
97 |
+
||
|
98 |
+
!is_string($name)
|
99 |
+
) {
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
|
103 |
+
if ( isset(self::$no_cookies_data[$name]) ) {
|
104 |
+
return self::$no_cookies_data[$name];
|
105 |
+
}
|
106 |
+
|
107 |
+
self::cleanFromOld();
|
108 |
+
|
109 |
+
global $wpdb;
|
110 |
+
|
111 |
+
$session_id = self::getID();
|
112 |
+
$result = $wpdb->get_row(
|
113 |
+
$wpdb->prepare(
|
114 |
+
'SELECT value
|
115 |
+
FROM `' . APBCT_TBL_NO_COOKIE . '`
|
116 |
+
WHERE id = %s AND name = %s;',
|
117 |
+
$session_id,
|
118 |
+
$name
|
119 |
+
),
|
120 |
+
ARRAY_A
|
121 |
+
);
|
122 |
+
|
123 |
+
return isset($result['value']) ? $result['value'] : '';
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Check POST for data transferred via ct_no_cookie_hidden_field, handle them then
|
129 |
+
* @return bool
|
130 |
+
*/
|
131 |
+
public static function setDataFromHiddenField()
|
132 |
+
{
|
133 |
+
if ( Post::get('ct_no_cookie_hidden_field') ) {
|
134 |
+
$data = Post::get('ct_no_cookie_hidden_field');
|
135 |
+
unset($_POST['ct_no_cookie_hidden_field']);
|
136 |
+
$data = base64_decode($data);
|
137 |
+
if ( $data ) {
|
138 |
+
$data = json_decode($data, true);
|
139 |
+
if ( !empty($data) && is_array($data) ) {
|
140 |
+
self::$no_cookies_data = array_merge(self::$no_cookies_data, $data);
|
141 |
+
return true;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Clean NoCookie table if random of APBCT_SEESION__CHANCE_TO_CLEAN fired
|
151 |
+
*/
|
152 |
+
public static function cleanFromOld()
|
153 |
+
{
|
154 |
+
global $wpdb;
|
155 |
+
|
156 |
+
if ( !self::$sessions_already_cleaned && rand(0, 1000) < APBCT_SEESION__CHANCE_TO_CLEAN ) {
|
157 |
+
self::$sessions_already_cleaned = true;
|
158 |
+
|
159 |
+
$wpdb->query(
|
160 |
+
'DELETE
|
161 |
+
FROM `' . APBCT_TBL_NO_COOKIE . '`
|
162 |
+
WHERE last_update < NOW() - INTERVAL ' . APBCT_SEESION__LIVE_TIME . ' SECOND
|
163 |
+
LIMIT 100000;'
|
164 |
+
);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Wipe NoCookie data
|
170 |
+
*/
|
171 |
+
public static function wipe()
|
172 |
+
{
|
173 |
+
//clear nodb data
|
174 |
+
self::$no_cookies_data = array();
|
175 |
+
|
176 |
+
global $wpdb;
|
177 |
+
//clear table
|
178 |
+
$wpdb->query(
|
179 |
+
'TRUNCATE TABLE ' . APBCT_TBL_NO_COOKIE . ';'
|
180 |
+
);
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Get NoCookie data from table to localize it in JS scripts
|
185 |
+
* @return array
|
186 |
+
*/
|
187 |
+
public static function preloadForScripts()
|
188 |
+
{
|
189 |
+
|
190 |
+
global $wpdb;
|
191 |
+
|
192 |
+
$session_id = self::getID();
|
193 |
+
$result = $wpdb->get_results(
|
194 |
+
$wpdb->prepare(
|
195 |
+
'SELECT *
|
196 |
+
FROM `' . APBCT_TBL_NO_COOKIE . '`
|
197 |
+
WHERE id = %s;',
|
198 |
+
$session_id
|
199 |
+
),
|
200 |
+
ARRAY_A
|
201 |
+
);
|
202 |
+
|
203 |
+
//keep previous value to use them before NoCookies handler loaded
|
204 |
+
foreach ( array_values($result) as $no_cookie_db_value ) {
|
205 |
+
self::set($no_cookie_db_value['name'], $no_cookie_db_value['prev_value']);
|
206 |
+
}
|
207 |
+
|
208 |
+
return self::$no_cookies_data;
|
209 |
+
}
|
210 |
+
}
|
lib/Cleantalk/Common/Helper.php
CHANGED
@@ -49,14 +49,15 @@ class Helper
|
|
49 |
*/
|
50 |
public static $cleantalks_servers = array(
|
51 |
// MODERATE
|
52 |
-
'https://moderate1.cleantalk.org' => '
|
53 |
-
'https://moderate2.cleantalk.org' => '
|
54 |
'https://moderate3.cleantalk.org' => '88.198.153.60',
|
55 |
'https://moderate4.cleantalk.org' => '159.69.51.30',
|
56 |
'https://moderate5.cleantalk.org' => '95.216.200.119',
|
57 |
-
'https://moderate6.cleantalk.org' => '
|
58 |
-
'https://
|
59 |
'https://moderate9.cleantalk.org' => '51.81.55.251',
|
|
|
60 |
|
61 |
// APIX
|
62 |
'https://apix1.cleantalk.org' => '35.158.52.161',
|
49 |
*/
|
50 |
public static $cleantalks_servers = array(
|
51 |
// MODERATE
|
52 |
+
'https://moderate1.cleantalk.org' => '143.198.237.245',
|
53 |
+
'https://moderate2.cleantalk.org' => '167.71.167.197',
|
54 |
'https://moderate3.cleantalk.org' => '88.198.153.60',
|
55 |
'https://moderate4.cleantalk.org' => '159.69.51.30',
|
56 |
'https://moderate5.cleantalk.org' => '95.216.200.119',
|
57 |
+
'https://moderate6.cleantalk.org' => '143.244.187.11',
|
58 |
+
'https://moderate7.cleantalk.org' => '168.119.82.149',
|
59 |
'https://moderate9.cleantalk.org' => '51.81.55.251',
|
60 |
+
'https://moderate10.cleantalk.org' => '5.9.221.162',
|
61 |
|
62 |
// APIX
|
63 |
'https://apix1.cleantalk.org' => '35.158.52.161',
|
lib/Cleantalk/Common/Schema.php
CHANGED
@@ -66,6 +66,15 @@ class Schema
|
|
66 |
'__indexes' => 'PRIMARY KEY (`name`(40), `id`(64))',
|
67 |
'__createkey' => 'VARCHAR(64) NOT NULL primary KEY FIRST'
|
68 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
'spamscan_logs' => array(
|
70 |
'id' => 'INT NOT NULL AUTO_INCREMENT',
|
71 |
'scan_type' => 'VARCHAR(11) NOT NULL',
|
66 |
'__indexes' => 'PRIMARY KEY (`name`(40), `id`(64))',
|
67 |
'__createkey' => 'VARCHAR(64) NOT NULL primary KEY FIRST'
|
68 |
),
|
69 |
+
'no_cookie_data' => array(
|
70 |
+
'id' => 'VARCHAR(64) NOT NULL',
|
71 |
+
'name' => 'VARCHAR(40) NOT NULL',
|
72 |
+
'value' => 'TEXT NULL DEFAULT NULL',
|
73 |
+
'last_update' => 'DATETIME NULL DEFAULT NULL',
|
74 |
+
'prev_value' => 'TEXT NULL DEFAULT NULL',
|
75 |
+
'__indexes' => 'PRIMARY KEY (`name`(40), `id`(64))',
|
76 |
+
'__createkey' => 'VARCHAR(64) NOT NULL primary KEY FIRST'
|
77 |
+
),
|
78 |
'spamscan_logs' => array(
|
79 |
'id' => 'INT NOT NULL AUTO_INCREMENT',
|
80 |
'scan_type' => 'VARCHAR(11) NOT NULL',
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
|
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 5.
|
8 |
License: GPLv2
|
9 |
|
10 |
Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
@@ -602,6 +602,36 @@ If your website has forms that send data to external sources, you can enable opt
|
|
602 |
|
603 |
== Changelog ==
|
604 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
= 5.184 Sep 08 2022 =
|
606 |
#### Settings interface fixed, Email Encoder improved, jQuery dependency removed and some minor issues fixed.
|
607 |
* New. cleantalk-admin-settings-page.js. Higlight access key field on key typos and do warn user.
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 5.185
|
8 |
License: GPLv2
|
9 |
|
10 |
Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
602 |
|
603 |
== Changelog ==
|
604 |
|
605 |
+
= 5.185 Sep 22 2022 =
|
606 |
+
#### NoCookie data collection, new admin notices style, external forms logic improved and many minor issues fixed.
|
607 |
+
* New. NoCookie data collection.
|
608 |
+
* New style admin notices
|
609 |
+
* Upd. Settings. Email encoder setting duplicated on the top level place.
|
610 |
+
* Fix: Fixed SFW looping with alternative cookies
|
611 |
+
* Fix: Changed hook for EventsManager
|
612 |
+
* Fix: Changed option description
|
613 |
+
* Fix. External forms. JS logic fixed.
|
614 |
+
* Fix. Cookies. Skip cookies setup on favicon loading.
|
615 |
+
* Fix. HttpRequest. Error string offset fix due request error handling.
|
616 |
+
* Fix: Fixed AdminNotices->is_cleantalk_page
|
617 |
+
* Fix. Common. Rotating moderate-server via cron job fixed.
|
618 |
+
* Fix. Common. Moderate servers details updated.
|
619 |
+
* Fix. Email encoder. An ability to decode again implemented if an error was occurred.
|
620 |
+
* Fix. GDPR. Contact form 7 integration fixed and upgraded.
|
621 |
+
* Fix. ct_ajax_hook(). ProfileGrid AJAX actions skipped.
|
622 |
+
* Fix. Connection report. Option implemented.
|
623 |
+
* Fix. Integrations. Formidable forms item_meta handling.
|
624 |
+
* Mod: Added clearing AC table from AC logs once a day
|
625 |
+
* Fix. Debugging logic. Now drops debug data correct.
|
626 |
+
* Mod. AltSessions. Now sends and parse cookies data as JSON.
|
627 |
+
* Fix. AltCookies. Getting some parameters fixed.
|
628 |
+
* New. MemberPress integration.
|
629 |
+
* Fix. Cookie. Mouse/scrolling cookie storing fixed.
|
630 |
+
* Fix. AltCookies. Correct handle types before save to DB when value is false.
|
631 |
+
* Mod. Ajax/Rest selection. Now check if REST route provide a JSON string.
|
632 |
+
* Fix. AltCookies. AltSession JSON handling fix.
|
633 |
+
* Fix. Common. 'no_cookie_data_taken' notice fixed.
|
634 |
+
|
635 |
= 5.184 Sep 08 2022 =
|
636 |
#### Settings interface fixed, Email Encoder improved, jQuery dependency removed and some minor issues fixed.
|
637 |
* New. cleantalk-admin-settings-page.js. Higlight access key field on key typos and do warn user.
|