diff --git a/css/cleantalk-admin.min.css b/css/cleantalk-admin.min.css index fcf8ecc5..e9baffb6 100644 --- a/css/cleantalk-admin.min.css +++ b/css/cleantalk-admin.min.css @@ -1 +1 @@ -.cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.apbct_bottom_links--left{margin-right:2pc}.apbct_bottom_links--other{margin-right:2pc;margin-left:2pc}.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}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}.apbct-restore-spam-order-button{cursor:pointer}.ct-modal-buttons{display:flex;align-items:center;padding:20px 0;justify-content:space-between}.ct-modal-message{font-weight:700;font-size:16px;line-height:2rem}.apbct-popup-fade:before{content:'';background:#000;position:fixed;left:0;top:0;width:100%;height:100%;opacity:.7;z-index:9999}.apbct-popup{position:fixed;top:20%;left:50%;padding:20px;width:360px;margin-left:-200px;background:#fff;border:1px solid;border-radius:4px;z-index:99999;opacity:1} \ No newline at end of file +.cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.apbct_bottom_links--left{margin-right:2pc}.apbct_bottom_links--other{margin-right:2pc;margin-left:2pc}.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}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}.apbct-restore-spam-order-button{cursor:pointer}.ct-modal-buttons{display:flex;align-items:center;padding:20px 0;justify-content:space-between}.ct-modal-message{font-weight:700;font-size:16px;line-height:2rem}.apbct-popup-fade:before{content:'';background:#000;position:fixed;left:0;top:0;width:100%;height:100%;opacity:.7;z-index:9999}.apbct-popup{position:fixed;top:20%;left:50%;padding:20px;width:360px;margin-left:-200px;background:#fff;border:1px solid;border-radius:4px;z-index:99999;opacity:1}.apbct-table-actions-wrapper{background:#FСFСFС;border-radius:2px;padding:5px!important;border:1px solid #d3d3d3;margin:0 5px 0 0} \ No newline at end of file diff --git a/css/src/cleantalk-admin.css b/css/src/cleantalk-admin.css index 73d33a38..e5d37304 100644 --- a/css/src/cleantalk-admin.css +++ b/css/src/cleantalk-admin.css @@ -11,18 +11,18 @@ } /* Additional styles for admin pages */ .ct_meta_links{ - + } .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; @@ -137,4 +137,12 @@ border-radius: 4px; z-index: 99999; opacity: 1; -} \ No newline at end of file +} + +.apbct-table-actions-wrapper { + background: #FСFСFС; + border-radius: 2px; + padding: 5px !important; + border: 1px solid lightgray; + margin: 0 5px 0 0;; +} diff --git a/js/cleantalk-users-checkspam.min.js b/js/cleantalk-users-checkspam.min.js index 2cd636af..427878bf 100644 --- a/js/cleantalk-users-checkspam.min.js +++ b/js/cleantalk-users-checkspam.min.js @@ -1,2 +1,2 @@ -String.prototype.printf=function(){var e,t=this;for(e in arguments)var c=t.substring(0,t.indexOf("%s",0)),a=t.substring(t.indexOf("%s",0)+2,t.length),t=c+arguments[e]+a;return t};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"string"==typeof(r="none"===(r=r||["apbct_","ct_"])?null:r)&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0,c=(jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val()),"https:"===location.protocol?"; secure":""),c=(document.cookie="apbct_check_users_offset=0; path=/; samesite=lax"+c,{action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag)if(!0===ct_pause){ct_working=!1,jQuery("#ct_working_message").hide();let e="users.php?page=ct_check_users&ct_worked=1";0!==ct_date_from&&0!==ct_date_till&&(e+="&from="+ct_date_from+"&till="+ct_date_till),void(location.href=e)}else{var a,e;ct_max_requests<=ct_requests_counter?(setTimeout(ct_cooling_down_toggle,ct_cool_down_time),ct_cooling_down_flag=!(ct_requests_counter=0)):(ct_requests_counter++,a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random(),offset:Number(getCookie("apbct_check_users_offset"))},ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,t=(t=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\n\t\t\t\t\tvar offset = Number(getCookie('apbct_check_users_offset')) + 100;\n\t\t\t\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\t\t\t\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + offset + \"; path=/; samesite=lax\" + ctSecure;\n\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tif(check_amount > 20){\n\t\t\t\tcheck_amount -= 20;\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\n\t\t\t}\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\n\tif( ct_working ){\n\n\t\tif(ct_cooling_down_flag === true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\n\t\t\treturn;\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\n\t\tif( ! ct_users_total ){\n\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce,\n\t\t\t\t'no_cache': Math.random()\n\t\t\t};\n\n\t\t\tif( ct_date_from && ct_date_till ){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\n// Main function of checking\nfunction ct_start_check( continue_check ){\n\n\tcontinue_check = continue_check || null;\n\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\n\t\t\talert(ctUsersCheck.ct_specify_date_range);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\tct_accurate_check = true;\n\t}\n\n\t//\n\tif (\n\t\tjQuery('#ct_accurate_check').is(':checked') &&\n\t\t! jQuery('#ct_allow_date_range').is(':checked')\n\t) {\n\t\talert(ctUsersCheck.ct_select_date_range);\n\t\treturn;\n\t}\n\n\tjQuery('.ct_to_hide').hide();\n\tjQuery('#ct_working_message').show();\n\tjQuery('#ct_preloader').show();\n\tjQuery('#ct_pause').show();\n\n\tct_working = true;\n\n\tif( continue_check ){\n\t\tct_show_users_info();\n\t\tct_send_users();\n\t} else {\n\t\tct_clear_users();\n\t}\n\n}\n\nfunction ct_delete_all_users( e ){\n\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users( e, data );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Setting dependences\n\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\tct_pause = false;\n\n\t\t//\n\n\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_pause = false;\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve',\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\n\t});\n\n\t// Request to Download CSV file.\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery('.' + e.target.id).addClass('disabled');\n\t\tjQuery('.spinner').css('visibility', 'visible');\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif( parseInt(msg) === 0 ) {\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\t} else {\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\n\n\t\t\t\t\tvar dummy = document.createElement('a');\n\t\t\t\t\tdummy.href = url;\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\n\n\t\t\t\t\tdocument.body.appendChild(dummy);\n\t\t\t\t\tdummy.click();\n\t\t\t\t}\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t}\n\t\t});\n\t});\n\n\t// Delete inserted users\n\tjQuery(\".ct_insert_users\").click(function( e ){\n\t\tct_insert_users();\n\t});\n\n\t// Insert users\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\n\t\tct_insert_users( true );\n\t});\n\n\t// Delete all spam users\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\n\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\n\t\t\treturn false;\n\n\t\tct_delete_all_users( e );\n\n\t});\n\n\tfunction ct_insert_users(delete_accounts){\n\n\t\tdelete_accounts = delete_accounts || null;\n\n\t\tvar data = {\n\t\t\t'action': 'ajax_insert_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\n\t\tif(delete_accounts)\n\t\t\tdata['delete'] = true;\n\n\t\tlet waitingPopup = document.createElement('div');\n\t\twaitingPopup.setAttribute('class', 'apbct-popup');\n\t\twaitingPopup.setAttribute('id', 'apbct_popup');\n\t\twaitingPopup.setAttribute('style', 'font-size: 20px');\n\t\twaitingPopup.innerText = 'Wait for users handling!..'\n\t\tdocument.body.append(waitingPopup);\n\t\tdocument.body.classList.add('apbct-popup-fade');\n\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(delete_accounts)\n\t\t\t\t\talert('Deleted ' + msg + ' users');\n\t\t\t\telse\n\t\t\t\t\talert('Inserted ' + msg + ' users');\n\t\t\t\tjQuery('#apbct_popup')[0].remove()\n\t\t\t\tdocument.body.classList.remove('apbct-popup-fade');\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t});\n\t}\n\n\n\t/**\n\t * Checked ct_accurate_check\n\t */\n\tjQuery('#ct_accurate_check').change(function () {\n\t\tif(this.checked) {\n\t\t\tjQuery('#ct_allow_date_range').prop('checked', true);\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t}\n\t});\n});\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction getCookie(name) {\n\tlet matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\n// Binds the bulk action events to the submit buttons.\n// This code has been copied from wordpress core js file wp-admin/js/media.js:184\njQuery( '#doaction' ).on( 'click', function( event ) {\n\t/*\n * Handle the bulk action based on its value.\n */\n\tjQuery( 'select[name=\"action\"]' ).each( function() {\n\t\tvar optionValue = jQuery( this ).val();\n\t\tif ( 'delete' === optionValue ) {\n\t\t\tif ( ! showNotice.warn() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t});\n});\n"],"names":["String","prototype","printf","arg","formatted","this","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","ctSecure","is","val","location","protocol","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","hide","let","new_href","href","check_amount","setTimeout","new_check","unchecked","amount","offset","Number","getCookie","parseJSON","parseInt","error","confirm","error_message","end","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_specify_date_range","ct_select_date_range","ct_delete_all_users","e","target","addClass","css","removeClass","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","waitingPopup","createElement","setAttribute","innerText","body","append","classList","add","remove","window","reload","click","ct_check","accurate","JSON","stringify","ct_id","fadeOut","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","download","appendChild","ct_confirm_deletion_all","change","event","each","showNotice","warn","preventDefault"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,Q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,CAC9C,CACD,CAAC,CACF,CAAC,EAGDvE,OAAO,kBAAkB,EAAEiH,MAAM,SAAU7C,GAC1CgC,EAAgB,CACjB,CAAC,EAGDpG,OAAO,0BAA0B,EAAEiH,MAAM,SAAU7C,GAClDgC,EAAiB,CAAA,CAAK,CACvB,CAAC,EAGDpG,OAAO,sBAAsB,EAAEiH,MAAM,SAAU7C,GAE9C,GAAK,CAAE5B,QAASvE,aAAakK,uBAAwB,EACpD,MAAO,CAAA,EAERhE,oBAAqBC,CAAE,CAExB,CAAC,EA2CDpE,OAAO,oBAAoB,EAAEoI,OAAO,WAChCnL,KAAK0F,UACP3C,OAAO,sBAAsB,EAAE4D,KAAK,UAAW,CAAA,CAAI,EACnD5D,OAAO,UAAU,EAAE4D,KAAK,UAAW,CAAA,CAAI,EAAEqB,KAAK,WAAW,CAAA,CAAK,EAEhE,CAAC,CACF,CAAC,EAgBDjF,OAAQ,WAAY,EAAEgF,GAAI,QAAS,SAAUqD,GAI5CrI,OAAQ,uBAAwB,EAAEsI,KAAM,WAElC,WADatI,OAAQ/C,IAAK,EAAEsD,IAAI,GAE7BgI,WAAWC,KAAK,GACtBH,EAAMI,eAAe,CAGxB,CAAC,CACF,CAAC"} \ No newline at end of file +{"version":3,"file":"cleantalk-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Set deafult amount to check by request.\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\n\tct_prev_from = ctUsersCheck.ct_prev_from,\n\tct_prev_till = ctUsersCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\n\tct_users_total = 0,\n\tct_users_checked = 0,\n\tct_users_spam = 0,\n\tct_users_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes === 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\nfunction apbct_get_cookie( name ){\n\tvar cookie = apbct_cookie__get( name, name );\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\n\t\treturn cookie[name];\n\t}else\n\t\treturn null;\n}\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to === 0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_users(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\n\tvar data = {\n\t\t'action' : 'ajax_clear_users',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}\n\t});\n\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_users();\n\tct_show_users_info();\n}\n\nfunction ct_send_users(){\n\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\tif (ct_pause === true) {\n\t\tct_working=false;\n\t\tjQuery('#ct_working_message').hide();\n\t\tlet new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\tif(ct_date_from !== 0 && ct_date_till !== 0)\n\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\tlocation.href = new_href;\n\t\treturn;\n\t}\n\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\n\n\tvar data = {\n\t\taction: 'ajax_check_users',\n\t\tsecurity: ct_ajax_nonce,\n\t\tnew_check: ct_new_check,\n\t\tunchecked: ct_unchecked,\n\t\tamount: check_amount,\n\t\t'no_cache': Math.random(),\n\t\t'offset' : Number(getCookie('apbct_check_users_offset'))\n\t};\n\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\n\t\t\tmsg = jQuery.parseJSON(msg);\n\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_users();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\n\t\t\t\t\tct_users_bad = parseInt( msg.bad );\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\n\t\t\t\t\tstatus_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\n\t\t\t\t\tvar offset = Number(getCookie('apbct_check_users_offset')) + 100;\n\t\t\t\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\t\t\t\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + offset + \"; path=/; samesite=lax\" + ctSecure;\n\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tif(check_amount > 20){\n\t\t\t\tcheck_amount -= 20;\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\n\t\t\t}\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\n\tif( ct_working ){\n\n\t\tif(ct_cooling_down_flag === true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\n\t\t\treturn;\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\n\t\tif( ! ct_users_total ){\n\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce,\n\t\t\t\t'no_cache': Math.random()\n\t\t\t};\n\n\t\t\tif( ct_date_from && ct_date_till ){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\n// Main function of checking\nfunction ct_start_check( continue_check ){\n\n\tcontinue_check = continue_check || null;\n\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\n\t\t\talert(ctUsersCheck.ct_specify_date_range);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\tct_accurate_check = true;\n\t}\n\n\t//\n\tif (\n\t\tjQuery('#ct_accurate_check').is(':checked') &&\n\t\t! jQuery('#ct_allow_date_range').is(':checked')\n\t) {\n\t\talert(ctUsersCheck.ct_select_date_range);\n\t\treturn;\n\t}\n\n\tjQuery('.ct_to_hide').hide();\n\tjQuery('#ct_working_message').show();\n\tjQuery('#ct_preloader').show();\n\tjQuery('#ct_pause').show();\n\n\tct_working = true;\n\n\tif( continue_check ){\n\t\tct_show_users_info();\n\t\tct_send_users();\n\t} else {\n\t\tct_clear_users();\n\t}\n\n}\n\nfunction ct_delete_all_users( e ){\n\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users( e, data );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Setting dependences\n\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\tct_pause = false;\n\n\t\t//\n\n\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_pause = false;\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve',\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\n\t});\n\n\t// Request to Download CSV file.\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery('.' + e.target.id).addClass('disabled');\n\t\tjQuery('.spinner').css('visibility', 'visible');\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif( parseInt(msg) === 0 ) {\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\t} else {\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\n\n\t\t\t\t\tvar dummy = document.createElement('a');\n\t\t\t\t\tdummy.href = url;\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\n\n\t\t\t\t\tdocument.body.appendChild(dummy);\n\t\t\t\t\tdummy.click();\n\t\t\t\t}\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t}\n\t\t});\n\t});\n\n\t// Delete inserted users\n\tjQuery(\".ct_insert_users\").click(function( e ){\n\t\tct_insert_users();\n\t});\n\n\t// Insert users\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\n\t\tct_insert_users( true );\n\t});\n\n\t// Delete all spam users\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\n\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\n\t\t\treturn false;\n\n\t\tct_delete_all_users( e );\n\n\t});\n\n\tfunction ct_insert_users(delete_accounts){\n\n\t\tdelete_accounts = delete_accounts || null;\n\n\t\tvar data = {\n\t\t\t'action': 'ajax_insert_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\n\t\tif(delete_accounts)\n\t\t\tdata['delete'] = true;\n\n\t\tlet waitingPopup = document.createElement('div');\n\t\twaitingPopup.setAttribute('class', 'apbct-popup');\n\t\twaitingPopup.setAttribute('id', 'apbct_popup');\n\t\twaitingPopup.setAttribute('style', 'font-size: 20px');\n\t\twaitingPopup.innerText = 'Wait for users handling!..'\n\t\tdocument.body.append(waitingPopup);\n\t\tdocument.body.classList.add('apbct-popup-fade');\n\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(delete_accounts)\n\t\t\t\t\talert('Deleted ' + msg + ' users');\n\t\t\t\telse\n\t\t\t\t\talert('Inserted ' + msg + ' users');\n\t\t\t\tjQuery('#apbct_popup')[0].remove()\n\t\t\t\tdocument.body.classList.remove('apbct-popup-fade');\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t});\n\t}\n\n\n\t/**\n\t * Checked ct_accurate_check\n\t */\n\tjQuery('#ct_accurate_check').change(function () {\n\t\tif(this.checked) {\n\t\t\tjQuery('#ct_allow_date_range').prop('checked', true);\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t}\n\t});\n\n\t/**\n\t * Usres ordering JS actions\n\t */\n\tjQuery('#ct_users_ordering').on('click', function(event) {\n\t\tevent.preventDefault();\n\t\t/*\n * Handle the bulk action based on its value.\n */\n\t\tconst value = jQuery( '#ct_users_order_by' ).val();\n\t\tconst _expires = 'expires=' + new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toUTCString();\n\t\tdocument.cookie = 'ct_users_order_by' +\n\t\t\t'=' +\n\t\t\tencodeURIComponent(value) +\n\t\t\t'; ' +\n\t\t\t_expires +\n\t\t\t'path=/; samesite=lax';\n\n\t\tconst direction = jQuery( '#ct_users_order_direction' ).val();\n\t\tdocument.cookie = 'ct_users_order_direction' +\n\t\t\t'=' +\n\t\t\tencodeURIComponent(direction) +\n\t\t\t'; ' +\n\t\t\t_expires +\n\t\t\t'path=/; samesite=lax';\n\n\t\twindow.location.reload()\n\t});\n\n\tif (getCookie('ct_users_order_by')) {\n\t\tjQuery('#ct_users_order_by').val(getCookie('ct_users_order_by'));\n\t}\n\n\tif (getCookie('ct_users_order_direction')) {\n\t\tjQuery('#ct_users_order_direction').val(getCookie('ct_users_order_direction'));\n\t}\n});\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction getCookie(name) {\n\tlet matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}\n\n// Binds the bulk action events to the submit buttons.\n// This code has been copied from wordpress core js file wp-admin/js/media.js:184\njQuery( '#doaction' ).on( 'click', function( event ) {\n\t/*\n * Handle the bulk action based on its value.\n */\n\tjQuery( 'select[name=\"action\"]' ).each( function() {\n\t\tvar optionValue = jQuery( this ).val();\n\t\tif ( 'delete' === optionValue ) {\n\t\t\tif ( ! showNotice.warn() ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t});\n});\n"],"names":["String","prototype","printf","arg","formatted","this","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","ctSecure","is","val","location","protocol","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","hide","let","new_href","href","check_amount","setTimeout","new_check","unchecked","amount","offset","Number","getCookie","parseJSON","parseInt","error","confirm","error_message","end","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_specify_date_range","ct_select_date_range","ct_delete_all_users","e","target","addClass","css","removeClass","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","waitingPopup","createElement","setAttribute","innerText","body","append","classList","add","remove","window","reload","click","ct_check","accurate","JSON","stringify","ct_id","fadeOut","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","download","appendChild","ct_confirm_deletion_all","change","event","preventDefault","value","_expires","Date","now","toUTCString","direction","encodeURIComponent","each","showNotice","warn"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,QAAQ,KAAM,CAAC,CAAC,EACpEC,EAAmBN,EAAUI,UAAUJ,EAAUK,QAAQ,KAAM,CAAC,EAAE,EAAGL,EAAUO,MAAM,EACzFP,EAAYG,EAAmBD,UAAUH,GAAOO,EAE9C,OAAON,CACX,EAMA,IAAIQ,WAAa,EAHjBC,SAASC,OAAS,oDAIjBC,aAAe,CAAA,EACfC,qBAAuB,CAAA,EACvBC,iBAAmB,CAAA,EACnBC,kBAAoB,CAAA,EACpBC,SAAW,CAAA,EACXC,iBAAmBC,aAAaD,iBAChCE,aAAm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AAO,oBAAoB,EAAEoI,OAAO,WAChCnL,KAAK0F,UACP3C,OAAO,sBAAsB,EAAE4D,KAAK,UAAW,CAAA,CAAI,EACnD5D,OAAO,UAAU,EAAE4D,KAAK,UAAW,CAAA,CAAI,EAAEqB,KAAK,WAAW,CAAA,CAAK,EAEhE,CAAC,EAKDjF,OAAO,oBAAoB,EAAEgF,GAAG,QAAS,SAASqD,GACjDA,EAAMC,eAAe,EAIrB,IAAMC,EAAQvI,OAAQ,oBAAqB,EAAEO,IAAI,EAC3CiI,EAAW,WAAa,IAAIC,KAAKA,KAAKC,IAAI,EAAI,OAAyB,EAAEC,YAAY,EAQrFC,GAPNnL,SAASC,OAAS,qBAEjBmL,mBAAmBN,CAAK,EACxB,KACAC,EACA,uBAEiBxI,OAAQ,2BAA4B,EAAEO,IAAI,GAC5D9C,SAASC,OAAS,4BAEjBmL,mBAAmBD,CAAS,EAC5B,KACAJ,EACA,uBAEDzB,OAAOvG,SAASwG,OAAO,CACxB,CAAC,EAEG5E,UAAU,mBAAmB,GAChCpC,OAAO,oBAAoB,EAAEO,IAAI6B,UAAU,mBAAmB,CAAC,EAG5DA,UAAU,0BAA0B,GACvCpC,OAAO,2BAA2B,EAAEO,IAAI6B,UAAU,0BAA0B,CAAC,CAE/E,CAAC,EAgBDpC,OAAQ,WAAY,EAAEgF,GAAI,QAAS,SAAUqD,GAI5CrI,OAAQ,uBAAwB,EAAE8I,KAAM,WAElC,WADa9I,OAAQ/C,IAAK,EAAEsD,IAAI,GAE7BwI,WAAWC,KAAK,GACtBX,EAAMC,eAAe,CAGxB,CAAC,CACF,CAAC"} \ No newline at end of file diff --git a/js/src/cleantalk-users-checkspam.js b/js/src/cleantalk-users-checkspam.js index b3cf9c4e..80477ba4 100644 --- a/js/src/cleantalk-users-checkspam.js +++ b/js/src/cleantalk-users-checkspam.js @@ -603,6 +603,42 @@ jQuery(document).ready(function(){ jQuery('.ct_date').prop('checked', true).attr('disabled',false); } }); + + /** + * Usres ordering JS actions + */ + jQuery('#ct_users_ordering').on('click', function(event) { + event.preventDefault(); + /* + * Handle the bulk action based on its value. + */ + const value = jQuery( '#ct_users_order_by' ).val(); + const _expires = 'expires=' + new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toUTCString(); + document.cookie = 'ct_users_order_by' + + '=' + + encodeURIComponent(value) + + '; ' + + _expires + + 'path=/; samesite=lax'; + + const direction = jQuery( '#ct_users_order_direction' ).val(); + document.cookie = 'ct_users_order_direction' + + '=' + + encodeURIComponent(direction) + + '; ' + + _expires + + 'path=/; samesite=lax'; + + window.location.reload() + }); + + if (getCookie('ct_users_order_by') && jQuery('#ct_users_order_by')) { + jQuery('#ct_users_order_by').val(getCookie('ct_users_order_by')); + } + + if (getCookie('ct_users_order_direction') && jQuery('#ct_users_order_direction')) { + jQuery('#ct_users_order_direction').val(getCookie('ct_users_order_direction')); + } }); /** diff --git a/lib/Cleantalk/ApbctWP/CleantalkListTable.php b/lib/Cleantalk/ApbctWP/CleantalkListTable.php index 4d3c22c8..a68f8457 100644 --- a/lib/Cleantalk/ApbctWP/CleantalkListTable.php +++ b/lib/Cleantalk/ApbctWP/CleantalkListTable.php @@ -992,9 +992,9 @@ protected function pagination( $which ) { $output .= "\n" . implode( "\n", $page_links ) . ''; if ( $total_pages ) { - $page_class = $total_pages < 2 ? ' one-page' : ''; + $page_class = $total_pages < 2 ? ' one-page apbct-table-actions-wrapper' : ' apbct-table-actions-wrapper'; } else { - $page_class = ' no-pages'; + $page_class = ' no-pages apbct-table-actions-wrapper'; } $this->_pagination = "
$output
"; @@ -1336,12 +1336,13 @@ protected function display_tablenav( $which ) {
has_items() ) : ?> -
+
bulk_actions( $which ); ?>
extra_tablenav( $which ); + echo ''; $this->pagination( $which ); ?> diff --git a/lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php b/lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php index 85f6c099..43b4bd33 100644 --- a/lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php +++ b/lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php @@ -51,15 +51,15 @@ public function extra_tablenav($which) // phpcs:ignore PSR1.Methods.CamelCapsMet $button_id_spam = ($which) ? "ct_spam_all_$which" : "ct_spam_all"; $button_id_trash = ($which) ? "ct_trash_all_$which" : "ct_trash_all"; ?> -
+
-
+ items[] = $items; } + + $this->items = static::sortItems($this->items); + } + + /** + * @param array $items + * + * @return array + */ + private static function sortItems($items) + { + try { + if (empty($items)) { + return $items; + } + if (isset($_COOKIE['ct_users_order_by'])) { + $order_by = Sanitize::cleanWord($_COOKIE['ct_users_order_by']); + if ( !in_array( + $order_by, + array('ct_id', 'ct_name', 'ct_email', 'ct_signed_up', 'ct_role', 'ct_posts', 'ct_orders') + ) ) { + $order_by = 'ct_id'; + } + } else { + $order_by = 'ct_id'; + } + + if (isset($_COOKIE['ct_users_order_direction'])) { + $order_direction = Sanitize::cleanWord($_COOKIE['ct_users_order_direction']); + $order_direction = $order_direction === 'desc' ? $order_direction : 'asc'; + } else { + $order_direction = 'asc'; + } + + $order_direction = $order_direction === 'asc' ? 1 : -1; + + usort($items, function ($a, $b) use ($order_by, $order_direction) { + return is_array($a) && is_array($b) && isset($a[$order_by], $b[$order_by]) + ? $order_direction * strcmp(TT::toString($a[$order_by]), TT::toString($b[$order_by])) + : 0; + }); + } catch (\Exception $e) { + return $items; + } + return $items; } public function extra_tablenav($which) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps { + if (empty($this->items)) { + return; + } + echo static::getExtraTableNav(); + } + + public static function getExtraTableNav() + { + //prepare sorting elements + $users = new UsersScan(); + $columns = $users->get_columns(); + unset($columns['cb']); + unset($columns['ct_id']); + unset($columns['ct_username']); + + $options = ''; + foreach ($columns as $key => $value) { + $options .= ''; + } + + $out = ''; + + $out .= '
'; + $out .= '' . __('Order users by', 'cleantalk-spam-protect') . ''; + $out .= ''; + + $out .= ''; + $out .= ''; + $out .= '
'; + + $out .= '
'; + $out .= ''; + + $out .= ''; + $out .= '
'; + return $out; + } + + public static function getExtraTableNavInsertDeleteUsers() + { + $out = ''; if ( isset($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] === '127.0.0.1' && in_array(Server::getDomain(), array('lc', 'loc', 'lh')) ) { - ?> - - - has_items() ) { - return; + $out .= '
'; + $out .= 'These actions available only for test purpose and buttons are visible only in local env:'; + $out .= ''; + $out .= ''; + $out .= '
'; } - ?> -
- - - -
- list_table = new UsersScan(); $this->getCurrentScanPanel($this); + echo UsersScan::getExtraTableNavInsertDeleteUsers(); echo '
'; $this->list_table->display(); echo '
'; @@ -577,8 +578,10 @@ public static function ctAjaxInsertUsers() // TEST INSERTION $to_insert = 500; + $query = 'SELECT network FROM `' . APBCT_TBL_FIREWALL_DATA . '` LIMIT ' . $to_insert . ';'; + $result = $wpdb->get_results( - 'SELECT network FROM `' . APBCT_TBL_FIREWALL_DATA . '` LIMIT ' . $to_insert . ';', + $query, ARRAY_A );