diff --git a/js/cleantalk-admin.min.js b/js/cleantalk-admin.min.js index 0e50afc1..a22460ca 100644 --- a/js/cleantalk-admin.min.js +++ b/js/cleantalk-admin.min.js @@ -1,4 +1,4 @@ -function ctFillDecodedEmailHandler(){document.body.classList.add("apbct-popup-fade");var e,t,n,a,o=document.getElementById("apbct_popup");o?(o.setAttribute("style","display: inherit"),document.getElementById("apbct_popup_text").innerHTML="Please wait while "+ctAdminCommon.plugin_name+" is decoding the email addresses."):((o=document.createElement("div")).setAttribute("class","apbct-popup apbct-email-encoder-popup"),o.setAttribute("id","apbct_popup"),(e=document.createElement("span")).classList="apbct-email-encoder-elements_center",(t=document.createElement("p")).innerText=ctAdminCommon.plugin_name,t.setAttribute("class","apbct-email-encoder--popup-header"),e.append(t),(t=document.createElement("div")).setAttribute("id","apbct_popup_text"),t.setAttribute("class","apbct-email-encoder-elements_center"),t.style.color="black",(n=document.createElement("p")).id="apbct_email_ecoder__popup_text_node_first",n.innerText="The magic is on the way, please wait for a few seconds!",n.setAttribute("class","apbct-email-encoder-elements_center"),(a=document.createElement("p")).id="apbct_email_ecoder__popup_text_node_second",a.innerText="Decoding process to the original data.",t.append(n),t.append(a),o.append(e),o.append(t),o.append(apbctSetEmailDecoderPopupAnimation()),document.body.append(o)),apbctAjaxEmailDecodeBulk(ctAdminCommon.encodedEmailNode)}function apbctSetEmailDecoderPopupAnimation(){var t=["apbct_dog_one","apbct_dog_two","apbct_dog_three"],n=document.createElement("div");n.classList="apbct-ee-animation-wrapper";for(let e=0;e{e.setAttribute("title",""),e.removeAttribute("style"),ctFillDecodedEmail(e,n)},2e3),e.removeEventListener("click",ctFillDecodedEmailHandler)}function ctFillDecodedEmail(e,t){jQuery(e).html(jQuery(e).html().replace(/.+?(
)/,t+"$1"))}function apbct_admin_sendAJAX(t,n,a){let o=n.callback||null,c=n.callback_context||null,i=n.callback_params||null;var e=n.async||!0;let l=n.notJson||null;var r=n.timeout||15e3,a=a||null;let d=n.button||null,s=n.spinner||null,p=n.progressbar||null;"string"==typeof t?t=t+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(t._ajax_nonce=ctAdminCommon._ajax_nonce,t.no_cache=Math.random()),d&&(d.setAttribute("disabled","disabled"),d.style.cursor="not-allowed"),s&&jQuery(s).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:t,async:e,success:function(e){d&&(d.removeAttribute("disabled"),d.style.cursor="pointer"),s&&jQuery(s).css("display","none"),(e=l?e:JSON.parse(e)).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded="Error:
"+e.error.toString(),cleantalkModal.open()):alert("Error happens: "+(e.error||"Unkown"))):o&&(i?o.apply(c,i.concat(e,t,n,a)):o(e,t,n,a))},error:function(e,t,n){d&&(d.removeAttribute("disabled"),d.style.cursor="pointer"),s&&jQuery(s).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log(n)},timeout:r})}function ctDecorationSelectorActions(){var e=document.querySelector("#apbct_setting_comments__form_decoration_selector");let t=document.querySelector("#apbct_setting_comments__form_decoration_color"),n=document.querySelector("#apbct_setting_comments__form_decoration_text"),a="Default Theme";t&&n&&e&&(e.value===a&&(t.setAttribute("disabled","disabled"),n.setAttribute("disabled","disabled")),e.addEventListener("change",function(e){e=e.target.value;e&&0

'+ctAdminCommon.apbctNoticeDismissSuccess+"

"),setTimeout(function(){jQuery("#apbct-notice-dismiss-success").fadeOut()},2e3))}),jQuery(".ct_username .row-actions .delete a").on("click",function(e){e.preventDefault(),confirm(ctAdminCommon.notice_when_deleting_user_text)&&(window.location=this.href)});let n=document.querySelector("#apbct_setting_forms__force_protection__On");var e;n.addEventListener("click",function(e){n.checked&&!confirm(ctAdminCommon.apbctNoticeForceProtectionOn)&&e.preventDefault()}),t(".apbct-restore-spam-order-button").click(function(){var e=t(this).data("spam-order-id"),e={action:"apbct_restore_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};t.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){e.success?window.location.reload():alert(e.data.message)}})}),jQuery("#deactivate-cleantalk-spam-protect").on("click",function(e){e.preventDefault();var t,e=this.getAttribute("href");"undefined"!=typeof cleantalkModal&&"1"===ctAdminCommon.deactivation_banner_is_needed?(t=` +function ctFillDecodedEmailHandler(){document.body.classList.add("apbct-popup-fade");var e,t,n,a,o=document.getElementById("apbct_popup");o?(o.setAttribute("style","display: inherit"),document.getElementById("apbct_popup_text").innerHTML="Please wait while "+ctAdminCommon.plugin_name+" is decoding the email addresses."):((o=document.createElement("div")).setAttribute("class","apbct-popup apbct-email-encoder-popup"),o.setAttribute("id","apbct_popup"),(e=document.createElement("span")).classList="apbct-email-encoder-elements_center",(t=document.createElement("p")).innerText=ctAdminCommon.plugin_name,t.setAttribute("class","apbct-email-encoder--popup-header"),e.append(t),(t=document.createElement("div")).setAttribute("id","apbct_popup_text"),t.setAttribute("class","apbct-email-encoder-elements_center"),t.style.color="black",(n=document.createElement("p")).id="apbct_email_ecoder__popup_text_node_first",n.innerText="The magic is on the way, please wait for a few seconds!",n.setAttribute("class","apbct-email-encoder-elements_center"),(a=document.createElement("p")).id="apbct_email_ecoder__popup_text_node_second",a.innerText="Decoding process to the original data.",t.append(n),t.append(a),o.append(e),o.append(t),o.append(apbctSetEmailDecoderPopupAnimation()),document.body.append(o)),apbctAjaxEmailDecodeBulk(ctAdminCommon.encodedEmailNode)}function apbctSetEmailDecoderPopupAnimation(){var t=["apbct_dog_one","apbct_dog_two","apbct_dog_three"],n=document.createElement("div");n.classList="apbct-ee-animation-wrapper";for(let e=0;e{e.setAttribute("title",""),e.removeAttribute("style"),ctFillDecodedEmail(e,n)},2e3),e.removeEventListener("click",ctFillDecodedEmailHandler)}function ctFillDecodedEmail(e,t){jQuery(e).html(jQuery(e).html().replace(/.+?(
)/,t+"$1"))}function apbct_admin_sendAJAX(t,n,a){let o=n.callback||null,c=n.callback_context||null,i=n.callback_params||null;var e=n.async||!0;let l=n.notJson||null;var r=n.timeout||15e3,a=a||null;let d=n.button||null,s=n.spinner||null,p=n.progressbar||null;"string"==typeof t?t=t+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(t._ajax_nonce=ctAdminCommon._ajax_nonce,t.no_cache=Math.random()),d&&(d.setAttribute("disabled","disabled"),d.style.cursor="not-allowed"),s&&jQuery(s).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:t,async:e,success:function(e){d&&(d.removeAttribute("disabled"),d.style.cursor="pointer"),s&&jQuery(s).css("display","none"),(e=l?e:JSON.parse(e)).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded="Error:
"+e.error.toString(),cleantalkModal.open()):alert("Error happens: "+(e.error||"Unkown"))):o&&(i?o.apply(c,i.concat(e,t,n,a)):o(e,t,n,a))},error:function(e,t,n){d&&(d.removeAttribute("disabled"),d.style.cursor="pointer"),s&&jQuery(s).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log(n)},timeout:r})}function ctDecorationSelectorActions(){var e=document.querySelector("#apbct_setting_comments__form_decoration_selector");let t=document.querySelector("#apbct_setting_comments__form_decoration_color"),n=document.querySelector("#apbct_setting_comments__form_decoration_text"),a="Default Theme";t&&n&&e&&(e.value===a&&(t.setAttribute("disabled","disabled"),n.setAttribute("disabled","disabled")),e.addEventListener("change",function(e){e=e.target.value;e&&0

'+ctAdminCommon.apbctNoticeDismissSuccess+"

"),setTimeout(function(){jQuery("#apbct-notice-dismiss-success").fadeOut()},2e3))}),jQuery(".ct_username .row-actions .delete a").on("click",function(e){e.preventDefault(),confirm(ctAdminCommon.notice_when_deleting_user_text)&&(window.location=this.href)});let n=document.querySelector("#apbct_setting_forms__force_protection__On");var e;n&&n.addEventListener("click",function(e){n.checked&&!confirm(ctAdminCommon.apbctNoticeForceProtectionOn)&&e.preventDefault()}),t(".apbct-restore-spam-order-button").click(function(){var e=t(this).data("spam-order-id"),e={action:"apbct_restore_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};t.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){e.success?window.location.reload():alert(e.data.message)}})}),jQuery("#deactivate-cleantalk-spam-protect").on("click",function(e){e.preventDefault();var t,e=this.getAttribute("href");"undefined"!=typeof cleantalkModal&&"1"===ctAdminCommon.deactivation_banner_is_needed?(t=`
${bannertText=ctAdminCommon.deactivation_banner_text.replace(/(https?:\/\/[^\s]+)/g,'$1')}
diff --git a/js/cleantalk-admin.min.js.map b/js/cleantalk-admin.min.js.map index 97e52d6d..e6f42f83 100644 --- a/js/cleantalk-admin.min.js.map +++ b/js/cleantalk-admin.min.js.map @@ -1 +1 @@ -{"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function($) {\n // Auto update banner close handler\n jQuery('.apbct_update_notice').on('click', 'button', function() {\n let ctDate = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = 'apbct_update_banner_closed=1; path=/; expires=' +\n ctDate.toUTCString() + '; samesite=lax' + ctSecure;\n });\n\n jQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space', 'nowrap')\n .css('display', 'inline-block');\n\n jQuery('body').on('click', '.apbct-notice .notice-dismiss-link', function(e) {\n jQuery(e.target).parent().siblings('.apbct-notice .notice-dismiss').click();\n });\n jQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e) {\n let apbctNoticeName = jQuery(e.target).parent().attr('id');\n if ( apbctNoticeName ) {\n apbct_admin_sendAJAX(\n {\n 'action': 'cleantalk_dismiss_notice',\n 'notice_id': apbctNoticeName,\n },\n {\n 'callback': null,\n 'notJson': true,\n },\n );\n jQuery(e.target)\n .parent('.notice')\n .after('

' +\n ctAdminCommon.apbctNoticeDismissSuccess +\n '

');\n setTimeout(function() {\n jQuery('#apbct-notice-dismiss-success').fadeOut();\n }, 2000);\n }\n });\n\n // Notice when deleting user\n jQuery('.ct_username .row-actions .delete a').on('click', function(e) {\n e.preventDefault();\n\n let result = confirm(ctAdminCommon.notice_when_deleting_user_text);\n\n if (result) {\n window.location = this.href;\n }\n });\n\n let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On');\n btnForceProtectionOn.addEventListener('click', function(e) {\n if (btnForceProtectionOn.checked) {\n let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn);\n\n if (!result) {\n e.preventDefault();\n }\n }\n });\n\n // Restore spam order\n $('.apbct-restore-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_restore_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n if (result.success) {\n window.location.reload();\n } else {\n alert(result.data.message);\n }\n },\n });\n });\n\n // Deactivation banner\n jQuery('#deactivate-cleantalk-spam-protect').on('click', function(e) {\n e.preventDefault();\n let deactivationLink = this.getAttribute('href');\n if ( typeof cleantalkModal !== 'undefined' && ctAdminCommon.deactivation_banner_is_needed === '1') {\n // force replace raw link to the href - fix for https://doboard.com/1/task/10192\n bannertText = ctAdminCommon.deactivation_banner_text\n .replace(/(https?:\\/\\/[^\\s]+)/g, '$1');\n const modalHTML = `\n
\n ${bannertText}\n
\n \n `;\n // look ahead ^ deactivationLink in the href was broken after modal handler URL converison\n cleantalkModal.loaded = modalHTML;\n // ignore URL conversions due modal handler\n cleantalkModal.ignoreURLConvert = true;\n cleantalkModal.open();\n } else {\n window.location.href = deactivationLink;\n }\n });\n\n // Email decoder example\n if (window.location.href.includes('options-general.php?page=cleantalk')) {\n let encodedEmailNode = document.querySelector('[data-original-string]');\n if (encodedEmailNode) {\n ctAdminCommon.encodedEmailNode = encodedEmailNode;\n encodedEmailNode.style.cursor = 'pointer';\n encodedEmailNode.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n\n ctDecorationSelectorActions();\n});\n\n/**\n * @param {mixed} event\n */\nfunction ctFillDecodedEmailHandler() {\n document.body.classList.add('apbct-popup-fade');\n let encoderPopup = document.getElementById('apbct_popup');\n\n if (!encoderPopup) {\n // construct popup\n let waitingPopup = document.createElement('div');\n waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup');\n waitingPopup.setAttribute('id', 'apbct_popup');\n\n // construct text header\n let popupHeaderWrapper = document.createElement('span');\n popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center';\n let popupHeader = document.createElement('p');\n popupHeader.innerText = ctAdminCommon.plugin_name;\n popupHeader.setAttribute('class', 'apbct-email-encoder--popup-header');\n popupHeaderWrapper.append(popupHeader);\n\n // construct text wrapper\n let popupTextWrapper = document.createElement('div');\n popupTextWrapper.setAttribute('id', 'apbct_popup_text');\n popupTextWrapper.setAttribute('class', 'apbct-email-encoder-elements_center');\n popupTextWrapper.style.color = 'black';\n\n // construct text first node\n // todo make translatable\n let popupTextWaiting = document.createElement('p');\n popupTextWaiting.id = 'apbct_email_ecoder__popup_text_node_first';\n popupTextWaiting.innerText = 'The magic is on the way, please wait for a few seconds!';\n popupTextWaiting.setAttribute('class', 'apbct-email-encoder-elements_center');\n\n // construct text second node\n // todo make translatable\n let popupTextDecoding = document.createElement('p');\n popupTextDecoding.id = 'apbct_email_ecoder__popup_text_node_second';\n popupTextDecoding.innerText = 'Decoding process to the original data.';\n\n // appending\n popupTextWrapper.append(popupTextWaiting);\n popupTextWrapper.append(popupTextDecoding);\n waitingPopup.append(popupHeaderWrapper);\n waitingPopup.append(popupTextWrapper);\n waitingPopup.append(apbctSetEmailDecoderPopupAnimation());\n document.body.append(waitingPopup);\n } else {\n encoderPopup.setAttribute('style', 'display: inherit');\n document.getElementById('apbct_popup_text').innerHTML =\n 'Please wait while ' + ctAdminCommon.plugin_name + ' is decoding the email addresses.';\n }\n\n apbctAjaxEmailDecodeBulk(ctAdminCommon.encodedEmailNode);\n}\n/**\n * @return {HTMLElement} event\n */\nfunction apbctSetEmailDecoderPopupAnimation() {\n const animationElements = ['apbct_dog_one', 'apbct_dog_two', 'apbct_dog_three'];\n const animationWrapper = document.createElement('div');\n animationWrapper.classList = 'apbct-ee-animation-wrapper';\n for (let i = 0; i < animationElements.length; i++) {\n const apbctEEAnimationDogOne = document.createElement('span');\n apbctEEAnimationDogOne.classList = 'apbct_dog ' + animationElements[i];\n apbctEEAnimationDogOne.innerText = '@';\n animationWrapper.append(apbctEEAnimationDogOne);\n }\n return animationWrapper;\n}\n\n/**\n * @param {HTMLElement} encodedEmailNode\n */\nfunction apbctAjaxEmailDecodeBulk(encodedEmailNode) {\n const encodedEmail = encodedEmailNode.dataset.originalString;\n let data = {\n encodedEmails: JSON.stringify({0: encodedEmail}),\n };\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n jQuery(encodedEmailNode).append(apbctTooltip);\n\n apbct_admin_sendAJAX(\n {\n 'action': 'apbct_decode_email',\n 'encodedEmails': data.encodedEmails,\n },\n {\n 'callback': function(result) {\n apbctEmailEncoderCallbackBulk(result, encodedEmailNode);\n },\n 'notJson': true,\n },\n );\n}\n\n/**\n * @param {mixed} result\n * @param {mixed} encodedEmailNode\n */\nfunction apbctEmailEncoderCallbackBulk(result, encodedEmailNode) {\n if (result.success && result.data[0].is_allowed === true) {\n // start process of visual decoding\n setTimeout(function() {\n let email = result.data[0].decoded_email;\n\n // change text\n let popup = document.getElementById('apbct_popup');\n if (popup !== null) {\n // handle first node\n let firstNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_first');\n // get email selectable by click\n let selectableEmail = document.createElement('b');\n selectableEmail.setAttribute('class', 'apbct-email-encoder-select-whole-email');\n selectableEmail.innerText = email;\n selectableEmail.title = 'Click to select the whole data';\n // add email to the first node\n firstNode.innerHTML = 'The original one is ' + selectableEmail.outerHTML + '.';\n firstNode.setAttribute('style', 'flex-direction: row;');\n // handle second node\n let secondNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_second');\n secondNode.innerText = 'Happy conversations!';\n // remove animation\n popup.querySelector('.apbct-ee-animation-wrapper').remove();\n // remove second node\n popup.querySelector('#apbct_email_ecoder__popup_text_node_second').remove();\n // add button\n let buttonWrapper = document.createElement('span');\n buttonWrapper.classList = 'apbct-email-encoder-elements_center top-margin-long';\n let button = document.createElement('button');\n button.innerText = 'Got it';\n button.classList = 'apbct-email-encoder-got-it-button';\n button.addEventListener('click', function() {\n document.body.classList.remove('apbct-popup-fade');\n popup.setAttribute('style', 'display:none');\n fillDecodedEmails(encodedEmailNode, result);\n });\n buttonWrapper.append(button);\n popup.append(buttonWrapper);\n }\n }, 3000);\n } else {\n console.log('result', result);\n }\n}\n\n/**\n * Run filling for every node with decoding result.\n * @param {mixed} encodedEmailNode\n * @param {mixed} decodingResult\n */\nfunction fillDecodedEmails(encodedEmailNode, decodingResult) {\n let currentResultData = decodingResult.data[0].decoded_email;\n encodedEmailNode.classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n encodedEmailNode.setAttribute('title', '');\n encodedEmailNode.removeAttribute('style');\n ctFillDecodedEmail(encodedEmailNode, currentResultData);\n }, 2000);\n encodedEmailNode.removeEventListener('click', ctFillDecodedEmailHandler);\n}\n\n/**\n * @param {mixed} target\n * @param {string} email\n */\nfunction ctFillDecodedEmail(target, email) {\n jQuery(target).html(\n jQuery(target)\n .html()\n .replace(/.+?(
)/, email + '$1'),\n );\n}\n\n// eslint-disable-next-line camelcase,require-jsdoc,no-unused-vars\nfunction apbct_admin_sendAJAX(data, params, obj) {\n // Default params\n let callback = params.callback || null;\n let callbackContext = params.callback_context || null;\n let callbackParams = params.callback_params || null;\n let async = params.async || true;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n var obj = obj || null; // eslint-disable-line no-var\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n\n if (typeof (data) === 'string') {\n data = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n } else {\n data._ajax_nonce = ctAdminCommon._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n async: async,\n success: function(result) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n if (!notJson) result = JSON.parse(result);\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n if ( typeof cleantalkModal !== 'undefined' ) {\n // Show the result by modal\n cleantalkModal.loaded = 'Error:
' + result.error.toString();\n cleantalkModal.open();\n } else {\n alert('Error happens: ' + (result.error || 'Unkown'));\n }\n } else {\n if (callback) {\n if (callbackParams) {\n callback.apply( callbackContext, callbackParams.concat( result, data, params, obj ) );\n } else {\n callback(result, data, params, obj);\n }\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log(errorThrown);\n },\n timeout: timeout,\n });\n}\n/**\n* @return {void}\n */\nfunction ctDecorationSelectorActions() {\n const selector = document.querySelector('#apbct_setting_comments__form_decoration_selector');\n const colorPicker = document.querySelector('#apbct_setting_comments__form_decoration_color');\n const headingText = document.querySelector('#apbct_setting_comments__form_decoration_text');\n const defaultThemeExpectedValue = 'Default Theme';\n if (colorPicker && headingText && selector) {\n if (selector.value === defaultThemeExpectedValue) {\n colorPicker.setAttribute('disabled', 'disabled');\n headingText.setAttribute('disabled', 'disabled');\n }\n selector.addEventListener('change', function(event) {\n const selectedValue = event.target.value;\n if (selectedValue && selectedValue.length > 0 && selectedValue === defaultThemeExpectedValue) {\n colorPicker.setAttribute('disabled', 'disabled');\n headingText.setAttribute('disabled', 'disabled');\n } else {\n colorPicker.removeAttribute('disabled');\n headingText.removeAttribute('disabled');\n }\n });\n }\n}\n"],"names":["ctFillDecodedEmailHandler","document","body","classList","add","let","popupHeaderWrapper","popupTextWrapper","popupTextWaiting","popupTextDecoding","encoderPopup","getElementById","setAttribute","innerHTML","ctAdminCommon","plugin_name","waitingPopup","createElement","popupHeader","innerText","append","style","color","id","apbctSetEmailDecoderPopupAnimation","apbctAjaxEmailDecodeBulk","encodedEmailNode","animationElements","animationWrapper","i","length","apbctEEAnimationDogOne","encodedEmail","dataset","originalString","data","encodedEmails","JSON","stringify","0","apbctTooltip","jQuery","apbct_admin_sendAJAX","action","callback","result","apbctEmailEncoderCallbackBulk","notJson","success","is_allowed","setTimeout","firstNode","button","email","decoded_email","popup","querySelector","selectableEmail","title","outerHTML","remove","buttonWrapper","addEventListener","fillDecodedEmails","console","log","decodingResult","currentResultData","removeAttribute","ctFillDecodedEmail","removeEventListener","target","html","replace","params","obj","callbackContext","callback_context","callbackParams","callback_params","async","timeout","spinner","progressbar","_ajax_nonce","Math","random","no_cache","cursor","css","ajax","type","url","_ajax_url","parse","error","fadeOut","cleantalkModal","loaded","toString","open","alert","apply","concat","jqXHR","textStatus","errorThrown","ctDecorationSelectorActions","selector","colorPicker","headingText","defaultThemeExpectedValue","value","event","selectedValue","ready","$","on","ctDate","Date","getTime","ctSecure","location","protocol","cookie","toUTCString","e","parent","siblings","click","apbctNoticeName","attr","notice_id","after","apbctNoticeDismissSuccess","preventDefault","confirm","notice_when_deleting_user_text","window","this","href","btnForceProtectionOn","checked","apbctNoticeForceProtectionOn","spmOrderId","order_id","reload","message","modalHTML","deactivationLink","getAttribute","deactivation_banner_is_needed","bannertText","deactivation_banner_text","ignoreURLConvert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,eAAeG,KAAK,GAEpBsC,OAAOhB,SAASkB,KAAOS,CAE/B,CAAC,EAGGX,OAAOhB,SAASkB,KAAKe,SAAS,oCAAoC,IAC9DjI,EAAmBzB,SAASuD,cAAc,wBAAwB,MAElE1C,cAAcY,iBAAmBA,GAChBL,MAAMmE,OAAS,UAChC9D,EAAiBoC,iBAAiB,QAAS9D,yBAAyB,GAI5E2G,4BAA4B,CAChC,CAAC"} \ No newline at end of file +{"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function($) {\n // Auto update banner close handler\n jQuery('.apbct_update_notice').on('click', 'button', function() {\n let ctDate = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = 'apbct_update_banner_closed=1; path=/; expires=' +\n ctDate.toUTCString() + '; samesite=lax' + ctSecure;\n });\n\n jQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space', 'nowrap')\n .css('display', 'inline-block');\n\n jQuery('body').on('click', '.apbct-notice .notice-dismiss-link', function(e) {\n jQuery(e.target).parent().siblings('.apbct-notice .notice-dismiss').click();\n });\n jQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e) {\n let apbctNoticeName = jQuery(e.target).parent().attr('id');\n if ( apbctNoticeName ) {\n apbct_admin_sendAJAX(\n {\n 'action': 'cleantalk_dismiss_notice',\n 'notice_id': apbctNoticeName,\n },\n {\n 'callback': null,\n 'notJson': true,\n },\n );\n jQuery(e.target)\n .parent('.notice')\n .after('

' +\n ctAdminCommon.apbctNoticeDismissSuccess +\n '

');\n setTimeout(function() {\n jQuery('#apbct-notice-dismiss-success').fadeOut();\n }, 2000);\n }\n });\n\n // Notice when deleting user\n jQuery('.ct_username .row-actions .delete a').on('click', function(e) {\n e.preventDefault();\n\n let result = confirm(ctAdminCommon.notice_when_deleting_user_text);\n\n if (result) {\n window.location = this.href;\n }\n });\n\n let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On');\n if (btnForceProtectionOn) {\n btnForceProtectionOn.addEventListener('click', function(e) {\n if (btnForceProtectionOn.checked) {\n let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn);\n\n if (!result) {\n e.preventDefault();\n }\n }\n });\n }\n // Restore spam order\n $('.apbct-restore-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_restore_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n if (result.success) {\n window.location.reload();\n } else {\n alert(result.data.message);\n }\n },\n });\n });\n\n // Deactivation banner\n jQuery('#deactivate-cleantalk-spam-protect').on('click', function(e) {\n e.preventDefault();\n let deactivationLink = this.getAttribute('href');\n if ( typeof cleantalkModal !== 'undefined' && ctAdminCommon.deactivation_banner_is_needed === '1') {\n // force replace raw link to the href - fix for https://doboard.com/1/task/10192\n bannertText = ctAdminCommon.deactivation_banner_text\n .replace(/(https?:\\/\\/[^\\s]+)/g, '$1');\n const modalHTML = `\n
\n ${bannertText}\n
\n \n `;\n // look ahead ^ deactivationLink in the href was broken after modal handler URL converison\n cleantalkModal.loaded = modalHTML;\n // ignore URL conversions due modal handler\n cleantalkModal.ignoreURLConvert = true;\n cleantalkModal.open();\n } else {\n window.location.href = deactivationLink;\n }\n });\n\n // Email decoder example\n if (window.location.href.includes('options-general.php?page=cleantalk')) {\n let encodedEmailNode = document.querySelector('[data-original-string]');\n if (encodedEmailNode) {\n ctAdminCommon.encodedEmailNode = encodedEmailNode;\n encodedEmailNode.style.cursor = 'pointer';\n encodedEmailNode.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n\n ctDecorationSelectorActions();\n});\n\n/**\n * @param {mixed} event\n */\nfunction ctFillDecodedEmailHandler() {\n document.body.classList.add('apbct-popup-fade');\n let encoderPopup = document.getElementById('apbct_popup');\n\n if (!encoderPopup) {\n // construct popup\n let waitingPopup = document.createElement('div');\n waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup');\n waitingPopup.setAttribute('id', 'apbct_popup');\n\n // construct text header\n let popupHeaderWrapper = document.createElement('span');\n popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center';\n let popupHeader = document.createElement('p');\n popupHeader.innerText = ctAdminCommon.plugin_name;\n popupHeader.setAttribute('class', 'apbct-email-encoder--popup-header');\n popupHeaderWrapper.append(popupHeader);\n\n // construct text wrapper\n let popupTextWrapper = document.createElement('div');\n popupTextWrapper.setAttribute('id', 'apbct_popup_text');\n popupTextWrapper.setAttribute('class', 'apbct-email-encoder-elements_center');\n popupTextWrapper.style.color = 'black';\n\n // construct text first node\n // todo make translatable\n let popupTextWaiting = document.createElement('p');\n popupTextWaiting.id = 'apbct_email_ecoder__popup_text_node_first';\n popupTextWaiting.innerText = 'The magic is on the way, please wait for a few seconds!';\n popupTextWaiting.setAttribute('class', 'apbct-email-encoder-elements_center');\n\n // construct text second node\n // todo make translatable\n let popupTextDecoding = document.createElement('p');\n popupTextDecoding.id = 'apbct_email_ecoder__popup_text_node_second';\n popupTextDecoding.innerText = 'Decoding process to the original data.';\n\n // appending\n popupTextWrapper.append(popupTextWaiting);\n popupTextWrapper.append(popupTextDecoding);\n waitingPopup.append(popupHeaderWrapper);\n waitingPopup.append(popupTextWrapper);\n waitingPopup.append(apbctSetEmailDecoderPopupAnimation());\n document.body.append(waitingPopup);\n } else {\n encoderPopup.setAttribute('style', 'display: inherit');\n document.getElementById('apbct_popup_text').innerHTML =\n 'Please wait while ' + ctAdminCommon.plugin_name + ' is decoding the email addresses.';\n }\n\n apbctAjaxEmailDecodeBulk(ctAdminCommon.encodedEmailNode);\n}\n/**\n * @return {HTMLElement} event\n */\nfunction apbctSetEmailDecoderPopupAnimation() {\n const animationElements = ['apbct_dog_one', 'apbct_dog_two', 'apbct_dog_three'];\n const animationWrapper = document.createElement('div');\n animationWrapper.classList = 'apbct-ee-animation-wrapper';\n for (let i = 0; i < animationElements.length; i++) {\n const apbctEEAnimationDogOne = document.createElement('span');\n apbctEEAnimationDogOne.classList = 'apbct_dog ' + animationElements[i];\n apbctEEAnimationDogOne.innerText = '@';\n animationWrapper.append(apbctEEAnimationDogOne);\n }\n return animationWrapper;\n}\n\n/**\n * @param {HTMLElement} encodedEmailNode\n */\nfunction apbctAjaxEmailDecodeBulk(encodedEmailNode) {\n const encodedEmail = encodedEmailNode.dataset.originalString;\n let data = {\n encodedEmails: JSON.stringify({0: encodedEmail}),\n };\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n jQuery(encodedEmailNode).append(apbctTooltip);\n\n apbct_admin_sendAJAX(\n {\n 'action': 'apbct_decode_email',\n 'encodedEmails': data.encodedEmails,\n },\n {\n 'callback': function(result) {\n apbctEmailEncoderCallbackBulk(result, encodedEmailNode);\n },\n 'notJson': true,\n },\n );\n}\n\n/**\n * @param {mixed} result\n * @param {mixed} encodedEmailNode\n */\nfunction apbctEmailEncoderCallbackBulk(result, encodedEmailNode) {\n if (result.success && result.data[0].is_allowed === true) {\n // start process of visual decoding\n setTimeout(function() {\n let email = result.data[0].decoded_email;\n\n // change text\n let popup = document.getElementById('apbct_popup');\n if (popup !== null) {\n // handle first node\n let firstNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_first');\n // get email selectable by click\n let selectableEmail = document.createElement('b');\n selectableEmail.setAttribute('class', 'apbct-email-encoder-select-whole-email');\n selectableEmail.innerText = email;\n selectableEmail.title = 'Click to select the whole data';\n // add email to the first node\n firstNode.innerHTML = 'The original one is ' + selectableEmail.outerHTML + '.';\n firstNode.setAttribute('style', 'flex-direction: row;');\n // handle second node\n let secondNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_second');\n secondNode.innerText = 'Happy conversations!';\n // remove animation\n popup.querySelector('.apbct-ee-animation-wrapper').remove();\n // remove second node\n popup.querySelector('#apbct_email_ecoder__popup_text_node_second').remove();\n // add button\n let buttonWrapper = document.createElement('span');\n buttonWrapper.classList = 'apbct-email-encoder-elements_center top-margin-long';\n let button = document.createElement('button');\n button.innerText = 'Got it';\n button.classList = 'apbct-email-encoder-got-it-button';\n button.addEventListener('click', function() {\n document.body.classList.remove('apbct-popup-fade');\n popup.setAttribute('style', 'display:none');\n fillDecodedEmails(encodedEmailNode, result);\n });\n buttonWrapper.append(button);\n popup.append(buttonWrapper);\n }\n }, 3000);\n } else {\n console.log('result', result);\n }\n}\n\n/**\n * Run filling for every node with decoding result.\n * @param {mixed} encodedEmailNode\n * @param {mixed} decodingResult\n */\nfunction fillDecodedEmails(encodedEmailNode, decodingResult) {\n let currentResultData = decodingResult.data[0].decoded_email;\n encodedEmailNode.classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n encodedEmailNode.setAttribute('title', '');\n encodedEmailNode.removeAttribute('style');\n ctFillDecodedEmail(encodedEmailNode, currentResultData);\n }, 2000);\n encodedEmailNode.removeEventListener('click', ctFillDecodedEmailHandler);\n}\n\n/**\n * @param {mixed} target\n * @param {string} email\n */\nfunction ctFillDecodedEmail(target, email) {\n jQuery(target).html(\n jQuery(target)\n .html()\n .replace(/.+?(
)/, email + '$1'),\n );\n}\n\n// eslint-disable-next-line camelcase,require-jsdoc,no-unused-vars\nfunction apbct_admin_sendAJAX(data, params, obj) {\n // Default params\n let callback = params.callback || null;\n let callbackContext = params.callback_context || null;\n let callbackParams = params.callback_params || null;\n let async = params.async || true;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n var obj = obj || null; // eslint-disable-line no-var\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n\n if (typeof (data) === 'string') {\n data = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n } else {\n data._ajax_nonce = ctAdminCommon._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n async: async,\n success: function(result) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n if (!notJson) result = JSON.parse(result);\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n if ( typeof cleantalkModal !== 'undefined' ) {\n // Show the result by modal\n cleantalkModal.loaded = 'Error:
' + result.error.toString();\n cleantalkModal.open();\n } else {\n alert('Error happens: ' + (result.error || 'Unkown'));\n }\n } else {\n if (callback) {\n if (callbackParams) {\n callback.apply( callbackContext, callbackParams.concat( result, data, params, obj ) );\n } else {\n callback(result, data, params, obj);\n }\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log(errorThrown);\n },\n timeout: timeout,\n });\n}\n/**\n* @return {void}\n */\nfunction ctDecorationSelectorActions() {\n const selector = document.querySelector('#apbct_setting_comments__form_decoration_selector');\n const colorPicker = document.querySelector('#apbct_setting_comments__form_decoration_color');\n const headingText = document.querySelector('#apbct_setting_comments__form_decoration_text');\n const defaultThemeExpectedValue = 'Default Theme';\n if (colorPicker && headingText && selector) {\n if (selector.value === defaultThemeExpectedValue) {\n colorPicker.setAttribute('disabled', 'disabled');\n headingText.setAttribute('disabled', 'disabled');\n }\n selector.addEventListener('change', function(event) {\n const selectedValue = event.target.value;\n if (selectedValue && selectedValue.length > 0 && selectedValue === defaultThemeExpectedValue) {\n colorPicker.setAttribute('disabled', 'disabled');\n headingText.setAttribute('disabled', 'disabled');\n } else {\n colorPicker.removeAttribute('disabled');\n headingText.removeAttribute('disabled');\n }\n });\n }\n}\n"],"names":["ctFillDecodedEmailHandler","document","body","classList","add","let","popupHeaderWrapper","popupTextWrapper","popupTextWaiting","popupTextDecoding","encoderPopup","getElementById","setAttribute","innerHTML","ctAdminCommon","plugin_name","waitingPopup","createElement","popupHeader","innerText","append","style","color","id","apbctSetEmailDecoderPopupAnimation","apbctAjaxEmailDecodeBulk","encodedEmailNode","animationElements","animationWrapper","i","length","apbctEEAnimationDogOne","encodedEmail","dataset","originalString","data","encodedEmails","JSON","stringify","0","apbctTooltip","jQuery","apbct_admin_sendAJAX","action","callback","result","apbctEmailEncoderCallbackBulk","notJson","success","is_allowed","setTimeout","firstNode","button","email","decoded_email","popup","querySelector","selectableEmail","title","outerHTML","remove","buttonWrapper","addEventListener","fillDecodedEmails","console","log","decodingResult","currentResultData","removeAttribute","ctFillDecodedEmail","removeEventListener","target","html","replace","params","obj","callbackContext","callback_context","callbackParams","callback_params","async","timeout","spinner","progressbar","_ajax_nonce","Math","random","no_cache","cursor","css","ajax","type","url","_ajax_url","parse","error","fadeOut","cleantalkModal","loaded","toString","open","alert","apply","concat","jqXHR","textStatus","errorThrown","ctDecorationSelectorActions","selector","colorPicker","headingText","defaultThemeExpectedValue","value","event","selectedValue","ready","$","on","ctDate","Date","getTime","ctSecure","location","protocol","cookie","toUTCString","e","parent","siblings","click","apbctNoticeName","attr","notice_id","after","apbctNoticeDismissSuccess","preventDefault","confirm","notice_when_deleting_user_text","window","this","href","btnForceProtectionOn","checked","apbctNoticeForceProtectionOn","spmOrderId","order_id","reload","message","modalHTML","deactivationLink","getAttribute","deactivation_banner_is_needed","bannertText","deactivation_banner_text","ignoreURLConvert","includes"],"mappings":"AA+HA,SAASA,4BACLC,SAASC,KAAKC,UAAUC,IAAI,kBAAkB,EAC9CC,IASQC,EAQAC,EAOAC,EAOAC,EA/BJC,EAAeT,SAASU,eAAe,aAAa,EAEnDD,GAyCDA,EAAaE,aAAa,QAAS,kBAAkB,EACrDX,SAASU,eAAe,kBAAkB,EAAEE,U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AAiB,QAAS9D,yBAAyB,GAI5E2G,4BAA4B,CAChC,CAAC"} \ No newline at end of file diff --git a/js/src/cleantalk-admin.js b/js/src/cleantalk-admin.js index 97c20611..5a010c20 100644 --- a/js/src/cleantalk-admin.js +++ b/js/src/cleantalk-admin.js @@ -49,16 +49,17 @@ jQuery(document).ready(function($) { }); let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On'); - btnForceProtectionOn.addEventListener('click', function(e) { - if (btnForceProtectionOn.checked) { - let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn); + if (btnForceProtectionOn) { + btnForceProtectionOn.addEventListener('click', function(e) { + if (btnForceProtectionOn.checked) { + let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn); - if (!result) { - e.preventDefault(); + if (!result) { + e.preventDefault(); + } } - } - }); - + }); + } // Restore spam order $('.apbct-restore-spam-order-button').click(function() { const spmOrderId = $(this).data('spam-order-id');