Version Description
Download this release
Release Info
Developer | taron96 |
Plugin | Comments – wpDiscuz |
Version | 7.0.7 |
Comparing to | |
See all releases |
Code changes from version 7.0.6 to 7.0.7
- assets/js/wpdiscuz-combo-no_quill.min.js +2 -2
- assets/js/wpdiscuz-combo.min.js +2 -2
- assets/js/wpdiscuz-mu-frontend.js +2 -0
- assets/js/wpdiscuz-mu-frontend.min.js +1 -1
- assets/js/wpdiscuz.js +2198 -2069
- assets/js/wpdiscuz.min.js +1 -1
- assets/third-party/font-awesome-5.13.0/css/fa.min.css +1 -1
- class.WpdiscuzCore.php +2113 -1942
- forms/wpDiscuzForm.php +13 -13
- forms/wpdFormAttr/Field/CheckboxField.php +1 -1
- forms/wpdFormAttr/Field/DefaultField/Captcha.php +5 -5
- forms/wpdFormAttr/Field/DefaultField/Email.php +1 -1
- forms/wpdFormAttr/Field/DefaultField/Submit.php +1 -1
- forms/wpdFormAttr/Field/DefaultField/Website.php +1 -1
- forms/wpdFormAttr/Field/Field.php +3 -3
- forms/wpdFormAttr/Field/HTMLField.php +5 -0
- forms/wpdFormAttr/Form.php +8 -9
- forms/wpdFormAttr/Login/SocialLogin.php +14 -14
- forms/wpdFormAttr/Login/twitter/Request.php +1 -1
- forms/wpdFormAttr/Login/twitter/SignatureMethod.php +1 -1
- forms/wpdFormAttr/Row.php +5 -5
- includes/class.WpdiscuzDBManager.php +24 -26
- includes/class.WpdiscuzRest.php +1 -0
- options/class.WpdiscuzOptions.php +7 -7
- options/html-addons.php +3 -3
- options/options-layouts/html-content.php +18 -10
- options/options-layouts/html-general.php +2 -2
- options/options-layouts/html-inline.php +3 -3
- options/options-layouts/html-live.php +3 -3
- options/options-layouts/html-thread_layouts.php +4 -4
- options/options-layouts/html-thread_styles.php +3 -3
- options/phrases-layouts/phrases-comment.php +4 -4
- readme.txt +18 -10
- themes/default/class.WpdiscuzWalker.php +21 -21
- themes/default/comment-form.php +4 -4
- utils/class.WpdiscuzCache.php +2 -2
- utils/class.WpdiscuzHelper.php +26 -21
- utils/class.WpdiscuzHelperAjax.php +4 -4
- utils/class.WpdiscuzHelperEmail.php +6 -6
- utils/class.WpdiscuzHelperOptimization.php +3 -3
- utils/class.WpdiscuzHelperUpload.php +21 -8
- utils/layouts/subscriptions/content.php +2 -2
- utils/layouts/subscriptions/subscriptions-page.php +2 -2
assets/js/wpdiscuz-combo-no_quill.min.js
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
/* Autogrow */
|
4 |
jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
|
5 |
/* wpDiscuz */
|
6 |
-
var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if("[object Array]"===Object.prototype.toString.call(e))for(var d in e)"[object Array]"===Object.prototype.toString.call(t)?"success"===t[d]?o="wpdiscuz-message-success":"warning"===t[d]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[d]).prependTo("#wpdiscuz-comment-message").delay("[object Array]"===Object.prototype.toString.call(a)?a[d]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,d=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,n=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),i=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,g=wpdiscuzAjaxObj.cookiehash,_=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),v=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,z=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),C=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),k=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),x=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=[],T=[],D=[],E=!1,M=1;(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),e(document).delegate("#wpdcom .ql-editor, #wpdcom .wc_comment","focus",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(v)}),e(document).delegate("#wpdcom textarea","focus",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||S({comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).delegate("#wpd-editor-source-code-wrapper-bg","click",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).delegate("#wpd-insert-source-code","click",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).delegate(".wpd-reply-button","click",function(){var n=V(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+n).focus()},v):setTimeout(function(){e("#wc-textarea-"+n).trigger("focus")},v),e("#wpd-secondary-form-wrapper-"+n).slideToggle(v)):function(a){var o=V(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var d=e("#wpd-secondary-form-wrapper-"+o);if(!t){var n={comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)};S(n)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},v):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},v);d.slideToggle(v,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===d){var n=B(t);setTimeout(function(){if(!T[n])try{T[n]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(n)}),e(document).delegate("#wpdcom .wpd-comment-link [data-comment-url]","click",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.select(),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit","click",function(e){e.preventDefault()}),e(document).delegate(".wpd-toggle.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=V(e(this),0),o=e(this),d=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&_?function(t,a){var o=B(t),d=new FormData;d.append("action","wpdShowReplies"),d.append("commentId",o),ce(z,!0,d).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies").remove(),ie(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,d){console.log(d),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(d.removeClass("fa-chevron-up"),d.addClass("fa-chevron-down"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(d.removeClass("fa-chevron-down"),d.addClass("fa-chevron-up"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).delegate(".wpd-new-loaded-comment","mouseenter",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).delegate(".wpd-sbs-toggle","click",function(){e(".wpdiscuz-subscribe-bar").slideToggle(v)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&("2.0"===d?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).delegate("#wpdiscuz-subscribe-form","submit",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===d&&e(document).delegate("#wpdiscuz_subscription_button","click",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.submit()},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===d){var F=e(window).width(),L=e("#wpdcom").width();L>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),L>=940&&L<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),L>=810&&L<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),L>=730&&L<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),L>=610&&L<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),F>650&&(L>=510&&L<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),L>=470&&L<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),L<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function R(t,a,o){ce(z||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(v),e(".wpd-thread-info").html(a.data.wc_all_comments_count_new_html),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(a.data.wc_all_comments_count_new),a.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide();var d=v;a.data.is_main?X(a.data.message):(d=v+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),ce(z,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),ce(z,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,d=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+g,a),Cookies.set("comment_author_"+g,o),d.length&&Cookies.set("comment_author_url_"+g,d)):(u=parseInt(u),Cookies.set("comment_author_email_"+g,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+g,o,{expires:u,path:"/"}),d.length&&Cookies.set("comment_author_url_"+g,d,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").attr("checked","checked")}(a.data):b||e(".wpd-cookies-checkbox").removeAttr("checked"),wpdiscuzLoadRichEditor&&wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]),t.get(0).reset(),S(a.data),e(".wmu-preview-wrap",t).remove(),I.length&&(I.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),I=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-32},1e3)},d),ie(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"),ie(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,d){console.log(d),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function S(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function q(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).delegate(".wc_comm_submit.wpd_not_clicked","click",function(){var t=e(this),n=1,s=e(this).parents("form");if(s.hasClass("wpd_main_comm_form")||(n=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===G(t,!1)&&(o=G(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),J(s,"#wpd-editor-"+e(".wpdiscuz_unique_id",s).val()),s.submit(function(e){e.preventDefault()}),""!==e(".wc_comment",s).val().trim()){if(s[0].checkValidity()&&(c=s,p=!0,"2.0"===d&&e("input[name=wc_captcha]",c).length&&!e("input[name=wc_captcha]",c).val().length?(p=!1,e(".wpdiscuz-recaptcha",c).css("border","1px solid red")):"2.0"===d&&e("input[name=wc_captcha]",c).length&&e(".wpdiscuz-recaptcha",c).css("border","none"),p)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+g,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){I.push(e(this))}))})}(s),e(t).removeClass("wpd_not_clicked");var i=new FormData;if(i.append("action","wpdAddComment"),e(":input",s).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&i.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),i.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&i.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",s).length&&!e(".wpd-cookies-checkbox",s).prop("checked")&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===d&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){i.append("g-recaptcha-response",e),R(s,i,t)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else R(s,i,t)}var c,p;!function(e){if((a||o)&&"2.0"===d){var t=B(e);grecaptcha.reset(T[t])}}(e(".wpdiscuz_unique_id",s).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields,"error")}),e(document).delegate(".wpd_editable_comment","click",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&q(V(e(".wpdiscuz-edit-form-wrap"),0),w);var t=V(e(this),0),a=B(t),o=new FormData;o.append("action","wpdEditComment"),o.append("commentId",a),w=e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-text").get(0),ce(z,!0,o).done(function(a){if("object"==typeof a)if(a.success){if(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(a.data.html),wpdiscuzLoadRichEditor){let o=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+t);o.clipboard.dangerouslyPasteHTML(0,a.data.content),o.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+t).val(a.data.content);e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error");else console.log(a);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wc_save_edited_comment","click",function(){var t=V(e(this)),a=B(t),o=e("#wpd-comm-"+t+" #wpdiscuz-edit-form");if(J(o,"#wpd-editor-edit_"+t),o.submit(function(e){e.preventDefault()}),o[0].checkValidity()){var d=new FormData;d.append("action","wpdSaveEditedComment"),d.append("commentId",a),e(":input",o).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&d.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&d.append(this.name+"",e(this).val())}),ce(z,!0,d).done(function(o){"object"==typeof o?(o.success?(q(t,o.data.message),o.data.lastEdited&&(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(o.data.lastEdited).insertAfter("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),o.data.twitterShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",o.data.twitterShareLink),o.data.whatsappShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",o.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[o.data],"error"),ie(o,a)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wc_cancel_edit","click",function(){var t=V(e(this));q(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){W(!0)},500):e(document).delegate(".wpd-load-comments","click",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),W(!0)})),e(document).delegate(".wpd-load-more-submit","click",function(){var t=e(this);t.hasClass("wpd-loaded")&&W(!1,t,"wpd-loaded","wpd-loading")});var U=!1;function H(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===U&&1==t&&(U=!0,W(!1,e(".wpd-load-more-submit"))))}function W(t,a,o,d){a&&(a.toggleClass(o),a.toggleClass(d));var s=new FormData;s.append("action","wpdLoadMoreComments");var i=e(".wpdiscuz-sort-button-active").attr("data-sorting");i&&s.append("sorting",i),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),ce(z,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==n),U=!1,r=s.data.loadLastCommentId,ie(s),t&&P(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))}).fail(function(t,n,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==n&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),ie(t)}function P(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-32},1e3),t&&N(o)},500);else{var d=new FormData;d.append("action","wpdGetSingleComment"),d.append("commentId",o),ce(z,!0,d).done(function(a){if("object"==typeof a&&a.success){var d="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e(d).offset().top-32},1e3),t&&N(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function N(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function Q(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)$((t=a[o]).comment_parent,t.comment_html)}function V(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function B(e){return e.substring(0,e.indexOf("_"))}function G(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function $(t,a){if(0==t)X(a);else{var o=V(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function Y(){var t,a,o="";return e(".wpd-comment-right").each(function(){t=V(e(this),0),a=B(t),o+=a+","}),o}function J(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).removeAttr("required"),0===e("input:checked",this).length?e("input",e(this)).attr("required","required"):e(".wpd-field-invalid",this).remove()})}function X(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function Z(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==n||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),H(),e(window).scroll(function(){H()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).delegate(".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked","click",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=B(V(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var d=new FormData;d.append("action","wpdVoteOnComment"),d.append("commentId",o),d.append("voteType",a),ce(z,!0,d).done(function(d){if(e(t).addClass("wpd_not_clicked"),"object"==typeof d){if(d.success){if("total"===d.data.buttonsStyle){var n=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=d.data.votes;n.text(s),n.removeClass("wpd-up wpd-down"),s>0&&n.addClass("wpd-up"),s<0&&n.addClass("wpd-down")}else{var i=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));i.text(d.data.likeCount),c.text(d.data.dislikeCount),parseInt(d.data.likeCount)>0?i.addClass("wpd-up"):i.removeClass("wpd-up"),parseInt(d.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),d.data.curUserReaction>0?p.addClass("wpd-up"):d.data.curUserReaction<0&&r.addClass("wpd-down")}else d.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data],"error");ie(d,o,a)}else console.log(d);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate("body","click",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).delegate(".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)","click",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var d=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",d||""),ce(z,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){P(!1)},1!=m&&P(!1),e(document).delegate(".wpdiscuz-readmore","click",function(){var t=V(e(this)),a=B(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),ce(z,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),ie(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-required-group","change",function(){0!==e("input:checked",this).length?e("input",e(this)).removeAttr("required"):e("input",e(this)).attr("required","required")}),e(document).delegate(".wpdiscuz-spoiler","click",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).delegate(".wpd-tools i","click",function(){var t=e(this).siblings(".wpd-tools-actions");t.css({display:t.is(":visible")?"none":"flex"})}),e(document).delegate(".wpd-comment-right","mouseleave",function(){e(this).find(".wpd-tools-actions").hide()}),e(document).delegate(".wpd_stick_btn","click",function(){var t=B(V(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),ce(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd_close_btn","click",function(){var t=B(V(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),ce(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-filter.wpd_not_clicked[data-filter-type]","click",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&o.append("sorting",d),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),ce(z,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),ie(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpdf-reacted.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),ce(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpdf-hottest.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),ce(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpd-filter-view-all","click",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-follow-link.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=B(V(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),ce(z,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.code],"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),Z(),e(document).delegate(".wc_email","keyup",function(){Z(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),k&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*x)},1e3*k),"content_left"===O)if(e(".entry-content").length){var ee=(te=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){ee=(te=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var te;ee=(te=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e("#wpd-bubble-add-message-close").click(function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e("#wpd-bubble").click(function(){e("html, body").animate({scrollTop:e("#wpdcom").offset().top-60},1e3,function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").focus()})}),e("#wpd-bubble-comment-close").click(function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e("#wpd-bubble-comment-reply-link a").click(function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),P(!0);var a=t.match(/#comment\-(\d+)/);D=D.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(D.length),0==D.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e("#wpd-bubble-count").click(function(){if(D.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",D.join()),ce(z,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),Q(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),D=[],e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-60},1e3),ie(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&C||i)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,data:{postId:s,lastId:l,visibleCommentIds:Y()}}).done(function(a){if(!E)if("object"==typeof a){if(a.ids.length){i&&((n=new FormData).append("action","wpdUpdateAutomatically"),n.append("loadLastCommentId",r),n.append("visibleCommentIds",Y()),ce(z,!1,n).done(function(t){E||"object"==typeof t&&t.success&&(Q(t),e(".wpd-thread-info").html(t.data.wc_all_comments_count_new_html),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(t.data.wc_all_comments_count_new),t.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),D=D.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var d=parseInt(e(".wpd-new-comments-count").text());d+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(d),e("#wpd-bubble-count").addClass("wpd-new-comments"),a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").text(a.all_comments_count),a.all_comments_count?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),e(".wpd-thread-info").html(a.all_comments_count_html)}}else console.log(a);var n;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var ae=new FormData;ae.append("action","wpdGetInlineCommentForm"),ce(z,!1,ae).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),se()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function oe(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function de(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function ne(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),se(t.siblings(".wpd-inline-form-wrapper"))))})}function se(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function ie(t,a,o,d){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,d):console.log(t.data.callbackFunctions[e]+" is not a function")})}function ce(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var d=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[d]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[d],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]](o,t,a))});var n=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:n,data:o,contentType:!1,processData:!1})}e(document).delegate("body","click",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){de();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),se(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).delegate(".wpd-inline-submit.wpd_not_clicked","click",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var d=new FormData;d.append("action","wpdAddInlineComment"),d.append("inline_form_id",oe(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&d.append(e(a).attr("name"),e(a).val()):d.append(e(a).attr("name"),e(a).val())}),ce(z,!0,d).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),de();var d=parseInt(t.data.newCount),n=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");n.text(d),d?n.addClass("wpd-has-comments"):n.removeClass("wpd-has-comments"),e(".wpd-thread-info").html(t.data.allCommentsCountNewHtml),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").text(t.data.allCommentsCountNew),t.data.allCommentsCountNew?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),t.data.message&&X(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wpd-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).delegate("#wpdiscuz-edit-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).delegate(".wpd-inline-comment-content","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-inline-icon-count.wpd-has-comments","click",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",oe(t)),ce(z,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-view-all-inline-comments","click",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-32},1e3)}),e(document).delegate(".wpd-feedback-content-link","click",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-38},1e3,function(){e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(ne(),e(window).scroll(ne)),e(document).delegate("#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg","click",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),ce(z,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e("#wpdiscuz-subscribe-form").submit(function(t){t.preventDefault();var a,o,n=e(this);if(n[0].checkValidity()&&(a=n,o=!0,"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",n).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),ce(z,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(".wpd-unsubscribe").click(function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),ce(z,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=ce});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
|
7 |
/* Colorbox */
|
8 |
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
|
9 |
/* Media Uploader */
|
10 |
-
jQuery(document).ready(function(e){if(e(document).delegate("#wpdcom .wmu-upload-wrap","click",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0)}),e(document).delegate(".wmu-add-files","change",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=a[0].files?a[0].files:[];d.length&&function(a,t,d){var o=new FormData;o.append("action","wmuUploadFiles"),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val());var
|
11 |
/* Lity */
|
12 |
!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t('<i style="display:none !important"/>'),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>'},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r<o;r++)n[r]&&(i[(t=n[r].split("="))[0]]=t[1]);return i}function w(e,n){return e+(e.indexOf("?")>-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t('<img src="'+e+'" alt="'+i+'"/>'),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('<span class="lity-error"/>').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+e+'"/></div>'}function E(){return n.documentElement.clientHeight?.9*n.documentElement.clientHeight:Math.round(.9*i.height())}function j(e){var t,i,r,o=z();o&&(27===e.keyCode&&o.options("esc")&&o.close(),9===e.keyCode&&(t=e,i=o.element().find(d),r=i.index(n.activeElement),t.shiftKey&&r<=0?(i.get(i.length-1).focus(),t.preventDefault()):t.shiftKey||r!==i.length-1||(i.get(0).focus(),t.preventDefault())))}function D(){t.each(a,function(e,t){t.resize()})}function z(){return 0===a.length?null:a[0]}function T(e,d,u,f){var y,v,p,m,b,w,x,C,k,z,T,O=this,q=!1,W=!1;d=t.extend({},c,d),v=t(d.template),O.element=function(){return v},O.opener=function(){return u},O.options=t.proxy(g,O,d),O.handlers=t.proxy(g,O,d.handlers),O.resize=function(){q&&!W&&p.css("max-height",E()+"px").trigger("lity:resize",[O])},O.close=function(){if(q&&!W){var e;W=!0,(e=O).element().attr(l,"true"),1===a.length&&(o.removeClass("lity-active"),i.off({resize:D,keydown:j})),((a=t.grep(a,function(t){return e!==t})).length?a[0].element():t(".lity-hidden")).removeClass("lity-hidden").each(function(){var e=t(this),n=e.data(s);n?e.attr(l,n):e.removeAttr(l),e.removeData(s)});var d=r();if(f&&(n.activeElement===v[0]||t.contains(v[0],n.activeElement)))try{f.focus()}catch(e){}return p.trigger("lity:close",[O]),v.removeClass("lity-opened").addClass("lity-closed"),h(p.add(v)).always(function(){p.trigger("lity:remove",[O]),v.remove(),v=void 0,d.resolve()}),d.promise()}},m=e,b=O,w=d.handlers,x=d.handler,k="inline",z=t.extend({},w),x&&z[x]?(C=z[x](m,b),k=x):(t.each(["inline","iframe"],function(e,t){delete z[t],z[t]=w[t]}),t.each(z,function(e,t){return!t||!(!t.test||t.test(m,b))||(!1!==(C=t(m,b))?(k=e,!1):void 0)})),y={handler:k,content:C||""},v.attr(l,"false").addClass("lity-loading lity-opened lity-"+y.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){t(e.target).is("[data-lity-close]")&&O.close()}).trigger("lity:open",[O]),T=O,1===a.unshift(T)&&(o.addClass("lity-active"),i.on({resize:D,keydown:j})),t("body > *").not(T.element()).addClass("lity-hidden").each(function(){var e=t(this);void 0===e.data(s)&&e.data(s,e.attr(l)||null)}).attr(l,"true"),t.when(y.content).always(function(e){p=t(e).css("max-height",E()+"px"),v.find(".lity-loader").each(function(){var e=t(this);h(e).always(function(){e.remove()})}),v.removeClass("lity-loading").find(".lity-content").empty().append(p),q=!0,p.trigger("lity:ready",[O])})}function O(e,i,r){e.preventDefault?(e.preventDefault(),e=(r=t(this)).data("lity-target")||r.attr("rel")||r.attr("src")):r=t(r);var o=new T(e,t.extend({},r.data("lity-options")||r.data("lity"),i),r,n.activeElement);if(!e.preventDefault)return o}return C.test=function(e){return u.test(e)},O.version="2.2.2",O.options=t.proxy(g,O,c),O.handlers=t.proxy(g,O,c.handlers),O.current=z,t(n).on("click.lity","[data-wpd-lity]",O),O});
|
13 |
/* My Content and Settings */
|
3 |
/* Autogrow */
|
4 |
jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
|
5 |
/* wpDiscuz */
|
6 |
+
var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if("[object Array]"===Object.prototype.toString.call(e))for(var d in e)"[object Array]"===Object.prototype.toString.call(t)?"success"===t[d]?o="wpdiscuz-message-success":"warning"===t[d]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[d]).prependTo("#wpdiscuz-comment-message").delay("[object Array]"===Object.prototype.toString.call(a)?a[d]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,d=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,n=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),i=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,g=wpdiscuzAjaxObj.cookiehash,_=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),v=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,z=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),C=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),k=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),x=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=[],T=[],D=[],E=!1,M=1,F=e("html").css("scroll-behavior"),L=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),e(document).delegate("#wpdcom .ql-editor, #wpdcom .wc_comment","focus",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(v)}),e(document).delegate("#wpdcom textarea","focus",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||U({comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).delegate("#wpd-editor-source-code-wrapper-bg","click",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).delegate("#wpd-insert-source-code","click",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).delegate(".wpd-reply-button","click",function(){var n=G(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+n).focus()},v):setTimeout(function(){e("#wc-textarea-"+n).trigger("focus")},v),e("#wpd-secondary-form-wrapper-"+n).slideToggle(v)):function(a){var o=G(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var d=e("#wpd-secondary-form-wrapper-"+o);if(!t){var n={comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)};U(n)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},v):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},v);d.slideToggle(v,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===d){var n=$(t);setTimeout(function(){if(!T[n])try{T[n]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(n)}),e(document).delegate("#wpdcom .wpd-comment-link [data-comment-url]","click",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.select(),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit","click",function(e){e.preventDefault()}),e(document).delegate(".wpd-toggle.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=G(e(this),0),o=e(this),d=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&_?function(t,a){var o=$(t),d=new FormData;d.append("action","wpdShowReplies"),d.append("commentId",o),me(z,!0,d).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies").remove(),le(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,d){console.log(d),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(d.removeClass("fa-chevron-up"),d.addClass("fa-chevron-down"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(d.removeClass("fa-chevron-down"),d.addClass("fa-chevron-up"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).delegate(".wpd-new-loaded-comment","mouseenter",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).delegate(".wpd-sbs-toggle","click",function(){e(".wpdiscuz-subscribe-bar").slideToggle(v)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&("2.0"===d?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).delegate("#wpdiscuz-subscribe-form","submit",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===d&&e(document).delegate("#wpdiscuz_subscription_button","click",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.submit()},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===d){var R=e(window).width(),S=e("#wpdcom").width();S>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),S>=940&&S<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),S>=810&&S<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),S>=730&&S<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),S>=610&&S<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),R>650&&(S>=510&&S<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),S>=470&&S<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),S<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function q(t,a,o){me(z||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(v),e(".wpd-thread-info").html(a.data.wc_all_comments_count_new_html),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(a.data.wc_all_comments_count_new),a.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide();var d=v;a.data.is_main?ae(a.data.message):(d=v+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),me(z,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),me(z,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,d=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+g,a),Cookies.set("comment_author_"+g,o),d.length&&Cookies.set("comment_author_url_"+g,d)):(u=parseInt(u),Cookies.set("comment_author_email_"+g,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+g,o,{expires:u,path:"/"}),d.length&&Cookies.set("comment_author_url_"+g,d,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").attr("checked","checked")}(a.data):b||e(".wpd-cookies-checkbox").removeAttr("checked"),wpdiscuzLoadRichEditor&&wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]),t.get(0).reset(),U(a.data),e(".wmu-preview-wrap",t).remove(),I.length&&(I.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),I=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-32},1e3,te)},d),le(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"),le(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,d){console.log(d),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function U(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function H(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).delegate(".wc_comm_submit.wpd_not_clicked","click",function(){var t=e(this),n=1,s=e(this).parents("form");if(s.hasClass("wpd_main_comm_form")||(n=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===X(t,!1)&&(o=X(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),Z(s,"#wpd-editor-"+e(".wpdiscuz_unique_id",s).val()),s.submit(function(e){e.preventDefault()}),""!==e(".wc_comment",s).val().trim()){if(s[0].checkValidity()&&(c=s,p=!0,"2.0"===d&&e("input[name=wc_captcha]",c).length&&!e("input[name=wc_captcha]",c).val().length?(p=!1,e(".wpdiscuz-recaptcha",c).css("border","1px solid red")):"2.0"===d&&e("input[name=wc_captcha]",c).length&&e(".wpdiscuz-recaptcha",c).css("border","none"),p)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+g,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){I.push(e(this))}))})}(s),e(t).removeClass("wpd_not_clicked");var i=new FormData;if(i.append("action","wpdAddComment"),e(":input",s).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&i.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),i.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&i.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",s).length&&!e(".wpd-cookies-checkbox",s).prop("checked")&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===d&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){i.append("g-recaptcha-response",e),q(s,i,t)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else q(s,i,t)}var c,p;!function(e){if((a||o)&&"2.0"===d){var t=$(e);grecaptcha.reset(T[t])}}(e(".wpdiscuz_unique_id",s).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields,"error")}),e(document).delegate(".wpd_editable_comment","click",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&H(G(e(".wpdiscuz-edit-form-wrap"),0),w);var t=G(e(this),0),a=$(t),o=new FormData;o.append("action","wpdEditComment"),o.append("commentId",a),w=e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-text").get(0),me(z,!0,o).done(function(a){if("object"==typeof a)if(a.success){if(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(a.data.html),wpdiscuzLoadRichEditor){let o=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+t);o.clipboard.dangerouslyPasteHTML(0,a.data.content),o.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+t).val(a.data.content);e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error");else console.log(a);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wc_save_edited_comment","click",function(){var t=G(e(this)),a=$(t),o=e("#wpd-comm-"+t+" #wpdiscuz-edit-form");if(Z(o,"#wpd-editor-edit_"+t),o.submit(function(e){e.preventDefault()}),o[0].checkValidity()){var d=new FormData;d.append("action","wpdSaveEditedComment"),d.append("commentId",a),e(":input",o).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&d.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&d.append(this.name+"",e(this).val())}),me(z,!0,d).done(function(o){"object"==typeof o?(o.success?(H(t,o.data.message),o.data.lastEdited&&(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(o.data.lastEdited).insertAfter("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),o.data.twitterShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",o.data.twitterShareLink),o.data.whatsappShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",o.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[o.data],"error"),le(o,a)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wc_cancel_edit","click",function(){var t=G(e(this));H(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){P(!0)},500):e(document).delegate(".wpd-load-comments","click",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),P(!0)})),e(document).delegate(".wpd-load-more-submit","click",function(){var t=e(this);t.hasClass("wpd-loaded")&&P(!1,t,"wpd-loaded","wpd-loading")});var W=!1;function N(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===W&&1==t&&(W=!0,P(!1,e(".wpd-load-more-submit"))))}function P(t,a,o,d){a&&(a.toggleClass(o),a.toggleClass(d));var s=new FormData;s.append("action","wpdLoadMoreComments");var i=e(".wpdiscuz-sort-button-active").attr("data-sorting");i&&s.append("sorting",i),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),me(z,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==n),W=!1,r=s.data.loadLastCommentId,le(s),t&&Q(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))}).fail(function(t,n,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==n&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),le(t)}function Q(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){ee(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-32},1e3,te),t&&V(o)},500);else{var d=new FormData;d.append("action","wpdGetSingleComment"),d.append("commentId",o),me(z,!0,d).done(function(a){if("object"==typeof a&&a.success){var d="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e(d).offset().top-32},1e3,te),t&&V(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function V(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function B(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)Y((t=a[o]).comment_parent,t.comment_html)}function G(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function $(e){return e.substring(0,e.indexOf("_"))}function X(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function Y(t,a){if(0==t)ae(a);else{var o=G(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function J(){var t,a,o="";return e(".wpd-comment-right").each(function(){t=G(e(this),0),a=$(t),o+=a+","}),o}function Z(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).removeAttr("required"),0===e("input:checked",this).length?e("input",e(this)).attr("required","required"):e(".wpd-field-invalid",this).remove()})}function ee(){e("html, body").css("scroll-behavior","unset")}function te(){e("html").css("scroll-behavior",F),e("body").css("scroll-behavior",L)}function ae(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function oe(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==n||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),N(),e(window).scroll(function(){N()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).delegate(".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked","click",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=$(G(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var d=new FormData;d.append("action","wpdVoteOnComment"),d.append("commentId",o),d.append("voteType",a),me(z,!0,d).done(function(d){if(e(t).addClass("wpd_not_clicked"),"object"==typeof d){if(d.success){if("total"===d.data.buttonsStyle){var n=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=d.data.votes;n.text(s),n.removeClass("wpd-up wpd-down"),s>0&&n.addClass("wpd-up"),s<0&&n.addClass("wpd-down")}else{var i=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));i.text(d.data.likeCount),c.text(d.data.dislikeCount),parseInt(d.data.likeCount)>0?i.addClass("wpd-up"):i.removeClass("wpd-up"),parseInt(d.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),d.data.curUserReaction>0?p.addClass("wpd-up"):d.data.curUserReaction<0&&r.addClass("wpd-down")}else d.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data],"error");le(d,o,a)}else console.log(d);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate("body","click",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).delegate(".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)","click",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var d=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",d||""),me(z,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){Q(!1)},1!=m&&Q(!1),e(document).delegate(".wpdiscuz-readmore","click",function(){var t=G(e(this)),a=$(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),me(z,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),le(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-required-group","change",function(){0!==e("input:checked",this).length?e("input",e(this)).removeAttr("required"):e("input",e(this)).attr("required","required")}),e(document).delegate(".wpdiscuz-spoiler","click",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).delegate(".wpd-tools i","click",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).delegate(".wpd-comment-right","mouseleave",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).delegate(".wpd_stick_btn","click",function(){var t=$(G(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),me(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd_close_btn","click",function(){var t=$(G(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),me(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-filter.wpd_not_clicked[data-filter-type]","click",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&o.append("sorting",d),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),me(z,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),le(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpdf-reacted.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),me(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3,te))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpdf-hottest.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),me(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3,te))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpd-filter-view-all","click",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-follow-link.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=$(G(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),me(z,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.code],"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),oe(),e(document).delegate(".wc_email","keyup",function(){oe(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),k&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*x)},1e3*k),"content_left"===O)if(e(".entry-content").length){var de=(ne=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){de=(ne=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var ne;de=(ne=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e("#wpd-bubble-add-message-close").click(function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e("#wpd-bubble").click(function(){ee(),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-60},1e3,function(){te(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").focus()})}),e("#wpd-bubble-comment-close").click(function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e("#wpd-bubble-comment-reply-link a").click(function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),Q(!0);var a=t.match(/#comment\-(\d+)/);D=D.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(D.length),0==D.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e("#wpd-bubble-count").click(function(){if(D.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",D.join()),me(z,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),B(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),D=[],ee(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-60},1e3,te),le(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&C||i)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:l,visibleCommentIds:J()}}).done(function(a){if(!E)if("object"==typeof a){if(a.ids.length){i&&((n=new FormData).append("action","wpdUpdateAutomatically"),n.append("loadLastCommentId",r),n.append("visibleCommentIds",J()),me(z,!1,n).done(function(t){E||"object"==typeof t&&t.success&&(B(t),e(".wpd-thread-info").html(t.data.wc_all_comments_count_new_html),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(t.data.wc_all_comments_count_new),t.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),D=D.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var d=parseInt(e(".wpd-new-comments-count").text());d+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(d),e("#wpd-bubble-count").addClass("wpd-new-comments"),a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").text(a.all_comments_count),a.all_comments_count?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),e(".wpd-thread-info").html(a.all_comments_count_html)}}else console.log(a);var n;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var se=new FormData;se.append("action","wpdGetInlineCommentForm"),me(z,!1,se).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),re()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function ie(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function ce(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function pe(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),re(t.siblings(".wpd-inline-form-wrapper"))))})}function re(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function le(t,a,o,d){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,d):console.log(t.data.callbackFunctions[e]+" is not a function")})}function me(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var d=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[d]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[d],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]](o,t,a))});var n=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:n,data:o,contentType:!1,processData:!1})}e(document).delegate("body","click",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){ce();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),re(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).delegate(".wpd-inline-submit.wpd_not_clicked","click",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var d=new FormData;d.append("action","wpdAddInlineComment"),d.append("inline_form_id",ie(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&d.append(e(a).attr("name"),e(a).val()):d.append(e(a).attr("name"),e(a).val())}),me(z,!0,d).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),ce();var d=parseInt(t.data.newCount),n=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");n.text(d),d?n.addClass("wpd-has-comments"):n.removeClass("wpd-has-comments"),e(".wpd-thread-info").html(t.data.allCommentsCountNewHtml),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").text(t.data.allCommentsCountNew),t.data.allCommentsCountNew?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),t.data.message&&ae(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wpd-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).delegate("#wpdiscuz-edit-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).delegate(".wpd-inline-comment-content","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-inline-icon-count.wpd-has-comments","click",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",ie(t)),me(z,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-view-all-inline-comments","click",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),ee(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-32},1e3,te)}),e(document).delegate(".wpd-feedback-content-link","click",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");ee(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-38},1e3,function(){te(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(pe(),e(window).scroll(pe)),e(document).delegate("#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg","click",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),me(z,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e("#wpdiscuz-subscribe-form").submit(function(t){t.preventDefault();var a,o,n=e(this);if(n[0].checkValidity()&&(a=n,o=!0,"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",n).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),me(z,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(".wpd-unsubscribe").click(function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),me(z,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=me});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
|
7 |
/* Colorbox */
|
8 |
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
|
9 |
/* Media Uploader */
|
10 |
+
jQuery(document).ready(function(e){if(e(document).delegate("#wpdcom .wmu-upload-wrap","click",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0)}),e(document).delegate(".wmu-add-files","change",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=a[0].files?a[0].files:[];d.length&&function(a,t,d){var o=new FormData;o.append("action","wmuUploadFiles"),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val());var i=0;e.each(d,function(e,a){i+=a.size,o.append(wpdiscuzAjaxObj.wmuInput+"["+e+"]",a)}),i>parseInt(wpdiscuzAjaxObj.wmuMaxFileSize)?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wmuPhraseMaxFileSize,"error",3e3):i>parseInt(wpdiscuzAjaxObj.wmuPostMaxSize)?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wmuPhrasePostMaxSize,"error",3e3):wpdiscuzAjaxObj.getAjaxObj(!0,!0,o).done(function(a){a.success?(e(".wmu-attached-data-info",t).remove(),e(".wmu-add-files",t).after(a.data.attachmentsHtml),a.data.tooltip&&e(".wmu-upload-wrap").attr("wpd-tooltip",a.data.tooltip),function(a,t){e.each(t.data.previewsData,function(t,d){e(".wmu-action-wrap .wmu-"+t+"-tab",a).html(""),e.each(d,function(d,o){var i=o.id,m="",s=o.fullname,u=o.shortname;t==wpdiscuzAjaxObj.wmuKeyImages?(m=o.url,u=""):t==wpdiscuzAjaxObj.wmuKeyVideos?m=wpdiscuzAjaxObj.wmuIconVideo:t==wpdiscuzAjaxObj.wmuKeyFiles&&(m=wpdiscuzAjaxObj.wmuIconFile);var r='<div class="wmu-preview [PREVIEW_TYPE_CLASS]" title="[PREVIEW_TITLE]" data-wmu-type="[PREVIEW_TYPE]" data-wmu-attachment="[PREVIEW_ID]"><div class="wmu-preview-remove"><img class="wmu-preview-img" src="[PREVIEW_ICON]"><div class="wmu-file-name">[PREVIEW_FILENAME]</div><div class="wmu-delete"> </div></div></div>';r=(r=(r=(r=(r=(r=r.replace("[PREVIEW_TYPE_CLASS]","wmu-preview-"+t)).replace("[PREVIEW_TITLE]",s)).replace("[PREVIEW_TYPE]",t)).replace("[PREVIEW_ID]",i)).replace("[PREVIEW_ICON]",m)).replace("[PREVIEW_FILENAME]",u),e(".wmu-action-wrap .wmu-"+t+"-tab",a).removeClass("wmu-hide").append(r)})})}(t,a),a.data.errors&&(wpdiscuzAjaxObj.setCommentMessage(a.data.errors,"error",3e3),console.log(a.data.errors))):a.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.errorCode],"error",3e3):a.data.error&&wpdiscuzAjaxObj.setCommentMessage(a.data.error,"error",3e3),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}(0,t,d)}),e(document).delegate(".wmu-attachment-delete","click",function(a){if(confirm(wpdiscuzAjaxObj.wmuPhraseConfirmDelete)){var t=e(this).data("wmu-attachment"),d=new FormData;d.append("action","wmuDeleteAttachment"),d.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),d.append("attachmentId",t),wpdiscuzAjaxObj.getAjaxObj(!0,!0,d).done(function(a){if(a.success){var d=e(".wmu-attachment-"+t).parents(".wmu-comment-attachments");e(".wmu-attachment-"+t).remove(),e(".wmu-attached-images *",d).length||e(".wmu-attached-images",d).remove(),e(".wmu-attached-videos *",d).length||e(".wmu-attached-videos",d).remove(),e(".wmu-attached-files *",d).length||e(".wmu-attached-files",d).remove()}else a.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.errorCode],"error",3e3):a.data.error&&wpdiscuzAjaxObj.setCommentMessage(a.data.error,"error",3e3);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}else console.log("canceled")}),e(document).delegate(".wmu-preview","click",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=(a.data("wmu-type"),a.data("wmu-attachment")),o=new FormData;o.append("action","wmuRemoveAttachmentPreview"),o.append("attachmentId",d),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val()),wpdiscuzAjaxObj.getAjaxObj(!0,!0,o).done(function(d){if(d.success){a.remove();var o=e(".wmu-tabs",t);e.each(o,function(a,t){e(".wmu-preview",t).length?e(t).removeClass("wmu-hide"):e(t).addClass("wmu-hide")}),e(".wmu-attached-data-info",t).remove(),e(".wmu-add-files",t).after(d.data.attachmentsHtml),d.data.tooltip&&e(".wmu-upload-wrap").attr("wpd-tooltip",d.data.tooltip)}else d.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data.errorCode],"error",3e3):d.data.error&&wpdiscuzAjaxObj.setCommentMessage(d.data.error,"error",3e3);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}),parseInt(wpdiscuzAjaxObj.wmuIsLightbox)){function a(){e(".wmu-lightbox").colorbox({maxHeight:"95%",maxWidth:"95%",rel:"wmu-lightbox",fixed:!0})}a(),wpdiscuzAjaxObj.wmuAddLightBox=a}wpdiscuzAjaxObj.wmuHideAll=function(a,t){"object"==typeof a?a.success?(e(".wmu-tabs",t).addClass("wmu-hide"),e(".wmu-preview",t).remove(),e(".wmu-attached-data-info",t).remove()):console.log(a.data):console.log(a)}});
|
11 |
/* Lity */
|
12 |
!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t('<i style="display:none !important"/>'),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>'},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r<o;r++)n[r]&&(i[(t=n[r].split("="))[0]]=t[1]);return i}function w(e,n){return e+(e.indexOf("?")>-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t('<img src="'+e+'" alt="'+i+'"/>'),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('<span class="lity-error"/>').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+e+'"/></div>'}function E(){return n.documentElement.clientHeight?.9*n.documentElement.clientHeight:Math.round(.9*i.height())}function j(e){var t,i,r,o=z();o&&(27===e.keyCode&&o.options("esc")&&o.close(),9===e.keyCode&&(t=e,i=o.element().find(d),r=i.index(n.activeElement),t.shiftKey&&r<=0?(i.get(i.length-1).focus(),t.preventDefault()):t.shiftKey||r!==i.length-1||(i.get(0).focus(),t.preventDefault())))}function D(){t.each(a,function(e,t){t.resize()})}function z(){return 0===a.length?null:a[0]}function T(e,d,u,f){var y,v,p,m,b,w,x,C,k,z,T,O=this,q=!1,W=!1;d=t.extend({},c,d),v=t(d.template),O.element=function(){return v},O.opener=function(){return u},O.options=t.proxy(g,O,d),O.handlers=t.proxy(g,O,d.handlers),O.resize=function(){q&&!W&&p.css("max-height",E()+"px").trigger("lity:resize",[O])},O.close=function(){if(q&&!W){var e;W=!0,(e=O).element().attr(l,"true"),1===a.length&&(o.removeClass("lity-active"),i.off({resize:D,keydown:j})),((a=t.grep(a,function(t){return e!==t})).length?a[0].element():t(".lity-hidden")).removeClass("lity-hidden").each(function(){var e=t(this),n=e.data(s);n?e.attr(l,n):e.removeAttr(l),e.removeData(s)});var d=r();if(f&&(n.activeElement===v[0]||t.contains(v[0],n.activeElement)))try{f.focus()}catch(e){}return p.trigger("lity:close",[O]),v.removeClass("lity-opened").addClass("lity-closed"),h(p.add(v)).always(function(){p.trigger("lity:remove",[O]),v.remove(),v=void 0,d.resolve()}),d.promise()}},m=e,b=O,w=d.handlers,x=d.handler,k="inline",z=t.extend({},w),x&&z[x]?(C=z[x](m,b),k=x):(t.each(["inline","iframe"],function(e,t){delete z[t],z[t]=w[t]}),t.each(z,function(e,t){return!t||!(!t.test||t.test(m,b))||(!1!==(C=t(m,b))?(k=e,!1):void 0)})),y={handler:k,content:C||""},v.attr(l,"false").addClass("lity-loading lity-opened lity-"+y.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){t(e.target).is("[data-lity-close]")&&O.close()}).trigger("lity:open",[O]),T=O,1===a.unshift(T)&&(o.addClass("lity-active"),i.on({resize:D,keydown:j})),t("body > *").not(T.element()).addClass("lity-hidden").each(function(){var e=t(this);void 0===e.data(s)&&e.data(s,e.attr(l)||null)}).attr(l,"true"),t.when(y.content).always(function(e){p=t(e).css("max-height",E()+"px"),v.find(".lity-loader").each(function(){var e=t(this);h(e).always(function(){e.remove()})}),v.removeClass("lity-loading").find(".lity-content").empty().append(p),q=!0,p.trigger("lity:ready",[O])})}function O(e,i,r){e.preventDefault?(e.preventDefault(),e=(r=t(this)).data("lity-target")||r.attr("rel")||r.attr("src")):r=t(r);var o=new T(e,t.extend({},r.data("lity-options")||r.data("lity"),i),r,n.activeElement);if(!e.preventDefault)return o}return C.test=function(e){return u.test(e)},O.version="2.2.2",O.options=t.proxy(g,O,c),O.handlers=t.proxy(g,O,c.handlers),O.current=z,t(n).on("click.lity","[data-wpd-lity]",O),O});
|
13 |
/* My Content and Settings */
|
assets/js/wpdiscuz-combo.min.js
CHANGED
@@ -7,11 +7,11 @@
|
|
7 |
/* Autogrow */
|
8 |
jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
|
9 |
/* wpDiscuz */
|
10 |
-
var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if("[object Array]"===Object.prototype.toString.call(e))for(var d in e)"[object Array]"===Object.prototype.toString.call(t)?"success"===t[d]?o="wpdiscuz-message-success":"warning"===t[d]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[d]).prependTo("#wpdiscuz-comment-message").delay("[object Array]"===Object.prototype.toString.call(a)?a[d]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,d=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,n=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),i=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,g=wpdiscuzAjaxObj.cookiehash,_=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),v=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,z=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),C=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),k=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),x=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=[],T=[],D=[],E=!1,M=1;(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),e(document).delegate("#wpdcom .ql-editor, #wpdcom .wc_comment","focus",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(v)}),e(document).delegate("#wpdcom textarea","focus",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||S({comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).delegate("#wpd-editor-source-code-wrapper-bg","click",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).delegate("#wpd-insert-source-code","click",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).delegate(".wpd-reply-button","click",function(){var n=V(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+n).focus()},v):setTimeout(function(){e("#wc-textarea-"+n).trigger("focus")},v),e("#wpd-secondary-form-wrapper-"+n).slideToggle(v)):function(a){var o=V(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var d=e("#wpd-secondary-form-wrapper-"+o);if(!t){var n={comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)};S(n)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},v):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},v);d.slideToggle(v,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===d){var n=B(t);setTimeout(function(){if(!T[n])try{T[n]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(n)}),e(document).delegate("#wpdcom .wpd-comment-link [data-comment-url]","click",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.select(),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit","click",function(e){e.preventDefault()}),e(document).delegate(".wpd-toggle.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=V(e(this),0),o=e(this),d=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&_?function(t,a){var o=B(t),d=new FormData;d.append("action","wpdShowReplies"),d.append("commentId",o),ce(z,!0,d).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies").remove(),ie(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,d){console.log(d),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(d.removeClass("fa-chevron-up"),d.addClass("fa-chevron-down"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(d.removeClass("fa-chevron-down"),d.addClass("fa-chevron-up"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).delegate(".wpd-new-loaded-comment","mouseenter",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).delegate(".wpd-sbs-toggle","click",function(){e(".wpdiscuz-subscribe-bar").slideToggle(v)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&("2.0"===d?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).delegate("#wpdiscuz-subscribe-form","submit",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===d&&e(document).delegate("#wpdiscuz_subscription_button","click",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.submit()},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===d){var F=e(window).width(),L=e("#wpdcom").width();L>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),L>=940&&L<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),L>=810&&L<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),L>=730&&L<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),L>=610&&L<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),F>650&&(L>=510&&L<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),L>=470&&L<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),L<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function R(t,a,o){ce(z||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(v),e(".wpd-thread-info").html(a.data.wc_all_comments_count_new_html),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(a.data.wc_all_comments_count_new),a.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide();var d=v;a.data.is_main?X(a.data.message):(d=v+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),ce(z,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),ce(z,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,d=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+g,a),Cookies.set("comment_author_"+g,o),d.length&&Cookies.set("comment_author_url_"+g,d)):(u=parseInt(u),Cookies.set("comment_author_email_"+g,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+g,o,{expires:u,path:"/"}),d.length&&Cookies.set("comment_author_url_"+g,d,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").attr("checked","checked")}(a.data):b||e(".wpd-cookies-checkbox").removeAttr("checked"),wpdiscuzLoadRichEditor&&wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]),t.get(0).reset(),S(a.data),e(".wmu-preview-wrap",t).remove(),I.length&&(I.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),I=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-32},1e3)},d),ie(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"),ie(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,d){console.log(d),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function S(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function q(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).delegate(".wc_comm_submit.wpd_not_clicked","click",function(){var t=e(this),n=1,s=e(this).parents("form");if(s.hasClass("wpd_main_comm_form")||(n=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===G(t,!1)&&(o=G(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),J(s,"#wpd-editor-"+e(".wpdiscuz_unique_id",s).val()),s.submit(function(e){e.preventDefault()}),""!==e(".wc_comment",s).val().trim()){if(s[0].checkValidity()&&(c=s,p=!0,"2.0"===d&&e("input[name=wc_captcha]",c).length&&!e("input[name=wc_captcha]",c).val().length?(p=!1,e(".wpdiscuz-recaptcha",c).css("border","1px solid red")):"2.0"===d&&e("input[name=wc_captcha]",c).length&&e(".wpdiscuz-recaptcha",c).css("border","none"),p)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+g,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){I.push(e(this))}))})}(s),e(t).removeClass("wpd_not_clicked");var i=new FormData;if(i.append("action","wpdAddComment"),e(":input",s).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&i.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),i.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&i.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",s).length&&!e(".wpd-cookies-checkbox",s).prop("checked")&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===d&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){i.append("g-recaptcha-response",e),R(s,i,t)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else R(s,i,t)}var c,p;!function(e){if((a||o)&&"2.0"===d){var t=B(e);grecaptcha.reset(T[t])}}(e(".wpdiscuz_unique_id",s).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields,"error")}),e(document).delegate(".wpd_editable_comment","click",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&q(V(e(".wpdiscuz-edit-form-wrap"),0),w);var t=V(e(this),0),a=B(t),o=new FormData;o.append("action","wpdEditComment"),o.append("commentId",a),w=e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-text").get(0),ce(z,!0,o).done(function(a){if("object"==typeof a)if(a.success){if(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(a.data.html),wpdiscuzLoadRichEditor){let o=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+t);o.clipboard.dangerouslyPasteHTML(0,a.data.content),o.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+t).val(a.data.content);e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error");else console.log(a);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wc_save_edited_comment","click",function(){var t=V(e(this)),a=B(t),o=e("#wpd-comm-"+t+" #wpdiscuz-edit-form");if(J(o,"#wpd-editor-edit_"+t),o.submit(function(e){e.preventDefault()}),o[0].checkValidity()){var d=new FormData;d.append("action","wpdSaveEditedComment"),d.append("commentId",a),e(":input",o).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&d.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&d.append(this.name+"",e(this).val())}),ce(z,!0,d).done(function(o){"object"==typeof o?(o.success?(q(t,o.data.message),o.data.lastEdited&&(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(o.data.lastEdited).insertAfter("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),o.data.twitterShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",o.data.twitterShareLink),o.data.whatsappShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",o.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[o.data],"error"),ie(o,a)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wc_cancel_edit","click",function(){var t=V(e(this));q(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){W(!0)},500):e(document).delegate(".wpd-load-comments","click",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),W(!0)})),e(document).delegate(".wpd-load-more-submit","click",function(){var t=e(this);t.hasClass("wpd-loaded")&&W(!1,t,"wpd-loaded","wpd-loading")});var U=!1;function H(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===U&&1==t&&(U=!0,W(!1,e(".wpd-load-more-submit"))))}function W(t,a,o,d){a&&(a.toggleClass(o),a.toggleClass(d));var s=new FormData;s.append("action","wpdLoadMoreComments");var i=e(".wpdiscuz-sort-button-active").attr("data-sorting");i&&s.append("sorting",i),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),ce(z,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==n),U=!1,r=s.data.loadLastCommentId,ie(s),t&&P(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))}).fail(function(t,n,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==n&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),ie(t)}function P(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-32},1e3),t&&N(o)},500);else{var d=new FormData;d.append("action","wpdGetSingleComment"),d.append("commentId",o),ce(z,!0,d).done(function(a){if("object"==typeof a&&a.success){var d="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e(d).offset().top-32},1e3),t&&N(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function N(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function Q(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)$((t=a[o]).comment_parent,t.comment_html)}function V(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function B(e){return e.substring(0,e.indexOf("_"))}function G(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function $(t,a){if(0==t)X(a);else{var o=V(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function Y(){var t,a,o="";return e(".wpd-comment-right").each(function(){t=V(e(this),0),a=B(t),o+=a+","}),o}function J(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).removeAttr("required"),0===e("input:checked",this).length?e("input",e(this)).attr("required","required"):e(".wpd-field-invalid",this).remove()})}function X(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function Z(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==n||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),H(),e(window).scroll(function(){H()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).delegate(".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked","click",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=B(V(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var d=new FormData;d.append("action","wpdVoteOnComment"),d.append("commentId",o),d.append("voteType",a),ce(z,!0,d).done(function(d){if(e(t).addClass("wpd_not_clicked"),"object"==typeof d){if(d.success){if("total"===d.data.buttonsStyle){var n=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=d.data.votes;n.text(s),n.removeClass("wpd-up wpd-down"),s>0&&n.addClass("wpd-up"),s<0&&n.addClass("wpd-down")}else{var i=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));i.text(d.data.likeCount),c.text(d.data.dislikeCount),parseInt(d.data.likeCount)>0?i.addClass("wpd-up"):i.removeClass("wpd-up"),parseInt(d.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),d.data.curUserReaction>0?p.addClass("wpd-up"):d.data.curUserReaction<0&&r.addClass("wpd-down")}else d.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data],"error");ie(d,o,a)}else console.log(d);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate("body","click",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).delegate(".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)","click",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var d=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",d||""),ce(z,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){P(!1)},1!=m&&P(!1),e(document).delegate(".wpdiscuz-readmore","click",function(){var t=V(e(this)),a=B(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),ce(z,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),ie(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-required-group","change",function(){0!==e("input:checked",this).length?e("input",e(this)).removeAttr("required"):e("input",e(this)).attr("required","required")}),e(document).delegate(".wpdiscuz-spoiler","click",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).delegate(".wpd-tools i","click",function(){var t=e(this).siblings(".wpd-tools-actions");t.css({display:t.is(":visible")?"none":"flex"})}),e(document).delegate(".wpd-comment-right","mouseleave",function(){e(this).find(".wpd-tools-actions").hide()}),e(document).delegate(".wpd_stick_btn","click",function(){var t=B(V(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),ce(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd_close_btn","click",function(){var t=B(V(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),ce(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-filter.wpd_not_clicked[data-filter-type]","click",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&o.append("sorting",d),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),ce(z,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),ie(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpdf-reacted.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),ce(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpdf-hottest.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),ce(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpd-filter-view-all","click",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-follow-link.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=B(V(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),ce(z,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.code],"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),Z(),e(document).delegate(".wc_email","keyup",function(){Z(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),k&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*x)},1e3*k),"content_left"===O)if(e(".entry-content").length){var ee=(te=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){ee=(te=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var te;ee=(te=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e("#wpd-bubble-add-message-close").click(function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e("#wpd-bubble").click(function(){e("html, body").animate({scrollTop:e("#wpdcom").offset().top-60},1e3,function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").focus()})}),e("#wpd-bubble-comment-close").click(function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e("#wpd-bubble-comment-reply-link a").click(function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),P(!0);var a=t.match(/#comment\-(\d+)/);D=D.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(D.length),0==D.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e("#wpd-bubble-count").click(function(){if(D.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",D.join()),ce(z,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),Q(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),D=[],e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-60},1e3),ie(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&C||i)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,data:{postId:s,lastId:l,visibleCommentIds:Y()}}).done(function(a){if(!E)if("object"==typeof a){if(a.ids.length){i&&((n=new FormData).append("action","wpdUpdateAutomatically"),n.append("loadLastCommentId",r),n.append("visibleCommentIds",Y()),ce(z,!1,n).done(function(t){E||"object"==typeof t&&t.success&&(Q(t),e(".wpd-thread-info").html(t.data.wc_all_comments_count_new_html),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(t.data.wc_all_comments_count_new),t.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),D=D.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var d=parseInt(e(".wpd-new-comments-count").text());d+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(d),e("#wpd-bubble-count").addClass("wpd-new-comments"),a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").text(a.all_comments_count),a.all_comments_count?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),e(".wpd-thread-info").html(a.all_comments_count_html)}}else console.log(a);var n;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var ae=new FormData;ae.append("action","wpdGetInlineCommentForm"),ce(z,!1,ae).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),se()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function oe(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function de(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function ne(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),se(t.siblings(".wpd-inline-form-wrapper"))))})}function se(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function ie(t,a,o,d){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,d):console.log(t.data.callbackFunctions[e]+" is not a function")})}function ce(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var d=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[d]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[d],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]](o,t,a))});var n=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:n,data:o,contentType:!1,processData:!1})}e(document).delegate("body","click",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){de();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),se(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).delegate(".wpd-inline-submit.wpd_not_clicked","click",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var d=new FormData;d.append("action","wpdAddInlineComment"),d.append("inline_form_id",oe(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&d.append(e(a).attr("name"),e(a).val()):d.append(e(a).attr("name"),e(a).val())}),ce(z,!0,d).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),de();var d=parseInt(t.data.newCount),n=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");n.text(d),d?n.addClass("wpd-has-comments"):n.removeClass("wpd-has-comments"),e(".wpd-thread-info").html(t.data.allCommentsCountNewHtml),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").text(t.data.allCommentsCountNew),t.data.allCommentsCountNew?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),t.data.message&&X(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wpd-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).delegate("#wpdiscuz-edit-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).delegate(".wpd-inline-comment-content","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-inline-icon-count.wpd-has-comments","click",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",oe(t)),ce(z,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-view-all-inline-comments","click",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-32},1e3)}),e(document).delegate(".wpd-feedback-content-link","click",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-38},1e3,function(){e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(ne(),e(window).scroll(ne)),e(document).delegate("#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg","click",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),ce(z,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e("#wpdiscuz-subscribe-form").submit(function(t){t.preventDefault();var a,o,n=e(this);if(n[0].checkValidity()&&(a=n,o=!0,"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",n).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),ce(z,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(".wpd-unsubscribe").click(function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),ce(z,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=ce});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
|
11 |
/* Colorbox */
|
12 |
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
|
13 |
/* Media Uploader */
|
14 |
-
jQuery(document).ready(function(e){if(e(document).delegate("#wpdcom .wmu-upload-wrap","click",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0)}),e(document).delegate(".wmu-add-files","change",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=a[0].files?a[0].files:[];d.length&&function(a,t,d){var o=new FormData;o.append("action","wmuUploadFiles"),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val());var
|
15 |
/* Lity */
|
16 |
!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t('<i style="display:none !important"/>'),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>'},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r<o;r++)n[r]&&(i[(t=n[r].split("="))[0]]=t[1]);return i}function w(e,n){return e+(e.indexOf("?")>-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t('<img src="'+e+'" alt="'+i+'"/>'),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('<span class="lity-error"/>').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+e+'"/></div>'}function E(){return n.documentElement.clientHeight?.9*n.documentElement.clientHeight:Math.round(.9*i.height())}function j(e){var t,i,r,o=z();o&&(27===e.keyCode&&o.options("esc")&&o.close(),9===e.keyCode&&(t=e,i=o.element().find(d),r=i.index(n.activeElement),t.shiftKey&&r<=0?(i.get(i.length-1).focus(),t.preventDefault()):t.shiftKey||r!==i.length-1||(i.get(0).focus(),t.preventDefault())))}function D(){t.each(a,function(e,t){t.resize()})}function z(){return 0===a.length?null:a[0]}function T(e,d,u,f){var y,v,p,m,b,w,x,C,k,z,T,O=this,q=!1,W=!1;d=t.extend({},c,d),v=t(d.template),O.element=function(){return v},O.opener=function(){return u},O.options=t.proxy(g,O,d),O.handlers=t.proxy(g,O,d.handlers),O.resize=function(){q&&!W&&p.css("max-height",E()+"px").trigger("lity:resize",[O])},O.close=function(){if(q&&!W){var e;W=!0,(e=O).element().attr(l,"true"),1===a.length&&(o.removeClass("lity-active"),i.off({resize:D,keydown:j})),((a=t.grep(a,function(t){return e!==t})).length?a[0].element():t(".lity-hidden")).removeClass("lity-hidden").each(function(){var e=t(this),n=e.data(s);n?e.attr(l,n):e.removeAttr(l),e.removeData(s)});var d=r();if(f&&(n.activeElement===v[0]||t.contains(v[0],n.activeElement)))try{f.focus()}catch(e){}return p.trigger("lity:close",[O]),v.removeClass("lity-opened").addClass("lity-closed"),h(p.add(v)).always(function(){p.trigger("lity:remove",[O]),v.remove(),v=void 0,d.resolve()}),d.promise()}},m=e,b=O,w=d.handlers,x=d.handler,k="inline",z=t.extend({},w),x&&z[x]?(C=z[x](m,b),k=x):(t.each(["inline","iframe"],function(e,t){delete z[t],z[t]=w[t]}),t.each(z,function(e,t){return!t||!(!t.test||t.test(m,b))||(!1!==(C=t(m,b))?(k=e,!1):void 0)})),y={handler:k,content:C||""},v.attr(l,"false").addClass("lity-loading lity-opened lity-"+y.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){t(e.target).is("[data-lity-close]")&&O.close()}).trigger("lity:open",[O]),T=O,1===a.unshift(T)&&(o.addClass("lity-active"),i.on({resize:D,keydown:j})),t("body > *").not(T.element()).addClass("lity-hidden").each(function(){var e=t(this);void 0===e.data(s)&&e.data(s,e.attr(l)||null)}).attr(l,"true"),t.when(y.content).always(function(e){p=t(e).css("max-height",E()+"px"),v.find(".lity-loader").each(function(){var e=t(this);h(e).always(function(){e.remove()})}),v.removeClass("lity-loading").find(".lity-content").empty().append(p),q=!0,p.trigger("lity:ready",[O])})}function O(e,i,r){e.preventDefault?(e.preventDefault(),e=(r=t(this)).data("lity-target")||r.attr("rel")||r.attr("src")):r=t(r);var o=new T(e,t.extend({},r.data("lity-options")||r.data("lity"),i),r,n.activeElement);if(!e.preventDefault)return o}return C.test=function(e){return u.test(e)},O.version="2.2.2",O.options=t.proxy(g,O,c),O.handlers=t.proxy(g,O,c.handlers),O.current=z,t(n).on("click.lity","[data-wpd-lity]",O),O});
|
17 |
/* My Content and Settings */
|
7 |
/* Autogrow */
|
8 |
jQuery.fn.autoGrow=function(){return this.each(function(){var createMirror=function(textarea){jQuery(textarea).after('<div class="autogrow-textarea-mirror"></div>');return jQuery(textarea).next(".autogrow-textarea-mirror")[0]};var sendContentToMirror=function(textarea){mirror.innerHTML=String(textarea.value).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br />")+".<br/>.";if(jQuery(textarea).height()!=jQuery(mirror).height())jQuery(textarea).height(jQuery(mirror).height())};var growTextarea=function(){sendContentToMirror(this)};var mirror=createMirror(this);mirror.style.display="none";mirror.style.wordWrap="break-word";mirror.style.padding=jQuery(this).css("padding");mirror.style.width=jQuery(this).css("width");mirror.style.fontFamily=jQuery(this).css("font-family");mirror.style.fontSize=jQuery(this).css("font-size");mirror.style.lineHeight=jQuery(this).css("line-height");this.style.overflow="hidden";this.style.minHeight=this.rows+"em";this.onkeydown=growTextarea;sendContentToMirror(this)})};
|
9 |
/* wpDiscuz */
|
10 |
+
var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if("[object Array]"===Object.prototype.toString.call(e))for(var d in e)"[object Array]"===Object.prototype.toString.call(t)?"success"===t[d]?o="wpdiscuz-message-success":"warning"===t[d]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[d]).prependTo("#wpdiscuz-comment-message").delay("[object Array]"===Object.prototype.toString.call(a)?a[d]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,d=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,n=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),i=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,g=wpdiscuzAjaxObj.cookiehash,_=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),v=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,z=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),C=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),k=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),x=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=[],T=[],D=[],E=!1,M=1,F=e("html").css("scroll-behavior"),L=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),e(document).delegate("#wpdcom .ql-editor, #wpdcom .wc_comment","focus",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(v)}),e(document).delegate("#wpdcom textarea","focus",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||U({comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).delegate("#wpd-editor-source-code-wrapper-bg","click",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).delegate("#wpd-insert-source-code","click",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).delegate(".wpd-reply-button","click",function(){var n=G(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+n).focus()},v):setTimeout(function(){e("#wc-textarea-"+n).trigger("focus")},v),e("#wpd-secondary-form-wrapper-"+n).slideToggle(v)):function(a){var o=G(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var d=e("#wpd-secondary-form-wrapper-"+o);if(!t){var n={comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)};U(n)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},v):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},v);d.slideToggle(v,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===d){var n=$(t);setTimeout(function(){if(!T[n])try{T[n]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(n)}),e(document).delegate("#wpdcom .wpd-comment-link [data-comment-url]","click",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.select(),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit","click",function(e){e.preventDefault()}),e(document).delegate(".wpd-toggle.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=G(e(this),0),o=e(this),d=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&_?function(t,a){var o=$(t),d=new FormData;d.append("action","wpdShowReplies"),d.append("commentId",o),me(z,!0,d).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies").remove(),le(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,d){console.log(d),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(d.removeClass("fa-chevron-up"),d.addClass("fa-chevron-down"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(d.removeClass("fa-chevron-down"),d.addClass("fa-chevron-up"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).delegate(".wpd-new-loaded-comment","mouseenter",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).delegate(".wpd-sbs-toggle","click",function(){e(".wpdiscuz-subscribe-bar").slideToggle(v)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&("2.0"===d?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).delegate("#wpdiscuz-subscribe-form","submit",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===d&&e(document).delegate("#wpdiscuz_subscription_button","click",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.submit()},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===d){var R=e(window).width(),S=e("#wpdcom").width();S>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),S>=940&&S<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),S>=810&&S<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),S>=730&&S<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),S>=610&&S<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),R>650&&(S>=510&&S<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),S>=470&&S<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),S<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function q(t,a,o){me(z||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(v),e(".wpd-thread-info").html(a.data.wc_all_comments_count_new_html),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(a.data.wc_all_comments_count_new),a.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide();var d=v;a.data.is_main?ae(a.data.message):(d=v+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),me(z,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),me(z,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,d=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+g,a),Cookies.set("comment_author_"+g,o),d.length&&Cookies.set("comment_author_url_"+g,d)):(u=parseInt(u),Cookies.set("comment_author_email_"+g,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+g,o,{expires:u,path:"/"}),d.length&&Cookies.set("comment_author_url_"+g,d,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").attr("checked","checked")}(a.data):b||e(".wpd-cookies-checkbox").removeAttr("checked"),wpdiscuzLoadRichEditor&&wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]),t.get(0).reset(),U(a.data),e(".wmu-preview-wrap",t).remove(),I.length&&(I.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),I=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-32},1e3,te)},d),le(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"),le(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,d){console.log(d),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function U(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function H(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).delegate(".wc_comm_submit.wpd_not_clicked","click",function(){var t=e(this),n=1,s=e(this).parents("form");if(s.hasClass("wpd_main_comm_form")||(n=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===X(t,!1)&&(o=X(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),Z(s,"#wpd-editor-"+e(".wpdiscuz_unique_id",s).val()),s.submit(function(e){e.preventDefault()}),""!==e(".wc_comment",s).val().trim()){if(s[0].checkValidity()&&(c=s,p=!0,"2.0"===d&&e("input[name=wc_captcha]",c).length&&!e("input[name=wc_captcha]",c).val().length?(p=!1,e(".wpdiscuz-recaptcha",c).css("border","1px solid red")):"2.0"===d&&e("input[name=wc_captcha]",c).length&&e(".wpdiscuz-recaptcha",c).css("border","none"),p)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+g,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){I.push(e(this))}))})}(s),e(t).removeClass("wpd_not_clicked");var i=new FormData;if(i.append("action","wpdAddComment"),e(":input",s).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&i.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),i.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&i.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",s).length&&!e(".wpd-cookies-checkbox",s).prop("checked")&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===d&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){i.append("g-recaptcha-response",e),q(s,i,t)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else q(s,i,t)}var c,p;!function(e){if((a||o)&&"2.0"===d){var t=$(e);grecaptcha.reset(T[t])}}(e(".wpdiscuz_unique_id",s).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields,"error")}),e(document).delegate(".wpd_editable_comment","click",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&H(G(e(".wpdiscuz-edit-form-wrap"),0),w);var t=G(e(this),0),a=$(t),o=new FormData;o.append("action","wpdEditComment"),o.append("commentId",a),w=e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-text").get(0),me(z,!0,o).done(function(a){if("object"==typeof a)if(a.success){if(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(a.data.html),wpdiscuzLoadRichEditor){let o=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+t);o.clipboard.dangerouslyPasteHTML(0,a.data.content),o.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+t).val(a.data.content);e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error");else console.log(a);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wc_save_edited_comment","click",function(){var t=G(e(this)),a=$(t),o=e("#wpd-comm-"+t+" #wpdiscuz-edit-form");if(Z(o,"#wpd-editor-edit_"+t),o.submit(function(e){e.preventDefault()}),o[0].checkValidity()){var d=new FormData;d.append("action","wpdSaveEditedComment"),d.append("commentId",a),e(":input",o).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&d.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&d.append(this.name+"",e(this).val())}),me(z,!0,d).done(function(o){"object"==typeof o?(o.success?(H(t,o.data.message),o.data.lastEdited&&(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(o.data.lastEdited).insertAfter("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),o.data.twitterShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",o.data.twitterShareLink),o.data.whatsappShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",o.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[o.data],"error"),le(o,a)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wc_cancel_edit","click",function(){var t=G(e(this));H(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){P(!0)},500):e(document).delegate(".wpd-load-comments","click",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),P(!0)})),e(document).delegate(".wpd-load-more-submit","click",function(){var t=e(this);t.hasClass("wpd-loaded")&&P(!1,t,"wpd-loaded","wpd-loading")});var W=!1;function N(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===W&&1==t&&(W=!0,P(!1,e(".wpd-load-more-submit"))))}function P(t,a,o,d){a&&(a.toggleClass(o),a.toggleClass(d));var s=new FormData;s.append("action","wpdLoadMoreComments");var i=e(".wpdiscuz-sort-button-active").attr("data-sorting");i&&s.append("sorting",i),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),me(z,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==n),W=!1,r=s.data.loadLastCommentId,le(s),t&&Q(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))}).fail(function(t,n,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==n&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),le(t)}function Q(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){ee(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-32},1e3,te),t&&V(o)},500);else{var d=new FormData;d.append("action","wpdGetSingleComment"),d.append("commentId",o),me(z,!0,d).done(function(a){if("object"==typeof a&&a.success){var d="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e(d).offset().top-32},1e3,te),t&&V(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function V(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function B(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)Y((t=a[o]).comment_parent,t.comment_html)}function G(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function $(e){return e.substring(0,e.indexOf("_"))}function X(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function Y(t,a){if(0==t)ae(a);else{var o=G(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function J(){var t,a,o="";return e(".wpd-comment-right").each(function(){t=G(e(this),0),a=$(t),o+=a+","}),o}function Z(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).removeAttr("required"),0===e("input:checked",this).length?e("input",e(this)).attr("required","required"):e(".wpd-field-invalid",this).remove()})}function ee(){e("html, body").css("scroll-behavior","unset")}function te(){e("html").css("scroll-behavior",F),e("body").css("scroll-behavior",L)}function ae(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function oe(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==n||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),N(),e(window).scroll(function(){N()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).delegate(".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked","click",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=$(G(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var d=new FormData;d.append("action","wpdVoteOnComment"),d.append("commentId",o),d.append("voteType",a),me(z,!0,d).done(function(d){if(e(t).addClass("wpd_not_clicked"),"object"==typeof d){if(d.success){if("total"===d.data.buttonsStyle){var n=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=d.data.votes;n.text(s),n.removeClass("wpd-up wpd-down"),s>0&&n.addClass("wpd-up"),s<0&&n.addClass("wpd-down")}else{var i=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));i.text(d.data.likeCount),c.text(d.data.dislikeCount),parseInt(d.data.likeCount)>0?i.addClass("wpd-up"):i.removeClass("wpd-up"),parseInt(d.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),d.data.curUserReaction>0?p.addClass("wpd-up"):d.data.curUserReaction<0&&r.addClass("wpd-down")}else d.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data],"error");le(d,o,a)}else console.log(d);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate("body","click",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).delegate(".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)","click",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var d=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",d||""),me(z,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){Q(!1)},1!=m&&Q(!1),e(document).delegate(".wpdiscuz-readmore","click",function(){var t=G(e(this)),a=$(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),me(z,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),le(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-required-group","change",function(){0!==e("input:checked",this).length?e("input",e(this)).removeAttr("required"):e("input",e(this)).attr("required","required")}),e(document).delegate(".wpdiscuz-spoiler","click",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).delegate(".wpd-tools i","click",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).delegate(".wpd-comment-right","mouseleave",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).delegate(".wpd_stick_btn","click",function(){var t=$(G(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),me(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd_close_btn","click",function(){var t=$(G(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),me(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-filter.wpd_not_clicked[data-filter-type]","click",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&o.append("sorting",d),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),me(z,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),le(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpdf-reacted.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),me(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3,te))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpdf-hottest.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),me(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3,te))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpd-filter-view-all","click",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-follow-link.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=$(G(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),me(z,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.code],"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),oe(),e(document).delegate(".wc_email","keyup",function(){oe(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),k&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*x)},1e3*k),"content_left"===O)if(e(".entry-content").length){var de=(ne=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){de=(ne=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var ne;de=(ne=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e("#wpd-bubble-add-message-close").click(function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e("#wpd-bubble").click(function(){ee(),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-60},1e3,function(){te(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").focus()})}),e("#wpd-bubble-comment-close").click(function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e("#wpd-bubble-comment-reply-link a").click(function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),Q(!0);var a=t.match(/#comment\-(\d+)/);D=D.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(D.length),0==D.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e("#wpd-bubble-count").click(function(){if(D.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",D.join()),me(z,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),B(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),D=[],ee(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-60},1e3,te),le(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&C||i)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:l,visibleCommentIds:J()}}).done(function(a){if(!E)if("object"==typeof a){if(a.ids.length){i&&((n=new FormData).append("action","wpdUpdateAutomatically"),n.append("loadLastCommentId",r),n.append("visibleCommentIds",J()),me(z,!1,n).done(function(t){E||"object"==typeof t&&t.success&&(B(t),e(".wpd-thread-info").html(t.data.wc_all_comments_count_new_html),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(t.data.wc_all_comments_count_new),t.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),D=D.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var d=parseInt(e(".wpd-new-comments-count").text());d+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(d),e("#wpd-bubble-count").addClass("wpd-new-comments"),a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").text(a.all_comments_count),a.all_comments_count?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),e(".wpd-thread-info").html(a.all_comments_count_html)}}else console.log(a);var n;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var se=new FormData;se.append("action","wpdGetInlineCommentForm"),me(z,!1,se).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),re()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function ie(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function ce(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function pe(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),re(t.siblings(".wpd-inline-form-wrapper"))))})}function re(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function le(t,a,o,d){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,d):console.log(t.data.callbackFunctions[e]+" is not a function")})}function me(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var d=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[d]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[d],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]](o,t,a))});var n=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:n,data:o,contentType:!1,processData:!1})}e(document).delegate("body","click",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){ce();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),re(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).delegate(".wpd-inline-submit.wpd_not_clicked","click",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var d=new FormData;d.append("action","wpdAddInlineComment"),d.append("inline_form_id",ie(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&d.append(e(a).attr("name"),e(a).val()):d.append(e(a).attr("name"),e(a).val())}),me(z,!0,d).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),ce();var d=parseInt(t.data.newCount),n=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");n.text(d),d?n.addClass("wpd-has-comments"):n.removeClass("wpd-has-comments"),e(".wpd-thread-info").html(t.data.allCommentsCountNewHtml),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").text(t.data.allCommentsCountNew),t.data.allCommentsCountNew?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),t.data.message&&ae(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wpd-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).delegate("#wpdiscuz-edit-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).delegate(".wpd-inline-comment-content","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-inline-icon-count.wpd-has-comments","click",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",ie(t)),me(z,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-view-all-inline-comments","click",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),ee(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-32},1e3,te)}),e(document).delegate(".wpd-feedback-content-link","click",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");ee(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-38},1e3,function(){te(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(pe(),e(window).scroll(pe)),e(document).delegate("#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg","click",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),me(z,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e("#wpdiscuz-subscribe-form").submit(function(t){t.preventDefault();var a,o,n=e(this);if(n[0].checkValidity()&&(a=n,o=!0,"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",n).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),me(z,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(".wpd-unsubscribe").click(function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),me(z,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=me});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
|
11 |
/* Colorbox */
|
12 |
(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),S=t('<button type="button"/>').attr({id:Z+"Slideshow"}),L),B=t('<button type="button"/>').attr({id:Z+"Close"}),y.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(R).add(S)),e.body&&!x.parent().length&&t(e.body).append(v,x.append(y,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return x?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),U&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if($=!0,q=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-N-j:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-z-D:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-z-D,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-N-j,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){L.show()},100),_.get("inline")){var c=t(e).eq(0);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),q=_.get("createImg"),t(q).addClass(Z+"Photo").bind("error."+Z,function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;_.get("retinaImage")&&i.devicePixelRatio>1&&(q.height=q.height/i.devicePixelRatio,q.width=q.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){q.height-=q.height*e,q.width-=q.width*e},_.mw&&q.width>_.mw&&(e=(q.width-_.mw)/q.width,o()),_.mh&&q.height>_.mh&&(e=(q.height-_.mh)/q.height,o())),_.h&&(q.style.marginTop=Math.max(_.mh-q.height,0)/2+"px"),W[1]&&(_.get("loop")||W[A+1])&&(q.style.cursor="pointer",t(q).bind("click."+Z,function(){J.next()})),q.style.width=q.width+"px",q.style.height=q.height+"px",h(q)},1)}),q.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,x,y,b,T,C,H,k,W,E,I,M,L,F,R,S,K,P,B,O,_,j,D,N,z,A,q,U,$,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title},createImg:function(){var e=new Image,i=t(this).data("cbox-img-attrs");return"object"==typeof i&&t.each(i,function(t,i){e[t]=i}),e},createIframe:function(){var i=e.createElement("iframe"),n=t(this).data("cbox-iframe-attrs");return"object"==typeof n&&t.each(n,function(t,e){i[t]=e}),"frameBorder"in i&&(i.frameBorder=0),"allowTransparency"in i&&(i.allowTransparency="true"),i.name=(new Date).getTime(),i.allowFullscreen=!0,i}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[A+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){S.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),x.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),S.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),x.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,S.hide(),t(),ae.unbind(ne,e).unbind(ie,t),x.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),S.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;return e=e||{},t.isFunction(o)&&(o=t("<a/>"),e.open=!0),o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(x[0].style.width,10)-D+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(x[0].style.height,10)-j+"px"}var r,h,s,l=0,d=0,c=x.offset();if(E.unbind("resize."+Z),x.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,x.css({position:"fixed"})):(l=h,d=s,x.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-z-D-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-z-D,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-N-j-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-N-j,0)/2),x.css({top:c.top,left:c.left,visibility:"visible"}),y[0].style.width=y[0].style.height="9999px",r={width:_.w+z+D,height:_.h+N+j,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||x.css(r),x.dequeue().animate(r,{duration:e||0,complete:function(){n(),$=!1,y[0].style.width=_.w+z+D+"px",y[0].style.height=_.h+N+j+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;U&&(t=t||{},t.width&&(_.w=a(t.width,"x")-z-D),t.innerWidth&&(_.w=a(t.innerWidth,"x")),I.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-N-j),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=I.scrollTop(),I.css({height:"auto"}),_.h=I.height()),I.css({height:_.h}),e&&I.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||I.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||I.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if(U){var d,g="none"===_.get("transition")?0:_.get("speed");I.remove(),I=n(se,"LoadedContent").append(i),I.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(q).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&x[0].style.removeAttribute("filter")}var n,o,a=W.length;U&&(o=function(){clearTimeout(Q),L.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),I.show(),a>1?("string"==typeof _.get("current")&&R.html(_.get("current").replace("{current}",A+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>A?"show":"hide"]().html(_.get("next")),P[_.get("loop")||A?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=_.get("createIframe"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),"class":Z+"Iframe"}).one("load",o).appendTo(I),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?x.fadeTo(g,1,i):i())},"fade"===_.get("transition")?x.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!$&&W[1]&&(_.get("loop")||W[A+1])&&(A=h(1),f(W[A]))},J.prev=function(){!$&&W[1]&&(_.get("loop")||A)&&(A=h(-1),f(W[A]))},J.close=function(){U&&!G&&(G=!0,U=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),x.stop().fadeTo(_.get("fadeOut")||0,0,function(){x.hide(),v.hide(),u(he),I.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){x&&(x.stop(),t[Y].close(),x.stop(!1,!0).remove(),v.remove(),G=!1,x=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
|
13 |
/* Media Uploader */
|
14 |
+
jQuery(document).ready(function(e){if(e(document).delegate("#wpdcom .wmu-upload-wrap","click",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0)}),e(document).delegate(".wmu-add-files","change",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=a[0].files?a[0].files:[];d.length&&function(a,t,d){var o=new FormData;o.append("action","wmuUploadFiles"),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val());var i=0;e.each(d,function(e,a){i+=a.size,o.append(wpdiscuzAjaxObj.wmuInput+"["+e+"]",a)}),i>parseInt(wpdiscuzAjaxObj.wmuMaxFileSize)?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wmuPhraseMaxFileSize,"error",3e3):i>parseInt(wpdiscuzAjaxObj.wmuPostMaxSize)?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wmuPhrasePostMaxSize,"error",3e3):wpdiscuzAjaxObj.getAjaxObj(!0,!0,o).done(function(a){a.success?(e(".wmu-attached-data-info",t).remove(),e(".wmu-add-files",t).after(a.data.attachmentsHtml),a.data.tooltip&&e(".wmu-upload-wrap").attr("wpd-tooltip",a.data.tooltip),function(a,t){e.each(t.data.previewsData,function(t,d){e(".wmu-action-wrap .wmu-"+t+"-tab",a).html(""),e.each(d,function(d,o){var i=o.id,m="",s=o.fullname,u=o.shortname;t==wpdiscuzAjaxObj.wmuKeyImages?(m=o.url,u=""):t==wpdiscuzAjaxObj.wmuKeyVideos?m=wpdiscuzAjaxObj.wmuIconVideo:t==wpdiscuzAjaxObj.wmuKeyFiles&&(m=wpdiscuzAjaxObj.wmuIconFile);var r='<div class="wmu-preview [PREVIEW_TYPE_CLASS]" title="[PREVIEW_TITLE]" data-wmu-type="[PREVIEW_TYPE]" data-wmu-attachment="[PREVIEW_ID]"><div class="wmu-preview-remove"><img class="wmu-preview-img" src="[PREVIEW_ICON]"><div class="wmu-file-name">[PREVIEW_FILENAME]</div><div class="wmu-delete"> </div></div></div>';r=(r=(r=(r=(r=(r=r.replace("[PREVIEW_TYPE_CLASS]","wmu-preview-"+t)).replace("[PREVIEW_TITLE]",s)).replace("[PREVIEW_TYPE]",t)).replace("[PREVIEW_ID]",i)).replace("[PREVIEW_ICON]",m)).replace("[PREVIEW_FILENAME]",u),e(".wmu-action-wrap .wmu-"+t+"-tab",a).removeClass("wmu-hide").append(r)})})}(t,a),a.data.errors&&(wpdiscuzAjaxObj.setCommentMessage(a.data.errors,"error",3e3),console.log(a.data.errors))):a.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.errorCode],"error",3e3):a.data.error&&wpdiscuzAjaxObj.setCommentMessage(a.data.error,"error",3e3),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}(0,t,d)}),e(document).delegate(".wmu-attachment-delete","click",function(a){if(confirm(wpdiscuzAjaxObj.wmuPhraseConfirmDelete)){var t=e(this).data("wmu-attachment"),d=new FormData;d.append("action","wmuDeleteAttachment"),d.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),d.append("attachmentId",t),wpdiscuzAjaxObj.getAjaxObj(!0,!0,d).done(function(a){if(a.success){var d=e(".wmu-attachment-"+t).parents(".wmu-comment-attachments");e(".wmu-attachment-"+t).remove(),e(".wmu-attached-images *",d).length||e(".wmu-attached-images",d).remove(),e(".wmu-attached-videos *",d).length||e(".wmu-attached-videos",d).remove(),e(".wmu-attached-files *",d).length||e(".wmu-attached-files",d).remove()}else a.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.errorCode],"error",3e3):a.data.error&&wpdiscuzAjaxObj.setCommentMessage(a.data.error,"error",3e3);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}else console.log("canceled")}),e(document).delegate(".wmu-preview","click",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=(a.data("wmu-type"),a.data("wmu-attachment")),o=new FormData;o.append("action","wmuRemoveAttachmentPreview"),o.append("attachmentId",d),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val()),wpdiscuzAjaxObj.getAjaxObj(!0,!0,o).done(function(d){if(d.success){a.remove();var o=e(".wmu-tabs",t);e.each(o,function(a,t){e(".wmu-preview",t).length?e(t).removeClass("wmu-hide"):e(t).addClass("wmu-hide")}),e(".wmu-attached-data-info",t).remove(),e(".wmu-add-files",t).after(d.data.attachmentsHtml),d.data.tooltip&&e(".wmu-upload-wrap").attr("wpd-tooltip",d.data.tooltip)}else d.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data.errorCode],"error",3e3):d.data.error&&wpdiscuzAjaxObj.setCommentMessage(d.data.error,"error",3e3);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}),parseInt(wpdiscuzAjaxObj.wmuIsLightbox)){function a(){e(".wmu-lightbox").colorbox({maxHeight:"95%",maxWidth:"95%",rel:"wmu-lightbox",fixed:!0})}a(),wpdiscuzAjaxObj.wmuAddLightBox=a}wpdiscuzAjaxObj.wmuHideAll=function(a,t){"object"==typeof a?a.success?(e(".wmu-tabs",t).addClass("wmu-hide"),e(".wmu-preview",t).remove(),e(".wmu-attached-data-info",t).remove()):console.log(a.data):console.log(a)}});
|
15 |
/* Lity */
|
16 |
!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,require("jquery")):e.lity=t(e,e.jQuery||e.Zepto)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=e.document,i=t(e),r=t.Deferred,o=t("html"),a=[],l="aria-hidden",s="lity-"+l,d='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',c={esc:!0,handler:null,handlers:{image:C,inline:function(e,n){var i,r,o;try{i=t(e)}catch(e){return!1}if(!i.length)return!1;return r=t('<i style="display:none !important"/>'),o=i.hasClass("lity-hide"),n.element().one("lity:remove",function(){r.before(i).remove(),o&&!i.closest(".lity-content").length&&i.addClass("lity-hide")}),i.removeClass("lity-hide").after(r)},youtube:function(e){var n=f.exec(e);if(!n)return!1;return k(x(e,w("https://www.youtube"+(n[2]||"")+".com/embed/"+n[4],t.extend({autoplay:1},b(n[5]||"")))))},vimeo:function(e){var n=y.exec(e);if(!n)return!1;return k(x(e,w("https://player.vimeo.com/video/"+n[3],t.extend({autoplay:1},b(n[4]||"")))))},googlemaps:function(e){var t=v.exec(e);if(!t)return!1;return k(x(e,w("https://www.google."+t[3]+"/maps?"+t[6],{output:t[6].indexOf("layer=c")>0?"svembed":"embed"})))},facebookvideo:function(e){var n=p.exec(e);if(!n)return!1;0!==e.indexOf("http")&&(e="https:"+e);return k(x(e,w("https://www.facebook.com/plugins/video.php?href="+e,t.extend({autoplay:1},b(n[4]||"")))))},iframe:k},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>'},u=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,f=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,y=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,v=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,p=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,m=function(){var e=n.createElement("div"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in t)if(void 0!==e.style[i])return t[i];return!1}();function h(e){var t=r();return m&&e.length?(e.one(m,t.resolve),setTimeout(t.resolve,500)):t.resolve(),t.promise()}function g(e,n,i){if(1===arguments.length)return t.extend({},e);if("string"==typeof n){if(void 0===i)return void 0===e[n]?null:e[n];e[n]=i}else t.extend(e,n);return this}function b(e){for(var t,n=decodeURI(e.split("#")[0]).split("&"),i={},r=0,o=n.length;r<o;r++)n[r]&&(i[(t=n[r].split("="))[0]]=t[1]);return i}function w(e,n){return e+(e.indexOf("?")>-1?"&":"?")+t.param(n)}function x(e,t){var n=e.indexOf("#");return-1===n?t:(n>0&&(e=e.substr(n)),t+e)}function C(e,n){var i=n.opener()&&n.opener().data("lity-desc")||"Image with no description",o=t('<img src="'+e+'" alt="'+i+'"/>'),a=r(),l=function(){var e;a.reject((e="Failed loading image",t('<span class="lity-error"/>').append(e)))};return o.on("load",function(){if(0===this.naturalWidth)return l();a.resolve(o)}).on("error",l),a.promise()}function k(e){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+e+'"/></div>'}function E(){return n.documentElement.clientHeight?.9*n.documentElement.clientHeight:Math.round(.9*i.height())}function j(e){var t,i,r,o=z();o&&(27===e.keyCode&&o.options("esc")&&o.close(),9===e.keyCode&&(t=e,i=o.element().find(d),r=i.index(n.activeElement),t.shiftKey&&r<=0?(i.get(i.length-1).focus(),t.preventDefault()):t.shiftKey||r!==i.length-1||(i.get(0).focus(),t.preventDefault())))}function D(){t.each(a,function(e,t){t.resize()})}function z(){return 0===a.length?null:a[0]}function T(e,d,u,f){var y,v,p,m,b,w,x,C,k,z,T,O=this,q=!1,W=!1;d=t.extend({},c,d),v=t(d.template),O.element=function(){return v},O.opener=function(){return u},O.options=t.proxy(g,O,d),O.handlers=t.proxy(g,O,d.handlers),O.resize=function(){q&&!W&&p.css("max-height",E()+"px").trigger("lity:resize",[O])},O.close=function(){if(q&&!W){var e;W=!0,(e=O).element().attr(l,"true"),1===a.length&&(o.removeClass("lity-active"),i.off({resize:D,keydown:j})),((a=t.grep(a,function(t){return e!==t})).length?a[0].element():t(".lity-hidden")).removeClass("lity-hidden").each(function(){var e=t(this),n=e.data(s);n?e.attr(l,n):e.removeAttr(l),e.removeData(s)});var d=r();if(f&&(n.activeElement===v[0]||t.contains(v[0],n.activeElement)))try{f.focus()}catch(e){}return p.trigger("lity:close",[O]),v.removeClass("lity-opened").addClass("lity-closed"),h(p.add(v)).always(function(){p.trigger("lity:remove",[O]),v.remove(),v=void 0,d.resolve()}),d.promise()}},m=e,b=O,w=d.handlers,x=d.handler,k="inline",z=t.extend({},w),x&&z[x]?(C=z[x](m,b),k=x):(t.each(["inline","iframe"],function(e,t){delete z[t],z[t]=w[t]}),t.each(z,function(e,t){return!t||!(!t.test||t.test(m,b))||(!1!==(C=t(m,b))?(k=e,!1):void 0)})),y={handler:k,content:C||""},v.attr(l,"false").addClass("lity-loading lity-opened lity-"+y.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){t(e.target).is("[data-lity-close]")&&O.close()}).trigger("lity:open",[O]),T=O,1===a.unshift(T)&&(o.addClass("lity-active"),i.on({resize:D,keydown:j})),t("body > *").not(T.element()).addClass("lity-hidden").each(function(){var e=t(this);void 0===e.data(s)&&e.data(s,e.attr(l)||null)}).attr(l,"true"),t.when(y.content).always(function(e){p=t(e).css("max-height",E()+"px"),v.find(".lity-loader").each(function(){var e=t(this);h(e).always(function(){e.remove()})}),v.removeClass("lity-loading").find(".lity-content").empty().append(p),q=!0,p.trigger("lity:ready",[O])})}function O(e,i,r){e.preventDefault?(e.preventDefault(),e=(r=t(this)).data("lity-target")||r.attr("rel")||r.attr("src")):r=t(r);var o=new T(e,t.extend({},r.data("lity-options")||r.data("lity"),i),r,n.activeElement);if(!e.preventDefault)return o}return C.test=function(e){return u.test(e)},O.version="2.2.2",O.options=t.proxy(g,O,c),O.handlers=t.proxy(g,O,c.handlers),O.current=z,t(n).on("click.lity","[data-wpd-lity]",O),O});
|
17 |
/* My Content and Settings */
|
assets/js/wpdiscuz-mu-frontend.js
CHANGED
@@ -91,6 +91,7 @@ jQuery(document).ready(function ($) {
|
|
91 |
var attachmentId = btn.data('wmu-attachment');
|
92 |
var data = new FormData();
|
93 |
data.append('action', 'wmuDeleteAttachment');
|
|
|
94 |
data.append('attachmentId', attachmentId);
|
95 |
wpdiscuzAjaxObj.getAjaxObj(true, true, data)
|
96 |
.done(function (r) {
|
@@ -135,6 +136,7 @@ jQuery(document).ready(function ($) {
|
|
135 |
var data = new FormData();
|
136 |
data.append('action', 'wmuRemoveAttachmentPreview');
|
137 |
data.append('attachmentId', id);
|
|
|
138 |
data.append('wmuAttachmentsData', $('.wmu-attachments-data', form).val());
|
139 |
wpdiscuzAjaxObj.getAjaxObj(true, true, data)
|
140 |
.done(function (r) {
|
91 |
var attachmentId = btn.data('wmu-attachment');
|
92 |
var data = new FormData();
|
93 |
data.append('action', 'wmuDeleteAttachment');
|
94 |
+
data.append('wmu_nonce', wpdiscuzAjaxObj.wmuSecurity);
|
95 |
data.append('attachmentId', attachmentId);
|
96 |
wpdiscuzAjaxObj.getAjaxObj(true, true, data)
|
97 |
.done(function (r) {
|
136 |
var data = new FormData();
|
137 |
data.append('action', 'wmuRemoveAttachmentPreview');
|
138 |
data.append('attachmentId', id);
|
139 |
+
data.append('wmu_nonce', wpdiscuzAjaxObj.wmuSecurity);
|
140 |
data.append('wmuAttachmentsData', $('.wmu-attachments-data', form).val());
|
141 |
wpdiscuzAjaxObj.getAjaxObj(true, true, data)
|
142 |
.done(function (r) {
|
assets/js/wpdiscuz-mu-frontend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(e){if(e(document).delegate("#wpdcom .wmu-upload-wrap","click",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0)}),e(document).delegate(".wmu-add-files","change",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=a[0].files?a[0].files:[];d.length&&function(a,t,d){var o=new FormData;o.append("action","wmuUploadFiles"),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val());var
|
1 |
+
jQuery(document).ready(function(e){if(e(document).delegate("#wpdcom .wmu-upload-wrap","click",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0)}),e(document).delegate(".wmu-add-files","change",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=a[0].files?a[0].files:[];d.length&&function(a,t,d){var o=new FormData;o.append("action","wmuUploadFiles"),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val());var i=0;e.each(d,function(e,a){i+=a.size,o.append(wpdiscuzAjaxObj.wmuInput+"["+e+"]",a)}),i>parseInt(wpdiscuzAjaxObj.wmuMaxFileSize)?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wmuPhraseMaxFileSize,"error",3e3):i>parseInt(wpdiscuzAjaxObj.wmuPostMaxSize)?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wmuPhrasePostMaxSize,"error",3e3):wpdiscuzAjaxObj.getAjaxObj(!0,!0,o).done(function(a){a.success?(e(".wmu-attached-data-info",t).remove(),e(".wmu-add-files",t).after(a.data.attachmentsHtml),a.data.tooltip&&e(".wmu-upload-wrap").attr("wpd-tooltip",a.data.tooltip),function(a,t){e.each(t.data.previewsData,function(t,d){e(".wmu-action-wrap .wmu-"+t+"-tab",a).html(""),e.each(d,function(d,o){var i=o.id,m="",s=o.fullname,u=o.shortname;t==wpdiscuzAjaxObj.wmuKeyImages?(m=o.url,u=""):t==wpdiscuzAjaxObj.wmuKeyVideos?m=wpdiscuzAjaxObj.wmuIconVideo:t==wpdiscuzAjaxObj.wmuKeyFiles&&(m=wpdiscuzAjaxObj.wmuIconFile);var r='<div class="wmu-preview [PREVIEW_TYPE_CLASS]" title="[PREVIEW_TITLE]" data-wmu-type="[PREVIEW_TYPE]" data-wmu-attachment="[PREVIEW_ID]"><div class="wmu-preview-remove"><img class="wmu-preview-img" src="[PREVIEW_ICON]"><div class="wmu-file-name">[PREVIEW_FILENAME]</div><div class="wmu-delete"> </div></div></div>';r=(r=(r=(r=(r=(r=r.replace("[PREVIEW_TYPE_CLASS]","wmu-preview-"+t)).replace("[PREVIEW_TITLE]",s)).replace("[PREVIEW_TYPE]",t)).replace("[PREVIEW_ID]",i)).replace("[PREVIEW_ICON]",m)).replace("[PREVIEW_FILENAME]",u),e(".wmu-action-wrap .wmu-"+t+"-tab",a).removeClass("wmu-hide").append(r)})})}(t,a),a.data.errors&&(wpdiscuzAjaxObj.setCommentMessage(a.data.errors,"error",3e3),console.log(a.data.errors))):a.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.errorCode],"error",3e3):a.data.error&&wpdiscuzAjaxObj.setCommentMessage(a.data.error,"error",3e3),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}(0,t,d)}),e(document).delegate(".wmu-attachment-delete","click",function(a){if(confirm(wpdiscuzAjaxObj.wmuPhraseConfirmDelete)){var t=e(this).data("wmu-attachment"),d=new FormData;d.append("action","wmuDeleteAttachment"),d.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),d.append("attachmentId",t),wpdiscuzAjaxObj.getAjaxObj(!0,!0,d).done(function(a){if(a.success){var d=e(".wmu-attachment-"+t).parents(".wmu-comment-attachments");e(".wmu-attachment-"+t).remove(),e(".wmu-attached-images *",d).length||e(".wmu-attached-images",d).remove(),e(".wmu-attached-videos *",d).length||e(".wmu-attached-videos",d).remove(),e(".wmu-attached-files *",d).length||e(".wmu-attached-files",d).remove()}else a.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.errorCode],"error",3e3):a.data.error&&wpdiscuzAjaxObj.setCommentMessage(a.data.error,"error",3e3);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}else console.log("canceled")}),e(document).delegate(".wmu-preview","click",function(){var a=e(this),t=a.parents(".wpd_comm_form"),d=(a.data("wmu-type"),a.data("wmu-attachment")),o=new FormData;o.append("action","wmuRemoveAttachmentPreview"),o.append("attachmentId",d),o.append("wmu_nonce",wpdiscuzAjaxObj.wmuSecurity),o.append("wmuAttachmentsData",e(".wmu-attachments-data",t).val()),wpdiscuzAjaxObj.getAjaxObj(!0,!0,o).done(function(d){if(d.success){a.remove();var o=e(".wmu-tabs",t);e.each(o,function(a,t){e(".wmu-preview",t).length?e(t).removeClass("wmu-hide"):e(t).addClass("wmu-hide")}),e(".wmu-attached-data-info",t).remove(),e(".wmu-add-files",t).after(d.data.attachmentsHtml),d.data.tooltip&&e(".wmu-upload-wrap").attr("wpd-tooltip",d.data.tooltip)}else d.data.errorCode?wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data.errorCode],"error",3e3):d.data.error&&wpdiscuzAjaxObj.setCommentMessage(d.data.error,"error",3e3);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,t,d){console.log(d),e("#wpdiscuz-loading-bar").fadeOut(250)})}),parseInt(wpdiscuzAjaxObj.wmuIsLightbox)){function a(){e(".wmu-lightbox").colorbox({maxHeight:"95%",maxWidth:"95%",rel:"wmu-lightbox",fixed:!0})}a(),wpdiscuzAjaxObj.wmuAddLightBox=a}wpdiscuzAjaxObj.wmuHideAll=function(a,t){"object"==typeof a?a.success?(e(".wmu-tabs",t).addClass("wmu-hide"),e(".wmu-preview",t).remove(),e(".wmu-attached-data-info",t).remove()):console.log(a.data):console.log(a)}});
|
assets/js/wpdiscuz.js
CHANGED
@@ -1,2115 +1,2244 @@
|
|
1 |
;
|
2 |
var wpdiscuzLoadRichEditor = parseInt(wpdiscuzAjaxObj.loadRichEditor);
|
3 |
if (wpdiscuzLoadRichEditor) {
|
4 |
-
|
5 |
}
|
|
|
6 |
function wpdMessagesOnInit(message, type) {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
}
|
|
|
12 |
/**
|
13 |
* @param {string/array} message(s) - message(s) to show
|
14 |
* @param {string/array} type(s) - message(s) type(s). acceptable values error/success/warning
|
15 |
* @param {string/array} delay(s) - timeout(s) before message(s) disappears
|
16 |
*/
|
17 |
-
wpdiscuzAjaxObj.setCommentMessage = function
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
};
|
59 |
-
jQuery(document).ready(function
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
219 |
//============================== reCAPTCHA ============================== //
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
|
390 |
//============================== /reCAPTCHA ============================== //
|
391 |
//============================== ADD COMMENT FUNCTION ============================== //
|
392 |
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
|
|
|
|
|
|
|
|
|
|
596 |
//============================== EDIT COMMENT FUNCTION ============================== //
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
|
711 |
//============================== /EDIT COMMENT FUNCTION ============================== //
|
712 |
//============================== LOAD MORE ============================== //
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
|
|
826 |
//============================== /LOAD MORE ============================== //
|
827 |
//============================== VOTE ============================== //
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
//============================== /VOTE ============================== //
|
893 |
//============================== SORTING ============================== //
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
//============================== /SORTING ============================== //
|
932 |
//============================== SINGLE COMMENT ============================== //
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
|
|
|
|
|
|
|
|
|
|
994 |
//============================== /SINGLE COMMENT ============================== //
|
995 |
//============================== LIVE UPDATE ============================== //
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
|
|
1036 |
//============================== READ MORE ============================== //
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
//============================== /READ MORE ============================== //
|
1064 |
//============================== FUNCTIONS ============================== //
|
1065 |
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1517 |
|
1518 |
//========================= BUBBLE =====================//
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1706 |
//========================= /BUBBLE =====================//
|
1707 |
//========================= INLINE COMMENTS =====================//
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1952 |
//========================= /INLINE COMMENTS =====================//
|
1953 |
//========================= POST RATING =====================//
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
//========================= /POST RATING =====================//
|
1980 |
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
|
|
2093 |
|
2094 |
});
|
2095 |
//========================= reCAPTCHA =====================//
|
2096 |
-
var onloadCallback = function
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
};
|
2115 |
//========================= /reCAPTCHA =====================//
|
1 |
;
|
2 |
var wpdiscuzLoadRichEditor = parseInt(wpdiscuzAjaxObj.loadRichEditor);
|
3 |
if (wpdiscuzLoadRichEditor) {
|
4 |
+
var wpDiscuzEditor = new WpdEditor();
|
5 |
}
|
6 |
+
|
7 |
function wpdMessagesOnInit(message, type) {
|
8 |
+
wpdiscuzAjaxObj.setCommentMessage(message, type);
|
9 |
+
setTimeout(function() {
|
10 |
+
location.href = location.href.substring(0, location.href.indexOf('wpdiscuzUrlAnchor') - 1);
|
11 |
+
}, 3000);
|
12 |
}
|
13 |
+
|
14 |
/**
|
15 |
* @param {string/array} message(s) - message(s) to show
|
16 |
* @param {string/array} type(s) - message(s) type(s). acceptable values error/success/warning
|
17 |
* @param {string/array} delay(s) - timeout(s) before message(s) disappears
|
18 |
*/
|
19 |
+
wpdiscuzAjaxObj.setCommentMessage = function(message, type, delay) {
|
20 |
+
var className = 'wpdiscuz-message-error';
|
21 |
+
if (Object.prototype.toString.call(message) === '[object Array]') {
|
22 |
+
for (var i in message) {
|
23 |
+
if (Object.prototype.toString.call(type) === '[object Array]') {
|
24 |
+
if (type[i] === 'success') {
|
25 |
+
className = 'wpdiscuz-message-success';
|
26 |
+
} else if (type[i] === 'warning') {
|
27 |
+
className = 'wpdiscuz-message-warning';
|
28 |
+
}
|
29 |
+
} else {
|
30 |
+
if (type === 'success') {
|
31 |
+
className = 'wpdiscuz-message-success';
|
32 |
+
} else if (type === 'warning') {
|
33 |
+
className = 'wpdiscuz-message-warning';
|
34 |
+
}
|
35 |
+
}
|
36 |
+
jQuery('<div/>')
|
37 |
+
.addClass(className)
|
38 |
+
.html(message[i])
|
39 |
+
.prependTo('#wpdiscuz-comment-message')
|
40 |
+
.delay(Object.prototype.toString.call(delay) === '[object Array]' ? delay[i] : delay ? delay : 4000)
|
41 |
+
.fadeOut(1000, function() {
|
42 |
+
jQuery(this).remove();
|
43 |
+
});
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
if (type === 'success') {
|
47 |
+
className = 'wpdiscuz-message-success';
|
48 |
+
} else if (type === 'warning') {
|
49 |
+
className = 'wpdiscuz-message-warning';
|
50 |
+
}
|
51 |
+
jQuery('<div/>')
|
52 |
+
.addClass(className)
|
53 |
+
.html(message)
|
54 |
+
.prependTo('#wpdiscuz-comment-message')
|
55 |
+
.delay(delay ? delay : 4000)
|
56 |
+
.fadeOut(1000, function() {
|
57 |
+
jQuery(this).remove();
|
58 |
+
});
|
59 |
+
}
|
60 |
};
|
61 |
+
jQuery(document).ready(function($) {
|
62 |
+
/* global wpdiscuzAjaxObj */
|
63 |
+
/* global Cookies */
|
64 |
+
/* global grecaptcha */
|
65 |
+
/* global Quill */
|
66 |
+
$('body').addClass('wpdiscuz_' + wpdiscuzAjaxObj.version);
|
67 |
+
var isUserLoggedIn = wpdiscuzAjaxObj.is_user_logged_in;
|
68 |
+
var isShowCaptchaForGuests = wpdiscuzAjaxObj.wc_captcha_show_for_guest == 1 && !isUserLoggedIn;
|
69 |
+
var isShowCaptchaForMembers = wpdiscuzAjaxObj.wc_captcha_show_for_members == 1 && isUserLoggedIn;
|
70 |
+
var wpdiscuzRecaptchaVersion = wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion;
|
71 |
+
var commentListLoadType = parseInt(wpdiscuzAjaxObj.commentListLoadType);
|
72 |
+
var wpdiscuzPostId = parseInt(wpdiscuzAjaxObj.wc_post_id);
|
73 |
+
var commentListUpdateType = parseInt(wpdiscuzAjaxObj.commentListUpdateType);
|
74 |
+
var commentListUpdateTimer = parseInt(wpdiscuzAjaxObj.commentListUpdateTimer) * 1000;
|
75 |
+
var enableGuestsLiveUpdate = parseInt(wpdiscuzAjaxObj.liveUpdateGuests);
|
76 |
+
var loadLastCommentId = wpdiscuzAjaxObj.loadLastCommentId;
|
77 |
+
var bubbleLastCommentId = loadLastCommentId;
|
78 |
+
var firstLoadWithAjax = parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);
|
79 |
+
if (Cookies.get('wpdiscuz_comments_sorting')) {
|
80 |
+
Cookies.remove('wpdiscuz_comments_sorting', {path: ''});
|
81 |
+
}
|
82 |
+
if (Cookies.get('wordpress_last_visit')) {
|
83 |
+
Cookies.remove('wordpress_last_visit', {path: ''});
|
84 |
+
}
|
85 |
+
if (Cookies.get('wpdiscuz_last_visit')) {
|
86 |
+
Cookies.remove('wpdiscuz_last_visit', {path: ''});
|
87 |
+
}
|
88 |
+
var storeCommenterData = wpdiscuzAjaxObj.storeCommenterData;
|
89 |
+
var wpdiscuzUploader = parseInt(wpdiscuzAjaxObj.wmuEnabled);
|
90 |
+
var isCookiesEnabled = wpdiscuzAjaxObj.isCookiesEnabled;
|
91 |
+
var wpdCookiesConsent = true;
|
92 |
+
var wpdiscuzCookiehash = wpdiscuzAjaxObj.cookiehash;
|
93 |
+
var isLoadOnlyParentComments = parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments);
|
94 |
+
var enableDropAnimation = parseInt(wpdiscuzAjaxObj.enableDropAnimation) ? 500 : 0;
|
95 |
+
var isNativeAjaxEnabled = parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled);
|
96 |
+
var bubbleEnabled = parseInt(wpdiscuzAjaxObj.enableBubble);
|
97 |
+
var bubbleLiveUpdate = parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate);
|
98 |
+
var bubbleHintTimeout = parseInt(wpdiscuzAjaxObj.bubbleHintTimeout);
|
99 |
+
var bubbleHintHideTimeout = parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout) ? parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout) : 5;
|
100 |
+
var bubbleShowNewCommentMessage = parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage);
|
101 |
+
var bubbleLocation = wpdiscuzAjaxObj.bubbleLocation;
|
102 |
+
var inlineFeedbackAttractionType = wpdiscuzAjaxObj.inlineFeedbackAttractionType;
|
103 |
+
var wpdiscuzAgreementFields = [];
|
104 |
+
var reCaptchaWidgets = [];
|
105 |
+
var bubbleNewCommentIds = [];
|
106 |
+
var addingComment = false;
|
107 |
+
var wpdiscuzLoadCount = 1;
|
108 |
+
|
109 |
+
var htmlScrollBehavior = $('html').css('scroll-behavior');
|
110 |
+
var bodyScrollBehavior = $('body').css('scroll-behavior');
|
111 |
+
|
112 |
+
loginButtonsClone();
|
113 |
+
if (wpdiscuzLoadRichEditor && $('#wpd-editor-0_0').length) {
|
114 |
+
wpDiscuzEditor.createEditor('#wpd-editor-0_0');
|
115 |
+
}
|
116 |
+
|
117 |
+
$(document).delegate('#wpdcom .ql-editor, #wpdcom .wc_comment', 'focus', function() {
|
118 |
+
$('.wpd-form-foot', $(this).parents('.wpd_comm_form')).slideDown(enableDropAnimation);
|
119 |
+
});
|
120 |
+
$(document).delegate('#wpdcom textarea', 'focus', function() {
|
121 |
+
if (!$(this).next('.autogrow-textarea-mirror').length) {
|
122 |
+
$(this).autoGrow();
|
123 |
+
}
|
124 |
+
});
|
125 |
+
|
126 |
+
if (!isUserLoggedIn) {
|
127 |
+
var commentAuthorCookies = {
|
128 |
+
comment_author: Cookies.get('comment_author_' + wpdiscuzCookiehash),
|
129 |
+
comment_author_email: Cookies.get('comment_author_email_' + wpdiscuzCookiehash),
|
130 |
+
comment_author_url: Cookies.get('comment_author_url_' + wpdiscuzCookiehash)
|
131 |
+
};
|
132 |
+
setCookieInForm(commentAuthorCookies);
|
133 |
+
}
|
134 |
+
|
135 |
+
$('.wpd-vote-down.wpd-dislike-hidden').remove();
|
136 |
+
$('.wpd-toolbar-hidden').prev('[id^=wpd-editor-]').css('border-bottom', "1px solid #dddddd");
|
137 |
+
|
138 |
+
$(document).delegate('#wpd-editor-source-code-wrapper-bg', 'click', function() {
|
139 |
+
$(this).hide();
|
140 |
+
$('#wpd-editor-source-code-wrapper').hide();
|
141 |
+
$('#wpd-editor-uid').val('');
|
142 |
+
$('#wpd-editor-source-code').val('');
|
143 |
+
});
|
144 |
+
|
145 |
+
if (wpdiscuzLoadRichEditor) {
|
146 |
+
$(document).delegate('#wpd-insert-source-code', 'click', function() {
|
147 |
+
var editor = wpDiscuzEditor.createEditor('#' + $('#wpd-editor-uid').val());
|
148 |
+
editor.deleteText(0, editor.getLength(), Quill.sources.USER);
|
149 |
+
var html = $('#wpd-editor-source-code').val();
|
150 |
+
if (html.length) {
|
151 |
+
editor.clipboard.dangerouslyPasteHTML(0, html, Quill.sources.USER);
|
152 |
+
}
|
153 |
+
editor.update();
|
154 |
+
$('#wpd-editor-source-code-wrapper-bg').hide();
|
155 |
+
$('#wpd-editor-source-code-wrapper').hide();
|
156 |
+
$('#wpd-editor-uid').val('');
|
157 |
+
$('#wpd-editor-source-code').val('');
|
158 |
+
});
|
159 |
+
}
|
160 |
+
|
161 |
+
$(document).delegate('.wpd-reply-button', 'click', function() {
|
162 |
+
var uniqueID = getUniqueID($(this), 0);
|
163 |
+
if ($(this).hasClass('wpdiscuz-clonned')) {
|
164 |
+
if (wpdiscuzLoadRichEditor) {
|
165 |
+
setTimeout(function() {
|
166 |
+
wpDiscuzEditor.createEditor('#wpd-editor-' + uniqueID).focus();
|
167 |
+
}, enableDropAnimation);
|
168 |
+
} else {
|
169 |
+
setTimeout(function() {
|
170 |
+
$('#wc-textarea-' + uniqueID).trigger('focus');
|
171 |
+
}, enableDropAnimation);
|
172 |
+
}
|
173 |
+
$('#wpd-secondary-form-wrapper-' + uniqueID).slideToggle(enableDropAnimation);
|
174 |
+
} else {
|
175 |
+
cloneSecondaryForm($(this));
|
176 |
+
}
|
177 |
+
generateReCaptcha(uniqueID);
|
178 |
+
});
|
179 |
+
|
180 |
+
$(document).delegate('#wpdcom .wpd-comment-link [data-comment-url]', 'click', function() {
|
181 |
+
var val = $(this).data('comment-url');
|
182 |
+
var el = $('<input/>');
|
183 |
+
el.appendTo('body').css({'position': 'absolute', 'top': '-10000000px'}).val(val);
|
184 |
+
el.select();
|
185 |
+
document.execCommand('copy');
|
186 |
+
el.remove();
|
187 |
+
wpdiscuzAjaxObj.setCommentMessage(val + '<br/>' + wpdiscuzAjaxObj.wc_copied_to_clipboard, 'success', 5000);
|
188 |
+
});
|
189 |
+
|
190 |
+
$(document).delegate('.wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit', 'click', function(e) {
|
191 |
+
e.preventDefault();
|
192 |
+
});
|
193 |
+
|
194 |
+
$(document).delegate('.wpd-toggle.wpd_not_clicked', 'click', function() {
|
195 |
+
var btn = $(this);
|
196 |
+
btn.removeClass('wpd_not_clicked');
|
197 |
+
var uniqueID = getUniqueID($(this), 0);
|
198 |
+
var toggle = $(this);
|
199 |
+
var icon = $('.fas', toggle);
|
200 |
+
if (!toggle.parents('.wpd-comment:not(.wpd-reply)').children('.wpd-reply').length && isLoadOnlyParentComments) {
|
201 |
+
wpdiscuzShowReplies(uniqueID, btn);
|
202 |
+
} else {
|
203 |
+
$('#wpd-comm-' + uniqueID + '> .wpd-reply').slideToggle(700, function() {
|
204 |
+
if ($(this).is(':hidden')) {
|
205 |
+
icon.removeClass('fa-chevron-up');
|
206 |
+
icon.addClass('fa-chevron-down');
|
207 |
+
toggle.attr('wpd-tooltip', wpdiscuzAjaxObj.wc_show_replies_text);
|
208 |
+
} else {
|
209 |
+
icon.removeClass('fa-chevron-down');
|
210 |
+
icon.addClass('fa-chevron-up');
|
211 |
+
toggle.attr('wpd-tooltip', wpdiscuzAjaxObj.wc_hide_replies_text);
|
212 |
+
}
|
213 |
+
btn.addClass('wpd_not_clicked');
|
214 |
+
});
|
215 |
+
}
|
216 |
+
});
|
217 |
+
|
218 |
+
$(document).delegate('.wpd-new-loaded-comment', 'mouseenter', function() {
|
219 |
+
$(this).removeClass('wpd-new-loaded-comment');
|
220 |
+
});
|
221 |
+
|
222 |
+
$(document).delegate('.wpd-sbs-toggle', 'click', function() {
|
223 |
+
$('.wpdiscuz-subscribe-bar').slideToggle(enableDropAnimation);
|
224 |
+
});
|
225 |
//============================== reCAPTCHA ============================== //
|
226 |
+
if (parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm) && !isUserLoggedIn && wpdiscuzAjaxObj.wpDiscuzReCaptchaSK) {
|
227 |
+
if (wpdiscuzRecaptchaVersion === '2.0') {
|
228 |
+
setTimeout(function() {
|
229 |
+
try {
|
230 |
+
grecaptcha.render('wpdiscuz-recaptcha-subscribe-form', {
|
231 |
+
'sitekey': wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,
|
232 |
+
'theme': wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,
|
233 |
+
'callback': function(response) {
|
234 |
+
$('#wpdiscuz-recaptcha-field-subscribe-form').val('key');
|
235 |
+
},
|
236 |
+
'expired-callback': function() {
|
237 |
+
$('#wpdiscuz-recaptcha-field-subscribe-form').val("");
|
238 |
+
}
|
239 |
+
});
|
240 |
+
} catch (e) {
|
241 |
+
console.log(e);
|
242 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error: ' + e.message, 'error');
|
243 |
+
}
|
244 |
+
}, 1000);
|
245 |
+
|
246 |
+
$(document).delegate('#wpdiscuz-subscribe-form', 'submit', function(e) {
|
247 |
+
if (!$('#wpdiscuz-recaptcha-field-subscribe-form').val()) {
|
248 |
+
$('.wpdiscuz-recaptcha', $(this)).css('border', '1px solid red');
|
249 |
+
e.preventDefault();
|
250 |
+
} else {
|
251 |
+
$('.wpdiscuz-recaptcha', $(this)).css('border', 'none');
|
252 |
+
}
|
253 |
+
});
|
254 |
+
} else if (wpdiscuzRecaptchaVersion === '3.0') {
|
255 |
+
$(document).delegate('#wpdiscuz_subscription_button', 'click', function(e) {
|
256 |
+
var subscriptionForm = $(this).parents('#wpdiscuz-subscribe-form');
|
257 |
+
e.preventDefault();
|
258 |
+
try {
|
259 |
+
grecaptcha.ready(function() {
|
260 |
+
grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK, {action: 'wpdiscuz/wpdAddSubscription'})
|
261 |
+
.then(function(token) {
|
262 |
+
console.log(5555);
|
263 |
+
document.getElementById('wpdiscuz-recaptcha-field-subscribe-form').value = token;
|
264 |
+
subscriptionForm.submit();
|
265 |
+
}, function(reason) {
|
266 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error', 'error');
|
267 |
+
console.log(reason);
|
268 |
+
});
|
269 |
+
});
|
270 |
+
} catch (e) {
|
271 |
+
console.log(e);
|
272 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error: ' + e.message, 'error');
|
273 |
+
}
|
274 |
+
});
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
function generateReCaptcha(uniqueId) {
|
279 |
+
if ((isShowCaptchaForGuests || isShowCaptchaForMembers) && wpdiscuzRecaptchaVersion === '2.0') {
|
280 |
+
var commentId = getCommentID(uniqueId);
|
281 |
+
setTimeout(function() {
|
282 |
+
if (!reCaptchaWidgets[commentId]) {
|
283 |
+
try {
|
284 |
+
reCaptchaWidgets[commentId] = grecaptcha.render('wpdiscuz-recaptcha-' + uniqueId, {
|
285 |
+
'sitekey': wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,
|
286 |
+
'theme': wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,
|
287 |
+
'callback': function(response) {
|
288 |
+
$('#wpdiscuz-recaptcha-field-' + uniqueId).val('key');
|
289 |
+
},
|
290 |
+
'expired-callback': function() {
|
291 |
+
$('#wpdiscuz-recaptcha-field-' + uniqueId).val("");
|
292 |
+
}
|
293 |
+
});
|
294 |
+
} catch (e) {
|
295 |
+
console.log(e);
|
296 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error: ' + e.message, 'error');
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}, 1000);
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
function resetReCaptcha(uniqueId) {
|
304 |
+
if ((isShowCaptchaForGuests || isShowCaptchaForMembers) && wpdiscuzRecaptchaVersion === '2.0') {
|
305 |
+
var commentId = getCommentID(uniqueId);
|
306 |
+
grecaptcha.reset(reCaptchaWidgets[commentId]);
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
function wpdReCaptchaValidate(form) {
|
311 |
+
var wpdGoogleRecaptchaValid = true;
|
312 |
+
if (wpdiscuzRecaptchaVersion === '2.0' && $('input[name=wc_captcha]', form).length && !$('input[name=wc_captcha]', form).val().length) {
|
313 |
+
wpdGoogleRecaptchaValid = false;
|
314 |
+
$('.wpdiscuz-recaptcha', form).css('border', '1px solid red');
|
315 |
+
} else if (wpdiscuzRecaptchaVersion === '2.0' && $('input[name=wc_captcha]', form).length) {
|
316 |
+
$('.wpdiscuz-recaptcha', form).css('border', 'none');
|
317 |
+
}
|
318 |
+
return wpdGoogleRecaptchaValid;
|
319 |
+
}
|
320 |
+
|
321 |
+
function wpdReCaptchaValidateOnSubscribeForm(form) {
|
322 |
+
var wpdGoogleRecaptchaValid = true;
|
323 |
+
if (wpdiscuzRecaptchaVersion === '2.0' && $('input[name=wpdiscuz_recaptcha_subscribe_form]', form).length && !$('input[name=wpdiscuz_recaptcha_subscribe_form]', form).val().length) {
|
324 |
+
wpdGoogleRecaptchaValid = false;
|
325 |
+
$('.wpdiscuz-recaptcha', form).css('border', '1px solid red');
|
326 |
+
} else if (wpdiscuzRecaptchaVersion === '2.0' && $('input[name=wpdiscuz_recaptcha_subscribe_form]', form).length) {
|
327 |
+
$('.wpdiscuz-recaptcha', form).css('border', 'none');
|
328 |
+
}
|
329 |
+
return wpdGoogleRecaptchaValid;
|
330 |
+
}
|
331 |
+
|
332 |
+
if ((isShowCaptchaForGuests || isShowCaptchaForMembers) && wpdiscuzRecaptchaVersion === '2.0') {
|
333 |
+
var ww = $(window).width();
|
334 |
+
var wpcomm = $('#wpdcom').width();
|
335 |
+
if (wpcomm >= 1100) {
|
336 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
337 |
+
"transform-origin": "right 0",
|
338 |
+
"-webkit-transform-origin": "right 0",
|
339 |
+
"transform": "scale(0.9)",
|
340 |
+
"-webkit-transform": "scale(0.9)"
|
341 |
+
});
|
342 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
343 |
+
"transform-origin": "right 0",
|
344 |
+
"-webkit-transform-origin": "right 0",
|
345 |
+
"transform": "scale(0.9)",
|
346 |
+
"-webkit-transform": "scale(0.9)"
|
347 |
+
});
|
348 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({"width": "65%"});
|
349 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({"width": "35%"});
|
350 |
+
}
|
351 |
+
if (wpcomm >= 940 && wpcomm < 1100) {
|
352 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
353 |
+
"transform-origin": "right 0",
|
354 |
+
"-webkit-transform-origin": "right 0",
|
355 |
+
"transform": "scale(0.9)",
|
356 |
+
"-webkit-transform": "scale(0.9)"
|
357 |
+
});
|
358 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
359 |
+
"transform-origin": "right 0",
|
360 |
+
"-webkit-transform-origin": "right 0",
|
361 |
+
"transform": "scale(0.9)",
|
362 |
+
"-webkit-transform": "scale(0.9)"
|
363 |
+
});
|
364 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({"width": "60%"});
|
365 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({"width": "40%"});
|
366 |
+
}
|
367 |
+
if (wpcomm >= 810 && wpcomm < 940) {
|
368 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
369 |
+
"transform": "scale(0.9)",
|
370 |
+
"-webkit-transform": "scale(0.9)"
|
371 |
+
});
|
372 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
373 |
+
"transform": "scale(0.8)",
|
374 |
+
"-webkit-transform": "scale(0.8)"
|
375 |
+
});
|
376 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({"width": "40%"});
|
377 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({"width": "60%"});
|
378 |
+
}
|
379 |
+
if (wpcomm >= 730 && wpcomm < 810) {
|
380 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
381 |
+
"transform": "scale(0.9)",
|
382 |
+
"-webkit-transform": "scale(0.9)"
|
383 |
+
});
|
384 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
385 |
+
"transform-origin": "right 0",
|
386 |
+
"-webkit-transform-origin": "right 0",
|
387 |
+
"transform": "scale(0.8)",
|
388 |
+
"-webkit-transform": "scale(0.8)"
|
389 |
+
});
|
390 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({"width": "45%"});
|
391 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({"width": "55%"});
|
392 |
+
}
|
393 |
+
if (wpcomm >= 610 && wpcomm < 730) {
|
394 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
395 |
+
"transform": "scale(0.85)",
|
396 |
+
"-webkit-transform": "scale(0.85)"
|
397 |
+
});
|
398 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
399 |
+
"transform": "scale(0.8)",
|
400 |
+
"-webkit-transform": "scale(0.8)"
|
401 |
+
});
|
402 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({"width": "43%"});
|
403 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({"width": "55%"});
|
404 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({"width": "30%"});
|
405 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({"width": "70%"});
|
406 |
+
}
|
407 |
+
if (ww > 650) {
|
408 |
+
if (wpcomm >= 510 && wpcomm < 610) {
|
409 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
410 |
+
"transform-origin": "center 0",
|
411 |
+
"-webkit-transform-origin": "center 0",
|
412 |
+
"transform": "scale(0.77)",
|
413 |
+
"-webkit-transform": "scale(0.77)"
|
414 |
+
});
|
415 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
416 |
+
"transform-origin": "right 0",
|
417 |
+
"-webkit-transform-origin": "right 0",
|
418 |
+
"transform": "scale(0.77)",
|
419 |
+
"-webkit-transform": "scale(0.77)"
|
420 |
+
});
|
421 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({"width": "35%"});
|
422 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({"width": "63%"});
|
423 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({
|
424 |
+
"width": "30%",
|
425 |
+
"position": "relative",
|
426 |
+
"right": "-60px"
|
427 |
+
});
|
428 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({"width": "70%"});
|
429 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left": "0px"});
|
430 |
+
}
|
431 |
+
if (wpcomm >= 470 && wpcomm < 510) {
|
432 |
+
$("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
433 |
+
"transform-origin": "center 0",
|
434 |
+
"-webkit-transform-origin": "center 0",
|
435 |
+
"transform": "scale(0.77)",
|
436 |
+
"-webkit-transform": "scale(0.77)"
|
437 |
+
});
|
438 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
439 |
+
"transform-origin": "right 0",
|
440 |
+
"-webkit-transform-origin": "right 0",
|
441 |
+
"transform": "scale(0.77)",
|
442 |
+
"-webkit-transform": "scale(0.77)"
|
443 |
+
});
|
444 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({"width": "40%"});
|
445 |
+
$("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({"width": "60%"});
|
446 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({
|
447 |
+
"float": "none",
|
448 |
+
"width": "100%",
|
449 |
+
"display": "block"
|
450 |
+
});
|
451 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({
|
452 |
+
"float": "none",
|
453 |
+
"width": "100%",
|
454 |
+
"display": "block"
|
455 |
+
});
|
456 |
+
$("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left": "0px"});
|
457 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left": "0px"});
|
458 |
+
}
|
459 |
+
if (wpcomm < 470) {
|
460 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({
|
461 |
+
"margin": "0px auto",
|
462 |
+
"transform-origin": "center 0",
|
463 |
+
"-webkit-transform-origin": "center 0"
|
464 |
+
});
|
465 |
+
$("#wpdcom .wpd-form-col-left").css({"float": "none", "width": "100%", "display": "block"});
|
466 |
+
$("#wpdcom .wpd-form-col-right").css({"float": "none", "width": "100%", "display": "block"});
|
467 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left": "0px"});
|
468 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align": "center"});
|
469 |
+
$("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align": "center"});
|
470 |
+
}
|
471 |
+
}
|
472 |
+
}
|
473 |
|
474 |
//============================== /reCAPTCHA ============================== //
|
475 |
//============================== ADD COMMENT FUNCTION ============================== //
|
476 |
|
477 |
+
$(document).delegate('.wc_comm_submit.wpd_not_clicked', 'click', function() {
|
478 |
+
var currentSubmitBtn = $(this);
|
479 |
+
var depth = 1;
|
480 |
+
var wcForm = $(this).parents('form');
|
481 |
+
if (!wcForm.hasClass('wpd_main_comm_form')) {
|
482 |
+
depth = getCommentDepth($(this).parents('.wpd-comment'));
|
483 |
+
}
|
484 |
+
|
485 |
+
wpdValidateFieldRequired(wcForm, '#wpd-editor-' + $('.wpdiscuz_unique_id', wcForm).val());
|
486 |
+
wcForm.submit(function(e) {
|
487 |
+
e.preventDefault();
|
488 |
+
});
|
489 |
+
if ($('.wc_comment', wcForm).val().trim() === '') {
|
490 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields, 'error');
|
491 |
+
return;
|
492 |
+
}
|
493 |
+
if (wcForm[0].checkValidity() && wpdReCaptchaValidate(wcForm)) {
|
494 |
+
addingComment = true;
|
495 |
+
addAgreementInCookie(wcForm);
|
496 |
+
$(currentSubmitBtn).removeClass('wpd_not_clicked');
|
497 |
+
var data = new FormData();
|
498 |
+
data.append('action', 'wpdAddComment');
|
499 |
+
var inputs = $(":input", wcForm);
|
500 |
+
inputs.each(function() {
|
501 |
+
if (this.name != '' && this.type != 'checkbox' && this.type != 'radio') {
|
502 |
+
data.append(this.name + '', $(this).val().trim());
|
503 |
+
}
|
504 |
+
if (this.type == 'checkbox' || this.type == 'radio') {
|
505 |
+
if ($(this).is(':checked')) {
|
506 |
+
data.append(this.name + '', $(this).val());
|
507 |
+
}
|
508 |
+
}
|
509 |
+
});
|
510 |
+
|
511 |
+
data.append('wpd_comment_depth', depth);
|
512 |
+
|
513 |
+
if (wpdiscuzAjaxObj.wpdiscuz_zs) {
|
514 |
+
data.append('wpdiscuz_zs', wpdiscuzAjaxObj.wpdiscuz_zs);
|
515 |
+
}
|
516 |
+
|
517 |
+
if ($('.wpd-cookies-checkbox', wcForm).length && !$('.wpd-cookies-checkbox', wcForm).prop("checked")) {
|
518 |
+
wpdCookiesConsent = false;
|
519 |
+
}
|
520 |
+
$('#wpdiscuz-loading-bar').show();
|
521 |
+
if (wpdiscuzAjaxObj.wpDiscuzReCaptchaSK && wpdiscuzRecaptchaVersion === '3.0' && ((wpdiscuzAjaxObj.wc_captcha_show_for_guest == 1 && !wpdiscuzAjaxObj.is_user_logged_in) || (wpdiscuzAjaxObj.wc_captcha_show_for_members == 1 && wpdiscuzAjaxObj.is_user_logged_in))) {
|
522 |
+
try {
|
523 |
+
grecaptcha.ready(function() {
|
524 |
+
grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK, {action: 'wpdiscuz/addComment'})
|
525 |
+
.then(function(token) {
|
526 |
+
data.append('g-recaptcha-response', token);
|
527 |
+
wpdiscuzSendComment(wcForm, data, currentSubmitBtn);
|
528 |
+
}, function(reason) {
|
529 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error', 'error');
|
530 |
+
console.log(reason);
|
531 |
+
});
|
532 |
+
});
|
533 |
+
} catch (e) {
|
534 |
+
console.log(e);
|
535 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error: ' + e.message, 'error');
|
536 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
537 |
+
}
|
538 |
+
} else {
|
539 |
+
wpdiscuzSendComment(wcForm, data, currentSubmitBtn);
|
540 |
+
}
|
541 |
+
|
542 |
+
}
|
543 |
+
resetReCaptcha($('.wpdiscuz_unique_id', wcForm).val());
|
544 |
+
wpdiscuzReset();
|
545 |
+
});
|
546 |
+
|
547 |
+
function wpdiscuzSendComment(wcForm, data, currentSubmitBtn) {
|
548 |
+
getAjaxObj(isNativeAjaxEnabled || wpdiscuzUploader, false, data)
|
549 |
+
.done(function(r) {
|
550 |
+
$(currentSubmitBtn).addClass('wpd_not_clicked');
|
551 |
+
if (typeof r === 'object') {
|
552 |
+
if (r.success) {
|
553 |
+
if (wpdiscuzAjaxObj.commentFormView === "collapsed") {
|
554 |
+
$('.wpd-form-foot', wcForm).slideUp(enableDropAnimation);
|
555 |
+
}
|
556 |
+
$('.wpd-thread-info').html(r.data.wc_all_comments_count_new_html);
|
557 |
+
r.data.wc_all_comments_count_new = parseInt(r.data.wc_all_comments_count_new);
|
558 |
+
$('#wpd-bubble-all-comments-count').text(r.data.wc_all_comments_count_new);
|
559 |
+
if (r.data.wc_all_comments_count_new) {
|
560 |
+
$('#wpd-bubble-all-comments-count').show();
|
561 |
+
} else {
|
562 |
+
$('#wpd-bubble-all-comments-count').hide();
|
563 |
+
}
|
564 |
+
var animateDelay = enableDropAnimation;
|
565 |
+
if (r.data.is_main) {
|
566 |
+
addCommentsAfterSticky(r.data.message);
|
567 |
+
} else {
|
568 |
+
animateDelay = enableDropAnimation + 700;
|
569 |
+
$('#wpd-secondary-form-wrapper-' + r.data.uniqueid).slideToggle(700);
|
570 |
+
if (r.data.is_in_same_container == 1) {
|
571 |
+
$('#wpd-secondary-form-wrapper-' + r.data.uniqueid).after(r.data.message);
|
572 |
+
} else {
|
573 |
+
$('#wpd-comm-' + r.data.uniqueid).after(r.data.message);
|
574 |
+
}
|
575 |
+
}
|
576 |
+
notifySubscribers(r);
|
577 |
+
wpdiscuzRedirect(r);
|
578 |
+
if (isCookiesEnabled && wpdCookiesConsent) {
|
579 |
+
addCookie(r.data);
|
580 |
+
} else if (!wpdCookiesConsent) {
|
581 |
+
$('.wpd-cookies-checkbox').removeAttr('checked');
|
582 |
+
}
|
583 |
+
if (wpdiscuzLoadRichEditor) {
|
584 |
+
wpDiscuzEditor.createEditor('#wpd-editor-' + $('.wpdiscuz_unique_id', wcForm).val()).setContents([{insert: '\n'}]);
|
585 |
+
}
|
586 |
+
wcForm.get(0).reset();
|
587 |
+
setCookieInForm(r.data);
|
588 |
+
$('.wmu-preview-wrap', wcForm).remove();
|
589 |
+
deleteAgreementFields();
|
590 |
+
if (parseInt(wpdiscuzAjaxObj.scrollToComment)) {
|
591 |
+
setTimeout(function() {
|
592 |
+
unsetHtmlAndBodyScrollBehaviors();
|
593 |
+
$('html, body').animate({
|
594 |
+
scrollTop: $('#comment-' + r.data.new_comment_id).offset().top - 32
|
595 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
596 |
+
}, animateDelay);
|
597 |
+
}
|
598 |
+
runCallbacks(r, wcForm);
|
599 |
+
} else if (r.data) {
|
600 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
601 |
+
runCallbacks(r, wcForm);
|
602 |
+
}
|
603 |
+
} else {
|
604 |
+
wpdiscuzAjaxObj.setCommentMessage(r, 'error');
|
605 |
+
}
|
606 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
607 |
+
addingComment = false;
|
608 |
+
})
|
609 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
610 |
+
console.log(errorThrown);
|
611 |
+
$(currentSubmitBtn).addClass('wpd_not_clicked');
|
612 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
613 |
+
});
|
614 |
+
}
|
615 |
+
|
616 |
+
function notifySubscribers(r) {
|
617 |
+
if (!r.data.held_moderate) {
|
618 |
+
var data = new FormData();
|
619 |
+
data.append('action', 'wpdCheckNotificationType');
|
620 |
+
data.append('comment_id', r.data.new_comment_id);
|
621 |
+
data.append('email', r.data.comment_author_email);
|
622 |
+
data.append('isParent', r.data.is_main);
|
623 |
+
getAjaxObj(isNativeAjaxEnabled, true, data);
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
function wpdiscuzRedirect(r) {
|
628 |
+
if (r.data.redirect > 0 && r.data.new_comment_id) {
|
629 |
+
var data = new FormData();
|
630 |
+
data.append('action', 'wpdRedirect');
|
631 |
+
data.append('commentId', r.data.new_comment_id);
|
632 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
633 |
+
.done(function(r) {
|
634 |
+
if (typeof r === 'object') {
|
635 |
+
if (r.success) {
|
636 |
+
setTimeout(function() {
|
637 |
+
location.href = r.data;
|
638 |
+
}, 2000);
|
639 |
+
}
|
640 |
+
}
|
641 |
+
})
|
642 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
643 |
+
console.log(errorThrown);
|
644 |
+
});
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
function setCookieInForm(obj) {
|
649 |
+
$('.wpd_comm_form .wc_name').val(obj.comment_author);
|
650 |
+
if (obj.comment_author_email && obj.comment_author_email.indexOf('@example.com') < 0) {
|
651 |
+
$('.wpd_comm_form .wc_email').val(obj.comment_author_email);
|
652 |
+
}
|
653 |
+
if (obj.comment_author_url) {
|
654 |
+
$('.wpd_comm_form .wc_website').val(obj.comment_author_url);
|
655 |
+
}
|
656 |
+
}
|
657 |
+
|
658 |
+
function addCookie(obj) {
|
659 |
+
var email = obj.comment_author_email;
|
660 |
+
var name = obj.comment_author;
|
661 |
+
var weburl = obj.comment_author_url;
|
662 |
+
if (storeCommenterData == null) {
|
663 |
+
Cookies.set('comment_author_email_' + wpdiscuzCookiehash, email);
|
664 |
+
Cookies.set('comment_author_' + wpdiscuzCookiehash, name);
|
665 |
+
if (weburl.length) {
|
666 |
+
Cookies.set('comment_author_url_' + wpdiscuzCookiehash, weburl);
|
667 |
+
}
|
668 |
+
} else {
|
669 |
+
storeCommenterData = parseInt(storeCommenterData);
|
670 |
+
Cookies.set('comment_author_email_' + wpdiscuzCookiehash, email, {expires: storeCommenterData, path: '/'});
|
671 |
+
Cookies.set('comment_author_' + wpdiscuzCookiehash, name, {expires: storeCommenterData, path: '/'});
|
672 |
+
if (weburl.length) {
|
673 |
+
Cookies.set('comment_author_url_' + wpdiscuzCookiehash, weburl, {
|
674 |
+
expires: storeCommenterData,
|
675 |
+
path: '/'
|
676 |
+
});
|
677 |
+
}
|
678 |
+
}
|
679 |
+
if ($('.wpd-cookies-checkbox').length) {
|
680 |
+
$('.wpd-cookies-checkbox').attr('checked', 'checked');
|
681 |
+
}
|
682 |
+
}
|
683 |
+
|
684 |
+
//============================== /ADD COMMENT FUNCTION ============================== //
|
685 |
//============================== EDIT COMMENT FUNCTION ============================== //
|
686 |
+
var wcCommentTextBeforeEditing;
|
687 |
+
|
688 |
+
$(document).delegate('.wpd_editable_comment', 'click', function() {
|
689 |
+
if (wcCommentTextBeforeEditing && $('.wpdiscuz-edit-form-wrap').length) {
|
690 |
+
wpdCancelOrSave(getUniqueID($('.wpdiscuz-edit-form-wrap'), 0), wcCommentTextBeforeEditing);
|
691 |
+
}
|
692 |
+
var uniqueID = getUniqueID($(this), 0);
|
693 |
+
var commentID = getCommentID(uniqueID);
|
694 |
+
var data = new FormData();
|
695 |
+
data.append('action', 'wpdEditComment');
|
696 |
+
data.append('commentId', commentID);
|
697 |
+
wcCommentTextBeforeEditing = $('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-text').get(0);
|
698 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
699 |
+
.done(function(r) {
|
700 |
+
if (typeof r === 'object') {
|
701 |
+
if (r.success) {
|
702 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text').replaceWith(r.data.html);
|
703 |
+
if (wpdiscuzLoadRichEditor) {
|
704 |
+
let currentEditor = wpDiscuzEditor.createEditor('#wpd-editor-edit_' + uniqueID);
|
705 |
+
currentEditor.clipboard.dangerouslyPasteHTML(0, r.data.content);
|
706 |
+
currentEditor.update();
|
707 |
+
$('.wpd-toolbar-hidden').prev('[id^=wpd-editor-]').css('border-bottom', "1px solid #dddddd");
|
708 |
+
} else {
|
709 |
+
$('#wc-textarea-edit_' + uniqueID).val(r.data.content);
|
710 |
+
}
|
711 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment').hide();
|
712 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-last-edited').hide();
|
713 |
+
} else {
|
714 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
715 |
+
}
|
716 |
+
} else {
|
717 |
+
console.log(r);
|
718 |
+
}
|
719 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
720 |
+
})
|
721 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
722 |
+
console.log(errorThrown);
|
723 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
724 |
+
});
|
725 |
+
});
|
726 |
+
|
727 |
+
$(document).delegate('.wc_save_edited_comment', 'click', function() {
|
728 |
+
var uniqueID = getUniqueID($(this));
|
729 |
+
var commentID = getCommentID(uniqueID);
|
730 |
+
var editCommentForm = $('#wpd-comm-' + uniqueID + ' #wpdiscuz-edit-form');
|
731 |
+
wpdValidateFieldRequired(editCommentForm, '#wpd-editor-edit_' + uniqueID);
|
732 |
+
editCommentForm.submit(function(e) {
|
733 |
+
e.preventDefault();
|
734 |
+
});
|
735 |
+
|
736 |
+
if (editCommentForm[0].checkValidity()) {
|
737 |
+
var data = new FormData();
|
738 |
+
data.append('action', 'wpdSaveEditedComment');
|
739 |
+
data.append('commentId', commentID);
|
740 |
+
var inputs = $(":input", editCommentForm);
|
741 |
+
inputs.each(function() {
|
742 |
+
if (this.name !== '' && this.type !== 'checkbox' && this.type !== 'radio') {
|
743 |
+
data.append(this.name + '', $(this).val());
|
744 |
+
}
|
745 |
+
if (this.type === 'checkbox' || this.type === 'radio') {
|
746 |
+
if ($(this).is(':checked')) {
|
747 |
+
data.append(this.name + '', $(this).val());
|
748 |
+
}
|
749 |
+
}
|
750 |
+
});
|
751 |
+
|
752 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
753 |
+
.done(function(r) {
|
754 |
+
if (typeof r === 'object') {
|
755 |
+
if (r.success) {
|
756 |
+
wpdCancelOrSave(uniqueID, r.data.message);
|
757 |
+
if (r.data.lastEdited) {
|
758 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-last-edited').remove();
|
759 |
+
$(r.data.lastEdited).insertAfter('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text');
|
760 |
+
}
|
761 |
+
if (r.data.twitterShareLink) {
|
762 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw').attr('href', r.data.twitterShareLink);
|
763 |
+
}
|
764 |
+
if (r.data.whatsappShareLink) {
|
765 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp').attr('href', r.data.whatsappShareLink);
|
766 |
+
}
|
767 |
+
if (wpdiscuzLoadRichEditor) {
|
768 |
+
wpDiscuzEditor.removeEditor('#wpd-editor-edit_' + uniqueID);
|
769 |
+
}
|
770 |
+
} else {
|
771 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
772 |
+
}
|
773 |
+
runCallbacks(r, commentID);
|
774 |
+
} else {
|
775 |
+
console.log(r);
|
776 |
+
}
|
777 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
778 |
+
})
|
779 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
780 |
+
console.log(errorThrown);
|
781 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
782 |
+
});
|
783 |
+
}
|
784 |
+
});
|
785 |
+
|
786 |
+
$(document).delegate('.wc_cancel_edit', 'click', function() {
|
787 |
+
var uniqueID = getUniqueID($(this));
|
788 |
+
wpdCancelOrSave(uniqueID, wcCommentTextBeforeEditing);
|
789 |
+
if (wpdiscuzLoadRichEditor) {
|
790 |
+
wpDiscuzEditor.removeEditor('#wpd-editor-edit_' + uniqueID);
|
791 |
+
}
|
792 |
+
});
|
793 |
+
|
794 |
+
function wpdCancelOrSave(uniqueID, content) {
|
795 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment').show();
|
796 |
+
$('#wpd-comm-' + uniqueID + ' .wpdiscuz-edit-form-wrap').replaceWith(content);
|
797 |
+
$('#wpd-comm-' + uniqueID + ' > .wpd-comment-wrap .wpd-comment-last-edited').show();
|
798 |
+
}
|
799 |
|
800 |
//============================== /EDIT COMMENT FUNCTION ============================== //
|
801 |
//============================== LOAD MORE ============================== //
|
802 |
+
if (!wpdiscuzAjaxObj.wordpressIsPaginate && firstLoadWithAjax) {
|
803 |
+
wpdiscuzLoadCount = 0;
|
804 |
+
if (firstLoadWithAjax == 1) {
|
805 |
+
setTimeout(function() {
|
806 |
+
wpdiscuzLoadComments(true);
|
807 |
+
}, 500);
|
808 |
+
} else {
|
809 |
+
$(document).delegate('.wpd-load-comments', 'click', function() {
|
810 |
+
$(this).parent('.wpd-load-more-submit-wrap').remove();
|
811 |
+
wpdiscuzLoadComments(true);
|
812 |
+
});
|
813 |
+
}
|
814 |
+
}
|
815 |
+
|
816 |
+
$(document).delegate('.wpd-load-more-submit', 'click', function() {
|
817 |
+
var loadButton = $(this);
|
818 |
+
var loaded = 'wpd-loaded';
|
819 |
+
var loading = 'wpd-loading';
|
820 |
+
if (loadButton.hasClass(loaded)) {
|
821 |
+
wpdiscuzLoadComments(false, loadButton, loaded, loading);
|
822 |
+
}
|
823 |
+
});
|
824 |
+
|
825 |
+
var isRun = false;
|
826 |
+
if (commentListLoadType === 2 && !wpdiscuzAjaxObj.wordpressIsPaginate) {
|
827 |
+
$('.wpd-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
|
828 |
+
wpdiscuzScrollEvents();
|
829 |
+
$(window).scroll(function() {
|
830 |
+
wpdiscuzScrollEvents();
|
831 |
+
});
|
832 |
+
}
|
833 |
+
|
834 |
+
function wpdiscuzScrollEvents() {
|
835 |
+
var wpdiscuzHasMoreComments = $('#wpdiscuzHasMoreComments').val();
|
836 |
+
var scrollHeight = $(document).height();
|
837 |
+
var scrollPosition = $(window).height() + $(window).scrollTop();
|
838 |
+
if (scrollHeight && scrollPosition) {
|
839 |
+
var scrollPercent = scrollPosition * 100 / scrollHeight;
|
840 |
+
if (scrollPercent >= 80 && isRun === false && wpdiscuzHasMoreComments == 1) {
|
841 |
+
isRun = true;
|
842 |
+
wpdiscuzLoadComments(false, $('.wpd-load-more-submit'));
|
843 |
+
}
|
844 |
+
}
|
845 |
+
}
|
846 |
+
|
847 |
+
function wpdiscuzLoadComments(isFirstLoad, loadButton, loaded, loading) {
|
848 |
+
if (loadButton) {
|
849 |
+
loadButton.toggleClass(loaded);
|
850 |
+
loadButton.toggleClass(loading);
|
851 |
+
}
|
852 |
+
var data = new FormData();
|
853 |
+
data.append('action', 'wpdLoadMoreComments');
|
854 |
+
var sorting = $('.wpdiscuz-sort-button-active').attr('data-sorting');
|
855 |
+
if (sorting) {
|
856 |
+
data.append('sorting', sorting);
|
857 |
+
}
|
858 |
+
data.append('offset', wpdiscuzLoadCount);
|
859 |
+
data.append('lastParentId', getLastParentID());
|
860 |
+
data.append('isFirstLoad', isFirstLoad ? 1 : 0);
|
861 |
+
var filterType = $('.wpdf-active').attr('data-filter-type');
|
862 |
+
data.append('wpdType', filterType ? filterType : '');
|
863 |
+
getAjaxObj(isNativeAjaxEnabled, isFirstLoad && firstLoadWithAjax == 1 ? false : true, data)
|
864 |
+
.done(function(r) {
|
865 |
+
if (typeof r === 'object') {
|
866 |
+
if (r.success) {
|
867 |
+
wpdiscuzLoadCount++;
|
868 |
+
if (isFirstLoad) {
|
869 |
+
$('.wpd-comment').remove();
|
870 |
+
}
|
871 |
+
$('.wpdiscuz_single').remove();
|
872 |
+
$('.wpdiscuz-comment-pagination').before(r.data.comment_list);
|
873 |
+
setLoadMoreVisibility(r, isFirstLoad && commentListLoadType !== 2);
|
874 |
+
isRun = false;
|
875 |
+
loadLastCommentId = r.data.loadLastCommentId;
|
876 |
+
runCallbacks(r);
|
877 |
+
if (isFirstLoad) {
|
878 |
+
getSingleComment(false);
|
879 |
+
}
|
880 |
+
}
|
881 |
+
}
|
882 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
883 |
+
$('.wpd-load-more-submit').blur();
|
884 |
+
if (loadButton) {
|
885 |
+
loadButton.toggleClass(loaded);
|
886 |
+
loadButton.toggleClass(loading);
|
887 |
+
}
|
888 |
+
})
|
889 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
890 |
+
console.log(errorThrown);
|
891 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
892 |
+
$('.wpd-load-more-submit').blur();
|
893 |
+
if (loadButton) {
|
894 |
+
loadButton.toggleClass(loaded);
|
895 |
+
loadButton.toggleClass(loading);
|
896 |
+
}
|
897 |
+
});
|
898 |
+
}
|
899 |
+
|
900 |
+
function setLoadMoreVisibility(r, showPagination) {
|
901 |
+
if (r.data.is_show_load_more == false) {
|
902 |
+
$('#wpdiscuzHasMoreComments').val(0);
|
903 |
+
$('.wpd-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
|
904 |
+
} else {
|
905 |
+
setLastParentID(r.data.last_parent_id);
|
906 |
+
$('#wpdiscuzHasMoreComments').val(1);
|
907 |
+
if (showPagination) {
|
908 |
+
$('.wpd-load-more-submit').parents('.wpdiscuz-comment-pagination').show();
|
909 |
+
}
|
910 |
+
}
|
911 |
+
|
912 |
+
runCallbacks(r);
|
913 |
+
}
|
914 |
+
|
915 |
+
wpdiscuzAjaxObj.setLoadMoreVisibility = setLoadMoreVisibility;
|
916 |
//============================== /LOAD MORE ============================== //
|
917 |
//============================== VOTE ============================== //
|
918 |
+
$(document).delegate('.wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked', 'click', function() {
|
919 |
+
var currentVoteBtn = $(this);
|
920 |
+
$(currentVoteBtn).removeClass('wpd_not_clicked');
|
921 |
+
var uniqueId = getUniqueID(currentVoteBtn);
|
922 |
+
var commentID = getCommentID(uniqueId);
|
923 |
+
var voteType;
|
924 |
+
if ($(this).hasClass('wpd-vote-up')) {
|
925 |
+
voteType = 1;
|
926 |
+
} else {
|
927 |
+
voteType = -1;
|
928 |
+
}
|
929 |
+
|
930 |
+
var data = new FormData();
|
931 |
+
data.append('action', 'wpdVoteOnComment');
|
932 |
+
data.append('commentId', commentID);
|
933 |
+
data.append('voteType', voteType);
|
934 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
935 |
+
.done(function(r) {
|
936 |
+
$(currentVoteBtn).addClass('wpd_not_clicked');
|
937 |
+
if (typeof r === 'object') {
|
938 |
+
if (r.success) {
|
939 |
+
if (r.data.buttonsStyle === 'total') {
|
940 |
+
var voteCountDiv = $('.wpd-comment-footer .wpd-vote-result', $('#comment-' + commentID));
|
941 |
+
var votes = r.data.votes;
|
942 |
+
voteCountDiv.text(votes);
|
943 |
+
voteCountDiv.removeClass('wpd-up wpd-down');
|
944 |
+
if (votes > 0) {
|
945 |
+
voteCountDiv.addClass('wpd-up');
|
946 |
+
}
|
947 |
+
if (votes < 0) {
|
948 |
+
voteCountDiv.addClass('wpd-down');
|
949 |
+
}
|
950 |
+
} else {
|
951 |
+
var likeCountDiv = $('.wpd-comment-footer .wpd-vote-result-like', $('#comment-' + commentID));
|
952 |
+
var dislikeCountDiv = $('.wpd-comment-footer .wpd-vote-result-dislike', $('#comment-' + commentID));
|
953 |
+
likeCountDiv.text(r.data.likeCount);
|
954 |
+
dislikeCountDiv.text(r.data.dislikeCount);
|
955 |
+
parseInt(r.data.likeCount) > 0 ? likeCountDiv.addClass('wpd-up') : likeCountDiv.removeClass('wpd-up');
|
956 |
+
parseInt(r.data.dislikeCount) < 0 ? dislikeCountDiv.addClass('wpd-down') : dislikeCountDiv.removeClass('wpd-down');
|
957 |
+
}
|
958 |
+
var voteUpDiv = $('.wpd-comment-footer .wpd-vote-up', $('#comment-' + commentID));
|
959 |
+
var voteDownDiv = $('.wpd-comment-footer .wpd-vote-down', $('#comment-' + commentID));
|
960 |
+
voteUpDiv.removeClass('wpd-up');
|
961 |
+
voteDownDiv.removeClass('wpd-down');
|
962 |
+
if (r.data.curUserReaction > 0) {
|
963 |
+
voteUpDiv.addClass('wpd-up');
|
964 |
+
} else if (r.data.curUserReaction < 0) {
|
965 |
+
voteDownDiv.addClass('wpd-down');
|
966 |
+
}
|
967 |
+
} else if (r.data) {
|
968 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
969 |
+
}
|
970 |
+
runCallbacks(r, commentID, voteType);
|
971 |
+
} else {
|
972 |
+
console.log(r);
|
973 |
+
}
|
974 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
975 |
+
})
|
976 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
977 |
+
console.log(errorThrown);
|
978 |
+
$(currentVoteBtn).addClass('wpd_not_clicked');
|
979 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
980 |
+
});
|
981 |
+
});
|
982 |
//============================== /VOTE ============================== //
|
983 |
//============================== SORTING ============================== //
|
984 |
+
$(document).delegate('body', 'click', function(e) {
|
985 |
+
var children = $('.wpdiscuz-sort-buttons');
|
986 |
+
if ($(e.target).hasClass('wpdf-sorting') || $(e.target).parent().hasClass('wpdf-sorting')) {
|
987 |
+
children.css({display: children.is(':visible') ? 'none' : 'flex'});
|
988 |
+
} else {
|
989 |
+
children.hide();
|
990 |
+
}
|
991 |
+
});
|
992 |
+
$(document).delegate('.wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)', 'click', function() {
|
993 |
+
var clickedBtn = $(this);
|
994 |
+
var sorting = $(this).attr("data-sorting");
|
995 |
+
if (sorting) {
|
996 |
+
$('.wpdiscuz-sort-button.wpdiscuz-sort-button-active').removeClass('wpdiscuz-sort-button-active').appendTo('.wpdiscuz-sort-buttons');
|
997 |
+
clickedBtn.addClass('wpdiscuz-sort-button-active').prependTo('.wpdf-sorting');
|
998 |
+
var data = new FormData();
|
999 |
+
data.append('action', 'wpdSorting');
|
1000 |
+
data.append('sorting', sorting);
|
1001 |
+
var filterType = $('.wpdf-active').attr('data-filter-type');
|
1002 |
+
data.append('wpdType', filterType ? filterType : '');
|
1003 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1004 |
+
.done(function(r) {
|
1005 |
+
if (typeof r === 'object') {
|
1006 |
+
if (r.success) {
|
1007 |
+
$('#wpdcom .wpd-comment').remove();
|
1008 |
+
$('#wpdcom .wpd-thread-list').prepend(r.data.message);
|
1009 |
+
setLoadMoreVisibility(r, false);
|
1010 |
+
wpdiscuzLoadCount = 1;
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1014 |
+
})
|
1015 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1016 |
+
console.log(errorThrown);
|
1017 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1018 |
+
});
|
1019 |
+
}
|
1020 |
+
});
|
1021 |
//============================== /SORTING ============================== //
|
1022 |
//============================== SINGLE COMMENT ============================== //
|
1023 |
+
function getSingleComment(showReply) {
|
1024 |
+
var loc = location.href;
|
1025 |
+
var matches = loc.match(/#comment\-(\d+)/);
|
1026 |
+
if (matches !== null) {
|
1027 |
+
var commentId = matches[1];
|
1028 |
+
if (!$('#comment-' + commentId).length) {
|
1029 |
+
var data = new FormData();
|
1030 |
+
data.append('action', 'wpdGetSingleComment');
|
1031 |
+
data.append('commentId', commentId);
|
1032 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1033 |
+
.done(function(r) {
|
1034 |
+
if (typeof r === 'object') {
|
1035 |
+
if (r.success) {
|
1036 |
+
var scrollToSelector = '#comment-' + commentId;
|
1037 |
+
if ($('#comment-' + r.data.parentCommentID).length) {
|
1038 |
+
$('#comment-' + r.data.parentCommentID).parents('[id^=wpd-comm-' + r.data.parentCommentID + ']').replaceWith(r.data.message);
|
1039 |
+
} else {
|
1040 |
+
$('.wpd-thread-list').prepend(r.data.message);
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
runCallbacks(r);
|
1044 |
+
|
1045 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1046 |
+
$('html, body').animate({
|
1047 |
+
scrollTop: $(scrollToSelector).offset().top - 32
|
1048 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
1049 |
+
if (showReply) {
|
1050 |
+
showReplyForm(commentId);
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
+
}
|
1054 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1055 |
+
})
|
1056 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1057 |
+
console.log(errorThrown);
|
1058 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1059 |
+
});
|
1060 |
+
} else {
|
1061 |
+
setTimeout(function() {
|
1062 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1063 |
+
$('html, body').animate({
|
1064 |
+
scrollTop: $('#comment-' + commentId).parents('[id^=wpd-comm-]').offset().top - 32
|
1065 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
1066 |
+
if (showReply) {
|
1067 |
+
showReplyForm(commentId);
|
1068 |
+
}
|
1069 |
+
}, 500);
|
1070 |
+
}
|
1071 |
+
}
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
window.onhashchange = function() {
|
1075 |
+
getSingleComment(false);
|
1076 |
+
};
|
1077 |
+
if (firstLoadWithAjax != 1) {
|
1078 |
+
getSingleComment(false);
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
function showReplyForm(commentId) {
|
1082 |
+
setTimeout(function() {
|
1083 |
+
if (!$('#comment-' + commentId).siblings('.wpd-secondary-form-wrapper').is(':visible')) {
|
1084 |
+
$('#comment-' + commentId).find('.wpd-reply-button').trigger('click');
|
1085 |
+
}
|
1086 |
+
}, 1100);
|
1087 |
+
}
|
1088 |
+
|
1089 |
//============================== /SINGLE COMMENT ============================== //
|
1090 |
//============================== LIVE UPDATE ============================== //
|
1091 |
+
function liveUpdate() {
|
1092 |
+
var data = new FormData();
|
1093 |
+
data.append('action', 'wpdUpdateAutomatically');
|
1094 |
+
data.append('loadLastCommentId', loadLastCommentId);
|
1095 |
+
data.append('visibleCommentIds', getVisibleCommentIds());
|
1096 |
+
getAjaxObj(isNativeAjaxEnabled, false, data)
|
1097 |
+
.done(function(r) {
|
1098 |
+
if (!addingComment) {
|
1099 |
+
if (typeof r === 'object') {
|
1100 |
+
if (r.success) {
|
1101 |
+
liveUpdateImmediately(r);
|
1102 |
+
$('.wpd-thread-info').html(r.data.wc_all_comments_count_new_html);
|
1103 |
+
r.data.wc_all_comments_count_new = parseInt(r.data.wc_all_comments_count_new);
|
1104 |
+
$('#wpd-bubble-all-comments-count').text(r.data.wc_all_comments_count_new);
|
1105 |
+
if (r.data.wc_all_comments_count_new) {
|
1106 |
+
$('#wpd-bubble-all-comments-count').show();
|
1107 |
+
} else {
|
1108 |
+
$('#wpd-bubble-all-comments-count').hide();
|
1109 |
+
}
|
1110 |
+
loadLastCommentId = r.data.loadLastCommentId;
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
}
|
1114 |
+
})
|
1115 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1116 |
+
console.log(errorThrown);
|
1117 |
+
});
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
function liveUpdateImmediately(r) {
|
1121 |
+
if (r.data.message !== undefined) {
|
1122 |
+
var commentObject;
|
1123 |
+
var message = r.data.message;
|
1124 |
+
for (var i = 0; i < message.length; i++) {
|
1125 |
+
commentObject = message[i];
|
1126 |
+
addCommentToTree(commentObject.comment_parent, commentObject.comment_html);
|
1127 |
+
}
|
1128 |
+
}
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
//============================== /LIVE UPDATE ============================== //
|
1132 |
//============================== READ MORE ============================== //
|
1133 |
+
$(document).delegate('.wpdiscuz-readmore', 'click', function() {
|
1134 |
+
var uniqueId = getUniqueID($(this));
|
1135 |
+
var commentId = getCommentID(uniqueId);
|
1136 |
+
var data = new FormData();
|
1137 |
+
data.append('action', 'wpdReadMore');
|
1138 |
+
data.append('commentId', commentId);
|
1139 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1140 |
+
.done(function(r) {
|
1141 |
+
if (typeof r === 'object') {
|
1142 |
+
if (r.success) {
|
1143 |
+
$('#comment-' + commentId + ' .wpd-comment-text').replaceWith(' ' + r.data.message);
|
1144 |
+
$('#wpdiscuz-readmore-' + uniqueId).remove();
|
1145 |
+
} else {
|
1146 |
+
console.log(r.data);
|
1147 |
+
}
|
1148 |
+
runCallbacks(r);
|
1149 |
+
} else {
|
1150 |
+
console.log(r);
|
1151 |
+
}
|
1152 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1153 |
+
})
|
1154 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1155 |
+
console.log(errorThrown);
|
1156 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1157 |
+
});
|
1158 |
+
});
|
1159 |
//============================== /READ MORE ============================== //
|
1160 |
//============================== FUNCTIONS ============================== //
|
1161 |
|
1162 |
+
function cloneSecondaryForm(field) {
|
1163 |
+
var uniqueId = getUniqueID(field, 0);
|
1164 |
+
$('#wpdiscuz_form_anchor-' + uniqueId).before(replaceUniqueId(uniqueId));
|
1165 |
+
var secondaryFormWrapper = $('#wpd-secondary-form-wrapper-' + uniqueId);
|
1166 |
+
if (!isUserLoggedIn) {
|
1167 |
+
var commentAuthorCookies = {
|
1168 |
+
comment_author: Cookies.get('comment_author_' + wpdiscuzCookiehash),
|
1169 |
+
comment_author_email: Cookies.get('comment_author_email_' + wpdiscuzCookiehash),
|
1170 |
+
comment_author_url: Cookies.get('comment_author_url_' + wpdiscuzCookiehash)
|
1171 |
+
};
|
1172 |
+
setCookieInForm(commentAuthorCookies);
|
1173 |
+
}
|
1174 |
+
if (wpdiscuzLoadRichEditor) {
|
1175 |
+
setTimeout(function() {
|
1176 |
+
wpDiscuzEditor.createEditor('#wpd-editor-' + uniqueId).focus();
|
1177 |
+
}, enableDropAnimation);
|
1178 |
+
} else {
|
1179 |
+
setTimeout(function() {
|
1180 |
+
$('#wc-textarea-' + uniqueId).trigger('focus');
|
1181 |
+
}, enableDropAnimation);
|
1182 |
+
}
|
1183 |
+
secondaryFormWrapper.slideToggle(enableDropAnimation, function() {
|
1184 |
+
field.addClass('wpdiscuz-clonned');
|
1185 |
+
});
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
function replaceUniqueId(uniqueId) {
|
1189 |
+
var secondaryForm = $('#wpdiscuz_hidden_secondary_form').html();
|
1190 |
+
return secondaryForm.replace(/wpdiscuzuniqueid/g, uniqueId);
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
function getUniqueID(field, isMain) {
|
1194 |
+
var fieldID = '';
|
1195 |
+
if (isMain) {
|
1196 |
+
fieldID = field.parents('.wpd-main-form-wrapper').attr('id');
|
1197 |
+
} else {
|
1198 |
+
fieldID = field.parents('.wpd-comment').attr('id');
|
1199 |
+
}
|
1200 |
+
var uniqueID = fieldID.substring(fieldID.lastIndexOf('-') + 1);
|
1201 |
+
return uniqueID;
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
function getCommentID(uniqueID) {
|
1205 |
+
return uniqueID.substring(0, uniqueID.indexOf('_'));
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
function getLastParentID() {
|
1209 |
+
return $('.wpd-load-more-submit').attr("data-lastparentid");
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
function setLastParentID(lastParentID) {
|
1213 |
+
$('.wpd-load-more-submit').attr("data-lastparentid", lastParentID);
|
1214 |
+
if (commentListLoadType !== 2) {
|
1215 |
+
$('.wpdiscuz-comment-pagination').show();
|
1216 |
+
}
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
function getCommentDepth(field) {
|
1220 |
+
var fieldClasses = field.attr('class');
|
1221 |
+
var classesArray = fieldClasses.split(' ');
|
1222 |
+
var depth = '';
|
1223 |
+
$.each(classesArray, function(index, value) {
|
1224 |
+
if ('wpd_comment_level' === getParentDepth(value, false)) {
|
1225 |
+
depth = getParentDepth(value, true);
|
1226 |
+
}
|
1227 |
+
});
|
1228 |
+
return parseInt(depth) + 1;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
function getParentDepth(depthValue, isNumberPart) {
|
1232 |
+
var depth = '';
|
1233 |
+
if (isNumberPart) {
|
1234 |
+
depth = depthValue.substring(depthValue.indexOf('-') + 1);
|
1235 |
+
} else {
|
1236 |
+
depth = depthValue.substring(0, depthValue.indexOf('-'));
|
1237 |
+
}
|
1238 |
+
return depth;
|
1239 |
+
}
|
1240 |
+
|
1241 |
+
function addCommentToTree(parentId, comment) {
|
1242 |
+
if (parentId == 0) {
|
1243 |
+
addCommentsAfterSticky(comment);
|
1244 |
+
} else {
|
1245 |
+
var parentUniqueId = getUniqueID($('#comment-' + parentId), 0);
|
1246 |
+
$('#wpdiscuz_form_anchor-' + parentUniqueId).after(comment);
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
function getVisibleCommentIds() {
|
1251 |
+
var uniqueId;
|
1252 |
+
var commentId;
|
1253 |
+
var visibleCommentIds = '';
|
1254 |
+
$('.wpd-comment-right').each(function() {
|
1255 |
+
uniqueId = getUniqueID($(this), 0);
|
1256 |
+
commentId = getCommentID(uniqueId);
|
1257 |
+
visibleCommentIds += commentId + ',';
|
1258 |
+
});
|
1259 |
+
return visibleCommentIds;
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
function loginButtonsClone() {
|
1263 |
+
if ($('.wc_social_plugin_wrapper .wp-social-login-provider-list').length) {
|
1264 |
+
$('.wc_social_plugin_wrapper .wp-social-login-provider-list').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content');
|
1265 |
+
} else if ($('.wc_social_plugin_wrapper .the_champ_login_container').length) {
|
1266 |
+
$('.wc_social_plugin_wrapper .the_champ_login_container').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content');
|
1267 |
+
} else if ($('.wc_social_plugin_wrapper .social_connect_form').length) {
|
1268 |
+
$('.wc_social_plugin_wrapper .social_connect_form').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content');
|
1269 |
+
} else if ($('.wc_social_plugin_wrapper .oneall_social_login_providers').length) {
|
1270 |
+
$('.wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content');
|
1271 |
+
}
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
function wpdiscuzReset() {
|
1275 |
+
$('.wpdiscuz_reset').val("");
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
function wpdValidateFieldRequired(form, editorId) {
|
1279 |
+
var fieldsGroup = form.find('.wpd-required-group');
|
1280 |
+
if (wpdiscuzLoadRichEditor) {
|
1281 |
+
form.find('.wc_comment').val($(editorId + '>.ql-editor').html());
|
1282 |
+
}
|
1283 |
+
wpdSanitizeCommentText(form);
|
1284 |
+
$.each(fieldsGroup, function() {
|
1285 |
+
$('input', this).removeAttr('required');
|
1286 |
+
var checkedFields = $('input:checked', this);
|
1287 |
+
if (checkedFields.length === 0) {
|
1288 |
+
$('input', $(this)).attr('required', 'required');
|
1289 |
+
} else {
|
1290 |
+
$('.wpd-field-invalid', this).remove();
|
1291 |
+
}
|
1292 |
+
});
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
function wpdSanitizeCommentText(form) {
|
1296 |
+
var textarea = form.find('.wc_comment');
|
1297 |
+
var commentText = textarea.val().trim();
|
1298 |
+
var replacedText = commentText.replace(/<p><br><\/p>/g, "\n").replace(/<p>(.*?)<\/p>/g, "$1\n");
|
1299 |
+
replacedText = replacedText.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g, " $3 ");
|
1300 |
+
replacedText = replacedText.replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g, " $1 ");
|
1301 |
+
replacedText = replacedText.replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g, " $3 ");
|
1302 |
+
replacedText = replacedText.replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g, " $2 ");
|
1303 |
+
textarea.val(replacedText);
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
function unsetHtmlAndBodyScrollBehaviors() {
|
1307 |
+
$('html, body').css('scroll-behavior', 'unset');
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
function restoreHtmlAndBodyScrollBehaviors() {
|
1311 |
+
$('html').css('scroll-behavior', htmlScrollBehavior);
|
1312 |
+
$('body').css('scroll-behavior', bodyScrollBehavior);
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
$(document).delegate('.wpd-required-group', 'change', function() {
|
1316 |
+
if ($('input:checked', this).length !== 0) {
|
1317 |
+
$('input', $(this)).removeAttr('required');
|
1318 |
+
} else {
|
1319 |
+
$('input', $(this)).attr('required', 'required');
|
1320 |
+
}
|
1321 |
+
});
|
1322 |
+
|
1323 |
+
/* SPOILER */
|
1324 |
+
$(document).delegate('.wpdiscuz-spoiler', 'click', function() {
|
1325 |
+
$(this).next().slideToggle();
|
1326 |
+
if ($(this).hasClass('wpdiscuz-spoiler-closed')) {
|
1327 |
+
$(this).parents('.wpdiscuz-spoiler-wrap').find('.fa-plus').removeClass('fa-plus').addClass('fa-minus');
|
1328 |
+
} else {
|
1329 |
+
$(this).parents('.wpdiscuz-spoiler-wrap').find('.fa-minus').removeClass('fa-minus').addClass('fa-plus');
|
1330 |
+
}
|
1331 |
+
$(this).toggleClass('wpdiscuz-spoiler-closed');
|
1332 |
+
});
|
1333 |
+
|
1334 |
+
function wpdiscuzShowReplies(uniqueId, btn) {
|
1335 |
+
var commentId = getCommentID(uniqueId);
|
1336 |
+
var data = new FormData();
|
1337 |
+
data.append('action', 'wpdShowReplies');
|
1338 |
+
data.append('commentId', commentId);
|
1339 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1340 |
+
.done(function(r) {
|
1341 |
+
btn.addClass('wpd_not_clicked');
|
1342 |
+
if (typeof r === 'object') {
|
1343 |
+
if (r.success) {
|
1344 |
+
$('#wpd-comm-' + uniqueId).replaceWith(r.data.comment_list);
|
1345 |
+
$('#wpd-comm-' + uniqueId + ' .wpd-toggle .fas').removeClass('fa-chevron-down').addClass('fa-chevron-up');
|
1346 |
+
$('#wpd-comm-' + uniqueId + ' .wpd-toggle').attr('wpd-tooltip', wpdiscuzAjaxObj.wc_hide_replies_text);
|
1347 |
+
$('#wpd-comm-' + uniqueId + ' .wpd-toggle .wpd-view-replies').remove();
|
1348 |
+
|
1349 |
+
runCallbacks(r);
|
1350 |
+
}
|
1351 |
+
}
|
1352 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1353 |
+
})
|
1354 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1355 |
+
console.log(errorThrown);
|
1356 |
+
btn.addClass('wpd_not_clicked');
|
1357 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1358 |
+
});
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
$(document).delegate('.wpd-tools i', 'click', function() {
|
1362 |
+
var sibling = $(this).siblings('.wpd-tools-actions');
|
1363 |
+
if (!sibling.is(':visible') && $(this).parents('.wpd-comment-right').attr('id') === $('[id^=comment-]').last().attr('id')) {
|
1364 |
+
$('#comments').css({paddingBottom: '160px'});
|
1365 |
+
}
|
1366 |
+
sibling.css({display: sibling.is(':visible') ? 'none' : 'flex'});
|
1367 |
+
});
|
1368 |
+
$(document).delegate('.wpd-comment-right', 'mouseleave', function() {
|
1369 |
+
$(this).find('.wpd-tools-actions').hide();
|
1370 |
+
$('#comments').css({paddingBottom: '0'});
|
1371 |
+
});
|
1372 |
+
|
1373 |
+
$(document).delegate('.wpd_stick_btn', 'click', function() {
|
1374 |
+
var uniqueId = getUniqueID($(this), 0);
|
1375 |
+
var commentId = getCommentID(uniqueId);
|
1376 |
+
var data = new FormData();
|
1377 |
+
data.append('action', 'wpdStickComment');
|
1378 |
+
data.append('commentId', commentId);
|
1379 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1380 |
+
.done(function(r) {
|
1381 |
+
if (typeof r === 'object') {
|
1382 |
+
if (r.success) {
|
1383 |
+
location.reload(true);
|
1384 |
+
}
|
1385 |
+
}
|
1386 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1387 |
+
})
|
1388 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1389 |
+
console.log(errorThrown);
|
1390 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1391 |
+
});
|
1392 |
+
});
|
1393 |
+
|
1394 |
+
$(document).delegate('.wpd_close_btn', 'click', function() {
|
1395 |
+
var uniqueId = getUniqueID($(this), 0);
|
1396 |
+
var commentId = getCommentID(uniqueId);
|
1397 |
+
var data = new FormData();
|
1398 |
+
data.append('action', 'wpdCloseThread');
|
1399 |
+
data.append('commentId', commentId);
|
1400 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1401 |
+
.done(function(r) {
|
1402 |
+
if (typeof r === 'object') {
|
1403 |
+
if (r.success) {
|
1404 |
+
location.reload(true);
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1408 |
+
})
|
1409 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1410 |
+
console.log(errorThrown);
|
1411 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1412 |
+
});
|
1413 |
+
});
|
1414 |
+
|
1415 |
+
$(document).delegate('.wpd-filter.wpd_not_clicked[data-filter-type]', 'click', function() {
|
1416 |
+
var btn = $(this);
|
1417 |
+
var type = btn.attr('data-filter-type');
|
1418 |
+
wpdiscuzAjaxObj.resetActiveFilters('.wpdf-' + type);
|
1419 |
+
btn.removeClass('wpd_not_clicked');
|
1420 |
+
$('.fas', btn).addClass('fa-pulse fa-spinner');
|
1421 |
+
var data = new FormData();
|
1422 |
+
data.append('action', 'wpdLoadMoreComments');
|
1423 |
+
var sorting = $('.wpdiscuz-sort-button-active').attr('data-sorting');
|
1424 |
+
if (sorting) {
|
1425 |
+
data.append('sorting', sorting);
|
1426 |
+
}
|
1427 |
+
data.append('lastParentId', 0);
|
1428 |
+
data.append('offset', 0);
|
1429 |
+
wpdiscuzLoadCount = 1;
|
1430 |
+
data.append('wpdType', btn.hasClass('wpdf-active') ? '' : type);
|
1431 |
+
data.append('isFirstLoad', 1);
|
1432 |
+
if ($(this).hasClass('wpdf-inline')) {
|
1433 |
+
if ($(this).hasClass('wpdf-active')) {
|
1434 |
+
$('.wpd-comment-info-bar').hide();
|
1435 |
+
} else {
|
1436 |
+
$('.wpd-comment-info-bar').css('display', 'flex');
|
1437 |
+
}
|
1438 |
+
} else {
|
1439 |
+
$('.wpd-comment-info-bar').hide();
|
1440 |
+
}
|
1441 |
+
getAjaxObj(isNativeAjaxEnabled, false, data)
|
1442 |
+
.done(function(r) {
|
1443 |
+
btn.addClass('wpd_not_clicked');
|
1444 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1445 |
+
if (typeof r === 'object') {
|
1446 |
+
if (r.success) {
|
1447 |
+
btn.toggleClass('wpdf-active');
|
1448 |
+
$('.wpd-load-comments').remove();
|
1449 |
+
$('.wpd-comment').remove();
|
1450 |
+
$('.wpd-thread-list').prepend(r.data.comment_list);
|
1451 |
+
setLoadMoreVisibility(r);
|
1452 |
+
loadLastCommentId = r.data.loadLastCommentId;
|
1453 |
+
$('.wpd-load-more-submit').blur();
|
1454 |
+
runCallbacks(r);
|
1455 |
+
}
|
1456 |
+
}
|
1457 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1458 |
+
})
|
1459 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1460 |
+
console.log(errorThrown);
|
1461 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1462 |
+
});
|
1463 |
+
});
|
1464 |
+
|
1465 |
+
$(document).delegate('.wpdf-reacted.wpd_not_clicked', 'click', function() {
|
1466 |
+
var btn = $(this);
|
1467 |
+
btn.removeClass('wpd_not_clicked');
|
1468 |
+
$('.fas', btn).addClass('fa-pulse fa-spinner');
|
1469 |
+
var data = new FormData();
|
1470 |
+
data.append('action', 'wpdMostReactedComment');
|
1471 |
+
getAjaxObj(isNativeAjaxEnabled, false, data)
|
1472 |
+
.done(function(r) {
|
1473 |
+
btn.addClass('wpd_not_clicked');
|
1474 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1475 |
+
if (typeof r === 'object') {
|
1476 |
+
if (r.success) {
|
1477 |
+
if ($('#comment-' + r.data.parentCommentID).length) {
|
1478 |
+
$('#comment-' + r.data.parentCommentID).parents('[id^=wpd-comm-' + r.data.parentCommentID + ']').replaceWith(r.data.message);
|
1479 |
+
} else if (!$('#comment-' + r.data.commentId).length) {
|
1480 |
+
$('.wpd-thread-list').prepend(r.data.message);
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
runCallbacks(r);
|
1484 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1485 |
+
$('html, body').animate({
|
1486 |
+
scrollTop: $('#comment-' + r.data.commentId).offset().top - 32
|
1487 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
1488 |
+
}
|
1489 |
+
}
|
1490 |
+
})
|
1491 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1492 |
+
console.log(errorThrown);
|
1493 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1494 |
+
});
|
1495 |
+
});
|
1496 |
+
|
1497 |
+
$(document).delegate('.wpdf-hottest.wpd_not_clicked', 'click', function() {
|
1498 |
+
var btn = $(this);
|
1499 |
+
btn.removeClass('wpd_not_clicked');
|
1500 |
+
$('.fas', btn).addClass('fa-pulse fa-spinner');
|
1501 |
+
var data = new FormData();
|
1502 |
+
data.append('action', 'wpdHottestThread');
|
1503 |
+
getAjaxObj(isNativeAjaxEnabled, false, data)
|
1504 |
+
.done(function(r) {
|
1505 |
+
btn.addClass('wpd_not_clicked');
|
1506 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1507 |
+
if (typeof r === 'object') {
|
1508 |
+
if (r.success) {
|
1509 |
+
if ($('#comment-' + r.data.commentId).length) {
|
1510 |
+
$('#comment-' + r.data.commentId).parents('[id^=wpd-comm-' + r.data.commentId + ']').replaceWith(r.data.message);
|
1511 |
+
} else {
|
1512 |
+
$('.wpd-thread-list').prepend(r.data.message);
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
runCallbacks(r);
|
1516 |
+
|
1517 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1518 |
+
$('html, body').animate({
|
1519 |
+
scrollTop: $('#comment-' + r.data.commentId).offset().top - 32
|
1520 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
1521 |
+
}
|
1522 |
+
}
|
1523 |
+
})
|
1524 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1525 |
+
console.log(errorThrown);
|
1526 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1527 |
+
});
|
1528 |
+
});
|
1529 |
+
|
1530 |
+
$(document).delegate('.wpd-filter-view-all', 'click', function() {
|
1531 |
+
$('.wpdf-inline.wpdf-active.wpd_not_clicked').trigger('click');
|
1532 |
+
});
|
1533 |
+
|
1534 |
+
|
1535 |
+
function addAgreementInCookie(wcForm) {
|
1536 |
+
$('.wpd-agreement-checkbox', wcForm).each(function() {
|
1537 |
+
if ($(this).hasClass('wpd_agreement_hide') && isCookiesEnabled && $(this).prop('checked')) {
|
1538 |
+
Cookies.set($(this).attr('name') + '_' + wpdiscuzCookiehash, 1, {expires: 30, path: '/'});
|
1539 |
+
$('input[name=' + $(this).attr('name') + ']').each(function() {
|
1540 |
+
wpdiscuzAgreementFields.push($(this));
|
1541 |
+
});
|
1542 |
+
}
|
1543 |
+
});
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
function deleteAgreementFields() {
|
1547 |
+
if (wpdiscuzAgreementFields.length) {
|
1548 |
+
wpdiscuzAgreementFields.forEach(function(item) {
|
1549 |
+
item.parents('.wpd-field-checkbox').remove();
|
1550 |
+
});
|
1551 |
+
wpdiscuzAgreementFields = [];
|
1552 |
+
}
|
1553 |
+
}
|
1554 |
+
|
1555 |
+
$(document).delegate('.wpd-follow-link.wpd_not_clicked', 'click', function() {
|
1556 |
+
var btn = $(this);
|
1557 |
+
btn.removeClass('wpd_not_clicked');
|
1558 |
+
$('.fas', btn).addClass('fa-pulse fa-spinner');
|
1559 |
+
var uniqueId = getUniqueID(btn, 0);
|
1560 |
+
var commentId = getCommentID(uniqueId);
|
1561 |
+
var data = new FormData();
|
1562 |
+
data.append('action', 'wpdFollowUser');
|
1563 |
+
data.append('commentId', commentId);
|
1564 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1565 |
+
.done(function(r) {
|
1566 |
+
btn.addClass('wpd_not_clicked');
|
1567 |
+
if (typeof r === 'object') {
|
1568 |
+
if (r.success) {
|
1569 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data.code], 'success');
|
1570 |
+
btn.removeClass('wpd-follow-active');
|
1571 |
+
if (r.data.followTip) {
|
1572 |
+
btn.attr('wpd-tooltip', r.data.followTip)
|
1573 |
+
}
|
1574 |
+
if (r.data.followClass) {
|
1575 |
+
btn.addClass(r.data.followClass);
|
1576 |
+
}
|
1577 |
+
} else {
|
1578 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
1579 |
+
}
|
1580 |
+
} else {
|
1581 |
+
console.log(r);
|
1582 |
+
}
|
1583 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1584 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1585 |
+
})
|
1586 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1587 |
+
console.log(errorThrown);
|
1588 |
+
$('.fas', btn).removeClass('fa-pulse fa-spinner');
|
1589 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1590 |
+
});
|
1591 |
+
});
|
1592 |
+
|
1593 |
+
function addCommentsAfterSticky(comment) {
|
1594 |
+
if ($('.wpd-sticky-comment').last()[0]) {
|
1595 |
+
$(comment).insertAfter($('.wpd-sticky-comment').last()[0]);
|
1596 |
+
} else {
|
1597 |
+
$('.wpd-thread-list').prepend(comment);
|
1598 |
+
}
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
function showHideNotificationType(current) {
|
1602 |
+
if (current) {
|
1603 |
+
if (!current.prop('required')) {
|
1604 |
+
if (current.val()) {
|
1605 |
+
current.parents('form').find('[name=wpdiscuz_notification_type]').parent().css('display', 'inline-block');
|
1606 |
+
} else {
|
1607 |
+
current.parents('form').find('[name=wpdiscuz_notification_type]').parent().css('display', 'none');
|
1608 |
+
}
|
1609 |
+
}
|
1610 |
+
} else {
|
1611 |
+
$.each($('.wc_email'), function(i, val) {
|
1612 |
+
var obj = $(val);
|
1613 |
+
if (!obj.prop('required')) {
|
1614 |
+
if (obj.val()) {
|
1615 |
+
obj.parents('form').find('[name=wpdiscuz_notification_type]').parent().css('display', 'inline-block');
|
1616 |
+
} else {
|
1617 |
+
obj.parents('form').find('[name=wpdiscuz_notification_type]').parent().css('display', 'none');
|
1618 |
+
}
|
1619 |
+
}
|
1620 |
+
});
|
1621 |
+
}
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
showHideNotificationType();
|
1625 |
+
|
1626 |
+
$(document).delegate('.wc_email', 'keyup', function() {
|
1627 |
+
showHideNotificationType($(this));
|
1628 |
+
});
|
1629 |
|
1630 |
//========================= BUBBLE =====================//
|
1631 |
+
if (bubbleEnabled && $('#wpdcom').length) {
|
1632 |
+
$('#wpd-bubble-wrapper').hover(function() {
|
1633 |
+
$(this).addClass('wpd-bubble-hover');
|
1634 |
+
}, function() {
|
1635 |
+
$(this).removeClass('wpd-bubble-hover');
|
1636 |
+
});
|
1637 |
+
if (bubbleHintTimeout && !Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)) {
|
1638 |
+
setTimeout(function() {
|
1639 |
+
$('#wpd-bubble-wrapper').addClass('wpd-bubble-hover');
|
1640 |
+
Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint, '1', {expires: 7, path: '/'});
|
1641 |
+
setTimeout(function() {
|
1642 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-bubble-hover');
|
1643 |
+
}, bubbleHintHideTimeout * 1000);
|
1644 |
+
}, bubbleHintTimeout * 1000);
|
1645 |
+
}
|
1646 |
+
if ('content_left' === bubbleLocation) {
|
1647 |
+
if ($('.entry-content').length) {
|
1648 |
+
var left = Math.min($('.entry-content').offset().left, $('#wpdcom').offset().left) - 120;
|
1649 |
+
var bubbleLeft = left > 25 ? left : 25;
|
1650 |
+
$('#wpd-bubble-wrapper').css({left: bubbleLeft + 'px'});
|
1651 |
+
$('#wpd-bubble-wrapper').addClass('wpd-left-content');
|
1652 |
+
} else if ($('.post-entry').length) {
|
1653 |
+
var left = Math.min($('.post-entry').offset().left, $('#wpdcom').offset().left) - 120;
|
1654 |
+
var bubbleLeft = left > 25 ? left : 25;
|
1655 |
+
$('#wpd-bubble-wrapper').css({left: bubbleLeft + 'px'});
|
1656 |
+
$('#wpd-bubble-wrapper').addClass('wpd-left-content');
|
1657 |
+
} else if ($('.container').length) {
|
1658 |
+
var left = Math.min($('.container').offset().left, $('#wpdcom').offset().left) - 120;
|
1659 |
+
var bubbleLeft = left > 25 ? left : 25;
|
1660 |
+
$('#wpd-bubble-wrapper').css({left: bubbleLeft + 'px'});
|
1661 |
+
$('#wpd-bubble-wrapper').addClass('wpd-left-content');
|
1662 |
+
} else {
|
1663 |
+
$('#wpd-bubble-wrapper').css({left: '25px'});
|
1664 |
+
$('#wpd-bubble-wrapper').addClass('wpd-left-corner');
|
1665 |
+
}
|
1666 |
+
} else if ('left_corner' === bubbleLocation) {
|
1667 |
+
$('#wpd-bubble-wrapper').css({left: '25px'});
|
1668 |
+
$('#wpd-bubble-wrapper').addClass('wpd-left-corner');
|
1669 |
+
} else if ('right_corner' === bubbleLocation) {
|
1670 |
+
$('#wpd-bubble-wrapper').css({right: '25px'});
|
1671 |
+
$('#wpd-bubble-wrapper').addClass('wpd-right-corner');
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
$('#wpd-bubble-wrapper').show();
|
1675 |
+
|
1676 |
+
$('#wpd-bubble-add-message-close').click(function(e) {
|
1677 |
+
e.preventDefault();
|
1678 |
+
e.stopPropagation();
|
1679 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-bubble-hover');
|
1680 |
+
});
|
1681 |
+
|
1682 |
+
$('#wpd-bubble').click(function() {
|
1683 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1684 |
+
$('html, body').animate({
|
1685 |
+
scrollTop: $('#wpdcom').offset().top - 60
|
1686 |
+
}, 1000, function() {
|
1687 |
+
restoreHtmlAndBodyScrollBehaviors();
|
1688 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-bubble-hover');
|
1689 |
+
if (wpdiscuzLoadRichEditor) {
|
1690 |
+
if ($('#wpd-editor-0_0').length) {
|
1691 |
+
wpDiscuzEditor.createEditor('#wpd-editor-0_0').focus();
|
1692 |
+
}
|
1693 |
+
} else if ($('#wc-textarea-0_0').length) {
|
1694 |
+
$('#wc-textarea-0_0').focus();
|
1695 |
+
}
|
1696 |
+
});
|
1697 |
+
});
|
1698 |
+
|
1699 |
+
$('#wpd-bubble-comment-close').click(function(e) {
|
1700 |
+
e.preventDefault();
|
1701 |
+
$('#wpd-bubble-notification-message').hide();
|
1702 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-new-comment-added');
|
1703 |
+
});
|
1704 |
+
|
1705 |
+
$('#wpd-bubble-comment-reply-link a').click(function() {
|
1706 |
+
var href = $(this).attr('href');
|
1707 |
+
setTimeout(function() {
|
1708 |
+
$('#wpd-bubble-notification-message').hide();
|
1709 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-new-comment-added');
|
1710 |
+
getSingleComment(true);
|
1711 |
+
var commentId = href.match(/#comment\-(\d+)/);
|
1712 |
+
bubbleNewCommentIds = bubbleNewCommentIds.filter(function(val) {
|
1713 |
+
return val != commentId[1];
|
1714 |
+
});
|
1715 |
+
$('#wpd-bubble-count .wpd-new-comments-count').text(bubbleNewCommentIds.length);
|
1716 |
+
if (bubbleNewCommentIds.length == 0) {
|
1717 |
+
$('#wpd-bubble-count').removeClass('wpd-new-comments');
|
1718 |
+
}
|
1719 |
+
}, 100);
|
1720 |
+
});
|
1721 |
+
|
1722 |
+
$('#wpd-bubble-count').click(function() {
|
1723 |
+
if (bubbleNewCommentIds.length) {
|
1724 |
+
var data = new FormData();
|
1725 |
+
data.append('action', 'wpdBubbleUpdate');
|
1726 |
+
data.append('newCommentIds', bubbleNewCommentIds.join());
|
1727 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1728 |
+
.done(function(r) {
|
1729 |
+
if (typeof r === 'object') {
|
1730 |
+
if (r.success) {
|
1731 |
+
r.data.message = r.data.message.filter(function(comment) {
|
1732 |
+
if (!$('#comment-' + comment.comment_id).length) {
|
1733 |
+
return comment;
|
1734 |
+
}
|
1735 |
+
});
|
1736 |
+
liveUpdateImmediately(r);
|
1737 |
+
$('#wpd-bubble-count').removeClass('wpd-new-comments');
|
1738 |
+
$('#wpd-bubble-count .wpd-new-comments-count').text('0');
|
1739 |
+
bubbleNewCommentIds = [];
|
1740 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1741 |
+
$('html, body').animate({
|
1742 |
+
scrollTop: $($('.wpd-new-loaded-comment')[0]).offset().top - 60
|
1743 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
1744 |
+
runCallbacks(r);
|
1745 |
+
}
|
1746 |
+
}
|
1747 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1748 |
+
})
|
1749 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1750 |
+
console.log(errorThrown);
|
1751 |
+
});
|
1752 |
+
}
|
1753 |
+
});
|
1754 |
+
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
function bubbleAjax() {
|
1758 |
+
$.ajax({
|
1759 |
+
type: 'GET',
|
1760 |
+
url: wpdiscuzAjaxObj.bubbleUpdateUrl,
|
1761 |
+
beforeSend: function(xhr) {
|
1762 |
+
xhr.setRequestHeader('X-WP-Nonce', wpdiscuzAjaxObj.restNonce);
|
1763 |
+
},
|
1764 |
+
data: {
|
1765 |
+
postId: wpdiscuzPostId,
|
1766 |
+
lastId: bubbleLastCommentId,
|
1767 |
+
visibleCommentIds: getVisibleCommentIds(),
|
1768 |
+
}
|
1769 |
+
}).done(function(r) {
|
1770 |
+
if (!addingComment) {
|
1771 |
+
if (typeof r === 'object') {
|
1772 |
+
if (r.ids.length) {
|
1773 |
+
if (commentListUpdateType) {
|
1774 |
+
liveUpdate();
|
1775 |
+
}
|
1776 |
+
r.ids = r.ids.filter(function(id) {
|
1777 |
+
if (!$('#comment-' + id).length) {
|
1778 |
+
return id;
|
1779 |
+
}
|
1780 |
+
});
|
1781 |
+
var timeout = 5000;
|
1782 |
+
bubbleLastCommentId = parseInt(r.ids[r.ids.length - 1]);
|
1783 |
+
bubbleNewCommentIds = bubbleNewCommentIds.concat(r.ids);
|
1784 |
+
if (bubbleShowNewCommentMessage && r.commentText) {
|
1785 |
+
$('#wpd-bubble-author-avatar').html(r.avatar);
|
1786 |
+
$('#wpd-bubble-author-name').html(r.authorName);
|
1787 |
+
$('#wpd-bubble-comment-date span').html(r.commentDate);
|
1788 |
+
$('#wpd-bubble-comment-text').html(r.commentText);
|
1789 |
+
$('#wpd-bubble-comment-reply-link a').attr('href', r.commentLink);
|
1790 |
+
$('#wpd-bubble-notification-message').show();
|
1791 |
+
timeout = 10000;
|
1792 |
+
}
|
1793 |
+
var count = parseInt($('.wpd-new-comments-count').text());
|
1794 |
+
count += r.ids.length;
|
1795 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-new-comment-added');
|
1796 |
+
$('#wpd-bubble-wrapper').addClass('wpd-new-comment-added');
|
1797 |
+
setTimeout(function() {
|
1798 |
+
$('#wpd-bubble-notification-message').hide();
|
1799 |
+
$('#wpd-bubble-wrapper').removeClass('wpd-new-comment-added');
|
1800 |
+
}, timeout);
|
1801 |
+
$('.wpd-new-comments-count').text(count);
|
1802 |
+
$('#wpd-bubble-count').addClass('wpd-new-comments');
|
1803 |
+
r.all_comments_count = parseInt(r.all_comments_count);
|
1804 |
+
$('#wpd-bubble-all-comments-count').text(r.all_comments_count);
|
1805 |
+
if (r.all_comments_count) {
|
1806 |
+
$('#wpd-bubble-all-comments-count').show();
|
1807 |
+
} else {
|
1808 |
+
$('#wpd-bubble-all-comments-count').hide();
|
1809 |
+
}
|
1810 |
+
$('.wpd-thread-info').html(r.all_comments_count_html);
|
1811 |
+
}
|
1812 |
+
} else {
|
1813 |
+
console.log(r);
|
1814 |
+
}
|
1815 |
+
}
|
1816 |
+
setTimeout(bubbleAjax, commentListUpdateTimer);
|
1817 |
+
}).fail(function(jqXHR, textStatus, errorThrown) {
|
1818 |
+
console.log(errorThrown);
|
1819 |
+
setTimeout(bubbleAjax, commentListUpdateTimer);
|
1820 |
+
});
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
if (((bubbleEnabled && bubbleLiveUpdate) || commentListUpdateType) && (isUserLoggedIn || (!isUserLoggedIn && enableGuestsLiveUpdate))) {
|
1824 |
+
setTimeout(bubbleAjax, commentListUpdateTimer);
|
1825 |
+
}
|
1826 |
//========================= /BUBBLE =====================//
|
1827 |
//========================= INLINE COMMENTS =====================//
|
1828 |
+
if ($('.wpd-inline-form-wrapper').length) {
|
1829 |
+
var data = new FormData();
|
1830 |
+
data.append('action', 'wpdGetInlineCommentForm');
|
1831 |
+
getAjaxObj(isNativeAjaxEnabled, false, data)
|
1832 |
+
.done(function(r) {
|
1833 |
+
if (typeof r === 'object') {
|
1834 |
+
if (r.success) {
|
1835 |
+
$('.wpd-inline-form-wrapper').append(r.data);
|
1836 |
+
$.each($('[name=_wpd_inline_nonce]'), function() {
|
1837 |
+
var id = $(this).attr('id');
|
1838 |
+
var parentId = $(this).parents('.wpd-inline-shortcode').attr('id');
|
1839 |
+
$(this).attr('id', id + '-' + parentId.substring(parentId.lastIndexOf('-') + 1));
|
1840 |
+
});
|
1841 |
+
$('.wpd-inline-opened').addClass('wpd-active');
|
1842 |
+
$('.wpd-inline-opened').find('.wpd-inline-form-wrapper').show();
|
1843 |
+
$('.wpd-inline-opened').find('.wpd-inline-icon').addClass('wpd-open');
|
1844 |
+
$('.wpd-inline-opened').find('.wpd-inline-icon').removeClass('wpd-ignored');
|
1845 |
+
fixInlineFormsPosition();
|
1846 |
+
} else {
|
1847 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
1848 |
+
}
|
1849 |
+
} else {
|
1850 |
+
console.log(r);
|
1851 |
+
}
|
1852 |
+
})
|
1853 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1854 |
+
console.log(errorThrown);
|
1855 |
+
});
|
1856 |
+
}
|
1857 |
+
$(document).delegate('body', 'click', function(e) {
|
1858 |
+
if ($(e.target).hasClass('wpd-inline-form-close') || $(e.target).parents('.wpd-inline-form-close').length) {
|
1859 |
+
e.preventDefault();
|
1860 |
+
$(e.target).parents('.wpd-inline-form-wrapper').hide();
|
1861 |
+
$(e.target).parents('.wpd-inline-shortcode').removeClass('wpd-active');
|
1862 |
+
$(e.target).parents('.wpd-inline-form-wrapper').siblings('.wpd-inline-icon').removeClass('wpd-open');
|
1863 |
+
} else if (!$(e.target).hasClass('wpd-inline-form-wrapper') && !$(e.target).parents('.wpd-inline-form-wrapper').length) {
|
1864 |
+
hideInlineForms();
|
1865 |
+
var currentEl = '';
|
1866 |
+
if ($(e.target).hasClass('wpd-inline-icon')) {
|
1867 |
+
currentEl = $(e.target);
|
1868 |
+
} else if ($(e.target).parents('.wpd-inline-icon').length) {
|
1869 |
+
currentEl = $(e.target).parents('.wpd-inline-icon');
|
1870 |
+
}
|
1871 |
+
if (currentEl.length) {
|
1872 |
+
currentEl.parents('.wpd-inline-shortcode').addClass('wpd-active');
|
1873 |
+
currentEl.siblings('.wpd-inline-form-wrapper').show();
|
1874 |
+
currentEl.addClass('wpd-open');
|
1875 |
+
currentEl.removeClass('wpd-ignored');
|
1876 |
+
fixInlineFormsPosition(currentEl.siblings('.wpd-inline-form-wrapper'));
|
1877 |
+
}
|
1878 |
+
}
|
1879 |
+
if ((!$(e.target).hasClass('wpd-last-inline-comments-wrapper') && !$(e.target).parents('.wpd-last-inline-comments-wrapper').length) || ($(e.target).parents('.wpd-last-inline-comments-wrapper').length && $(e.target).hasClass('wpd-load-inline-comment'))) {
|
1880 |
+
$('.wpd-last-inline-comments-wrapper').remove();
|
1881 |
+
}
|
1882 |
+
});
|
1883 |
+
$(document).delegate('.wpd-inline-submit.wpd_not_clicked', 'click', function(e) {
|
1884 |
+
e.preventDefault();
|
1885 |
+
var clickedButton = $(this);
|
1886 |
+
var form = $(this).parents('.wpd_inline_comm_form');
|
1887 |
+
if (form[0].checkValidity()) {
|
1888 |
+
$(this).removeClass('wpd_not_clicked');
|
1889 |
+
var data = new FormData();
|
1890 |
+
data.append('action', 'wpdAddInlineComment');
|
1891 |
+
data.append('inline_form_id', getInlineFormId(form));
|
1892 |
+
$.each($('input, textarea', form), function(i, val) {
|
1893 |
+
if (this.type === 'checkbox') {
|
1894 |
+
if ($(this).is(':checked')) {
|
1895 |
+
data.append($(val).attr('name'), $(val).val());
|
1896 |
+
}
|
1897 |
+
} else {
|
1898 |
+
data.append($(val).attr('name'), $(val).val());
|
1899 |
+
}
|
1900 |
+
});
|
1901 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1902 |
+
.done(function(r) {
|
1903 |
+
clickedButton.addClass('wpd_not_clicked');
|
1904 |
+
if (typeof r === 'object') {
|
1905 |
+
if (r.success) {
|
1906 |
+
form[0].reset();
|
1907 |
+
hideInlineForms();
|
1908 |
+
var newCount = parseInt(r.data.newCount);
|
1909 |
+
var countEl = clickedButton.parents('.wpd-inline-icon-wrapper').find('.wpd-inline-icon-count');
|
1910 |
+
countEl.text(newCount);
|
1911 |
+
if (newCount) {
|
1912 |
+
countEl.addClass('wpd-has-comments');
|
1913 |
+
} else {
|
1914 |
+
countEl.removeClass('wpd-has-comments');
|
1915 |
+
}
|
1916 |
+
$('.wpd-thread-info').html(r.data.allCommentsCountNewHtml);
|
1917 |
+
r.data.allCommentsCountNew = parseInt(r.data.allCommentsCountNew);
|
1918 |
+
$('#wpd-bubble-all-comments-count').text(r.data.allCommentsCountNew);
|
1919 |
+
if (r.data.allCommentsCountNew) {
|
1920 |
+
$('#wpd-bubble-all-comments-count').show();
|
1921 |
+
} else {
|
1922 |
+
$('#wpd-bubble-all-comments-count').hide();
|
1923 |
+
}
|
1924 |
+
if (r.data.message) {
|
1925 |
+
addCommentsAfterSticky(r.data.message);
|
1926 |
+
}
|
1927 |
+
wpdiscuzAjaxObj.setCommentMessage(r.data.notification, 'success');
|
1928 |
+
} else if (r.data) {
|
1929 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
1930 |
+
}
|
1931 |
+
} else {
|
1932 |
+
wpdiscuzAjaxObj.setCommentMessage(r, 'error');
|
1933 |
+
}
|
1934 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1935 |
+
})
|
1936 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1937 |
+
console.log(errorThrown);
|
1938 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1939 |
+
});
|
1940 |
+
}
|
1941 |
+
});
|
1942 |
+
$(document).delegate('.wpd-form', 'keydown', function(e) {
|
1943 |
+
if (e.ctrlKey && e.keyCode == 13) {
|
1944 |
+
$(this).find('.wc_comm_submit').trigger('click');
|
1945 |
+
}
|
1946 |
+
});
|
1947 |
+
$(document).delegate('#wpdiscuz-edit-form', 'keydown', function(e) {
|
1948 |
+
if (e.ctrlKey && e.keyCode == 13) {
|
1949 |
+
$(this).find('.wc_save_edited_comment').trigger('click');
|
1950 |
+
}
|
1951 |
+
});
|
1952 |
+
$(document).delegate('.wpd-inline-comment-content', 'keydown', function(e) {
|
1953 |
+
if (e.ctrlKey && e.keyCode == 13) {
|
1954 |
+
$(this).parents('.wpd_inline_comm_form').find('.wpd-inline-submit.wpd_not_clicked').trigger('click');
|
1955 |
+
}
|
1956 |
+
});
|
1957 |
+
$(document).delegate('.wpd-inline-icon-count.wpd-has-comments', 'click', function() {
|
1958 |
+
var clickedButton = $(this);
|
1959 |
+
var data = new FormData();
|
1960 |
+
data.append('action', 'wpdGetLastInlineComments');
|
1961 |
+
data.append('inline_form_id', getInlineFormId(clickedButton));
|
1962 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
1963 |
+
.done(function(r) {
|
1964 |
+
if (typeof r === 'object') {
|
1965 |
+
if (r.success) {
|
1966 |
+
$(r.data).insertAfter(clickedButton);
|
1967 |
+
} else {
|
1968 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
1969 |
+
}
|
1970 |
+
} else {
|
1971 |
+
console.log(r);
|
1972 |
+
}
|
1973 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1974 |
+
})
|
1975 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
1976 |
+
console.log(errorThrown);
|
1977 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
1978 |
+
});
|
1979 |
+
});
|
1980 |
+
$(document).delegate('.wpd-view-all-inline-comments', 'click', function(e) {
|
1981 |
+
e.preventDefault();
|
1982 |
+
$(this).parents('.wpd-last-inline-comments-wrapper').remove();
|
1983 |
+
if (!$('.wpdf-inline').hasClass('wpdf-active')) {
|
1984 |
+
$('.wpdf-inline').trigger('click');
|
1985 |
+
}
|
1986 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1987 |
+
$('html, body').animate({
|
1988 |
+
scrollTop: $('.wpdf-inline').offset().top - 32
|
1989 |
+
}, 1000, restoreHtmlAndBodyScrollBehaviors);
|
1990 |
+
});
|
1991 |
+
$(document).delegate('.wpd-feedback-content-link', 'click', function(e) {
|
1992 |
+
e.preventDefault();
|
1993 |
+
var feedbackId = $(this).data('feedback-content-id');
|
1994 |
+
unsetHtmlAndBodyScrollBehaviors();
|
1995 |
+
$('html, body').animate({
|
1996 |
+
scrollTop: $('#wpd-inline-' + feedbackId).offset().top - 38
|
1997 |
+
}, 1000, function() {
|
1998 |
+
restoreHtmlAndBodyScrollBehaviors();
|
1999 |
+
$('#wpd-inline-' + feedbackId).addClass('wpd-active');
|
2000 |
+
});
|
2001 |
+
});
|
2002 |
+
if (inlineFeedbackAttractionType === 'scroll_open' || inlineFeedbackAttractionType === 'blink') {
|
2003 |
+
inlineAttraction();
|
2004 |
+
$(window).scroll(inlineAttraction);
|
2005 |
+
}
|
2006 |
+
|
2007 |
+
function getInlineFormId(el) {
|
2008 |
+
if ($(el).hasClass('wpd-inline-shortcode')) {
|
2009 |
+
var elId = $(el).attr('id');
|
2010 |
+
} else {
|
2011 |
+
var elId = $(el).parents('.wpd-inline-shortcode').attr('id');
|
2012 |
+
}
|
2013 |
+
return elId.substring(elId.lastIndexOf('-') + 1);
|
2014 |
+
}
|
2015 |
+
|
2016 |
+
function hideInlineForms() {
|
2017 |
+
$('.wpd-inline-form-wrapper').hide();
|
2018 |
+
$('.wpd-inline-shortcode').removeClass('wpd-active');
|
2019 |
+
$('.wpd-inline-icon').removeClass('wpd-open');
|
2020 |
+
}
|
2021 |
+
|
2022 |
+
function inlineAttraction() {
|
2023 |
+
$.each($('.wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon'), function() {
|
2024 |
+
var el = $(this);
|
2025 |
+
var diff = el.offset().top - window.pageYOffset;
|
2026 |
+
if (diff > 0 && diff < 300) {
|
2027 |
+
if (inlineFeedbackAttractionType === 'blink') {
|
2028 |
+
el.addClass('wpd-blink');
|
2029 |
+
setTimeout(function() {
|
2030 |
+
el.removeClass('wpd-blink');
|
2031 |
+
}, 3000);
|
2032 |
+
} else {
|
2033 |
+
el.parents('.wpd-inline-shortcode').addClass('wpd-active');
|
2034 |
+
el.siblings('.wpd-inline-form-wrapper').show();
|
2035 |
+
el.addClass('wpd-open');
|
2036 |
+
fixInlineFormsPosition(el.siblings('.wpd-inline-form-wrapper'));
|
2037 |
+
}
|
2038 |
+
}
|
2039 |
+
});
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
function fixInlineFormsPosition(form) {
|
2043 |
+
if (form) {
|
2044 |
+
if (form.offset().left <= 10) {
|
2045 |
+
form.css('left', Math.ceil(parseInt(form.css('left')) - form.offset().left + 10));
|
2046 |
+
var beforeLeft = Math.ceil(form.siblings('.wpd-inline-icon.wpd-open').offset().left - form.offset().left + 2);
|
2047 |
+
if (beforeLeft < 3) {
|
2048 |
+
beforeLeft = 3;
|
2049 |
+
}
|
2050 |
+
document.styleSheets[0].addRule('#' + form.parents('.wpd-inline-shortcode').attr('id') + ' .wpd-inline-form-wrapper::before', 'left: ' + beforeLeft + 'px;');
|
2051 |
+
} else if (form.offset().left + form.width() > document.body.clientWidth - 10) {
|
2052 |
+
form.css('left', Math.ceil(parseInt(form.css('left')) + (document.body.clientWidth - (form.offset().left + form.width())) - 10));
|
2053 |
+
var beforeLeft = Math.ceil(form.siblings('.wpd-inline-icon.wpd-open').offset().left - form.offset().left + 2);
|
2054 |
+
if (beforeLeft > form.width() - 3) {
|
2055 |
+
beforeLeft = form.width() - 3;
|
2056 |
+
}
|
2057 |
+
document.styleSheets[0].addRule('#' + form.parents('.wpd-inline-shortcode').attr('id') + ' .wpd-inline-form-wrapper::before', 'left: ' + beforeLeft + 'px;');
|
2058 |
+
}
|
2059 |
+
} else {
|
2060 |
+
$.each($('.wpd-inline-form-wrapper:visible'), function() {
|
2061 |
+
if ($(this).offset().left <= 10) {
|
2062 |
+
$(this).css('left', Math.ceil(parseInt($(this).css('left')) - $(this).offset().left + 10));
|
2063 |
+
var beforeLeft = Math.ceil($(this).siblings('.wpd-inline-icon.wpd-open').offset().left - $(this).offset().left + 2);
|
2064 |
+
if (beforeLeft < 3) {
|
2065 |
+
beforeLeft = 3;
|
2066 |
+
}
|
2067 |
+
document.styleSheets[0].addRule('#' + $(this).parents('.wpd-inline-shortcode').attr('id') + ' .wpd-inline-form-wrapper::before', 'left: ' + beforeLeft + 'px;');
|
2068 |
+
} else if ($(this).offset().left + $(this).width() > document.body.clientWidth - 10) {
|
2069 |
+
$(this).css('left', Math.ceil(parseInt($(this).css('left')) + (document.body.clientWidth - ($(this).offset().left + $(this).width())) - 10));
|
2070 |
+
var beforeLeft = Math.ceil($(this).siblings('.wpd-inline-icon.wpd-open').offset().left - $(this).offset().left + 2);
|
2071 |
+
if (beforeLeft > $(this).width() - 3) {
|
2072 |
+
beforeLeft = $(this).width() - 3;
|
2073 |
+
}
|
2074 |
+
document.styleSheets[0].addRule('#' + $(this).parents('.wpd-inline-shortcode').attr('id') + ' .wpd-inline-form-wrapper::before', 'left: ' + beforeLeft + 'px;');
|
2075 |
+
}
|
2076 |
+
});
|
2077 |
+
}
|
2078 |
+
}
|
2079 |
+
|
2080 |
//========================= /INLINE COMMENTS =====================//
|
2081 |
//========================= POST RATING =====================//
|
2082 |
+
$(document).delegate('#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg', 'click', function() {
|
2083 |
+
var data = new FormData();
|
2084 |
+
var rating = $(this).index();
|
2085 |
+
if (rating >= 0 && rating < 5) {
|
2086 |
+
data.append('action', 'wpdUserRate');
|
2087 |
+
data.append('rating', rating + 1);
|
2088 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
2089 |
+
.done(function(r) {
|
2090 |
+
if (typeof r === 'object') {
|
2091 |
+
if (r.success) {
|
2092 |
+
location.reload(true);
|
2093 |
+
} else {
|
2094 |
+
wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[r.data], 'error');
|
2095 |
+
}
|
2096 |
+
} else {
|
2097 |
+
console.log(r);
|
2098 |
+
}
|
2099 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
2100 |
+
})
|
2101 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
2102 |
+
console.log(errorThrown);
|
2103 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
2104 |
+
});
|
2105 |
+
}
|
2106 |
+
});
|
2107 |
//========================= /POST RATING =====================//
|
2108 |
|
2109 |
+
$('#wpdiscuz-subscribe-form').submit(function(e) {
|
2110 |
+
e.preventDefault();
|
2111 |
+
var wcForm = $(this);
|
2112 |
+
if (wcForm[0].checkValidity() && wpdReCaptchaValidateOnSubscribeForm(wcForm)) {
|
2113 |
+
var data = new FormData();
|
2114 |
+
data.append('action', 'wpdAddSubscription');
|
2115 |
+
var elements = $("*", wcForm);
|
2116 |
+
elements.each(function() {
|
2117 |
+
if (this.name != '' && this.type != 'checkbox' && this.type != 'radio') {
|
2118 |
+
data.append(this.name + '', $(this).val());
|
2119 |
+
}
|
2120 |
+
if (this.type == 'checkbox' || this.type == 'radio') {
|
2121 |
+
if ($(this).is(':checked')) {
|
2122 |
+
data.append(this.name + '', $(this).val());
|
2123 |
+
}
|
2124 |
+
}
|
2125 |
+
});
|
2126 |
+
getAjaxObj(isNativeAjaxEnabled, true, data)
|
2127 |
+
.done(function(r) {
|
2128 |
+
if (typeof r === 'object') {
|
2129 |
+
if (r.success) {
|
2130 |
+
wpdiscuzAjaxObj.setCommentMessage(r.data, 'success');
|
2131 |
+
setTimeout(function() {
|
2132 |
+
location.reload(true);
|
2133 |
+
}, 3000);
|
2134 |
+
} else {
|
2135 |
+
wpdiscuzAjaxObj.setCommentMessage(r.data, 'error');
|
2136 |
+
}
|
2137 |
+
} else {
|
2138 |
+
wpdiscuzAjaxObj.setCommentMessage(r, 'error');
|
2139 |
+
}
|
2140 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
2141 |
+
addingComment = false;
|
2142 |
+
})
|
2143 |
+
.fail(function(jqXHR, textStatus, errorThrown) {
|
2144 |
+
console.log(errorThrown);
|
2145 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
2146 |
+
});
|
2147 |
+
}
|
2148 |
+
});
|
2149 |
+
$('.wpd-unsubscribe').click(function(e) {
|
2150 |
+
e.preventDefault();
|
2151 |
+
var data = new FormData();
|
2152 |
+
data.append('action', 'wpdUnsubscribe');
|
2153 |
+
data.append('sid', $(this).data('sid'));
|
2154 |
+
data.append('skey', $(this).data('skey'));
|
2155 |
+
getAjaxObj(isNativeAjaxEnabled, true, data).done(function(r) {
|
2156 |
+
if (typeof r === 'object') {
|
2157 |
+
if (r.success) {
|
2158 |
+
wpdiscuzAjaxObj.setCommentMessage(r.data, 'success');
|
2159 |
+
setTimeout(function() {
|
2160 |
+
location.reload(true);
|
2161 |
+
}, 3000);
|
2162 |
+
} else {
|
2163 |
+
wpdiscuzAjaxObj.setCommentMessage(r.data, 'error');
|
2164 |
+
}
|
2165 |
+
} else {
|
2166 |
+
console.log(r);
|
2167 |
+
}
|
2168 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
2169 |
+
addingComment = false;
|
2170 |
+
}).fail(function(jqXHR, textStatus, errorThrown) {
|
2171 |
+
console.log(errorThrown);
|
2172 |
+
$('#wpdiscuz-loading-bar').fadeOut(250);
|
2173 |
+
});
|
2174 |
+
});
|
2175 |
+
|
2176 |
+
wpdiscuzAjaxObj.resetActiveFilters = function(currentItemSelector) {
|
2177 |
+
$('.wpd-filter.wpdf-active' + (currentItemSelector ? ':not(' + currentItemSelector + ')' : '')).removeClass('wpdf-active');
|
2178 |
+
};
|
2179 |
+
|
2180 |
+
function runCallbacks(r, commentID, voteType, wcForm) {
|
2181 |
+
if (r.data.callbackFunctions) {
|
2182 |
+
$.each(r.data.callbackFunctions, function(i) {
|
2183 |
+
if (typeof wpdiscuzAjaxObj[r.data.callbackFunctions[i]] === "function") {
|
2184 |
+
wpdiscuzAjaxObj[r.data.callbackFunctions[i]](r, commentID, voteType, wcForm);
|
2185 |
+
} else {
|
2186 |
+
console.log(r.data.callbackFunctions[i] + " is not a function");
|
2187 |
+
}
|
2188 |
+
});
|
2189 |
+
}
|
2190 |
+
}
|
2191 |
+
|
2192 |
+
/**
|
2193 |
+
* @param {int/bool} isNative - use native or custom ajax
|
2194 |
+
* @param {bool} isShowTopLoading - show loading bar
|
2195 |
+
* @param {object} data - data for ajax request
|
2196 |
+
* @returns {jqXHR}
|
2197 |
+
*/
|
2198 |
+
function getAjaxObj(isNative, isShowTopLoading, data) {
|
2199 |
+
if (isShowTopLoading) {
|
2200 |
+
$('#wpdiscuz-loading-bar').show();
|
2201 |
+
}
|
2202 |
+
data.append('postId', wpdiscuzPostId);
|
2203 |
+
var action = data.get('action');
|
2204 |
+
if (wpdiscuzAjaxObj.dataFilterCallbacks && wpdiscuzAjaxObj.dataFilterCallbacks[action]) {
|
2205 |
+
$.each(wpdiscuzAjaxObj.dataFilterCallbacks[action], function(i) {
|
2206 |
+
if (typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[action][i]] === "function") {
|
2207 |
+
data = wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[action][i]](data, isNative, isShowTopLoading);
|
2208 |
+
}
|
2209 |
+
});
|
2210 |
+
}
|
2211 |
+
var url = isNative ? wpdiscuzAjaxObj.url : wpdiscuzAjaxObj.customAjaxUrl;
|
2212 |
+
return $.ajax({
|
2213 |
+
type: 'POST',
|
2214 |
+
url: url,
|
2215 |
+
data: data,
|
2216 |
+
contentType: false,
|
2217 |
+
processData: false
|
2218 |
+
});
|
2219 |
+
}
|
2220 |
+
|
2221 |
+
wpdiscuzAjaxObj.getAjaxObj = getAjaxObj;
|
2222 |
|
2223 |
});
|
2224 |
//========================= reCAPTCHA =====================//
|
2225 |
+
var onloadCallback = function() {
|
2226 |
+
if (document.getElementById('wpdiscuz-recaptcha-0_0') && wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion === '2.0' && ((wpdiscuzAjaxObj.wc_captcha_show_for_guest == 1 && !wpdiscuzAjaxObj.is_user_logged_in) || (wpdiscuzAjaxObj.wc_captcha_show_for_members == 1 && wpdiscuzAjaxObj.is_user_logged_in))) {
|
2227 |
+
try {
|
2228 |
+
grecaptcha.render('wpdiscuz-recaptcha-0_0', {
|
2229 |
+
'sitekey': wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,
|
2230 |
+
'theme': wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,
|
2231 |
+
'callback': function(response) {
|
2232 |
+
jQuery('#wpdiscuz-recaptcha-field-0_0').val('key');
|
2233 |
+
},
|
2234 |
+
'expired-callback': function() {
|
2235 |
+
jQuery('#wpdiscuz-recaptcha-field-0_0').val("");
|
2236 |
+
}
|
2237 |
+
});
|
2238 |
+
} catch (e) {
|
2239 |
+
console.log(e);
|
2240 |
+
wpdiscuzAjaxObj.setCommentMessage('reCaptcha Error: ' + e.message, 'error');
|
2241 |
+
}
|
2242 |
+
}
|
2243 |
};
|
2244 |
//========================= /reCAPTCHA =====================//
|
assets/js/wpdiscuz.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if("[object Array]"===Object.prototype.toString.call(e))for(var d in e)"[object Array]"===Object.prototype.toString.call(t)?"success"===t[d]?o="wpdiscuz-message-success":"warning"===t[d]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[d]).prependTo("#wpdiscuz-comment-message").delay("[object Array]"===Object.prototype.toString.call(a)?a[d]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,d=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,n=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),i=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,g=wpdiscuzAjaxObj.cookiehash,_=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),v=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,z=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),C=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),k=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),x=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=[],T=[],D=[],E=!1,M=1;(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),e(document).delegate("#wpdcom .ql-editor, #wpdcom .wc_comment","focus",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(v)}),e(document).delegate("#wpdcom textarea","focus",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||S({comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).delegate("#wpd-editor-source-code-wrapper-bg","click",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).delegate("#wpd-insert-source-code","click",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).delegate(".wpd-reply-button","click",function(){var n=V(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+n).focus()},v):setTimeout(function(){e("#wc-textarea-"+n).trigger("focus")},v),e("#wpd-secondary-form-wrapper-"+n).slideToggle(v)):function(a){var o=V(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var d=e("#wpd-secondary-form-wrapper-"+o);if(!t){var n={comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)};S(n)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},v):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},v);d.slideToggle(v,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===d){var n=B(t);setTimeout(function(){if(!T[n])try{T[n]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(n)}),e(document).delegate("#wpdcom .wpd-comment-link [data-comment-url]","click",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.select(),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit","click",function(e){e.preventDefault()}),e(document).delegate(".wpd-toggle.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=V(e(this),0),o=e(this),d=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&_?function(t,a){var o=B(t),d=new FormData;d.append("action","wpdShowReplies"),d.append("commentId",o),ce(z,!0,d).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies").remove(),ie(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,d){console.log(d),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(d.removeClass("fa-chevron-up"),d.addClass("fa-chevron-down"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(d.removeClass("fa-chevron-down"),d.addClass("fa-chevron-up"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).delegate(".wpd-new-loaded-comment","mouseenter",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).delegate(".wpd-sbs-toggle","click",function(){e(".wpdiscuz-subscribe-bar").slideToggle(v)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&("2.0"===d?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).delegate("#wpdiscuz-subscribe-form","submit",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===d&&e(document).delegate("#wpdiscuz_subscription_button","click",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.submit()},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===d){var F=e(window).width(),L=e("#wpdcom").width();L>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),L>=940&&L<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),L>=810&&L<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),L>=730&&L<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),L>=610&&L<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),F>650&&(L>=510&&L<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),L>=470&&L<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),L<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function R(t,a,o){ce(z||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(v),e(".wpd-thread-info").html(a.data.wc_all_comments_count_new_html),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(a.data.wc_all_comments_count_new),a.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide();var d=v;a.data.is_main?X(a.data.message):(d=v+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),ce(z,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),ce(z,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,d=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+g,a),Cookies.set("comment_author_"+g,o),d.length&&Cookies.set("comment_author_url_"+g,d)):(u=parseInt(u),Cookies.set("comment_author_email_"+g,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+g,o,{expires:u,path:"/"}),d.length&&Cookies.set("comment_author_url_"+g,d,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").attr("checked","checked")}(a.data):b||e(".wpd-cookies-checkbox").removeAttr("checked"),wpdiscuzLoadRichEditor&&wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]),t.get(0).reset(),S(a.data),e(".wmu-preview-wrap",t).remove(),I.length&&(I.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),I=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-32},1e3)},d),ie(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"),ie(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,d){console.log(d),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function S(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function q(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).delegate(".wc_comm_submit.wpd_not_clicked","click",function(){var t=e(this),n=1,s=e(this).parents("form");if(s.hasClass("wpd_main_comm_form")||(n=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===G(t,!1)&&(o=G(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),J(s,"#wpd-editor-"+e(".wpdiscuz_unique_id",s).val()),s.submit(function(e){e.preventDefault()}),""!==e(".wc_comment",s).val().trim()){if(s[0].checkValidity()&&(c=s,p=!0,"2.0"===d&&e("input[name=wc_captcha]",c).length&&!e("input[name=wc_captcha]",c).val().length?(p=!1,e(".wpdiscuz-recaptcha",c).css("border","1px solid red")):"2.0"===d&&e("input[name=wc_captcha]",c).length&&e(".wpdiscuz-recaptcha",c).css("border","none"),p)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+g,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){I.push(e(this))}))})}(s),e(t).removeClass("wpd_not_clicked");var i=new FormData;if(i.append("action","wpdAddComment"),e(":input",s).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&i.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),i.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&i.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",s).length&&!e(".wpd-cookies-checkbox",s).prop("checked")&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===d&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){i.append("g-recaptcha-response",e),R(s,i,t)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else R(s,i,t)}var c,p;!function(e){if((a||o)&&"2.0"===d){var t=B(e);grecaptcha.reset(T[t])}}(e(".wpdiscuz_unique_id",s).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields,"error")}),e(document).delegate(".wpd_editable_comment","click",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&q(V(e(".wpdiscuz-edit-form-wrap"),0),w);var t=V(e(this),0),a=B(t),o=new FormData;o.append("action","wpdEditComment"),o.append("commentId",a),w=e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-text").get(0),ce(z,!0,o).done(function(a){if("object"==typeof a)if(a.success){if(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(a.data.html),wpdiscuzLoadRichEditor){let o=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+t);o.clipboard.dangerouslyPasteHTML(0,a.data.content),o.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+t).val(a.data.content);e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error");else console.log(a);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wc_save_edited_comment","click",function(){var t=V(e(this)),a=B(t),o=e("#wpd-comm-"+t+" #wpdiscuz-edit-form");if(J(o,"#wpd-editor-edit_"+t),o.submit(function(e){e.preventDefault()}),o[0].checkValidity()){var d=new FormData;d.append("action","wpdSaveEditedComment"),d.append("commentId",a),e(":input",o).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&d.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&d.append(this.name+"",e(this).val())}),ce(z,!0,d).done(function(o){"object"==typeof o?(o.success?(q(t,o.data.message),o.data.lastEdited&&(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(o.data.lastEdited).insertAfter("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),o.data.twitterShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",o.data.twitterShareLink),o.data.whatsappShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",o.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[o.data],"error"),ie(o,a)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wc_cancel_edit","click",function(){var t=V(e(this));q(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){W(!0)},500):e(document).delegate(".wpd-load-comments","click",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),W(!0)})),e(document).delegate(".wpd-load-more-submit","click",function(){var t=e(this);t.hasClass("wpd-loaded")&&W(!1,t,"wpd-loaded","wpd-loading")});var U=!1;function H(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===U&&1==t&&(U=!0,W(!1,e(".wpd-load-more-submit"))))}function W(t,a,o,d){a&&(a.toggleClass(o),a.toggleClass(d));var s=new FormData;s.append("action","wpdLoadMoreComments");var i=e(".wpdiscuz-sort-button-active").attr("data-sorting");i&&s.append("sorting",i),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),ce(z,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==n),U=!1,r=s.data.loadLastCommentId,ie(s),t&&P(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))}).fail(function(t,n,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==n&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),ie(t)}function P(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-32},1e3),t&&N(o)},500);else{var d=new FormData;d.append("action","wpdGetSingleComment"),d.append("commentId",o),ce(z,!0,d).done(function(a){if("object"==typeof a&&a.success){var d="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e(d).offset().top-32},1e3),t&&N(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function N(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function Q(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)$((t=a[o]).comment_parent,t.comment_html)}function V(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function B(e){return e.substring(0,e.indexOf("_"))}function G(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function $(t,a){if(0==t)X(a);else{var o=V(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function Y(){var t,a,o="";return e(".wpd-comment-right").each(function(){t=V(e(this),0),a=B(t),o+=a+","}),o}function J(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).removeAttr("required"),0===e("input:checked",this).length?e("input",e(this)).attr("required","required"):e(".wpd-field-invalid",this).remove()})}function X(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function Z(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==n||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),H(),e(window).scroll(function(){H()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).delegate(".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked","click",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=B(V(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var d=new FormData;d.append("action","wpdVoteOnComment"),d.append("commentId",o),d.append("voteType",a),ce(z,!0,d).done(function(d){if(e(t).addClass("wpd_not_clicked"),"object"==typeof d){if(d.success){if("total"===d.data.buttonsStyle){var n=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=d.data.votes;n.text(s),n.removeClass("wpd-up wpd-down"),s>0&&n.addClass("wpd-up"),s<0&&n.addClass("wpd-down")}else{var i=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));i.text(d.data.likeCount),c.text(d.data.dislikeCount),parseInt(d.data.likeCount)>0?i.addClass("wpd-up"):i.removeClass("wpd-up"),parseInt(d.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),d.data.curUserReaction>0?p.addClass("wpd-up"):d.data.curUserReaction<0&&r.addClass("wpd-down")}else d.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data],"error");ie(d,o,a)}else console.log(d);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate("body","click",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).delegate(".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)","click",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var d=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",d||""),ce(z,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){P(!1)},1!=m&&P(!1),e(document).delegate(".wpdiscuz-readmore","click",function(){var t=V(e(this)),a=B(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),ce(z,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),ie(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-required-group","change",function(){0!==e("input:checked",this).length?e("input",e(this)).removeAttr("required"):e("input",e(this)).attr("required","required")}),e(document).delegate(".wpdiscuz-spoiler","click",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).delegate(".wpd-tools i","click",function(){var t=e(this).siblings(".wpd-tools-actions");t.css({display:t.is(":visible")?"none":"flex"})}),e(document).delegate(".wpd-comment-right","mouseleave",function(){e(this).find(".wpd-tools-actions").hide()}),e(document).delegate(".wpd_stick_btn","click",function(){var t=B(V(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),ce(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd_close_btn","click",function(){var t=B(V(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),ce(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-filter.wpd_not_clicked[data-filter-type]","click",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&o.append("sorting",d),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),ce(z,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),ie(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpdf-reacted.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),ce(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpdf-hottest.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),ce(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),ie(a),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpd-filter-view-all","click",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-follow-link.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=B(V(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),ce(z,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.code],"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),Z(),e(document).delegate(".wc_email","keyup",function(){Z(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),k&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*x)},1e3*k),"content_left"===O)if(e(".entry-content").length){var ee=(te=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){ee=(te=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var te;ee=(te=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?te:25;e("#wpd-bubble-wrapper").css({left:ee+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e("#wpd-bubble-add-message-close").click(function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e("#wpd-bubble").click(function(){e("html, body").animate({scrollTop:e("#wpdcom").offset().top-60},1e3,function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").focus()})}),e("#wpd-bubble-comment-close").click(function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e("#wpd-bubble-comment-reply-link a").click(function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),P(!0);var a=t.match(/#comment\-(\d+)/);D=D.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(D.length),0==D.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e("#wpd-bubble-count").click(function(){if(D.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",D.join()),ce(z,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),Q(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),D=[],e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-60},1e3),ie(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&C||i)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,data:{postId:s,lastId:l,visibleCommentIds:Y()}}).done(function(a){if(!E)if("object"==typeof a){if(a.ids.length){i&&((n=new FormData).append("action","wpdUpdateAutomatically"),n.append("loadLastCommentId",r),n.append("visibleCommentIds",Y()),ce(z,!1,n).done(function(t){E||"object"==typeof t&&t.success&&(Q(t),e(".wpd-thread-info").html(t.data.wc_all_comments_count_new_html),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(t.data.wc_all_comments_count_new),t.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),D=D.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var d=parseInt(e(".wpd-new-comments-count").text());d+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(d),e("#wpd-bubble-count").addClass("wpd-new-comments"),a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").text(a.all_comments_count),a.all_comments_count?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),e(".wpd-thread-info").html(a.all_comments_count_html)}}else console.log(a);var n;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var ae=new FormData;ae.append("action","wpdGetInlineCommentForm"),ce(z,!1,ae).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),se()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function oe(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function de(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function ne(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),se(t.siblings(".wpd-inline-form-wrapper"))))})}function se(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function ie(t,a,o,d){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,d):console.log(t.data.callbackFunctions[e]+" is not a function")})}function ce(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var d=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[d]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[d],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]](o,t,a))});var n=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:n,data:o,contentType:!1,processData:!1})}e(document).delegate("body","click",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){de();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),se(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).delegate(".wpd-inline-submit.wpd_not_clicked","click",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var d=new FormData;d.append("action","wpdAddInlineComment"),d.append("inline_form_id",oe(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&d.append(e(a).attr("name"),e(a).val()):d.append(e(a).attr("name"),e(a).val())}),ce(z,!0,d).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),de();var d=parseInt(t.data.newCount),n=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");n.text(d),d?n.addClass("wpd-has-comments"):n.removeClass("wpd-has-comments"),e(".wpd-thread-info").html(t.data.allCommentsCountNewHtml),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").text(t.data.allCommentsCountNew),t.data.allCommentsCountNew?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),t.data.message&&X(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wpd-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).delegate("#wpdiscuz-edit-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).delegate(".wpd-inline-comment-content","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-inline-icon-count.wpd-has-comments","click",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",oe(t)),ce(z,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-view-all-inline-comments","click",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-32},1e3)}),e(document).delegate(".wpd-feedback-content-link","click",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-38},1e3,function(){e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(ne(),e(window).scroll(ne)),e(document).delegate("#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg","click",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),ce(z,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e("#wpdiscuz-subscribe-form").submit(function(t){t.preventDefault();var a,o,n=e(this);if(n[0].checkValidity()&&(a=n,o=!0,"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",n).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),ce(z,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(".wpd-unsubscribe").click(function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),ce(z,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=ce});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
|
1 |
+
var wpdiscuzLoadRichEditor=parseInt(wpdiscuzAjaxObj.loadRichEditor);if(wpdiscuzLoadRichEditor)var wpDiscuzEditor=new WpdEditor;function wpdMessagesOnInit(e,t){wpdiscuzAjaxObj.setCommentMessage(e,t),setTimeout(function(){location.href=location.href.substring(0,location.href.indexOf("wpdiscuzUrlAnchor")-1)},3e3)}wpdiscuzAjaxObj.setCommentMessage=function(e,t,a){var o="wpdiscuz-message-error";if("[object Array]"===Object.prototype.toString.call(e))for(var d in e)"[object Array]"===Object.prototype.toString.call(t)?"success"===t[d]?o="wpdiscuz-message-success":"warning"===t[d]&&(o="wpdiscuz-message-warning"):"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e[d]).prependTo("#wpdiscuz-comment-message").delay("[object Array]"===Object.prototype.toString.call(a)?a[d]:a||4e3).fadeOut(1e3,function(){jQuery(this).remove()});else"success"===t?o="wpdiscuz-message-success":"warning"===t&&(o="wpdiscuz-message-warning"),jQuery("<div/>").addClass(o).html(e).prependTo("#wpdiscuz-comment-message").delay(a||4e3).fadeOut(1e3,function(){jQuery(this).remove()})},jQuery(document).ready(function(e){e("body").addClass("wpdiscuz_"+wpdiscuzAjaxObj.version);var t=wpdiscuzAjaxObj.is_user_logged_in,a=1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!t,o=1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&t,d=wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion,n=parseInt(wpdiscuzAjaxObj.commentListLoadType),s=parseInt(wpdiscuzAjaxObj.wc_post_id),i=parseInt(wpdiscuzAjaxObj.commentListUpdateType),c=1e3*parseInt(wpdiscuzAjaxObj.commentListUpdateTimer),p=parseInt(wpdiscuzAjaxObj.liveUpdateGuests),r=wpdiscuzAjaxObj.loadLastCommentId,l=r,m=parseInt(wpdiscuzAjaxObj.firstLoadWithAjax);Cookies.get("wpdiscuz_comments_sorting")&&Cookies.remove("wpdiscuz_comments_sorting",{path:""}),Cookies.get("wordpress_last_visit")&&Cookies.remove("wordpress_last_visit",{path:""}),Cookies.get("wpdiscuz_last_visit")&&Cookies.remove("wpdiscuz_last_visit",{path:""});var w,u=wpdiscuzAjaxObj.storeCommenterData,f=parseInt(wpdiscuzAjaxObj.wmuEnabled),h=wpdiscuzAjaxObj.isCookiesEnabled,b=!0,g=wpdiscuzAjaxObj.cookiehash,_=parseInt(wpdiscuzAjaxObj.isLoadOnlyParentComments),v=parseInt(wpdiscuzAjaxObj.enableDropAnimation)?500:0,z=parseInt(wpdiscuzAjaxObj.isNativeAjaxEnabled),j=parseInt(wpdiscuzAjaxObj.enableBubble),C=parseInt(wpdiscuzAjaxObj.bubbleLiveUpdate),k=parseInt(wpdiscuzAjaxObj.bubbleHintTimeout),x=parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout)?parseInt(wpdiscuzAjaxObj.bubbleHintHideTimeout):5,y=parseInt(wpdiscuzAjaxObj.bubbleShowNewCommentMessage),O=wpdiscuzAjaxObj.bubbleLocation,A=wpdiscuzAjaxObj.inlineFeedbackAttractionType,I=[],T=[],D=[],E=!1,M=1,F=e("html").css("scroll-behavior"),L=e("body").css("scroll-behavior");(e(".wc_social_plugin_wrapper .wp-social-login-provider-list").length?e(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .the_champ_login_container").length?e(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .social_connect_form").length?e(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"):e(".wc_social_plugin_wrapper .oneall_social_login_providers").length&&e(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wpd-form-wrapper > .wpd-secondary-forms-social-content"),wpdiscuzLoadRichEditor&&e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0"),e(document).delegate("#wpdcom .ql-editor, #wpdcom .wc_comment","focus",function(){e(".wpd-form-foot",e(this).parents(".wpd_comm_form")).slideDown(v)}),e(document).delegate("#wpdcom textarea","focus",function(){e(this).next(".autogrow-textarea-mirror").length||e(this).autoGrow()}),t)||U({comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)});if(e(".wpd-vote-down.wpd-dislike-hidden").remove(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd"),e(document).delegate("#wpd-editor-source-code-wrapper-bg","click",function(){e(this).hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),wpdiscuzLoadRichEditor&&e(document).delegate("#wpd-insert-source-code","click",function(){var t=wpDiscuzEditor.createEditor("#"+e("#wpd-editor-uid").val());t.deleteText(0,t.getLength(),Quill.sources.USER);var a=e("#wpd-editor-source-code").val();a.length&&t.clipboard.dangerouslyPasteHTML(0,a,Quill.sources.USER),t.update(),e("#wpd-editor-source-code-wrapper-bg").hide(),e("#wpd-editor-source-code-wrapper").hide(),e("#wpd-editor-uid").val(""),e("#wpd-editor-source-code").val("")}),e(document).delegate(".wpd-reply-button","click",function(){var n=G(e(this),0);e(this).hasClass("wpdiscuz-clonned")?(wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+n).focus()},v):setTimeout(function(){e("#wc-textarea-"+n).trigger("focus")},v),e("#wpd-secondary-form-wrapper-"+n).slideToggle(v)):function(a){var o=G(a,0);e("#wpdiscuz_form_anchor-"+o).before(function(t){return e("#wpdiscuz_hidden_secondary_form").html().replace(/wpdiscuzuniqueid/g,t)}(o));var d=e("#wpd-secondary-form-wrapper-"+o);if(!t){var n={comment_author:Cookies.get("comment_author_"+g),comment_author_email:Cookies.get("comment_author_email_"+g),comment_author_url:Cookies.get("comment_author_url_"+g)};U(n)}wpdiscuzLoadRichEditor?setTimeout(function(){wpDiscuzEditor.createEditor("#wpd-editor-"+o).focus()},v):setTimeout(function(){e("#wc-textarea-"+o).trigger("focus")},v);d.slideToggle(v,function(){a.addClass("wpdiscuz-clonned")})}(e(this)),function(t){if((a||o)&&"2.0"===d){var n=$(t);setTimeout(function(){if(!T[n])try{T[n]=grecaptcha.render("wpdiscuz-recaptcha-"+t,{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(a){e("#wpdiscuz-recaptcha-field-"+t).val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-"+t).val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3)}}(n)}),e(document).delegate("#wpdcom .wpd-comment-link [data-comment-url]","click",function(){var t=e(this).data("comment-url"),a=e("<input/>");a.appendTo("body").css({position:"absolute",top:"-10000000px"}).val(t),a.select(),document.execCommand("copy"),a.remove(),wpdiscuzAjaxObj.setCommentMessage(t+"<br/>"+wpdiscuzAjaxObj.wc_copied_to_clipboard,"success",5e3)}),e(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wpd-load-more-submit","click",function(e){e.preventDefault()}),e(document).delegate(".wpd-toggle.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked");var a=G(e(this),0),o=e(this),d=e(".fas",o);!o.parents(".wpd-comment:not(.wpd-reply)").children(".wpd-reply").length&&_?function(t,a){var o=$(t),d=new FormData;d.append("action","wpdShowReplies"),d.append("commentId",o),me(z,!0,d).done(function(o){a.addClass("wpd_not_clicked"),"object"==typeof o&&o.success&&(e("#wpd-comm-"+t).replaceWith(o.data.comment_list),e("#wpd-comm-"+t+" .wpd-toggle .fas").removeClass("fa-chevron-down").addClass("fa-chevron-up"),e("#wpd-comm-"+t+" .wpd-toggle").attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text),e("#wpd-comm-"+t+" .wpd-toggle .wpd-view-replies").remove(),le(o)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,o,d){console.log(d),a.addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}(a,t):e("#wpd-comm-"+a+"> .wpd-reply").slideToggle(700,function(){e(this).is(":hidden")?(d.removeClass("fa-chevron-up"),d.addClass("fa-chevron-down"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_show_replies_text)):(d.removeClass("fa-chevron-down"),d.addClass("fa-chevron-up"),o.attr("wpd-tooltip",wpdiscuzAjaxObj.wc_hide_replies_text)),t.addClass("wpd_not_clicked")})}),e(document).delegate(".wpd-new-loaded-comment","mouseenter",function(){e(this).removeClass("wpd-new-loaded-comment")}),e(document).delegate(".wpd-sbs-toggle","click",function(){e(".wpdiscuz-subscribe-bar").slideToggle(v)}),parseInt(wpdiscuzAjaxObj.wpDiscuzIsShowOnSubscribeForm)&&!t&&wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&("2.0"===d?(setTimeout(function(){try{grecaptcha.render("wpdiscuz-recaptcha-subscribe-form",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val("key")},"expired-callback":function(){e("#wpdiscuz-recaptcha-field-subscribe-form").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}},1e3),e(document).delegate("#wpdiscuz-subscribe-form","submit",function(t){e("#wpdiscuz-recaptcha-field-subscribe-form").val()?e(".wpdiscuz-recaptcha",e(this)).css("border","none"):(e(".wpdiscuz-recaptcha",e(this)).css("border","1px solid red"),t.preventDefault())})):"3.0"===d&&e(document).delegate("#wpdiscuz_subscription_button","click",function(t){var a=e(this).parents("#wpdiscuz-subscribe-form");t.preventDefault();try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/wpdAddSubscription"}).then(function(e){console.log(5555),document.getElementById("wpdiscuz-recaptcha-field-subscribe-form").value=e,a.submit()},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error")}})),(a||o)&&"2.0"===d){var R=e(window).width(),S=e("#wpdcom").width();S>=1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"65%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"35%"})),S>=940&&S<1100&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"60%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"40%"})),S>=810&&S<940&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"60%"})),S>=730&&S<810&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.9)","-webkit-transform":"scale(0.9)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"45%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"55%"})),S>=610&&S<730&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.85)","-webkit-transform":"scale(0.85)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({transform:"scale(0.8)","-webkit-transform":"scale(0.8)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"43%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"55%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"})),R>650&&(S>=510&&S<610&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"35%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"63%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({width:"30%",position:"relative",right:"-60px"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({width:"70%"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),S>=470&&S<510&&(e("#wpdcom .wpd_main_comm_form .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"center 0","-webkit-transform-origin":"center 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({"transform-origin":"right 0","-webkit-transform-origin":"right 0",transform:"scale(0.77)","-webkit-transform":"scale(0.77)"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-left").css({width:"40%"}),e("#wpdcom .wpd_main_comm_form .wpd-form-col-right").css({width:"60%"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd_main_comm_form .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"})),S<470&&(e("#wpdcom .wpd-secondary-form-wrapper .wpd-field-captcha .wpdiscuz-recaptcha").css({margin:"0px auto","transform-origin":"center 0","-webkit-transform-origin":"center 0"}),e("#wpdcom .wpd-form-col-left").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-form-col-right").css({float:"none",width:"100%",display:"block"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-form-footer").css({"margin-left":"0px"}),e("#wpdcom .wpd-secondary-form-wrapper .wc_notification_checkboxes").css({"text-align":"center"}),e("#wpdcom .wpd-secondary-form-wrapper .wc-field-submit").css({"text-align":"center"})))}function q(t,a,o){me(z||f,!1,a).done(function(a){if(e(o).addClass("wpd_not_clicked"),"object"==typeof a)if(a.success){"collapsed"===wpdiscuzAjaxObj.commentFormView&&e(".wpd-form-foot",t).slideUp(v),e(".wpd-thread-info").html(a.data.wc_all_comments_count_new_html),a.data.wc_all_comments_count_new=parseInt(a.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(a.data.wc_all_comments_count_new),a.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide();var d=v;a.data.is_main?ae(a.data.message):(d=v+700,e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).slideToggle(700),1==a.data.is_in_same_container?e("#wpd-secondary-form-wrapper-"+a.data.uniqueid).after(a.data.message):e("#wpd-comm-"+a.data.uniqueid).after(a.data.message)),function(e){if(!e.data.held_moderate){var t=new FormData;t.append("action","wpdCheckNotificationType"),t.append("comment_id",e.data.new_comment_id),t.append("email",e.data.comment_author_email),t.append("isParent",e.data.is_main),me(z,!0,t)}}(a),function(e){if(e.data.redirect>0&&e.data.new_comment_id){var t=new FormData;t.append("action","wpdRedirect"),t.append("commentId",e.data.new_comment_id),me(z,!0,t).done(function(e){"object"==typeof e&&e.success&&setTimeout(function(){location.href=e.data},2e3)}).fail(function(e,t,a){console.log(a)})}}(a),h&&b?function(t){var a=t.comment_author_email,o=t.comment_author,d=t.comment_author_url;null==u?(Cookies.set("comment_author_email_"+g,a),Cookies.set("comment_author_"+g,o),d.length&&Cookies.set("comment_author_url_"+g,d)):(u=parseInt(u),Cookies.set("comment_author_email_"+g,a,{expires:u,path:"/"}),Cookies.set("comment_author_"+g,o,{expires:u,path:"/"}),d.length&&Cookies.set("comment_author_url_"+g,d,{expires:u,path:"/"}));e(".wpd-cookies-checkbox").length&&e(".wpd-cookies-checkbox").attr("checked","checked")}(a.data):b||e(".wpd-cookies-checkbox").removeAttr("checked"),wpdiscuzLoadRichEditor&&wpDiscuzEditor.createEditor("#wpd-editor-"+e(".wpdiscuz_unique_id",t).val()).setContents([{insert:"\n"}]),t.get(0).reset(),U(a.data),e(".wmu-preview-wrap",t).remove(),I.length&&(I.forEach(function(e){e.parents(".wpd-field-checkbox").remove()}),I=[]),parseInt(wpdiscuzAjaxObj.scrollToComment)&&setTimeout(function(){ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.new_comment_id).offset().top-32},1e3,te)},d),le(a,t)}else a.data&&(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"),le(a,t));else wpdiscuzAjaxObj.setCommentMessage(a,"error");e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,d){console.log(d),e(o).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}function U(t){e(".wpd_comm_form .wc_name").val(t.comment_author),t.comment_author_email&&t.comment_author_email.indexOf("@example.com")<0&&e(".wpd_comm_form .wc_email").val(t.comment_author_email),t.comment_author_url&&e(".wpd_comm_form .wc_website").val(t.comment_author_url)}function H(t,a){e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").show(),e("#wpd-comm-"+t+" .wpdiscuz-edit-form-wrap").replaceWith(a),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").show()}e(document).delegate(".wc_comm_submit.wpd_not_clicked","click",function(){var t=e(this),n=1,s=e(this).parents("form");if(s.hasClass("wpd_main_comm_form")||(n=function(t){var a=t.attr("class").split(" "),o="";return e.each(a,function(e,t){"wpd_comment_level"===X(t,!1)&&(o=X(t,!0))}),parseInt(o)+1}(e(this).parents(".wpd-comment"))),Z(s,"#wpd-editor-"+e(".wpdiscuz_unique_id",s).val()),s.submit(function(e){e.preventDefault()}),""!==e(".wc_comment",s).val().trim()){if(s[0].checkValidity()&&(c=s,p=!0,"2.0"===d&&e("input[name=wc_captcha]",c).length&&!e("input[name=wc_captcha]",c).val().length?(p=!1,e(".wpdiscuz-recaptcha",c).css("border","1px solid red")):"2.0"===d&&e("input[name=wc_captcha]",c).length&&e(".wpdiscuz-recaptcha",c).css("border","none"),p)){E=!0,function(t){e(".wpd-agreement-checkbox",t).each(function(){e(this).hasClass("wpd_agreement_hide")&&h&&e(this).prop("checked")&&(Cookies.set(e(this).attr("name")+"_"+g,1,{expires:30,path:"/"}),e("input[name="+e(this).attr("name")+"]").each(function(){I.push(e(this))}))})}(s),e(t).removeClass("wpd_not_clicked");var i=new FormData;if(i.append("action","wpdAddComment"),e(":input",s).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&i.append(this.name+"",e(this).val().trim()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&i.append(this.name+"",e(this).val())}),i.append("wpd_comment_depth",n),wpdiscuzAjaxObj.wpdiscuz_zs&&i.append("wpdiscuz_zs",wpdiscuzAjaxObj.wpdiscuz_zs),e(".wpd-cookies-checkbox",s).length&&!e(".wpd-cookies-checkbox",s).prop("checked")&&(b=!1),e("#wpdiscuz-loading-bar").show(),wpdiscuzAjaxObj.wpDiscuzReCaptchaSK&&"3.0"===d&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.ready(function(){grecaptcha.execute(wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,{action:"wpdiscuz/addComment"}).then(function(e){i.append("g-recaptcha-response",e),q(s,i,t)},function(e){wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error","error"),console.log(e)})})}catch(t){console.log(t),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+t.message,"error"),e("#wpdiscuz-loading-bar").fadeOut(250)}else q(s,i,t)}var c,p;!function(e){if((a||o)&&"2.0"===d){var t=$(e);grecaptcha.reset(T[t])}}(e(".wpdiscuz_unique_id",s).val()),e(".wpdiscuz_reset").val("")}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj.wc_msg_required_fields,"error")}),e(document).delegate(".wpd_editable_comment","click",function(){w&&e(".wpdiscuz-edit-form-wrap").length&&H(G(e(".wpdiscuz-edit-form-wrap"),0),w);var t=G(e(this),0),a=$(t),o=new FormData;o.append("action","wpdEditComment"),o.append("commentId",a),w=e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-text").get(0),me(z,!0,o).done(function(a){if("object"==typeof a)if(a.success){if(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text").replaceWith(a.data.html),wpdiscuzLoadRichEditor){let o=wpDiscuzEditor.createEditor("#wpd-editor-edit_"+t);o.clipboard.dangerouslyPasteHTML(0,a.data.content),o.update(),e(".wpd-toolbar-hidden").prev("[id^=wpd-editor-]").css("border-bottom","1px solid #dddddd")}else e("#wc-textarea-edit_"+t).val(a.data.content);e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd_editable_comment").hide(),e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").hide()}else wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error");else console.log(a);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wc_save_edited_comment","click",function(){var t=G(e(this)),a=$(t),o=e("#wpd-comm-"+t+" #wpdiscuz-edit-form");if(Z(o,"#wpd-editor-edit_"+t),o.submit(function(e){e.preventDefault()}),o[0].checkValidity()){var d=new FormData;d.append("action","wpdSaveEditedComment"),d.append("commentId",a),e(":input",o).each(function(){""!==this.name&&"checkbox"!==this.type&&"radio"!==this.type&&d.append(this.name+"",e(this).val()),"checkbox"!==this.type&&"radio"!==this.type||e(this).is(":checked")&&d.append(this.name+"",e(this).val())}),me(z,!0,d).done(function(o){"object"==typeof o?(o.success?(H(t,o.data.message),o.data.lastEdited&&(e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-last-edited").remove(),e(o.data.lastEdited).insertAfter("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-right .wpd-comment-text")),o.data.twitterShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_tw").attr("href",o.data.twitterShareLink),o.data.whatsappShareLink&&e("#wpd-comm-"+t+" > .wpd-comment-wrap .wpd-comment-share .wpd-tooltip-content .wc_whatsapp").attr("href",o.data.whatsappShareLink),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[o.data],"error"),le(o,a)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wc_cancel_edit","click",function(){var t=G(e(this));H(t,w),wpdiscuzLoadRichEditor&&wpDiscuzEditor.removeEditor("#wpd-editor-edit_"+t)}),!wpdiscuzAjaxObj.wordpressIsPaginate&&m&&(M=0,1==m?setTimeout(function(){P(!0)},500):e(document).delegate(".wpd-load-comments","click",function(){e(this).parent(".wpd-load-more-submit-wrap").remove(),P(!0)})),e(document).delegate(".wpd-load-more-submit","click",function(){var t=e(this);t.hasClass("wpd-loaded")&&P(!1,t,"wpd-loaded","wpd-loading")});var W=!1;function N(){var t=e("#wpdiscuzHasMoreComments").val(),a=e(document).height(),o=e(window).height()+e(window).scrollTop();a&&o&&(100*o/a>=80&&!1===W&&1==t&&(W=!0,P(!1,e(".wpd-load-more-submit"))))}function P(t,a,o,d){a&&(a.toggleClass(o),a.toggleClass(d));var s=new FormData;s.append("action","wpdLoadMoreComments");var i=e(".wpdiscuz-sort-button-active").attr("data-sorting");i&&s.append("sorting",i),s.append("offset",M),s.append("lastParentId",e(".wpd-load-more-submit").attr("data-lastparentid")),s.append("isFirstLoad",t?1:0);var c=e(".wpdf-active").attr("data-filter-type");s.append("wpdType",c||""),me(z,!t||1!=m,s).done(function(s){"object"==typeof s&&s.success&&(M++,t&&e(".wpd-comment").remove(),e(".wpdiscuz_single").remove(),e(".wpdiscuz-comment-pagination").before(s.data.comment_list),K(s,t&&2!==n),W=!1,r=s.data.loadLastCommentId,le(s),t&&Q(!1)),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))}).fail(function(t,n,s){console.log(s),e("#wpdiscuz-loading-bar").fadeOut(250),e(".wpd-load-more-submit").blur(),a&&(a.toggleClass(o),a.toggleClass(d))})}function K(t,a){var o;0==t.data.is_show_load_more?(e("#wpdiscuzHasMoreComments").val(0),e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()):(o=t.data.last_parent_id,e(".wpd-load-more-submit").attr("data-lastparentid",o),2!==n&&e(".wpdiscuz-comment-pagination").show(),e("#wpdiscuzHasMoreComments").val(1),a&&e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").show()),le(t)}function Q(t){var a=location.href.match(/#comment\-(\d+)/);if(null!==a){var o=a[1];if(e("#comment-"+o).length)setTimeout(function(){ee(),e("html, body").animate({scrollTop:e("#comment-"+o).parents("[id^=wpd-comm-]").offset().top-32},1e3,te),t&&V(o)},500);else{var d=new FormData;d.append("action","wpdGetSingleComment"),d.append("commentId",o),me(z,!0,d).done(function(a){if("object"==typeof a&&a.success){var d="#comment-"+o;e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e(d).offset().top-32},1e3,te),t&&V(o)}e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}}function V(t){setTimeout(function(){e("#comment-"+t).siblings(".wpd-secondary-form-wrapper").is(":visible")||e("#comment-"+t).find(".wpd-reply-button").trigger("click")},1100)}function B(e){if(void 0!==e.data.message)for(var t,a=e.data.message,o=0;o<a.length;o++)Y((t=a[o]).comment_parent,t.comment_html)}function G(e,t){var a="";return(a=t?e.parents(".wpd-main-form-wrapper").attr("id"):e.parents(".wpd-comment").attr("id")).substring(a.lastIndexOf("-")+1)}function $(e){return e.substring(0,e.indexOf("_"))}function X(e,t){return t?e.substring(e.indexOf("-")+1):e.substring(0,e.indexOf("-"))}function Y(t,a){if(0==t)ae(a);else{var o=G(e("#comment-"+t),0);e("#wpdiscuz_form_anchor-"+o).after(a)}}function J(){var t,a,o="";return e(".wpd-comment-right").each(function(){t=G(e(this),0),a=$(t),o+=a+","}),o}function Z(t,a){var o=t.find(".wpd-required-group");wpdiscuzLoadRichEditor&&t.find(".wc_comment").val(e(a+">.ql-editor").html()),function(e){var t=e.find(".wc_comment"),a=t.val().trim().replace(/<p><br><\/p>/g,"\n").replace(/<p>(.*?)<\/p>/g,"$1\n");a=(a=(a=(a=a.replace(/<img src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img[^>]+alt=["|']([^"|']+)["|'][^>]+src=["|']https\:\/\/s\.w\.org\/images\/core\/emoji\/([^"|']+)["|'][^>]?>/g," $1 ")).replace(/<img\s+([^>]*)class=["|']wpdem\-sticker["|'](.*?)alt=["|']([^"|']+)["|'](.*?)[^>]*>/g," $3 ")).replace(/<img\s+([^>]*)src=["|']([^"|']+)["|'](.*?)[^>]*>/g," $2 "),t.val(a)}(t),e.each(o,function(){e("input",this).removeAttr("required"),0===e("input:checked",this).length?e("input",e(this)).attr("required","required"):e(".wpd-field-invalid",this).remove()})}function ee(){e("html, body").css("scroll-behavior","unset")}function te(){e("html").css("scroll-behavior",F),e("body").css("scroll-behavior",L)}function ae(t){e(".wpd-sticky-comment").last()[0]?e(t).insertAfter(e(".wpd-sticky-comment").last()[0]):e(".wpd-thread-list").prepend(t)}function oe(t){t?t.prop("required")||(t.val()?t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):t.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none")):e.each(e(".wc_email"),function(t,a){var o=e(a);o.prop("required")||(o.val()?o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","inline-block"):o.parents("form").find("[name=wpdiscuz_notification_type]").parent().css("display","none"))})}if(2!==n||wpdiscuzAjaxObj.wordpressIsPaginate||(e(".wpd-load-more-submit").parents(".wpdiscuz-comment-pagination").hide(),N(),e(window).scroll(function(){N()})),wpdiscuzAjaxObj.setLoadMoreVisibility=K,e(document).delegate(".wpd-vote-up.wpd_not_clicked, .wpd-vote-down.wpd_not_clicked","click",function(){var t=e(this);e(t).removeClass("wpd_not_clicked");var a,o=$(G(t));a=e(this).hasClass("wpd-vote-up")?1:-1;var d=new FormData;d.append("action","wpdVoteOnComment"),d.append("commentId",o),d.append("voteType",a),me(z,!0,d).done(function(d){if(e(t).addClass("wpd_not_clicked"),"object"==typeof d){if(d.success){if("total"===d.data.buttonsStyle){var n=e(".wpd-comment-footer .wpd-vote-result",e("#comment-"+o)),s=d.data.votes;n.text(s),n.removeClass("wpd-up wpd-down"),s>0&&n.addClass("wpd-up"),s<0&&n.addClass("wpd-down")}else{var i=e(".wpd-comment-footer .wpd-vote-result-like",e("#comment-"+o)),c=e(".wpd-comment-footer .wpd-vote-result-dislike",e("#comment-"+o));i.text(d.data.likeCount),c.text(d.data.dislikeCount),parseInt(d.data.likeCount)>0?i.addClass("wpd-up"):i.removeClass("wpd-up"),parseInt(d.data.dislikeCount)<0?c.addClass("wpd-down"):c.removeClass("wpd-down")}var p=e(".wpd-comment-footer .wpd-vote-up",e("#comment-"+o)),r=e(".wpd-comment-footer .wpd-vote-down",e("#comment-"+o));p.removeClass("wpd-up"),r.removeClass("wpd-down"),d.data.curUserReaction>0?p.addClass("wpd-up"):d.data.curUserReaction<0&&r.addClass("wpd-down")}else d.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[d.data],"error");le(d,o,a)}else console.log(d);e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(t).addClass("wpd_not_clicked"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate("body","click",function(t){var a=e(".wpdiscuz-sort-buttons");e(t.target).hasClass("wpdf-sorting")||e(t.target).parent().hasClass("wpdf-sorting")?a.css({display:a.is(":visible")?"none":"flex"}):a.hide()}),e(document).delegate(".wpdiscuz-sort-button:not(.wpdiscuz-sort-button-active)","click",function(){var t=e(this),a=e(this).attr("data-sorting");if(a){e(".wpdiscuz-sort-button.wpdiscuz-sort-button-active").removeClass("wpdiscuz-sort-button-active").appendTo(".wpdiscuz-sort-buttons"),t.addClass("wpdiscuz-sort-button-active").prependTo(".wpdf-sorting");var o=new FormData;o.append("action","wpdSorting"),o.append("sorting",a);var d=e(".wpdf-active").attr("data-filter-type");o.append("wpdType",d||""),me(z,!0,o).done(function(t){"object"==typeof t&&t.success&&(e("#wpdcom .wpd-comment").remove(),e("#wpdcom .wpd-thread-list").prepend(t.data.message),K(t,!1),M=1),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),window.onhashchange=function(){Q(!1)},1!=m&&Q(!1),e(document).delegate(".wpdiscuz-readmore","click",function(){var t=G(e(this)),a=$(t),o=new FormData;o.append("action","wpdReadMore"),o.append("commentId",a),me(z,!0,o).done(function(o){"object"==typeof o?(o.success?(e("#comment-"+a+" .wpd-comment-text").replaceWith(" "+o.data.message),e("#wpdiscuz-readmore-"+t).remove()):console.log(o.data),le(o)):console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-required-group","change",function(){0!==e("input:checked",this).length?e("input",e(this)).removeAttr("required"):e("input",e(this)).attr("required","required")}),e(document).delegate(".wpdiscuz-spoiler","click",function(){e(this).next().slideToggle(),e(this).hasClass("wpdiscuz-spoiler-closed")?e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-plus").removeClass("fa-plus").addClass("fa-minus"):e(this).parents(".wpdiscuz-spoiler-wrap").find(".fa-minus").removeClass("fa-minus").addClass("fa-plus"),e(this).toggleClass("wpdiscuz-spoiler-closed")}),e(document).delegate(".wpd-tools i","click",function(){var t=e(this).siblings(".wpd-tools-actions");t.is(":visible")||e(this).parents(".wpd-comment-right").attr("id")!==e("[id^=comment-]").last().attr("id")||e("#comments").css({paddingBottom:"160px"}),t.css({display:t.is(":visible")?"none":"flex"})}),e(document).delegate(".wpd-comment-right","mouseleave",function(){e(this).find(".wpd-tools-actions").hide(),e("#comments").css({paddingBottom:"0"})}),e(document).delegate(".wpd_stick_btn","click",function(){var t=$(G(e(this),0)),a=new FormData;a.append("action","wpdStickComment"),a.append("commentId",t),me(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd_close_btn","click",function(){var t=$(G(e(this),0)),a=new FormData;a.append("action","wpdCloseThread"),a.append("commentId",t),me(z,!0,a).done(function(t){"object"==typeof t&&t.success&&location.reload(!0),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-filter.wpd_not_clicked[data-filter-type]","click",function(){var t=e(this),a=t.attr("data-filter-type");wpdiscuzAjaxObj.resetActiveFilters(".wpdf-"+a),t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var o=new FormData;o.append("action","wpdLoadMoreComments");var d=e(".wpdiscuz-sort-button-active").attr("data-sorting");d&&o.append("sorting",d),o.append("lastParentId",0),o.append("offset",0),M=1,o.append("wpdType",t.hasClass("wpdf-active")?"":a),o.append("isFirstLoad",1),e(this).hasClass("wpdf-inline")?e(this).hasClass("wpdf-active")?e(".wpd-comment-info-bar").hide():e(".wpd-comment-info-bar").css("display","flex"):e(".wpd-comment-info-bar").hide(),me(z,!1,o).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(t.toggleClass("wpdf-active"),e(".wpd-load-comments").remove(),e(".wpd-comment").remove(),e(".wpd-thread-list").prepend(a.data.comment_list),K(a),r=a.data.loadLastCommentId,e(".wpd-load-more-submit").blur(),le(a)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpdf-reacted.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdMostReactedComment"),me(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.parentCommentID).length?e("#comment-"+a.data.parentCommentID).parents("[id^=wpd-comm-"+a.data.parentCommentID+"]").replaceWith(a.data.message):e("#comment-"+a.data.commentId).length||e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3,te))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpdf-hottest.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=new FormData;a.append("action","wpdHottestThread"),me(z,!1,a).done(function(a){t.addClass("wpd_not_clicked"),e(".fas",t).removeClass("fa-pulse fa-spinner"),"object"==typeof a&&a.success&&(e("#comment-"+a.data.commentId).length?e("#comment-"+a.data.commentId).parents("[id^=wpd-comm-"+a.data.commentId+"]").replaceWith(a.data.message):e(".wpd-thread-list").prepend(a.data.message),le(a),ee(),e("html, body").animate({scrollTop:e("#comment-"+a.data.commentId).offset().top-32},1e3,te))}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner")})}),e(document).delegate(".wpd-filter-view-all","click",function(){e(".wpdf-inline.wpdf-active.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-follow-link.wpd_not_clicked","click",function(){var t=e(this);t.removeClass("wpd_not_clicked"),e(".fas",t).addClass("fa-pulse fa-spinner");var a=$(G(t,0)),o=new FormData;o.append("action","wpdFollowUser"),o.append("commentId",a),me(z,!0,o).done(function(a){t.addClass("wpd_not_clicked"),"object"==typeof a?a.success?(wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data.code],"success"),t.removeClass("wpd-follow-active"),a.data.followTip&&t.attr("wpd-tooltip",a.data.followTip),a.data.followClass&&t.addClass(a.data.followClass)):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(a,o,d){console.log(d),e(".fas",t).removeClass("fa-pulse fa-spinner"),e("#wpdiscuz-loading-bar").fadeOut(250)})}),oe(),e(document).delegate(".wc_email","keyup",function(){oe(e(this))}),j&&e("#wpdcom").length){if(e("#wpd-bubble-wrapper").hover(function(){e(this).addClass("wpd-bubble-hover")},function(){e(this).removeClass("wpd-bubble-hover")}),k&&!Cookies.get(wpdiscuzAjaxObj.cookieHideBubbleHint)&&setTimeout(function(){e("#wpd-bubble-wrapper").addClass("wpd-bubble-hover"),Cookies.set(wpdiscuzAjaxObj.cookieHideBubbleHint,"1",{expires:7,path:"/"}),setTimeout(function(){e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")},1e3*x)},1e3*k),"content_left"===O)if(e(".entry-content").length){var de=(ne=Math.min(e(".entry-content").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".post-entry").length){de=(ne=Math.min(e(".post-entry").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else if(e(".container").length){var ne;de=(ne=Math.min(e(".container").offset().left,e("#wpdcom").offset().left)-120)>25?ne:25;e("#wpd-bubble-wrapper").css({left:de+"px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-content")}else e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner");else"left_corner"===O?(e("#wpd-bubble-wrapper").css({left:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-left-corner")):"right_corner"===O&&(e("#wpd-bubble-wrapper").css({right:"25px"}),e("#wpd-bubble-wrapper").addClass("wpd-right-corner"));e("#wpd-bubble-wrapper").show(),e("#wpd-bubble-add-message-close").click(function(t){t.preventDefault(),t.stopPropagation(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover")}),e("#wpd-bubble").click(function(){ee(),e("html, body").animate({scrollTop:e("#wpdcom").offset().top-60},1e3,function(){te(),e("#wpd-bubble-wrapper").removeClass("wpd-bubble-hover"),wpdiscuzLoadRichEditor?e("#wpd-editor-0_0").length&&wpDiscuzEditor.createEditor("#wpd-editor-0_0").focus():e("#wc-textarea-0_0").length&&e("#wc-textarea-0_0").focus()})}),e("#wpd-bubble-comment-close").click(function(t){t.preventDefault(),e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")}),e("#wpd-bubble-comment-reply-link a").click(function(){var t=e(this).attr("href");setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),Q(!0);var a=t.match(/#comment\-(\d+)/);D=D.filter(function(e){return e!=a[1]}),e("#wpd-bubble-count .wpd-new-comments-count").text(D.length),0==D.length&&e("#wpd-bubble-count").removeClass("wpd-new-comments")},100)}),e("#wpd-bubble-count").click(function(){if(D.length){var t=new FormData;t.append("action","wpdBubbleUpdate"),t.append("newCommentIds",D.join()),me(z,!0,t).done(function(t){"object"==typeof t&&t.success&&(t.data.message=t.data.message.filter(function(t){if(!e("#comment-"+t.comment_id).length)return t}),B(t),e("#wpd-bubble-count").removeClass("wpd-new-comments"),e("#wpd-bubble-count .wpd-new-comments-count").text("0"),D=[],ee(),e("html, body").animate({scrollTop:e(e(".wpd-new-loaded-comment")[0]).offset().top-60},1e3,te),le(t)),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(e,t,a){console.log(a)})}})}if((j&&C||i)&&(t||!t&&p)&&setTimeout(function t(){e.ajax({type:"GET",url:wpdiscuzAjaxObj.bubbleUpdateUrl,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",wpdiscuzAjaxObj.restNonce)},data:{postId:s,lastId:l,visibleCommentIds:J()}}).done(function(a){if(!E)if("object"==typeof a){if(a.ids.length){i&&((n=new FormData).append("action","wpdUpdateAutomatically"),n.append("loadLastCommentId",r),n.append("visibleCommentIds",J()),me(z,!1,n).done(function(t){E||"object"==typeof t&&t.success&&(B(t),e(".wpd-thread-info").html(t.data.wc_all_comments_count_new_html),t.data.wc_all_comments_count_new=parseInt(t.data.wc_all_comments_count_new),e("#wpd-bubble-all-comments-count").text(t.data.wc_all_comments_count_new),t.data.wc_all_comments_count_new?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),r=t.data.loadLastCommentId)}).fail(function(e,t,a){console.log(a)})),a.ids=a.ids.filter(function(t){if(!e("#comment-"+t).length)return t});var o=5e3;l=parseInt(a.ids[a.ids.length-1]),D=D.concat(a.ids),y&&a.commentText&&(e("#wpd-bubble-author-avatar").html(a.avatar),e("#wpd-bubble-author-name").html(a.authorName),e("#wpd-bubble-comment-date span").html(a.commentDate),e("#wpd-bubble-comment-text").html(a.commentText),e("#wpd-bubble-comment-reply-link a").attr("href",a.commentLink),e("#wpd-bubble-notification-message").show(),o=1e4);var d=parseInt(e(".wpd-new-comments-count").text());d+=a.ids.length,e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added"),e("#wpd-bubble-wrapper").addClass("wpd-new-comment-added"),setTimeout(function(){e("#wpd-bubble-notification-message").hide(),e("#wpd-bubble-wrapper").removeClass("wpd-new-comment-added")},o),e(".wpd-new-comments-count").text(d),e("#wpd-bubble-count").addClass("wpd-new-comments"),a.all_comments_count=parseInt(a.all_comments_count),e("#wpd-bubble-all-comments-count").text(a.all_comments_count),a.all_comments_count?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),e(".wpd-thread-info").html(a.all_comments_count_html)}}else console.log(a);var n;setTimeout(t,c)}).fail(function(e,a,o){console.log(o),setTimeout(t,c)})},c),e(".wpd-inline-form-wrapper").length){var se=new FormData;se.append("action","wpdGetInlineCommentForm"),me(z,!1,se).done(function(t){"object"==typeof t?t.success?(e(".wpd-inline-form-wrapper").append(t.data),e.each(e("[name=_wpd_inline_nonce]"),function(){var t=e(this).attr("id"),a=e(this).parents(".wpd-inline-shortcode").attr("id");e(this).attr("id",t+"-"+a.substring(a.lastIndexOf("-")+1))}),e(".wpd-inline-opened").addClass("wpd-active"),e(".wpd-inline-opened").find(".wpd-inline-form-wrapper").show(),e(".wpd-inline-opened").find(".wpd-inline-icon").addClass("wpd-open"),e(".wpd-inline-opened").find(".wpd-inline-icon").removeClass("wpd-ignored"),re()):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t)}).fail(function(e,t,a){console.log(a)})}function ie(t){if(e(t).hasClass("wpd-inline-shortcode"))var a=e(t).attr("id");else a=e(t).parents(".wpd-inline-shortcode").attr("id");return a.substring(a.lastIndexOf("-")+1)}function ce(){e(".wpd-inline-form-wrapper").hide(),e(".wpd-inline-shortcode").removeClass("wpd-active"),e(".wpd-inline-icon").removeClass("wpd-open")}function pe(){e.each(e(".wpd-inline-shortcode:not(.wpd-inline-opened) .wpd-inline-icon"),function(){var t=e(this),a=t.offset().top-window.pageYOffset;a>0&&a<300&&("blink"===A?(t.addClass("wpd-blink"),setTimeout(function(){t.removeClass("wpd-blink")},3e3)):(t.parents(".wpd-inline-shortcode").addClass("wpd-active"),t.siblings(".wpd-inline-form-wrapper").show(),t.addClass("wpd-open"),re(t.siblings(".wpd-inline-form-wrapper"))))})}function re(t){if(t){if(t.offset().left<=10)t.css("left",Math.ceil(parseInt(t.css("left"))-t.offset().left+10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))<3&&(a=3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;");else if(t.offset().left+t.width()>document.body.clientWidth-10){var a;t.css("left",Math.ceil(parseInt(t.css("left"))+(document.body.clientWidth-(t.offset().left+t.width()))-10)),(a=Math.ceil(t.siblings(".wpd-inline-icon.wpd-open").offset().left-t.offset().left+2))>t.width()-3&&(a=t.width()-3),document.styleSheets[0].addRule("#"+t.parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+a+"px;")}}else e.each(e(".wpd-inline-form-wrapper:visible"),function(){if(e(this).offset().left<=10)e(this).css("left",Math.ceil(parseInt(e(this).css("left"))-e(this).offset().left+10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))<3&&(t=3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;");else if(e(this).offset().left+e(this).width()>document.body.clientWidth-10){var t;e(this).css("left",Math.ceil(parseInt(e(this).css("left"))+(document.body.clientWidth-(e(this).offset().left+e(this).width()))-10)),(t=Math.ceil(e(this).siblings(".wpd-inline-icon.wpd-open").offset().left-e(this).offset().left+2))>e(this).width()-3&&(t=e(this).width()-3),document.styleSheets[0].addRule("#"+e(this).parents(".wpd-inline-shortcode").attr("id")+" .wpd-inline-form-wrapper::before","left: "+t+"px;")}})}function le(t,a,o,d){t.data.callbackFunctions&&e.each(t.data.callbackFunctions,function(e){"function"==typeof wpdiscuzAjaxObj[t.data.callbackFunctions[e]]?wpdiscuzAjaxObj[t.data.callbackFunctions[e]](t,a,o,d):console.log(t.data.callbackFunctions[e]+" is not a function")})}function me(t,a,o){a&&e("#wpdiscuz-loading-bar").show(),o.append("postId",s);var d=o.get("action");wpdiscuzAjaxObj.dataFilterCallbacks&&wpdiscuzAjaxObj.dataFilterCallbacks[d]&&e.each(wpdiscuzAjaxObj.dataFilterCallbacks[d],function(e){"function"==typeof wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]]&&(o=wpdiscuzAjaxObj[wpdiscuzAjaxObj.dataFilterCallbacks[d][e]](o,t,a))});var n=t?wpdiscuzAjaxObj.url:wpdiscuzAjaxObj.customAjaxUrl;return e.ajax({type:"POST",url:n,data:o,contentType:!1,processData:!1})}e(document).delegate("body","click",function(t){if(e(t.target).hasClass("wpd-inline-form-close")||e(t.target).parents(".wpd-inline-form-close").length)t.preventDefault(),e(t.target).parents(".wpd-inline-form-wrapper").hide(),e(t.target).parents(".wpd-inline-shortcode").removeClass("wpd-active"),e(t.target).parents(".wpd-inline-form-wrapper").siblings(".wpd-inline-icon").removeClass("wpd-open");else if(!e(t.target).hasClass("wpd-inline-form-wrapper")&&!e(t.target).parents(".wpd-inline-form-wrapper").length){ce();var a="";e(t.target).hasClass("wpd-inline-icon")?a=e(t.target):e(t.target).parents(".wpd-inline-icon").length&&(a=e(t.target).parents(".wpd-inline-icon")),a.length&&(a.parents(".wpd-inline-shortcode").addClass("wpd-active"),a.siblings(".wpd-inline-form-wrapper").show(),a.addClass("wpd-open"),a.removeClass("wpd-ignored"),re(a.siblings(".wpd-inline-form-wrapper")))}(!e(t.target).hasClass("wpd-last-inline-comments-wrapper")&&!e(t.target).parents(".wpd-last-inline-comments-wrapper").length||e(t.target).parents(".wpd-last-inline-comments-wrapper").length&&e(t.target).hasClass("wpd-load-inline-comment"))&&e(".wpd-last-inline-comments-wrapper").remove()}),e(document).delegate(".wpd-inline-submit.wpd_not_clicked","click",function(t){t.preventDefault();var a=e(this),o=e(this).parents(".wpd_inline_comm_form");if(o[0].checkValidity()){e(this).removeClass("wpd_not_clicked");var d=new FormData;d.append("action","wpdAddInlineComment"),d.append("inline_form_id",ie(o)),e.each(e("input, textarea",o),function(t,a){"checkbox"===this.type?e(this).is(":checked")&&d.append(e(a).attr("name"),e(a).val()):d.append(e(a).attr("name"),e(a).val())}),me(z,!0,d).done(function(t){if(a.addClass("wpd_not_clicked"),"object"==typeof t)if(t.success){o[0].reset(),ce();var d=parseInt(t.data.newCount),n=a.parents(".wpd-inline-icon-wrapper").find(".wpd-inline-icon-count");n.text(d),d?n.addClass("wpd-has-comments"):n.removeClass("wpd-has-comments"),e(".wpd-thread-info").html(t.data.allCommentsCountNewHtml),t.data.allCommentsCountNew=parseInt(t.data.allCommentsCountNew),e("#wpd-bubble-all-comments-count").text(t.data.allCommentsCountNew),t.data.allCommentsCountNew?e("#wpd-bubble-all-comments-count").show():e("#wpd-bubble-all-comments-count").hide(),t.data.message&&ae(t.data.message),wpdiscuzAjaxObj.setCommentMessage(t.data.notification,"success")}else t.data&&wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error");else wpdiscuzAjaxObj.setCommentMessage(t,"error");e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(document).delegate(".wpd-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_comm_submit").trigger("click")}),e(document).delegate("#wpdiscuz-edit-form","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).find(".wc_save_edited_comment").trigger("click")}),e(document).delegate(".wpd-inline-comment-content","keydown",function(t){t.ctrlKey&&13==t.keyCode&&e(this).parents(".wpd_inline_comm_form").find(".wpd-inline-submit.wpd_not_clicked").trigger("click")}),e(document).delegate(".wpd-inline-icon-count.wpd-has-comments","click",function(){var t=e(this),a=new FormData;a.append("action","wpdGetLastInlineComments"),a.append("inline_form_id",ie(t)),me(z,!0,a).done(function(a){"object"==typeof a?a.success?e(a.data).insertAfter(t):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[a.data],"error"):console.log(a),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),e(document).delegate(".wpd-view-all-inline-comments","click",function(t){t.preventDefault(),e(this).parents(".wpd-last-inline-comments-wrapper").remove(),e(".wpdf-inline").hasClass("wpdf-active")||e(".wpdf-inline").trigger("click"),ee(),e("html, body").animate({scrollTop:e(".wpdf-inline").offset().top-32},1e3,te)}),e(document).delegate(".wpd-feedback-content-link","click",function(t){t.preventDefault();var a=e(this).data("feedback-content-id");ee(),e("html, body").animate({scrollTop:e("#wpd-inline-"+a).offset().top-38},1e3,function(){te(),e("#wpd-inline-"+a).addClass("wpd-active")})}),"scroll_open"!==A&&"blink"!==A||(pe(),e(window).scroll(pe)),e(document).delegate("#wpd-post-rating.wpd-not-rated .wpd-rate-starts svg","click",function(){var t=new FormData,a=e(this).index();a>=0&&a<5&&(t.append("action","wpdUserRate"),t.append("rating",a+1),me(z,!0,t).done(function(t){"object"==typeof t?t.success?location.reload(!0):wpdiscuzAjaxObj.setCommentMessage(wpdiscuzAjaxObj[t.data],"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250)}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)}))}),e("#wpdiscuz-subscribe-form").submit(function(t){t.preventDefault();var a,o,n=e(this);if(n[0].checkValidity()&&(a=n,o=!0,"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&!e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).val().length?(o=!1,e(".wpdiscuz-recaptcha",a).css("border","1px solid red")):"2.0"===d&&e("input[name=wpdiscuz_recaptcha_subscribe_form]",a).length&&e(".wpdiscuz-recaptcha",a).css("border","none"),o)){var s=new FormData;s.append("action","wpdAddSubscription"),e("*",n).each(function(){""!=this.name&&"checkbox"!=this.type&&"radio"!=this.type&&s.append(this.name+"",e(this).val()),"checkbox"!=this.type&&"radio"!=this.type||e(this).is(":checked")&&s.append(this.name+"",e(this).val())}),me(z,!0,s).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):wpdiscuzAjaxObj.setCommentMessage(t,"error"),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}}),e(".wpd-unsubscribe").click(function(t){t.preventDefault();var a=new FormData;a.append("action","wpdUnsubscribe"),a.append("sid",e(this).data("sid")),a.append("skey",e(this).data("skey")),me(z,!0,a).done(function(t){"object"==typeof t?t.success?(wpdiscuzAjaxObj.setCommentMessage(t.data,"success"),setTimeout(function(){location.reload(!0)},3e3)):wpdiscuzAjaxObj.setCommentMessage(t.data,"error"):console.log(t),e("#wpdiscuz-loading-bar").fadeOut(250),E=!1}).fail(function(t,a,o){console.log(o),e("#wpdiscuz-loading-bar").fadeOut(250)})}),wpdiscuzAjaxObj.resetActiveFilters=function(t){e(".wpd-filter.wpdf-active"+(t?":not("+t+")":"")).removeClass("wpdf-active")},wpdiscuzAjaxObj.getAjaxObj=me});var onloadCallback=function(){if(document.getElementById("wpdiscuz-recaptcha-0_0")&&"2.0"===wpdiscuzAjaxObj.wpDiscuzReCaptchaVersion&&(1==wpdiscuzAjaxObj.wc_captcha_show_for_guest&&!wpdiscuzAjaxObj.is_user_logged_in||1==wpdiscuzAjaxObj.wc_captcha_show_for_members&&wpdiscuzAjaxObj.is_user_logged_in))try{grecaptcha.render("wpdiscuz-recaptcha-0_0",{sitekey:wpdiscuzAjaxObj.wpDiscuzReCaptchaSK,theme:wpdiscuzAjaxObj.wpDiscuzReCaptchaTheme,callback:function(e){jQuery("#wpdiscuz-recaptcha-field-0_0").val("key")},"expired-callback":function(){jQuery("#wpdiscuz-recaptcha-field-0_0").val("")}})}catch(e){console.log(e),wpdiscuzAjaxObj.setCommentMessage("reCaptcha Error: "+e.message,"error")}};
|
assets/third-party/font-awesome-5.13.0/css/fa.min.css
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}
|
2 |
-
.fa-asterisk:before{content:"\f069"}.fa-plus:before{content:"\f067"}.fa-question:before{content:"\f128"}.fa-minus:before{content:"\f068"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before{content:"\f00d"}.fa-remove:before{content:"\f00d"}.fa-times:before{content:"\f00d"}.fa-signal:before{content:"\f012"}.fa-cog:before{content:"\f013"}.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-repeat:before{content:"\f01e"}.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-tag:before{content:"\f02b"}.fa-bookmark:before{content:"\f02e"}.fa-camera:before{content:"\f030"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-video-camera:before{content:"\f03d"}.fa-image:before{content:"\f03e"}.fa-photo:before{content:"\f03e"}.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-edit:before{content:"\f044"}.fa-pencil-square-o:before{content:"\f044"}.fa-check-square-o:before{content:"\f046"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-check-circle-o:before{content:"\f05d"}.fa-mail-forward:before{content:"\f064"}.fa-share:before{content:"\f064"}.fa-exclamation-circle:before{content:"\f06a"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before{content:"\f071"}.fa-warning:before{content:"\f071"}.fa-comment:before{content:"\f075"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-bar-chart:before{content:"\f080"}.fa-bar-chart-o:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-cogs:before{content:"\f085"}.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f09a"}.fa-unlock:before{content:"\f09c"}.fa-feed:before{content:"\f09e"}.fa-rss:before{content:"\f09e"}.fa-bell-o:before{content:"\f0a2"}.fa-certificate:before{content:"\f0a3"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-wrench:before{content:"\f0ad"}.fa-group:before{content:"\f0c0"}.fa-users:before{content:"\f0c0"}.fa-chain:before{content:"\f0c1"}.fa-link:before{content:"\f0c1"}.fa-paperclip:before{content:"\f0c6"}.fa-bars:before{content:"\f0c9"}.fa-navicon:before{content:"\f0c9"}.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before{content:"\f0e2"}.fa-undo:before{content:"\f0e2"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before{content:"\f0e7"}.fa-flash:before{content:"\f0e7"}.fa-bell:before{content:"\f0f3"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-mail-reply:before{content:"\f112"}.fa-reply:before{content:"\f112"}.fa-smile-o:before{content:"\f118"}.fa-smile:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-frown:before{content:"\f119"}.fa-flag-o:before{content:"\f11d"}.fa-mail-reply-all:before{content:"\f122"}.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before{content:"\f123"}.fa-star-half-full:before{content:"\f123"}.fa-star-half-o:before{content:"\f123"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-shield:before{content:"\f132"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-unlock-alt:before{content:"\f13e"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-play:before{content:"\f16a"}.fa-vk:before{content:"\f189"}.fa-wordpress:before{content:"\f19a"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-language:before{content:"\f1ab"}.fa-cubes:before{content:"\f1b3"}.fa-life-bouy:before{content:"\f1cd"}.fa-life-buoy:before{content:"\f1cd"}.fa-life-ring:before{content:"\f1cd"}.fa-life-saver:before{content:"\f1cd"}.fa-support:before{content:"\f1cd"}.fa-circle:before{content:"\f111"}.fa-clock:before{content:"\f017"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-facebook-official:before{content:"\f230"}.fa-whatsapp:before{content:"\f232"}.fa-user-plus:before{content:"\f234"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-fa:before{content:"\f2b4"}.fa-font-awesome:before{content:"\f2b4"}.fa-address-card:before{content:"\f2bb"}.fa-vcard:before{content:"\f2bb"}.fa-address-card-o:before{content:"\f2bc"}.fa-vcard-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-pencil-alt:before{content:"\f303"}.fa-columns:before{content:"\f0db"}.fa-trash-alt:before{content:"\f2ed"}.fa-arrows-alt:before{content:"\f0b2"}.fa-shield-alt:before{content:"\f3ed"}.fa-user-cog:before{content:"\f4fe"}.fa-photo-video:before{content:"\f87c"}.fa-fire:before{content:"\f06d"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-up:before{content:"\f0de"}.fa-thumbtack:before{content:"\f08d"}.fa-instagram:before{content:"\f16d"}.fa-wordpress-simple:before{content:"\f411"}.fa-linkedin-in:before{content:"\f0e1"}.fa-yandex-international:before{content:"\f414"}.fa-at:before{content:"\f1fa"}.fa-weixin:before{content:"\f1d7"}.fa-weibo:before{content:"\f18a"}.fa-qq:before{content:"\f1d6"}.fa-baidu:before{content:"\f1b0"}.fa-spinner:before{content:"\f110"}
|
3 |
.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:400;font-display:block; src:url(../webfonts/fa-brands-400.eot); src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"), url(../webfonts/fa-brands-400.woff2) format("woff2"), url(../webfonts/fa-brands-400.woff) format("woff"), url(../webfonts/fa-brands-400.ttf) format("truetype"), url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"} @font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block; src:url(../webfonts/fa-regular-400.eot); src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"), url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"), url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.fab,.far{font-weight:400} @font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block; src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900}
|
1 |
.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}
|
2 |
+
.fa-asterisk:before{content:"\f069"}.fa-plus:before{content:"\f067"}.fa-question:before{content:"\f128"}.fa-minus:before{content:"\f068"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before{content:"\f00d"}.fa-remove:before{content:"\f00d"}.fa-times:before{content:"\f00d"}.fa-signal:before{content:"\f012"}.fa-cog:before{content:"\f013"}.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-repeat:before{content:"\f01e"}.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-tag:before{content:"\f02b"}.fa-bookmark:before{content:"\f02e"}.fa-camera:before{content:"\f030"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-video-camera:before{content:"\f03d"}.fa-image:before{content:"\f03e"}.fa-photo:before{content:"\f03e"}.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-edit:before{content:"\f044"}.fa-pencil-square-o:before{content:"\f044"}.fa-check-square-o:before{content:"\f046"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-check-circle-o:before{content:"\f05d"}.fa-mail-forward:before{content:"\f064"}.fa-share:before{content:"\f064"}.fa-exclamation-circle:before{content:"\f06a"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before{content:"\f071"}.fa-warning:before{content:"\f071"}.fa-comment:before{content:"\f075"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-bar-chart:before{content:"\f080"}.fa-bar-chart-o:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-cogs:before{content:"\f085"}.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f09a"}.fa-unlock:before{content:"\f09c"}.fa-feed:before{content:"\f09e"}.fa-rss:before{content:"\f09e"}.fa-bell-o:before{content:"\f0a2"}.fa-certificate:before{content:"\f0a3"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-wrench:before{content:"\f0ad"}.fa-group:before{content:"\f0c0"}.fa-users:before{content:"\f0c0"}.fa-chain:before{content:"\f0c1"}.fa-link:before{content:"\f0c1"}.fa-paperclip:before{content:"\f0c6"}.fa-bars:before{content:"\f0c9"}.fa-navicon:before{content:"\f0c9"}.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before{content:"\f0e2"}.fa-undo:before{content:"\f0e2"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before{content:"\f0e7"}.fa-flash:before{content:"\f0e7"}.fa-bell:before{content:"\f0f3"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-mail-reply:before{content:"\f112"}.fa-reply:before{content:"\f112"}.fa-smile-o:before{content:"\f118"}.fa-smile:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-frown:before{content:"\f119"}.fa-flag-o:before{content:"\f11d"}.fa-mail-reply-all:before{content:"\f122"}.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before{content:"\f123"}.fa-star-half-full:before{content:"\f123"}.fa-star-half-o:before{content:"\f123"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-shield:before{content:"\f132"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-unlock-alt:before{content:"\f13e"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-play:before{content:"\f16a"}.fa-vk:before{content:"\f189"}.fa-wordpress:before{content:"\f19a"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-language:before{content:"\f1ab"}.fa-cubes:before{content:"\f1b3"}.fa-life-bouy:before{content:"\f1cd"}.fa-life-buoy:before{content:"\f1cd"}.fa-life-ring:before{content:"\f1cd"}.fa-life-saver:before{content:"\f1cd"}.fa-support:before{content:"\f1cd"}.fa-circle:before{content:"\f111"}.fa-clock:before{content:"\f017"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-facebook-official:before{content:"\f230"}.fa-whatsapp:before{content:"\f232"}.fa-user-plus:before{content:"\f234"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-fa:before{content:"\f2b4"}.fa-font-awesome:before{content:"\f2b4"}.fa-address-card:before{content:"\f2bb"}.fa-vcard:before{content:"\f2bb"}.fa-address-card-o:before{content:"\f2bc"}.fa-vcard-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-pencil-alt:before{content:"\f303"}.fa-columns:before{content:"\f0db"}.fa-trash-alt:before{content:"\f2ed"}.fa-arrows-alt:before{content:"\f0b2"}.fa-shield-alt:before{content:"\f3ed"}.fa-user-cog:before{content:"\f4fe"}.fa-photo-video:before{content:"\f87c"}.fa-fire:before{content:"\f06d"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-up:before{content:"\f0de"}.fa-thumbtack:before{content:"\f08d"}.fa-instagram:before{content:"\f16d"}.fa-wordpress-simple:before{content:"\f411"}.fa-linkedin-in:before{content:"\f0e1"}.fa-yandex-international:before{content:"\f414"}.fa-at:before{content:"\f1fa"}.fa-weixin:before{content:"\f1d7"}.fa-weibo:before{content:"\f18a"}.fa-qq:before{content:"\f1d6"}.fa-baidu:before{content:"\f1b0"}.fa-spinner:before{content:"\f110"}.fa-microphone:before{content:"\f130"}
|
3 |
.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:400;font-display:block; src:url(../webfonts/fa-brands-400.eot); src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"), url(../webfonts/fa-brands-400.woff2) format("woff2"), url(../webfonts/fa-brands-400.woff) format("woff"), url(../webfonts/fa-brands-400.ttf) format("truetype"), url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"} @font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block; src:url(../webfonts/fa-regular-400.eot); src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"), url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"), url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.fab,.far{font-weight:400} @font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block; src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900}
|
class.WpdiscuzCore.php
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
/*
|
3 |
* Plugin Name: wpDiscuz
|
4 |
* Description: #1 WordPress Comment Plugin. Innovative, modern and feature-rich comment system to supercharge your website comment section.
|
5 |
-
* Version: 7.0.
|
6 |
* Author: gVectors Team
|
7 |
* Author URI: https://gvectors.com/
|
8 |
* Plugin URI: https://wpdiscuz.com/
|
9 |
* Text Domain: wpdiscuz
|
10 |
* Domain Path: /languages/
|
11 |
-
* wpDiscuz Update:
|
12 |
*/
|
13 |
if (!defined("ABSPATH")) {
|
14 |
-
|
15 |
}
|
16 |
|
17 |
define("WPDISCUZ_DIR_PATH", dirname(__FILE__));
|
@@ -32,1805 +32,1931 @@ include_once WPDISCUZ_DIR_PATH . "/includes/class.WpdiscuzRest.php";
|
|
32 |
|
33 |
class WpdiscuzCore implements WpDiscuzConstants {
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
}
|
502 |
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
if ($trimmedContent != $comment->comment_content) {
|
509 |
-
$trimmedContent = $this->helper->replaceCommentContentCode($trimmedContent);
|
510 |
-
$commentContent = $this->helper->filterCommentText($trimmedContent);
|
511 |
-
$userAgent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
|
512 |
-
$commentarr = [
|
513 |
-
"comment_ID" => $commentId,
|
514 |
-
"comment_content" => $commentContent,
|
515 |
-
"comment_agent" => $userAgent,
|
516 |
-
"comment_approved" => $comment->comment_approved
|
517 |
-
];
|
518 |
-
wp_update_comment(wp_slash($commentarr));
|
519 |
-
$lastEditedAt = current_time("mysql", 1);
|
520 |
-
update_comment_meta($commentId, self::META_KEY_LAST_EDITED_AT, $lastEditedAt);
|
521 |
-
update_comment_meta($commentId, self::META_KEY_LAST_EDITED_BY, !empty($currentUser->ID) ? $currentUser->ID : $comment->comment_author_email);
|
522 |
-
if ($this->options->moderation["displayEditingInfo"]) {
|
523 |
-
if (!empty($currentUser->ID)) {
|
524 |
-
$lastEditedBy = get_user_by("id", $currentUser->ID);
|
525 |
-
} else {
|
526 |
-
$lastEditedBy = get_user_by("email", $currentUser->comment_author_email);
|
527 |
-
}
|
528 |
-
$username = $lastEditedBy ? $lastEditedBy->display_name : $comment->comment_author;
|
529 |
-
$response["lastEdited"] = "<div class='wpd-comment-last-edited'><i class='far fa-edit'></i>" . esc_html(sprintf($this->options->phrases["wc_last_edited"], $this->helper->dateDiff($lastEditedAt), $username)) . "</div>";
|
530 |
-
}
|
531 |
-
do_action("wpdiscuz_clean_post_cache", $comment->comment_post_ID, "comment_edited");
|
532 |
-
}
|
533 |
-
|
534 |
-
$form->saveCommentMeta($comment->comment_ID);
|
535 |
-
$commentContent = isset($commentContent) ? $commentContent : $trimmedContent;
|
536 |
-
if ($this->options->content["enableImageConversion"]) {
|
537 |
-
$commentContent = $this->helper->makeClickable($commentContent);
|
538 |
-
}
|
539 |
-
$commentLink = get_comment_link($comment);
|
540 |
-
if ($this->options->social["enableTwitterShare"]) {
|
541 |
-
$response["twitterShareLink"] = esc_url_raw("https://twitter.com/intent/tweet?text=" . $this->helper->getTwitterShareContent($commentContent, $commentLink) . "&url=" . urlencode($commentLink));
|
542 |
-
}
|
543 |
-
if ($this->options->social["enableWhatsappShare"]) {
|
544 |
-
$response["whatsappShareLink"] = esc_url_raw((wp_is_mobile() ? "https://api.whatsapp.com" : "https://web.whatsapp.com") . "/send?text=" . $this->helper->getWhatsappShareContent($commentContent, $commentLink));
|
545 |
-
}
|
546 |
-
$commentContent = apply_filters("comment_text", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
|
547 |
-
$commentReadMoreLimit = $this->options->content["commentReadMoreLimit"];
|
548 |
-
if (stripos($commentContent, "[/spoiler]") !== false) {
|
549 |
-
$commentReadMoreLimit = 0;
|
550 |
-
$commentContent = $this->helper->spoiler($commentContent);
|
551 |
-
}
|
552 |
-
if ($commentReadMoreLimit && WpdiscuzHelper::strWordCount(wp_strip_all_tags($commentContent)) > $commentReadMoreLimit) {
|
553 |
-
$commentContent = WpdiscuzHelper::getCommentExcerpt($commentContent, $uniqueId, $this->options);
|
554 |
-
}
|
555 |
-
$commentContent = apply_filters("wpdiscuz_after_read_more", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
|
556 |
-
|
557 |
-
$components = $this->helper->getComponents($form->getTheme(), $form->getLayout());
|
558 |
-
$inlineContent = "";
|
559 |
-
if ($inlineFormID = intval(get_comment_meta($comment->comment_ID, self::META_KEY_FEEDBACK_FORM_ID, true))) {
|
560 |
-
$feedbackForm = $this->dbManager->getFeedbackForm($inlineFormID);
|
561 |
-
$inlineContent = "<div class='wpd-inline-feedback-wrapper'><span class='wpd-inline-feedback-info'>" . esc_html($this->options->phrases["wc_feedback_content_text"]) . "</span> <i class='fas fa-quote-left'></i>" . wp_trim_words($feedbackForm->content, apply_filters("wpdiscuz_feedback_content_words_count", 20)) . "" <a class='wpd-feedback-content-link' data-feedback-content-id='{$feedbackForm->id}' href='#wpd-inline-{$feedbackForm->id}'>" . esc_html($this->options->phrases["wc_read_more"]) . "</a></div>";
|
562 |
-
}
|
563 |
-
$response["message"] = str_replace(["{TEXT_WRAPPER_CLASSES}", "{TEXT}"], ["wpd-comment-text", $inlineContent . $commentContent], $components["text.html"]);
|
564 |
-
$response["callbackFunctions"] = [];
|
565 |
-
$response = apply_filters("wpdiscuz_comment_edit_save", $response);
|
566 |
-
wp_send_json_success($response);
|
567 |
-
} else {
|
568 |
-
wp_send_json_error("wc_comment_edit_not_possible");
|
569 |
-
}
|
570 |
-
} else {
|
571 |
-
wp_send_json_error("wc_comment_edit_not_possible");
|
572 |
-
}
|
573 |
-
}
|
574 |
-
}
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Gets single comment with its full thread and displays in comment list
|
578 |
-
*/
|
579 |
-
public function getSingleComment() {
|
580 |
-
$commentId = isset($_POST["commentId"]) ? intval($_POST["commentId"]) : 0;
|
581 |
-
$comment = get_comment($commentId);
|
582 |
-
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
583 |
-
if ($commentId && $postId && $comment && $comment->comment_post_ID == $postId) {
|
584 |
-
$commentListArgs = $this->getCommentListArgs($postId);
|
585 |
-
$this->commentsArgs = $this->getDefaultCommentsArgs($postId);
|
586 |
-
$showUnapprovedComment = false;
|
587 |
-
$includeUnapproved = null;
|
588 |
-
if ($comment->comment_approved === "0") {
|
589 |
-
if ($commentListArgs["high_level_user"]) {
|
590 |
-
$showUnapprovedComment = true;
|
591 |
-
} else if (!empty($this->commentsArgs["include_unapproved"])) {
|
592 |
-
$includeUnapproved = $this->commentsArgs["include_unapproved"][0];
|
593 |
-
if (is_numeric($this->commentsArgs["include_unapproved"][0])) {
|
594 |
-
if ($comment->user_id == $this->commentsArgs["include_unapproved"][0]) {
|
595 |
-
$showUnapprovedComment = true;
|
596 |
-
}
|
597 |
-
} else if ($comment->comment_author_email == $this->commentsArgs["include_unapproved"][0]) {
|
598 |
-
$showUnapprovedComment = true;
|
599 |
-
}
|
600 |
-
}
|
601 |
-
}
|
602 |
-
if ($comment->comment_approved === "1" || $showUnapprovedComment) {
|
603 |
-
$this->isWpdiscuzLoaded = true;
|
604 |
-
$commentStatusIn = ["1"];
|
605 |
-
if ($this->commentsArgs["status"] === "all") {
|
606 |
-
$commentStatusIn[] = "0";
|
607 |
-
}
|
608 |
-
$parentComment = null;
|
609 |
-
if (!$this->options->wp["threadComments"]) {
|
610 |
-
$comments = [$comment];
|
611 |
-
$parentComment = $comment;
|
612 |
-
} else if ($parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved)) {
|
613 |
-
$args = [
|
614 |
-
"format" => "flat",
|
615 |
-
"status" => $this->commentsArgs["status"],
|
616 |
-
"orderby" => $this->commentsArgs["orderby"],
|
617 |
-
"post_id" => $this->commentsArgs["post_id"],
|
618 |
-
];
|
619 |
-
if (!empty($this->commentsArgs["include_unapproved"])) {
|
620 |
-
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
621 |
-
}
|
622 |
-
$tree = $parentComment->get_children($args);
|
623 |
-
$comments = array_merge([$parentComment], $tree);
|
624 |
-
}
|
625 |
-
if ($parentComment) {
|
626 |
-
$commentListArgs["isSingle"] = true;
|
627 |
-
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
628 |
-
if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
|
629 |
-
if (!empty($commentListArgs['current_user']->ID)) {
|
630 |
-
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
631 |
-
} else {
|
632 |
-
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
633 |
-
}
|
634 |
-
}
|
635 |
-
$response = [];
|
636 |
-
$response["message"] = wp_list_comments($commentListArgs, $comments);
|
637 |
-
$response["parentCommentID"] = $parentComment->comment_ID;
|
638 |
-
$response["callbackFunctions"] = [];
|
639 |
-
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
640 |
-
wp_send_json_success($response);
|
641 |
-
}
|
642 |
-
}
|
643 |
-
}
|
644 |
-
}
|
645 |
-
|
646 |
-
public function loadMoreComments() {
|
647 |
-
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
648 |
-
$lastParentId = isset($_POST["lastParentId"]) ? intval($_POST["lastParentId"]) : 0;
|
649 |
-
if ($lastParentId >= 0 && $postId) {
|
650 |
-
$this->isWpdiscuzLoaded = true;
|
651 |
-
$isFirstLoad = isset($_POST["isFirstLoad"]) ? intval($_POST["isFirstLoad"]) : 0;
|
652 |
-
// max value of php int for limit
|
653 |
-
$limit = ($isFirstLoad && $this->options->thread_display["commentListLoadType"] == 3) || (!$isFirstLoad && $this->options->thread_display["commentListLoadType"] == 1) ? PHP_INT_MAX - 1 : $this->options->wp["commentPerPage"];
|
654 |
-
$args = ["number" => $limit];
|
655 |
-
$args["wpdType"] = !empty($_POST["wpdType"]) ? trim($_POST["wpdType"]) : "";
|
656 |
-
if ($isFirstLoad) {
|
657 |
-
$args["first_load"] = true;
|
658 |
-
}
|
659 |
-
$sorting = isset($_POST["sorting"]) ? trim($_POST["sorting"]) : "";
|
660 |
-
if ($sorting === "newest") {
|
661 |
-
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
662 |
-
$args["order"] = "desc";
|
663 |
-
} else if ($sorting === "oldest") {
|
664 |
-
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
665 |
-
$args["order"] = "asc";
|
666 |
-
} else if ($sorting === "by_vote") {
|
667 |
-
$args["orderby"] = "by_vote";
|
668 |
-
$args["order"] = $this->options->wp["commentOrder"];
|
669 |
-
}
|
670 |
-
if (isset($args["orderby"]) && $args["orderby"] === "by_vote" && !empty($_POST["offset"]) && ($offset = intval($_POST["offset"]))) {
|
671 |
-
$args["offset"] = $offset * ($isFirstLoad && $this->options->thread_display["commentListLoadType"] == 3 ? 0 : $this->options->wp["commentPerPage"]);
|
672 |
-
}
|
673 |
-
$args["last_parent_id"] = $lastParentId;
|
674 |
-
$args["post_id"] = $postId;
|
675 |
-
$args = apply_filters("wpdiscuz_filter_args", $args);
|
676 |
-
$commentData = $this->getWPComments($args);
|
677 |
-
$commentData["loadLastCommentId"] = $this->dbManager->getLastCommentId($this->commentsArgs);
|
678 |
-
$commentData["callbackFunctions"] = [];
|
679 |
-
$commentData = apply_filters("wpdiscuz_ajax_callbacks", $commentData);
|
680 |
-
wp_send_json_success($commentData);
|
681 |
-
}
|
682 |
-
}
|
683 |
-
|
684 |
-
public function sorting() {
|
685 |
-
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
686 |
-
$sorting = isset($_POST["sorting"]) ? trim($_POST["sorting"]) : "";
|
687 |
-
if ($postId && $sorting) {
|
688 |
-
$this->isWpdiscuzLoaded = true;
|
689 |
-
$args = ["post_id" => $postId];
|
690 |
-
if ($sorting === "newest") {
|
691 |
-
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
692 |
-
$args["order"] = "desc";
|
693 |
-
} else if ($sorting === "oldest") {
|
694 |
-
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
695 |
-
$args["order"] = "asc";
|
696 |
-
} else if ($sorting === "by_vote") {
|
697 |
-
$args["orderby"] = "by_vote";
|
698 |
-
$args["order"] = $this->options->wp["commentOrder"];
|
699 |
-
}
|
700 |
-
$args["first_load"] = 1;
|
701 |
-
$args["wpdType"] = !empty($_POST["wpdType"]) ? trim($_POST["wpdType"]) : "";
|
702 |
-
$args = apply_filters("wpdiscuz_filter_args", $args);
|
703 |
-
$commentData = $this->getWPComments($args);
|
704 |
-
$response = [
|
705 |
-
"last_parent_id" => $commentData["last_parent_id"],
|
706 |
-
"is_show_load_more" => $commentData["is_show_load_more"],
|
707 |
-
"message" => $commentData["comment_list"],
|
708 |
-
"callbackFunctions" => [],
|
709 |
-
];
|
710 |
-
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
711 |
-
wp_send_json_success($response);
|
712 |
-
}
|
713 |
-
}
|
714 |
-
|
715 |
-
/**
|
716 |
-
* get comments by comment type
|
717 |
-
*/
|
718 |
-
public function getWPComments($args = []) {
|
719 |
-
global $post;
|
720 |
-
$postId = isset($args["post_id"]) ? $args["post_id"] : $post->ID;
|
721 |
-
$defaults = $this->getDefaultCommentsArgs($postId);
|
722 |
-
$this->commentsArgs = wp_parse_args($args, $defaults);
|
723 |
-
$commentListArgs = $this->getCommentListArgs($postId);
|
724 |
-
do_action("wpdiscuz_before_getcomments", $this->commentsArgs, $commentListArgs["current_user"], $args);
|
725 |
-
$commentData = [];
|
726 |
-
$commentList = $this->_getWPComments($commentListArgs, $commentData);
|
727 |
-
$commentData["comment_list"] = wp_list_comments($commentListArgs, $commentList);
|
728 |
-
$this->commentsArgs["caller"] = "";
|
729 |
-
if ($this->cache->doGravatarsCache && $this->cache->gravatars) {
|
730 |
-
$this->dbManager->addGravatars($this->cache->gravatars);
|
731 |
-
}
|
732 |
-
return $commentData;
|
733 |
-
}
|
734 |
-
|
735 |
-
public function _getWPComments(&$commentListArgs, &$commentData) {
|
736 |
-
$commentList = [];
|
737 |
-
if ($this->options->wp["isPaginate"]) {// PAGINATION
|
738 |
-
$page = get_query_var("cpage");
|
739 |
-
$this->commentsArgs["number"] = $this->options->wp["commentPerPage"];
|
740 |
-
$this->commentsArgs["order"] = "asc";
|
741 |
-
$this->commentsArgs["caller"] = "";
|
742 |
-
if ($this->options->wp["threadComments"]) {
|
743 |
-
$this->commentsArgs["parent"] = 0;
|
744 |
-
}
|
745 |
-
|
746 |
-
if ($page) {
|
747 |
-
$this->commentsArgs["offset"] = ($page - 1) * $this->options->wp["commentPerPage"];
|
748 |
-
} else if ($this->options->wp["defaultCommentsPage"] == "oldest") {
|
749 |
-
$this->commentsArgs["offset"] = 0;
|
750 |
-
}
|
751 |
-
|
752 |
-
$commentListArgs["page"] = 0;
|
753 |
-
$commentListArgs["per_page"] = 0;
|
754 |
-
$commentListArgs["reverse_top_level"] = ($this->options->wp["commentOrder"] == "desc");
|
755 |
-
|
756 |
-
$commentList = get_comments($this->commentsArgs);
|
757 |
-
if ($this->options->wp["threadComments"] && $commentList) {
|
758 |
-
$commentList = $this->getChildren($commentList, $commentListArgs);
|
759 |
-
}
|
760 |
-
$this->getStickyComments(true, $commentList, $commentListArgs);
|
761 |
-
} else {
|
762 |
-
$limitBefore = $this->commentsArgs["number"];
|
763 |
-
if ($this->commentsArgs["number"]) {
|
764 |
-
$this->commentsArgs["number"] += 1;
|
765 |
-
}
|
766 |
-
if ($this->commentsArgs["wpdType"] === "inline") {
|
767 |
-
$this->commentsArgs["meta_query"] = [
|
768 |
-
[
|
769 |
-
"key" => self::META_KEY_FEEDBACK_FORM_ID,
|
770 |
-
"value" => 0,
|
771 |
-
"compare" => "!=",
|
772 |
-
],
|
773 |
-
];
|
774 |
-
}
|
775 |
-
$commentList = get_comments($this->commentsArgs);
|
776 |
-
$commentListCount = count($commentList);
|
777 |
-
if ($limitBefore && $commentListCount > $limitBefore) {
|
778 |
-
unset($commentList[$commentListCount - 1]);
|
779 |
-
$commentListCount--;
|
780 |
-
$commentData["is_show_load_more"] = true;
|
781 |
-
} else {
|
782 |
-
$commentData["is_show_load_more"] = false;
|
783 |
-
}
|
784 |
-
if ($commentList) {
|
785 |
-
$commentData["last_parent_id"] = $commentList[$commentListCount - 1]->comment_ID;
|
786 |
-
if ($this->options->wp["threadComments"]) {
|
787 |
-
$commentList = $this->getChildren($commentList, $commentListArgs);
|
788 |
-
}
|
789 |
-
} else {
|
790 |
-
$commentData["last_parent_id"] = 0;
|
791 |
-
}
|
792 |
-
$this->getStickyComments(false, $commentList, $commentListArgs);
|
793 |
-
$commentListArgs["page"] = 1;
|
794 |
-
$commentListArgs["last_parent_id"] = $commentData["last_parent_id"];
|
795 |
-
}
|
796 |
-
if ($commentList && $this->options->thread_layouts["highlightVotingButtons"]) {
|
797 |
-
if (!empty($commentListArgs['current_user']->ID)) {
|
798 |
-
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($commentList, $commentListArgs['current_user']->ID);
|
799 |
-
} else {
|
800 |
-
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($commentList, md5($this->helper->getRealIPAddr()));
|
801 |
-
}
|
802 |
-
}
|
803 |
-
return $commentList;
|
804 |
-
}
|
805 |
-
|
806 |
-
private function getChildren($commentList, &$commentListArgs) {
|
807 |
-
$parentComments = [];
|
808 |
-
$args = [
|
809 |
-
"format" => "flat",
|
810 |
-
"status" => $this->commentsArgs["status"],
|
811 |
-
"orderby" => $this->commentsArgs["orderby"],
|
812 |
-
"post_id" => $this->commentsArgs["post_id"],
|
813 |
-
];
|
814 |
-
if (!empty($this->commentsArgs["include_unapproved"])) {
|
815 |
-
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
816 |
-
}
|
817 |
-
foreach ($commentList as $k => $parentComment) {
|
818 |
-
$parentComments[] = $parentComment;
|
819 |
-
$children = $parentComment->get_children($args);
|
820 |
-
if ($this->options->thread_display["isLoadOnlyParentComments"]) {
|
821 |
-
$commentListArgs["wpdiscuz_child_count_" . $parentComment->comment_ID] = count($children);
|
822 |
-
} else {
|
823 |
-
$parentComments = array_merge($parentComments, $children);
|
824 |
-
}
|
825 |
-
}
|
826 |
-
return $parentComments;
|
827 |
-
}
|
828 |
-
|
829 |
-
public function commentsTemplateQueryArgs($args) {
|
830 |
-
global $post;
|
831 |
-
if ($this->isWpdiscuzLoaded) {
|
832 |
-
if ($this->options->wp["isPaginate"]) {
|
833 |
-
$args["caller"] = "wpdiscuz";
|
834 |
-
} else {
|
835 |
-
$args["post__not_in"] = $post->ID;
|
836 |
-
}
|
837 |
-
}
|
838 |
-
return $args;
|
839 |
-
}
|
840 |
-
|
841 |
-
public function preGetComments($queryObj) {
|
842 |
-
if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz-") {
|
843 |
-
$vars = $queryObj->query_vars;
|
844 |
-
$vars["comment__in"] = "";
|
845 |
-
$queryObj->query_vars = $vars;
|
846 |
-
}
|
847 |
-
}
|
848 |
-
|
849 |
-
public function foundCommentsQuery($q, $qObj) {
|
850 |
-
if ($this->options->wp["isPaginate"] && isset($qObj->query_vars["caller"]) && $qObj->query_vars["caller"] === "wpdiscuz" && empty($this->commentsArgs["sticky"])) {
|
851 |
-
global $wpdb, $post;
|
852 |
-
$where = "WHERE";
|
853 |
-
if (!empty($qObj->query_vars["include_unapproved"][0])) {
|
854 |
-
if (is_numeric($qObj->query_vars["include_unapproved"][0])) {
|
855 |
-
$where .= " (comment_approved = '1' OR " . $wpdb->prepare("(user_id = %d AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
|
856 |
-
} else {
|
857 |
-
$where .= " (comment_approved = '1' OR " . $wpdb->prepare("(comment_author_email = %s AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
|
858 |
-
}
|
859 |
-
} else {
|
860 |
-
$where .= " comment_approved = '1'";
|
861 |
-
}
|
862 |
-
$where .= " AND comment_post_ID = {$post->ID}";
|
863 |
-
if ($this->options->wp["threadComments"]) {
|
864 |
-
$where .= " AND comment_parent = 0";
|
865 |
-
}
|
866 |
-
$typesNotIn = apply_filters("wpdiscuz_found_comments_query", [self::WPDISCUZ_STICKY_COMMENT]);
|
867 |
-
foreach ($typesNotIn as $k => &$type) {
|
868 |
-
$type = esc_sql($type);
|
869 |
-
}
|
870 |
-
$where .= " AND comment_type NOT IN ('" . implode("','", $typesNotIn) . "')";
|
871 |
-
$q = "SELECT COUNT(*) FROM {$wpdb->comments} $where";
|
872 |
-
}
|
873 |
-
return $q;
|
874 |
-
}
|
875 |
-
|
876 |
-
/**
|
877 |
-
* add comments clauses
|
878 |
-
* add new orderby clause when sort type is vote and wordpress comments order is older (ASC)
|
879 |
-
*/
|
880 |
-
public function commentsClauses($args) {
|
881 |
-
global $wpdb;
|
882 |
-
if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz" && !$this->options->wp["isPaginate"]) {
|
883 |
-
$orderby = "";
|
884 |
-
$args["caller"] = $this->commentsArgs["caller"] = "wpdiscuz-";
|
885 |
-
if ($this->options->thread_layouts["showVotingButtons"] && $this->commentsArgs["orderby"] === "by_vote") {
|
886 |
-
$args["join"] .= " LEFT JOIN " . $wpdb->commentmeta . " AS `cm` ON " . $wpdb->comments . ".comment_ID = `cm`.comment_id AND (`cm`.meta_key = '" . self::META_KEY_VOTES . "')";
|
887 |
-
$orderby = " IFNULL(`cm`.meta_value,0)+0 DESC, ";
|
888 |
-
} else if ($this->commentsArgs["last_parent_id"] && empty($this->commentsArgs["sticky"])) {
|
889 |
-
$args["where"] = $wpdb->comments . ".`comment_ID`" . ($this->commentsArgs["order"] === 'desc' ? " < " : " > ") . $this->commentsArgs["last_parent_id"] . ($args["where"] ? " AND " : "") . $args["where"];
|
890 |
-
}
|
891 |
-
$args["orderby"] = $orderby . $wpdb->comments . ".`{$this->options->thread_display["orderCommentsBy"]}` ";
|
892 |
-
$args["orderby"] .= isset($args["order"]) ? "" : $this->commentsArgs["order"];
|
893 |
-
}
|
894 |
-
return $args;
|
895 |
-
}
|
896 |
-
|
897 |
-
public function getDefaultCommentsArgs($postId = 0) {
|
898 |
-
global $user_ID;
|
899 |
-
$commenter = wp_get_current_commenter();
|
900 |
-
$args = [
|
901 |
-
"caller" => "wpdiscuz",
|
902 |
-
"post_id" => intval($postId),
|
903 |
-
"last_parent_id" => 0,
|
904 |
-
"orderby" => $this->options->thread_display["orderCommentsBy"],
|
905 |
-
"order" => $this->options->wp["commentOrder"],
|
906 |
-
// max value of php int for limit
|
907 |
-
"number" => $this->options->thread_display["commentListLoadType"] == 3 ? PHP_INT_MAX - 1 : $this->options->wp["commentPerPage"],
|
908 |
-
"status" => !$this->options->wp["isPaginate"] && current_user_can("moderate_comments") ? "all" : "approve",
|
909 |
-
"update_comment_meta_cache" => false,
|
910 |
-
"no_found_rows" => false,
|
911 |
-
"type__not_in" => [self::WPDISCUZ_STICKY_COMMENT],
|
912 |
-
"wpdType" => "",
|
913 |
-
];
|
914 |
-
if ($this->options->wp["threadComments"]) {
|
915 |
-
$args["parent"] = 0;
|
916 |
-
}
|
917 |
-
if (!current_user_can("moderate_comments")) {
|
918 |
-
if ($user_ID) {
|
919 |
-
$args["include_unapproved"] = [$user_ID];
|
920 |
-
} elseif (!empty($commenter["comment_author_email"])) {
|
921 |
-
$args["include_unapproved"] = [$commenter["comment_author_email"]];
|
922 |
-
}
|
923 |
-
}
|
924 |
-
return apply_filters("wpdiscuz_comments_args", $args);
|
925 |
-
}
|
926 |
-
|
927 |
-
/**
|
928 |
-
* register options page for plugin
|
929 |
-
*/
|
930 |
-
public function addPluginOptionsPage() {
|
931 |
-
add_menu_page("wpDiscuz", "wpDiscuz", "manage_options", self::PAGE_WPDISCUZ, "", "dashicons-admin-comments", 26);
|
932 |
-
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Dashboard", "wpdiscuz"), "» " . esc_html__("Dashboard", "wpdiscuz"), "manage_options", self::PAGE_WPDISCUZ, [&$this->options, "dashboard"]);
|
933 |
-
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Settings", "wpdiscuz"), "» " . esc_html__("Settings", "wpdiscuz"), "manage_options", self::PAGE_SETTINGS, [&$this->options, "mainOptionsForm"]);
|
934 |
-
if (!$this->options->general["isUsePoMo"]) {
|
935 |
-
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Phrases", "wpdiscuz"), "» " . esc_html__("Phrases", "wpdiscuz"), "manage_options", self::PAGE_PHRASES, [&$this->options, "phrasesOptionsForm"]);
|
936 |
-
}
|
937 |
-
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Tools", "wpdiscuz"), "» " . esc_html__("Tools", "wpdiscuz"), "manage_options", self::PAGE_TOOLS, [&$this->options, "tools"]);
|
938 |
-
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Addons", "wpdiscuz"), "» " . esc_html__("Addons", "wpdiscuz"), "manage_options", self::PAGE_ADDONS, [&$this->options, "addons"]);
|
939 |
-
}
|
940 |
-
|
941 |
-
/**
|
942 |
-
* Scripts and styles registration on administration pages
|
943 |
-
*/
|
944 |
-
public function backendFiles() {
|
945 |
-
global $typenow, $pagenow;
|
946 |
-
$wp_version = get_bloginfo("version");
|
947 |
-
$wpdiscuzWpPages = apply_filters("wpdiscuz_wp_admin_pages", ["edit-comments.php", "admin.php", "comment.php"]);
|
948 |
-
$wpdiscuzPages = apply_filters("wpdiscuz_admin_pages", [self::PAGE_WPDISCUZ, self::PAGE_SETTINGS, self::PAGE_PHRASES, self::PAGE_TOOLS, self::PAGE_ADDONS]);
|
949 |
-
wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
|
950 |
-
|
951 |
-
if ((isset($_GET["page"]) && in_array($_GET["page"], $wpdiscuzPages) && in_array($pagenow, $wpdiscuzWpPages)) || ($typenow == "wpdiscuz_form") || ($pagenow == self::PAGE_COMMENTS)) {
|
952 |
-
$args = [
|
953 |
-
"msgConfirmResetOptions" => esc_html__("Do you really want to reset all options?", "wpdiscuz"),
|
954 |
-
"msgConfirmResetTabOptions" => esc_html__("Do you really want to reset tab options?", "wpdiscuz"),
|
955 |
-
"msgConfirmRemoveVotes" => esc_html__("Do you really want to remove voting data?", "wpdiscuz"),
|
956 |
-
"msgConfirmResetPhrases" => esc_html__("Do you really want to reset phrases?", "wpdiscuz"),
|
957 |
-
"wmuMsgConfirmAttachmentDelete" => esc_html__("Do you really want to delet this attachment?", "wpdiscuz"),
|
958 |
-
"msgConfirmPurgeGravatarsCache" => esc_html__("Do you really want to delete gravatars cache?", "wpdiscuz"),
|
959 |
-
];
|
960 |
-
// Media Upload Lightbox
|
961 |
-
wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox.css"));
|
962 |
-
wp_enqueue_style("wmu-colorbox-css");
|
963 |
-
wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox.min.js"), ["jquery"]);
|
964 |
-
wp_enqueue_script("wmu-colorbox-js");
|
965 |
-
|
966 |
-
wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-backend.css"));
|
967 |
-
wp_enqueue_style("wpdiscuz-mu-css");
|
968 |
-
wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-backend.js"), ["jquery"], $this->version, true);
|
969 |
-
wp_localize_script("wpdiscuz-mu-js", "wpdiscuzMUJsObj", $args);
|
970 |
-
wp_enqueue_script("wpdiscuz-mu-js");
|
971 |
-
|
972 |
-
wp_enqueue_style("wpdiscuz-font-awesome");
|
973 |
-
wp_register_style("wpdiscuz-cp-index-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/css/index.css"), null, $this->version);
|
974 |
-
wp_enqueue_style("wpdiscuz-cp-index-css");
|
975 |
-
wp_register_style("wpdiscuz-cp-compatibility-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/css/compatibility.css"), null, $this->version);
|
976 |
-
wp_enqueue_style("wpdiscuz-cp-compatibility-css");
|
977 |
-
wp_register_script("wpdiscuz-cp-colors-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/js/colors.js"), ["jquery"], $this->version, false);
|
978 |
-
wp_enqueue_script("wpdiscuz-cp-colors-js");
|
979 |
-
wp_register_script("wpdiscuz-cp-colorpicker-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/js/jqColorPicker.min.js"), ["jquery"], $this->version, false);
|
980 |
-
wp_enqueue_script("wpdiscuz-cp-colorpicker-js");
|
981 |
-
wp_register_script("wpdiscuz-cp-index-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/js/index.js"), ["jquery"], $this->version, false);
|
982 |
-
wp_enqueue_script("wpdiscuz-cp-index-js");
|
983 |
-
wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
|
984 |
-
wp_enqueue_style("wpdiscuz-options-css");
|
985 |
-
wp_register_script("wpdiscuz-options-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-options.js"), ["jquery"], $this->version);
|
986 |
-
wp_enqueue_script("wpdiscuz-options-js");
|
987 |
-
wp_localize_script("wpdiscuz-options-js", "wpdiscuzObj", $args);
|
988 |
-
wp_enqueue_script("thickbox");
|
989 |
-
wp_register_script("wpdiscuz-contenthover", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/contenthover/jquery.contenthover.min.js"), ["jquery"], $this->version, true);
|
990 |
-
wp_enqueue_script("wpdiscuz-contenthover");
|
991 |
-
|
992 |
-
if (isset($_GET["page"])) {
|
993 |
-
wp_register_style("wpdiscuz-easy-responsive-tabs-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css"), null, $this->version);
|
994 |
-
wp_enqueue_style("wpdiscuz-easy-responsive-tabs-css");
|
995 |
-
wp_register_script("wpdiscuz-easy-responsive-tabs-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js"), ["jquery"], $this->version, true);
|
996 |
-
wp_enqueue_script("wpdiscuz-easy-responsive-tabs-js");
|
997 |
-
wp_register_script("wpdiscuz-jquery-cookie", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
|
998 |
-
wp_enqueue_script("wpdiscuz-jquery-cookie");
|
999 |
-
wp_register_script("wpdiscuz-chart-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/chart/chart.min.js"), [], $this->version, true);
|
1000 |
-
wp_enqueue_script("wpdiscuz-chart-js");
|
1001 |
-
}
|
1002 |
-
} else if ($pagenow == "comment.php") {
|
1003 |
-
wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
|
1004 |
-
wp_enqueue_style("wpdiscuz-options-css");
|
1005 |
-
wp_enqueue_style("wpdiscuz-font-awesome");
|
1006 |
-
}
|
1007 |
-
if (version_compare($wp_version, "4.2.0", ">=")) {
|
1008 |
-
wp_register_script("wpdiscuz-addon-notes", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-notes.js"), ["jquery"], $this->version, true);
|
1009 |
-
wp_enqueue_script("wpdiscuz-addon-notes");
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
if (!get_option(self::OPTION_SLUG_DEACTIVATION) && (strpos($this->requestUri, "/plugins.php") !== false)) {
|
1013 |
-
$reasonArgs = [
|
1014 |
-
"msgReasonRequired" => esc_html__("Please check one of reasons before sending feedback!", "wpdiscuz"),
|
1015 |
-
"msgReasonDescRequired" => esc_html__("Please provide more information", "wpdiscuz"),
|
1016 |
-
"adminUrl" => get_admin_url()
|
1017 |
-
];
|
1018 |
-
wp_register_style("wpdiscuz-lity-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.css"), null, $this->version);
|
1019 |
-
wp_enqueue_style("wpdiscuz-lity-css");
|
1020 |
-
wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.js"), ["jquery"], $this->version);
|
1021 |
-
wp_enqueue_script("wpdiscuz-lity-js");
|
1022 |
-
wp_register_style("wpdiscuz-deactivation-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-deactivation.css"));
|
1023 |
-
wp_enqueue_style("wpdiscuz-deactivation-css");
|
1024 |
-
wp_register_script("wpdiscuz-deactivation-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-deactivation.js"), ["jquery"], $this->version);
|
1025 |
-
wp_enqueue_script("wpdiscuz-deactivation-js");
|
1026 |
-
wp_localize_script("wpdiscuz-deactivation-js", "deactivationObj", $reasonArgs);
|
1027 |
-
}
|
1028 |
-
wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", null);
|
1029 |
-
wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js");
|
1030 |
-
wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", "wpdObject", ["ajaxUrl" => admin_url("admin-ajax.php"), "shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE, "image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"), "tooltip" => $this->options->phrases["wc_feedback_shortcode_tooltip"], "popup_title" => $this->options->phrases["wc_feedback_popup_title"], "leave_feebdack" => $this->options->phrases["wc_please_leave_feebdack"], "no_text_selected" => esc_html__("No text is selected. Please select a part of text from post content.", "wpdiscuz")]);
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
/**
|
1034 |
-
* Styles and scripts registration to use on front page
|
1035 |
-
*/
|
1036 |
-
public function frontendFiles() {
|
1037 |
-
global $post;
|
1038 |
-
$this->isWpdiscuzLoaded = $this->helper->isLoadWpdiscuz($post);
|
1039 |
-
$suf = $this->options->general["loadMinVersion"] ? ".min" : "";
|
1040 |
-
wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
|
1041 |
-
wp_register_style("wpdiscuz-ratings", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings$suf.css"), null, $this->version);
|
1042 |
-
wp_register_style("wpdiscuz-ratings-rtl", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings-rtl$suf.css"), null, $this->version);
|
1043 |
-
if (!$this->isWpdiscuzLoaded && $this->options->rating["ratingCssOnNoneSingular"]) {
|
1044 |
-
wp_enqueue_style("wpdiscuz-ratings");
|
1045 |
-
if (is_rtl()) {
|
1046 |
-
wp_enqueue_style("wpdiscuz-ratings-rtl");
|
1047 |
-
}
|
1048 |
-
}
|
1049 |
-
if ($this->isWpdiscuzLoaded) {
|
1050 |
-
$this->form = $this->wpdiscuzForm->getForm($post->ID);
|
1051 |
-
$this->form->initFormMeta();
|
1052 |
-
$this->wpdiscuzOptionsJs = $this->options->getOptionsForJs();
|
1053 |
-
$this->wpdiscuzOptionsJs["version"] = $this->version;
|
1054 |
-
$this->wpdiscuzOptionsJs["wc_post_id"] = $post->ID;
|
1055 |
-
$this->wpdiscuzOptionsJs["loadLastCommentId"] = 0;
|
1056 |
-
$this->wpdiscuzOptionsJs["isCookiesEnabled"] = has_action("set_comment_cookies");
|
1057 |
-
if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
|
1058 |
-
$cArgs = $this->getDefaultCommentsArgs($post->ID);
|
1059 |
-
$this->wpdiscuzOptionsJs["loadLastCommentId"] = $this->dbManager->getLastCommentId($cArgs);
|
1060 |
-
}
|
1061 |
-
if ($this->form->showRecaptcha() && apply_filters("wpdiscuz_recaptcha_site_key", $this->options->recaptcha["siteKey"]) && apply_filters("wpdiscuz_recaptcha_secret", $this->options->recaptcha["secretKey"])) {
|
1062 |
-
wp_register_script("wpdiscuz-google-recaptcha", apply_filters("wpdiscuz_recaptcha_url", $this->options->recaptcha["reCaptchaUrl"]), null, "1.0.0", true);
|
1063 |
-
wp_enqueue_script("wpdiscuz-google-recaptcha");
|
1064 |
-
}
|
1065 |
-
$this->wpdiscuzOptionsJs["dataFilterCallbacks"] = [];
|
1066 |
-
$this->wpdiscuzOptionsJs = apply_filters("wpdiscuz_js_options", $this->wpdiscuzOptionsJs, $this->options);
|
1067 |
-
$this->wpdiscuzOptionsJs["url"] = admin_url("admin-ajax.php");
|
1068 |
-
$this->wpdiscuzOptionsJs["customAjaxUrl"] = plugins_url(WPDISCUZ_DIR_NAME . "/utils/ajax/wpdiscuz-ajax.php");
|
1069 |
-
$this->wpdiscuzOptionsJs["bubbleUpdateUrl"] = rest_url("wpdiscuz/v1/update");
|
1070 |
-
$loadQuill = $this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop");
|
1071 |
-
$customCSSSlug = "wpdiscuz-frontend-custom-css";
|
1072 |
-
$customFileName = "style-custom";
|
1073 |
-
if (is_rtl()) {
|
1074 |
-
$customCSSSlug = "wpdiscuz-frontend-custom-rtl-css";
|
1075 |
-
$customFileName = "style-custom-rtl";
|
1076 |
-
if ($this->options->thread_styles["theme"] === "wpd-minimal") {
|
1077 |
-
$cssSlug = "wpdiscuz-frontend-minimal-rtl-css";
|
1078 |
-
$fileName = "style-minimal-rtl";
|
1079 |
-
} else {
|
1080 |
-
$cssSlug = "wpdiscuz-frontend-rtl-css";
|
1081 |
-
$fileName = "style-rtl";
|
1082 |
-
}
|
1083 |
-
} else if ($this->options->thread_styles["theme"] === "wpd-minimal") {
|
1084 |
-
$cssSlug = "wpdiscuz-frontend-minimal-css";
|
1085 |
-
$fileName = "style-minimal";
|
1086 |
-
} else {
|
1087 |
-
$cssSlug = "wpdiscuz-frontend-css";
|
1088 |
-
$fileName = "style";
|
1089 |
-
}
|
1090 |
-
$this->helper->enqueueWpDiscuzStyle($cssSlug, $fileName, $this->version, $this->form);
|
1091 |
-
$this->helper->enqueueWpDiscuzStyle($customCSSSlug, $customFileName, $this->version, $this->form);
|
1092 |
-
wp_add_inline_style($cssSlug, $this->helper->initCustomCss());
|
1093 |
-
$ucArgs = [
|
1094 |
-
"msgConfirmDeleteComment" => esc_html($this->options->phrases["wc_confirm_comment_delete"]),
|
1095 |
-
"msgConfirmCancelSubscription" => esc_html($this->options->phrases["wc_confirm_cancel_subscription"]),
|
1096 |
-
"msgConfirmCancelFollow" => esc_html($this->options->phrases["wc_confirm_cancel_follow"]),
|
1097 |
-
"additionalTab" => (int) apply_filters("wpdiscuz_enable_content_modal", false),
|
1098 |
-
];
|
1099 |
-
if ($this->options->thread_styles["enableFontAwesome"]) {
|
1100 |
-
if ($this->form->hasIcon) {
|
1101 |
-
wp_enqueue_style("wpdiscuz-font-awesome");
|
1102 |
-
} else {
|
1103 |
-
wp_register_style("wpdiscuz-fa", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fa.min.css"), null, $this->version);
|
1104 |
-
wp_enqueue_style("wpdiscuz-fa");
|
1105 |
-
}
|
1106 |
-
}
|
1107 |
-
if ($this->options->general["loadComboVersion"]) {
|
1108 |
-
$combo_js = "";
|
1109 |
-
$combo_css = "";
|
1110 |
-
if (!$loadQuill) {
|
1111 |
-
$combo_js .= "-no_quill";
|
1112 |
-
$combo_css .= "-no_quill";
|
1113 |
-
}
|
1114 |
-
wp_register_style("wpdiscuz-combo-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-combo$combo_css.min.css"));
|
1115 |
-
wp_enqueue_style("wpdiscuz-combo-css");
|
1116 |
-
wp_register_script("wpdiscuz-combo-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-combo$combo_js.min.js"), ["jquery"], $this->version, true);
|
1117 |
-
wp_enqueue_script("wpdiscuz-combo-js");
|
1118 |
-
wp_localize_script("wpdiscuz-combo-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
|
1119 |
-
wp_localize_script("wpdiscuz-combo-js", "wpdiscuzUCObj", $ucArgs);
|
1120 |
-
if ($loadQuill) {
|
1121 |
-
wp_add_inline_script("wpdiscuz-combo$combo_js-js", $this->options->editorOptions(), "before");
|
1122 |
-
}
|
1123 |
-
} else {
|
1124 |
-
wp_register_script("wpdiscuz-cookie-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
|
1125 |
-
wp_enqueue_script("wpdiscuz-cookie-js");
|
1126 |
-
//
|
1127 |
-
if ($loadQuill) {
|
1128 |
-
wp_register_style("quill-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/quill/quill.snow$suf.css"), null, "1.3.6");
|
1129 |
-
wp_enqueue_style("quill-css");
|
1130 |
-
wp_register_script("quill", plugins_url("/assets/third-party/quill/quill$suf.js", __FILE__), ["wpdiscuz-cookie-js"], "1.3.6", true);
|
1131 |
-
wp_enqueue_script("quill");
|
1132 |
-
wp_add_inline_script("quill", $this->options->editorOptions(), "before");
|
1133 |
-
wp_register_script("wpd-editor", plugins_url("/assets/js/wpd-editor$suf.js", __FILE__), ["quill"], "1.3.6", true);
|
1134 |
-
wp_enqueue_script("wpd-editor");
|
1135 |
-
}
|
1136 |
-
wp_register_script("autogrowtextarea-js", plugins_url("/assets/third-party/autogrow/jquery.autogrowtextarea.min.js", __FILE__), ["jquery"], "1.3.6", true);
|
1137 |
-
wp_enqueue_script("autogrowtextarea-js");
|
1138 |
-
wp_register_script("wpdiscuz-ajax-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz$suf.js"), [$loadQuill ? "wpd-editor" : "jquery"], $this->version, true);
|
1139 |
-
wp_enqueue_script("wpdiscuz-ajax-js");
|
1140 |
-
wp_localize_script("wpdiscuz-ajax-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
|
1141 |
-
//
|
1142 |
-
if ($this->options->content["wmuIsEnabled"]) {
|
1143 |
-
// Media Upload Lightbox
|
1144 |
-
if ($this->options->content["wmuIsLightbox"]) {
|
1145 |
-
wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox$suf.css"));
|
1146 |
-
wp_enqueue_style("wmu-colorbox-css");
|
1147 |
-
wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox$suf.js"), ["jquery"], $this->version, true);
|
1148 |
-
wp_enqueue_script("wmu-colorbox-js");
|
1149 |
-
}
|
1150 |
-
wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-frontend$suf.css"));
|
1151 |
-
wp_enqueue_style("wpdiscuz-mu-css");
|
1152 |
-
wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-frontend$suf.js"), ["wpdiscuz-ajax-js"], $this->version, true);
|
1153 |
-
wp_enqueue_script("wpdiscuz-mu-js");
|
1154 |
-
}
|
1155 |
-
if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
|
1156 |
-
wp_register_style("wpdiscuz-user-content-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-user-content$suf.css"), null, $this->version);
|
1157 |
-
wp_enqueue_style("wpdiscuz-user-content-css");
|
1158 |
-
wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity$suf.js"), ["jquery"], $this->version, true);
|
1159 |
-
wp_enqueue_script("wpdiscuz-lity-js");
|
1160 |
-
wp_register_script("wpdiscuz-user-content-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-user-content$suf.js"), ["wpdiscuz-lity-js"], $this->version, true);
|
1161 |
-
wp_enqueue_script("wpdiscuz-user-content-js");
|
1162 |
-
wp_localize_script("wpdiscuz-user-content-js", "wpdiscuzUCObj", $ucArgs);
|
1163 |
-
}
|
1164 |
-
}
|
1165 |
-
if (!$loadQuill && $this->options->form["enableQuickTags"]) {
|
1166 |
-
wp_enqueue_script("quicktags");
|
1167 |
-
wp_register_script("wpdiscuz-quicktags", plugins_url("/assets/third-party/quicktags/wpdiscuz-quictags.js", __FILE__), [$this->options->general["loadComboVersion"] ? "wpdiscuz-combo-js" : "wpdiscuz-ajax-js"], $this->version, true);
|
1168 |
-
wp_enqueue_script("wpdiscuz-quicktags");
|
1169 |
-
}
|
1170 |
-
do_action("wpdiscuz_front_scripts", $this->options);
|
1171 |
-
}
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
public function pluginNewVersion() {
|
1175 |
-
$pluginData = get_plugin_data(__FILE__);
|
1176 |
-
if (version_compare($pluginData["Version"], $this->version, ">")) {
|
1177 |
-
$this->dbManager->dbCreateTables();
|
1178 |
-
$this->wpdiscuzForm->createDefaultForm($this->version);
|
1179 |
-
$options = $this->changeOldOptions(get_option(self::OPTION_SLUG_OPTIONS), $pluginData);
|
1180 |
-
if ($this->version === "5.3.2") {
|
1181 |
-
$this->mergeOptions($options);
|
1182 |
-
} else {
|
1183 |
-
$this->addNewOptions($options);
|
1184 |
-
}
|
1185 |
-
$this->addNewPhrases();
|
1186 |
-
update_option(self::OPTION_SLUG_VERSION, $pluginData["Version"]);
|
1187 |
-
|
1188 |
-
if (version_compare($this->version, "2.1.2", "<=") && version_compare($this->version, "1.0.0", "!=")) {
|
1189 |
-
$this->dbManager->alterPhrasesTable();
|
1190 |
-
}
|
1191 |
-
|
1192 |
-
if (version_compare($this->version, "2.1.7", "<=") && version_compare($this->version, "1.0.0", "!=")) {
|
1193 |
-
$this->dbManager->alterVotingTable();
|
1194 |
-
}
|
1195 |
-
|
1196 |
-
if (version_compare($this->version, "5.0.5", "<=") && version_compare($this->version, "1.0.0", "!=")) {
|
1197 |
-
$this->dbManager->alterNotificationTable();
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
if (version_compare($this->version, "5.1.2", "<=")) {
|
1201 |
-
$this->dbManager->deleteOldStatisticCaches();
|
1202 |
-
}
|
1203 |
-
|
1204 |
-
if (version_compare($this->version, "7.0.0", "<")) {
|
1205 |
-
$this->deactivateAddons();
|
1206 |
-
if (version_compare($this->version, "1.0.0", "!=") && version_compare($this->version, "7.0.0-beta-1", "<")) {
|
1207 |
-
$this->dbManager->alterVotingTableForDateAndPostId();
|
1208 |
-
$this->options->replaceOldOptions($options);
|
1209 |
}
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
add_option(self::OPTION_SLUG_SHOW_CLOSED_REG_MESSAGE, ($showClosedRegenerate ? "1" : "0"), "", "no");
|
1215 |
-
$showVoteDataRegenerate = intval($this->dbManager->showVoteDataRegenerate());
|
1216 |
-
add_option(self::OPTION_SLUG_SHOW_VOTE_DATA_REG_MESSAGE, ($showVoteDataRegenerate ? "1" : "0"), "", "no");
|
1217 |
-
add_option(self::OPTION_SLUG_SHOW_SYNC_COMMENTERS_MESSAGE, ($this->dbManager->usersHaveComments() ? "1" : "0"), "", "no");
|
1218 |
-
add_option(self::OPTION_SLUG_WIZARD_COMPLETED, "0", "", "no");
|
1219 |
-
add_option(self::OPTION_SLUG_WIZARD_AFTER_UPDATE, ($this->version === "1.0.0" ? "0" : "1"), "", "no");
|
1220 |
-
$this->removeOldFiles();
|
1221 |
-
$this->dbManager->deleteStatisticCaches();
|
1222 |
-
if (($advancedNocaptcha = get_option("anr_admin_options")) && !empty($advancedNocaptcha["enabled_forms"]) && ($key = array_search("comment", $advancedNocaptcha["enabled_forms"]))) {
|
1223 |
-
unset($advancedNocaptcha["enabled_forms"][$key]);
|
1224 |
-
update_option("anr_admin_options", $advancedNocaptcha);
|
1225 |
-
}
|
1226 |
-
if (($invisibleRecaptcha = get_option("ic-wordpress-settings")) && !empty($invisibleRecaptcha["CF"])) {
|
1227 |
-
unset($invisibleRecaptcha["CF"]);
|
1228 |
-
update_option("ic-wordpress-settings", $invisibleRecaptcha);
|
1229 |
-
}
|
1230 |
-
}
|
1231 |
-
if (version_compare($this->version, "7.0.3", "<") && version_compare($this->version, "1.0.0", "!=")) {
|
1232 |
-
$this->dbManager->alterSubscriptionTable();
|
1233 |
-
}
|
1234 |
-
do_action("wpdiscuz_clean_all_caches", $pluginData["Version"], $this->version);
|
1235 |
-
}
|
1236 |
-
do_action("wpdiscuz_check_version");
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
/**
|
1240 |
-
* remove old captcha files
|
1241 |
-
*/
|
1242 |
-
private function removeOldFiles() {
|
1243 |
-
$wpUploadsDir = wp_upload_dir();
|
1244 |
-
$captchaDir = $wpUploadsDir["basedir"] . "/wpdiscuz/captcha/";
|
1245 |
-
if (file_exists($captchaDir)) {
|
1246 |
-
$files = function_exists("scandir") ? scandir($captchaDir) : false;
|
1247 |
-
if ($files && is_array($files)) {
|
1248 |
-
foreach ($files as $k => $file) {
|
1249 |
-
if ($file != "." && $file != "..") {
|
1250 |
-
$fileName = $captchaDir . $file;
|
1251 |
-
if (is_file($fileName)) {
|
1252 |
-
@unlink($fileName);
|
1253 |
-
} else {
|
1254 |
-
@rmdir($fileName);
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
}
|
1258 |
-
}
|
1259 |
-
@rmdir($captchaDir);
|
1260 |
-
}
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
private function deactivateAddons() {
|
1264 |
-
$plugins = [];
|
1265 |
-
if (is_plugin_active("wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php")) {
|
1266 |
-
$plugins[] = "wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php";
|
1267 |
-
}
|
1268 |
-
if (is_plugin_active("wpdiscuz-advanced-likers/class.WpdiscuzVoters.php")) {
|
1269 |
-
$plugins[] = "wpdiscuz-advanced-likers/class.WpdiscuzVoters.php";
|
1270 |
-
}
|
1271 |
-
if (is_plugin_active("wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php")) {
|
1272 |
-
$plugins[] = "wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php";
|
1273 |
-
}
|
1274 |
-
if (is_plugin_active("wpdiscuz-comment-search/wpDiscuzCommentSearch.php")) {
|
1275 |
-
$plugins[] = "wpdiscuz-comment-search/wpDiscuzCommentSearch.php";
|
1276 |
-
}
|
1277 |
-
if (is_plugin_active("wpdiscuz-comment-translation/wpdiscuz-translate.php")) {
|
1278 |
-
$plugins[] = "wpdiscuz-comment-translation/wpdiscuz-translate.php";
|
1279 |
-
}
|
1280 |
-
if (is_plugin_active("wpdiscuz-emoticons/wpDiscuzSmile.php")) {
|
1281 |
-
$plugins[] = "wpdiscuz-emoticons/wpDiscuzSmile.php";
|
1282 |
-
}
|
1283 |
-
if (is_plugin_active("wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php")) {
|
1284 |
-
$plugins[] = "wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php";
|
1285 |
-
}
|
1286 |
-
if (is_plugin_active("wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php")) {
|
1287 |
-
$plugins[] = "wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php";
|
1288 |
-
}
|
1289 |
-
if (is_plugin_active("wpdiscuz-mycred/wpdiscuz-mc.php")) {
|
1290 |
-
$plugins[] = "wpdiscuz-mycred/wpdiscuz-mc.php";
|
1291 |
-
}
|
1292 |
-
if (is_plugin_active("wpdiscuz-online-users/wpdiscuz-ou.php")) {
|
1293 |
-
$plugins[] = "wpdiscuz-online-users/wpdiscuz-ou.php";
|
1294 |
-
}
|
1295 |
-
if (is_plugin_active("wpdiscuz-recaptcha/wpDiscuzReCaptcha.php")) {
|
1296 |
-
$plugins[] = "wpdiscuz-recaptcha/wpDiscuzReCaptcha.php";
|
1297 |
-
}
|
1298 |
-
if (is_plugin_active("wpdiscuz-report-flagging/wpDiscuzFlagComment.php")) {
|
1299 |
-
$plugins[] = "wpdiscuz-report-flagging/wpDiscuzFlagComment.php";
|
1300 |
-
}
|
1301 |
-
if (is_plugin_active("wpdiscuz-subscribe-manager/wpdSubscribeManager.php")) {
|
1302 |
-
$plugins[] = "wpdiscuz-subscribe-manager/wpdSubscribeManager.php";
|
1303 |
-
}
|
1304 |
-
if (is_plugin_active("wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php")) {
|
1305 |
-
$plugins[] = "wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php";
|
1306 |
-
}
|
1307 |
-
if (is_plugin_active("wpdiscuz-widgets/wpDiscuzWidgets.php")) {
|
1308 |
-
$plugins[] = "wpdiscuz-widgets/wpDiscuzWidgets.php";
|
1309 |
-
}
|
1310 |
-
if ($plugins) {
|
1311 |
-
deactivate_plugins($plugins);
|
1312 |
-
add_option(self::OPTION_SLUG_WIZARD_SHOW_ADDONS_MSG, "1", "", "no");
|
1313 |
-
}
|
1314 |
-
}
|
1315 |
-
|
1316 |
-
/**
|
1317 |
-
* set recaptcha options
|
1318 |
-
*/
|
1319 |
-
private function setRecaptchaOptions($options) {
|
1320 |
-
if (!$options[self::TAB_RECAPTCHA]["siteKey"] && ($recaptchaSettings = get_option("wpdiscuz_recaptcha"))) {
|
1321 |
-
$options[self::TAB_RECAPTCHA]["siteKey"] = $recaptchaSettings["site_key"];
|
1322 |
-
$options[self::TAB_RECAPTCHA]["secretKey"] = $recaptchaSettings["secret_key"];
|
1323 |
-
$options[self::TAB_RECAPTCHA]["theme"] = $recaptchaSettings["theme"];
|
1324 |
-
$options[self::TAB_RECAPTCHA]["lang"] = $recaptchaSettings["lang"];
|
1325 |
-
$options[self::TAB_RECAPTCHA]["showForGuests"] = 1;
|
1326 |
-
$options[self::TAB_RECAPTCHA]["requestMethod"] = $recaptchaSettings["request_method"];
|
1327 |
-
$options[self::TAB_RECAPTCHA]["isShowOnSubscribeForm"] = $recaptchaSettings["isShowOnSubscribeForm"] === "on" ? 1 : 0;
|
1328 |
-
$this->options->initOptions($options);
|
1329 |
-
$this->options->updateOptions();
|
1330 |
-
}
|
1331 |
-
}
|
1332 |
-
|
1333 |
-
/**
|
1334 |
-
* merge old and new options
|
1335 |
-
*/
|
1336 |
-
private function addNewOptions(&$options) {
|
1337 |
-
$options = array_merge($this->options->getDefaultOptions(), $options);
|
1338 |
-
$this->options->initOptions($options);
|
1339 |
-
$this->options->updateOptions();
|
1340 |
-
}
|
1341 |
-
|
1342 |
-
/**
|
1343 |
-
* merge old and new options recursively
|
1344 |
-
*/
|
1345 |
-
private function mergeOptions(&$options) {
|
1346 |
-
$newOptions = [];
|
1347 |
-
$defaults = $this->options->getDefaultOptions();
|
1348 |
-
foreach ($options as $key => $value) {
|
1349 |
-
$newOptions[$key] = array_merge($defaults[$key], $value);
|
1350 |
-
}
|
1351 |
-
$options = $newOptions;
|
1352 |
-
$this->options->initOptions($options);
|
1353 |
-
$this->options->updateOptions();
|
1354 |
-
}
|
1355 |
-
|
1356 |
-
/**
|
1357 |
-
* merge old and new phrases
|
1358 |
-
*/
|
1359 |
-
private function addNewPhrases() {
|
1360 |
-
if ($this->dbManager->isPhraseExists("wc_be_the_first_text")) {
|
1361 |
-
$wc_saved_phrases = $this->dbManager->getPhrases();
|
1362 |
-
$this->options->initPhrases();
|
1363 |
-
$wc_phrases = $this->options->phrases;
|
1364 |
-
$wc_new_phrases = array_merge($wc_phrases, $wc_saved_phrases);
|
1365 |
-
$this->dbManager->updatePhrases($wc_new_phrases);
|
1366 |
-
}
|
1367 |
-
}
|
1368 |
-
|
1369 |
-
/**
|
1370 |
-
* change old options if needed
|
1371 |
-
*/
|
1372 |
-
private function changeOldOptions($options, $pluginData) {
|
1373 |
-
$oldOptions = maybe_unserialize($options);
|
1374 |
-
if (isset($oldOptions["wc_comment_list_order"])) {
|
1375 |
-
update_option("comment_order", $oldOptions["wc_comment_list_order"]);
|
1376 |
-
}
|
1377 |
-
if (isset($oldOptions["wc_comment_count"])) {
|
1378 |
-
update_option("comments_per_page", $oldOptions["wc_comment_count"]);
|
1379 |
-
}
|
1380 |
-
if (isset($oldOptions["wc_load_all_comments"])) {
|
1381 |
-
$this->options->commentListLoadType = 1;
|
1382 |
-
}
|
1383 |
-
if (isset($this->options->disableFontAwesome) && $this->options->disableFontAwesome && $pluginData["Version"] == "5.0.4") {
|
1384 |
-
$this->options->disableFontAwesome = 0;
|
1385 |
-
$oldOptions["disableFontAwesome"] = 0;
|
1386 |
-
}
|
1387 |
-
|
1388 |
-
if (version_compare($this->version, "5.2.1", "<=")) {
|
1389 |
-
$oldOptions["isNativeAjaxEnabled"] = 1;
|
1390 |
-
}
|
1391 |
-
if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.2", "<")) {
|
1392 |
-
$oldOptions[self::TAB_RATING]["enablePostRatingSchema"] = 0;
|
1393 |
-
}
|
1394 |
-
if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.4", "<")) {
|
1395 |
-
$newMimeTypes = [];
|
1396 |
-
foreach ($oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] as $exts => $type) {
|
1397 |
-
foreach (explode('|', $exts) as $k => $ext) {
|
1398 |
-
$newMimeTypes[$ext] = $type;
|
1399 |
}
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
}
|
1405 |
-
|
1406 |
-
// Add settings link on plugin page
|
1407 |
-
public function addPluginSettingsLink($links) {
|
1408 |
-
$links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_WPDISCUZ)) . "'>" . esc_html__("Dashboard", "wpdiscuz") . "</a>";
|
1409 |
-
$links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_SETTINGS)) . "'>" . esc_html__("Settings", "wpdiscuz") . "</a>";
|
1410 |
-
if (!$this->options->general["isUsePoMo"]) {
|
1411 |
-
$links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_PHRASES)) . "'>" . esc_html__("Phrases", "wpdiscuz") . "</a>";
|
1412 |
-
}
|
1413 |
-
return $links;
|
1414 |
-
}
|
1415 |
-
|
1416 |
-
public function initCurrentPostType() {
|
1417 |
-
global $post;
|
1418 |
-
if ($this->isWpdiscuzLoaded) {
|
1419 |
-
$this->form = $this->wpdiscuzForm->getForm($post->ID);
|
1420 |
-
add_filter("comments_template", [&$this, "addCommentForm"], 9999999);
|
1421 |
-
}
|
1422 |
-
}
|
1423 |
-
|
1424 |
-
public function addContentModal() {
|
1425 |
-
echo "<a href='javascript:void(0);' id='wpdUserContentInfoAnchor' style='display:none;' rel='#wpdUserContentInfo' data-wpd-lity>wpDiscuz</a>";
|
1426 |
-
echo "<div id='wpdUserContentInfo' style='overflow:auto;background:#FDFDF6;padding:20px;width:600px;max-width:100%;border-radius:6px;' class='lity-hide'></div>";
|
1427 |
-
}
|
1428 |
-
|
1429 |
-
public function saveLastVisit($post) {
|
1430 |
-
$currentUser = WpdiscuzHelper::getCurrentUser();
|
1431 |
-
if (!empty($currentUser->ID)) {
|
1432 |
-
$lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true);
|
1433 |
-
$lastVisit = is_array($lastVisit) ? $lastVisit : [];
|
1434 |
-
$lastVisit[$post->ID] = current_time("timestamp");
|
1435 |
-
update_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, $lastVisit);
|
1436 |
-
}
|
1437 |
-
}
|
1438 |
-
|
1439 |
-
public function addCommentForm($file) {
|
1440 |
-
return $this->helper->getCommentFormPath($this->form->getTheme());
|
1441 |
-
}
|
1442 |
-
|
1443 |
-
public function getCommentListArgs($postId) {
|
1444 |
-
$post = get_post($postId);
|
1445 |
-
$postsAuthors = $post->comment_count && $this->options->login["enableProfileURLs"] ? $this->dbManager->getPostsAuthors() : [];
|
1446 |
-
$voteSvgs = [
|
1447 |
-
"fa-plus|fa-minus" => [
|
1448 |
-
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='plus' class='svg-inline--fa fa-plus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
|
1449 |
-
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='minus' class='svg-inline--fa fa-minus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
|
1450 |
-
],
|
1451 |
-
"fa-chevron-up|fa-chevron-down" => [
|
1452 |
-
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-up' class='svg-inline--fa fa-chevron-up fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z'></path></svg>",
|
1453 |
-
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-down' class='svg-inline--fa fa-chevron-down fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z'></path></svg>",
|
1454 |
-
],
|
1455 |
-
"fa-thumbs-up|fa-thumbs-down" => [
|
1456 |
-
"<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0V0z'/><path d='M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z'/></svg>",
|
1457 |
-
"<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0z'/><path d='M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z'/></svg>",
|
1458 |
-
],
|
1459 |
-
"fa-smile|fa-frown" => [
|
1460 |
-
"<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='smile' class='svg-inline--fa fa-smile fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z'></path></svg>",
|
1461 |
-
"<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='frown' class='svg-inline--fa fa-frown fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160-64c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-80 128c-40.2 0-78 17.7-103.8 48.6-8.5 10.2-7.1 25.3 3.1 33.8 10.2 8.4 25.3 7.1 33.8-3.1 16.6-19.9 41-31.4 66.9-31.4s50.3 11.4 66.9 31.4c8.1 9.7 23.1 11.9 33.8 3.1 10.2-8.5 11.5-23.6 3.1-33.8C326 321.7 288.2 304 248 304z'></path></svg>",
|
1462 |
-
],
|
1463 |
-
];
|
1464 |
-
$currentUser = WpdiscuzHelper::getCurrentUser();
|
1465 |
-
$currentUserEmail = "";
|
1466 |
-
$isUserLoggedIn = false;
|
1467 |
-
if (!empty($currentUser->ID)) {
|
1468 |
-
$currentUserEmail = $currentUser->user_email;
|
1469 |
-
$isUserLoggedIn = true;
|
1470 |
-
} else if (!empty($_COOKIE["comment_author_email_" . COOKIEHASH])) {
|
1471 |
-
$currentUserEmail = urldecode(trim($_COOKIE["comment_author_email_" . COOKIEHASH]));
|
1472 |
-
}
|
1473 |
-
$this->form = $this->wpdiscuzForm->getForm($postId);
|
1474 |
-
$high_level_user = current_user_can("moderate_comments");
|
1475 |
-
$can_stick_or_close = $post->post_author == $currentUser->ID;
|
1476 |
-
$post_permalink = get_permalink($postId);
|
1477 |
-
$theme = $this->form->getTheme();
|
1478 |
-
$layout = $this->form->getLayout();
|
1479 |
-
$replyForWoo = apply_filters("wpdiscuz_product_review_replies", true, $postId);
|
1480 |
-
include_once $this->helper->getWalkerPath($theme);
|
1481 |
-
$args = [
|
1482 |
-
"style" => "div",
|
1483 |
-
"echo" => false,
|
1484 |
-
"isSingle" => false,
|
1485 |
-
"reverse_top_level" => false,
|
1486 |
-
"post_id" => $postId,
|
1487 |
-
"reverse_children" => !$this->options->thread_display["reverseChildren"],
|
1488 |
-
"post_author" => $post->post_author,
|
1489 |
-
"posts_authors" => $postsAuthors,
|
1490 |
-
"voting_icons" => $voteSvgs[$this->options->thread_layouts["votingButtonsIcon"]],
|
1491 |
-
"high_level_user" => $high_level_user,
|
1492 |
-
"avatar_trackback" => apply_filters("wpdiscuz_avatar_trackback", plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/trackback.png")),
|
1493 |
-
"wpdiscuz_gravatar_size" => apply_filters("wpdiscuz_gravatar_size", 64),
|
1494 |
-
"can_stick_or_close" => $can_stick_or_close,
|
1495 |
-
"user_follows" => $this->dbManager->getUserFollows($currentUserEmail),
|
1496 |
-
"current_user" => $currentUser,
|
1497 |
-
"current_user_email" => $currentUserEmail,
|
1498 |
-
"is_share_enabled" => $this->options->isShareEnabled(),
|
1499 |
-
"post_permalink" => $post_permalink,
|
1500 |
-
"can_user_reply" => comments_open($post->ID) && $this->options->wp["threadComments"] && (($this->form ? $this->form->isUserCanComment($currentUser, $postId) : true) || $high_level_user) && !(class_exists("WooCommerce") && get_post_type($post) === "product" && !$replyForWoo),
|
1501 |
-
"can_user_follow" => $this->options->subscription["isFollowActive"] && $isUserLoggedIn && !empty($currentUserEmail),
|
1502 |
-
"can_user_vote" => $currentUser->ID || $this->options->thread_layouts["isGuestCanVote"],
|
1503 |
-
"wpd_stick_btn" => $this->options->moderation["enableStickButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_stick_btn wpd-cta-button'>%s</span>" : "",
|
1504 |
-
"wpd_close_btn" => $this->options->moderation["enableCloseButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_close_btn wpd-cta-button'>%s</span>" : "",
|
1505 |
-
"is_wpdiscuz_comment" => true,
|
1506 |
-
"share_buttons" => "",
|
1507 |
-
"feedback_content_words_count" => apply_filters("wpdiscuz_feedback_content_words_count", 20),
|
1508 |
-
"user_votes" => [],
|
1509 |
-
"last_visit" => $this->options->thread_display["highlightUnreadComments"] && ($lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true)) && !empty($lastVisit[$postId]) ? $lastVisit[$postId] : "",
|
1510 |
-
"site_url" => get_site_url(),
|
1511 |
-
"layout" => $layout,
|
1512 |
-
"components" => $this->helper->getComponents($theme, $layout),
|
1513 |
-
"walker" => new WpdiscuzWalker($this->helper, $this->helperOptimization, $this->dbManager, $this->options),
|
1514 |
-
];
|
1515 |
-
if ($this->options->social["enableFbShare"] && $this->options->social["fbAppID"]) {
|
1516 |
-
$args["share_buttons"] .= "<span class='wc_fb'><i class='fab fa-facebook-f wpf-cta' aria-hidden='true' title='" . esc_attr($this->options->phrases["wc_share_facebook"]) . "'></i></span>";
|
1517 |
-
}
|
1518 |
-
if ($this->options->social["enableVkShare"]) {
|
1519 |
-
$args["share_buttons"] .= "<a class='wc_vk' rel='noreferrer' target='_blank' href='https://vk.com/share.php?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->phrases["wc_share_vk"]) . "'><i class='fab fa-vk wpf-cta' aria-hidden='true'></i></a>";
|
1520 |
-
}
|
1521 |
-
if ($this->options->social["enableOkShare"]) {
|
1522 |
-
$args["share_buttons"] .= "<a class='wc_ok' rel='noreferrer' target='_blank' href='https://connect.ok.ru/offer?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->phrases["wc_share_ok"]) . "'><i class='fab fa-odnoklassniki wpf-cta' aria-hidden='true'></i></a>";
|
1523 |
-
}
|
1524 |
-
if ($this->options->social["enableWhatsappShare"]) {
|
1525 |
-
$args["whatsapp_url"] = wp_is_mobile() ? "https://api.whatsapp.com" : "https://web.whatsapp.com";
|
1526 |
-
}
|
1527 |
-
return apply_filters("wpdiscuz_comment_list_args", $args);
|
1528 |
-
}
|
1529 |
-
|
1530 |
-
public function addNewRoles() {
|
1531 |
-
global $wp_roles;
|
1532 |
-
$roles = apply_filters("editable_roles", $wp_roles->roles);
|
1533 |
-
$newBlogRoles = [];
|
1534 |
-
$newBlogRoleLabels = [];
|
1535 |
-
$newRolePhrases = [];
|
1536 |
-
foreach ($roles as $roleName => $roleInfo) {
|
1537 |
-
$newBlogRoles[$roleName] = isset($this->options->labels["blogRoles"][$roleName]) ? $this->options->labels["blogRoles"][$roleName] : "#00B38F";
|
1538 |
-
if ($roleName === "administrator") {
|
1539 |
-
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
|
1540 |
-
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Admin", "wpdiscuz");
|
1541 |
-
} elseif ($roleName === "post_author") {
|
1542 |
-
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
|
1543 |
-
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Author", "wpdiscuz");
|
1544 |
-
} elseif ($roleName === "editor") {
|
1545 |
-
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
|
1546 |
-
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Editor", "wpdiscuz");
|
1547 |
-
} else {
|
1548 |
-
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 0;
|
1549 |
-
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Member", "wpdiscuz");
|
1550 |
-
}
|
1551 |
-
}
|
1552 |
-
$newBlogRoles["post_author"] = isset($this->options->labels["blogRoles"]["post_author"]) ? $this->options->labels["blogRoles"]["post_author"] : "#00B38F";
|
1553 |
-
$newBlogRoleLabels["post_author"] = isset($this->options->labels["blogRoleLabels"]["post_author"]) ? $this->options->labels["blogRoleLabels"]["post_author"] : 1;
|
1554 |
-
$newBlogRoles["guest"] = isset($this->options->labels["blogRoles"]["guest"]) ? $this->options->labels["blogRoles"]["guest"] : "#00B38F";
|
1555 |
-
$newBlogRoleLabels["guest"] = isset($this->options->labels["blogRoleLabels"]["guest"]) ? $this->options->labels["blogRoleLabels"]["guest"] : 0;
|
1556 |
-
$newRolePhrases["wc_blog_role_post_author"] = isset($this->options->phrases["wc_blog_role_post_author"]) ? $this->options->phrases["wc_blog_role_post_author"] : esc_html__("Author", "wpdiscuz");
|
1557 |
-
$newRolePhrases["wc_blog_role_guest"] = isset($this->options->phrases["wc_blog_role_guest"]) ? $this->options->phrases["wc_blog_role_guest"] : esc_html__("Guest", "wpdiscuz");
|
1558 |
-
foreach ($this->options->phrases as $key => $value) {
|
1559 |
-
if (strpos("wc_blog_role_", $key) === 0) {
|
1560 |
-
unset($this->options->phrases[$key]);
|
1561 |
-
}
|
1562 |
-
}
|
1563 |
-
foreach ($newRolePhrases as $key => $value) {
|
1564 |
-
$this->options->phrases[$key] = $value;
|
1565 |
-
}
|
1566 |
-
$this->options->labels["blogRoles"] = $newBlogRoles;
|
1567 |
-
$this->options->labels["blogRoleLabels"] = $newBlogRoleLabels;
|
1568 |
-
}
|
1569 |
-
|
1570 |
-
public function showReplies() {
|
1571 |
-
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
1572 |
-
$commentId = isset($_POST["commentId"]) ? intval($_POST["commentId"]) : 0;
|
1573 |
-
if ($postId) {
|
1574 |
-
$this->isWpdiscuzLoaded = true;
|
1575 |
-
$commentListArgs = $this->getCommentListArgs($postId);
|
1576 |
-
$cArgs = $this->getDefaultCommentsArgs($postId);
|
1577 |
-
$cArgs["parent"] = $commentId;
|
1578 |
-
$cArgs["number"] = null;
|
1579 |
-
$comment = get_comment($commentId);
|
1580 |
-
$args = [
|
1581 |
-
"format" => "flat",
|
1582 |
-
"status" => $cArgs["status"],
|
1583 |
-
"orderby" => $cArgs["orderby"],
|
1584 |
-
"post_id" => $cArgs["post_id"],
|
1585 |
-
];
|
1586 |
-
if (!empty($cArgs["include_unapproved"])) {
|
1587 |
-
$args["include_unapproved"] = $cArgs["include_unapproved"];
|
1588 |
-
}
|
1589 |
-
$children = $comment->get_children($args);
|
1590 |
-
$commentListArgs["wpdiscuz_child_count_" . $comment->comment_ID] = count($children);
|
1591 |
-
$comments = array_merge([$comment], $children);
|
1592 |
-
if ($comments) {
|
1593 |
-
$response = [];
|
1594 |
-
if ($this->options->thread_layouts["highlightVotingButtons"]) {
|
1595 |
-
if (!empty($commentListArgs['current_user']->ID)) {
|
1596 |
-
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
1597 |
-
} else {
|
1598 |
-
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
1599 |
-
}
|
1600 |
}
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
}
|
1607 |
-
}
|
1608 |
-
|
1609 |
-
public function mostReactedComment() {
|
1610 |
-
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
1611 |
-
if ($postId) {
|
1612 |
-
$this->isWpdiscuzLoaded = true;
|
1613 |
-
$commentId = $this->dbManager->getMostReactedCommentId($postId);
|
1614 |
-
$comment = get_comment($commentId);
|
1615 |
-
if ($comment && $comment->comment_post_ID == $postId) {
|
1616 |
-
$this->commentsArgs = $this->getDefaultCommentsArgs($postId);
|
1617 |
-
$commentStatusIn = ["1"];
|
1618 |
-
if ($this->commentsArgs["status"] === "all") {
|
1619 |
-
$commentStatusIn[] = "0";
|
1620 |
}
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
$includeUnapproved = null;
|
1628 |
-
if (!empty($this->commentsArgs["include_unapproved"])) {
|
1629 |
-
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
1630 |
-
$includeUnapproved = $this->commentsArgs["include_unapproved"];
|
1631 |
}
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
$commentListArgs = $this->getCommentListArgs($postId);
|
1636 |
-
$commentListArgs["isSingle"] = true;
|
1637 |
-
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
1638 |
-
$response = [];
|
1639 |
-
if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
|
1640 |
-
if (!empty($commentListArgs['current_user']->ID)) {
|
1641 |
-
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
1642 |
-
} else {
|
1643 |
-
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
1644 |
-
}
|
1645 |
}
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
public function hottestThread() {
|
1657 |
-
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
1658 |
-
if ($postId) {
|
1659 |
-
$this->isWpdiscuzLoaded = true;
|
1660 |
-
$this->commentsArgs = $this->getDefaultCommentsArgs($postId);
|
1661 |
-
$commentStatusIn = ["1"];
|
1662 |
-
if ($this->commentsArgs["status"] === "all") {
|
1663 |
-
$commentStatusIn[] = "0";
|
1664 |
-
}
|
1665 |
-
$parentCommentIds = $this->dbManager->getParentCommentsHavingReplies($postId, $commentStatusIn);
|
1666 |
-
$childCount = 0;
|
1667 |
-
$hottestCommentId = 0;
|
1668 |
-
$hottestChildren = [];
|
1669 |
-
foreach ($parentCommentIds as $k => $parentCommentId) {
|
1670 |
-
$tree = [];
|
1671 |
-
$children = $this->dbManager->getHottestTree($parentCommentId);
|
1672 |
-
$tmpCount = count($children);
|
1673 |
-
if ($childCount < $tmpCount) {
|
1674 |
-
$childCount = $tmpCount;
|
1675 |
-
$hottestCommentId = $parentCommentId;
|
1676 |
-
$hottestChildren = $children;
|
1677 |
}
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
$includeUnapproved = null;
|
1688 |
-
if (!empty($this->commentsArgs["include_unapproved"])) {
|
1689 |
-
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
1690 |
-
$includeUnapproved = $this->commentsArgs["include_unapproved"];
|
1691 |
}
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
$commentListArgs["isSingle"] = true;
|
1697 |
-
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
1698 |
-
$response = [];
|
1699 |
-
if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
|
1700 |
-
if (!empty($commentListArgs['current_user']->ID)) {
|
1701 |
-
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
1702 |
-
} else {
|
1703 |
-
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
1704 |
-
}
|
1705 |
}
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
wp_send_json_success($response);
|
1711 |
-
}
|
1712 |
-
}
|
1713 |
-
}
|
1714 |
-
|
1715 |
-
private function getStickyComments($isPaginate, &$commentList, &$commentListArgs) {
|
1716 |
-
if (!empty($this->commentsArgs["first_load"])) {
|
1717 |
-
$this->commentsArgs["sticky"] = 1;
|
1718 |
-
$this->commentsArgs["number"] = null;
|
1719 |
-
if ($isPaginate) {
|
1720 |
-
$this->commentsArgs["number"] = "";
|
1721 |
-
$this->commentsArgs["offset"] = "";
|
1722 |
-
$this->commentsArgs["parent"] = "";
|
1723 |
-
}
|
1724 |
-
$this->commentsArgs["caller"] = "wpdiscuz";
|
1725 |
-
$this->commentsArgs["type__not_in"] = [];
|
1726 |
-
$this->commentsArgs["type__in"] = [self::WPDISCUZ_STICKY_COMMENT];
|
1727 |
-
$stickyComments = get_comments($this->commentsArgs);
|
1728 |
-
if ($stickyComments) {
|
1729 |
-
if ($this->options->wp["threadComments"]) {
|
1730 |
-
$stickyComments = $this->getChildren($stickyComments, $commentListArgs);
|
1731 |
}
|
1732 |
-
$commentList = ($isPaginate && $this->options->wp["commentOrder"] == "desc") ? array_merge($commentList, $stickyComments) : array_merge($stickyComments, $commentList);
|
1733 |
-
}
|
1734 |
-
}
|
1735 |
-
}
|
1736 |
-
|
1737 |
-
public function footerContents() {
|
1738 |
-
if ($this->isWpdiscuzLoaded) {
|
1739 |
-
global $post;
|
1740 |
-
if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
|
1741 |
-
$this->addContentModal();
|
1742 |
-
}
|
1743 |
-
if ($this->options->live["enableBubble"]) {
|
1744 |
-
$this->addBubble($post);
|
1745 |
-
}
|
1746 |
-
if ($this->options->thread_display["highlightUnreadComments"]) {
|
1747 |
-
$this->saveLastVisit($post);
|
1748 |
-
}
|
1749 |
-
echo "<div id='wpd-editor-source-code-wrapper-bg'></div><div id='wpd-editor-source-code-wrapper'><textarea id='wpd-editor-source-code'></textarea><button id='wpd-insert-source-code'>Insert</button><input type='hidden' id='wpd-editor-uid' /></div>";
|
1750 |
-
}
|
1751 |
-
}
|
1752 |
-
|
1753 |
-
public function addBubble($post) {
|
1754 |
-
if (comments_open($post->ID)) {
|
1755 |
-
echo "<div id='wpd-bubble-wrapper'>";
|
1756 |
-
$commentsNumber = get_comments_number($post->ID);
|
1757 |
-
echo "<span id='wpd-bubble-all-comments-count'" . ($commentsNumber ? "" : " style='display:none;'") . ">" . esc_html($commentsNumber) . "</span>";
|
1758 |
-
echo "<div id='wpd-bubble-count'>";
|
1759 |
-
echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-count-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-count-second' d='M0 0h24v24H0z' /></svg>";
|
1760 |
-
echo "<span class='wpd-new-comments-count'>0</span>";
|
1761 |
-
echo "</div>";
|
1762 |
-
echo "<div id='wpd-bubble'>";
|
1763 |
-
echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-plus-first' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/><path class='wpd-bubble-plus-second' d='M0 0h24v24H0z' /></svg>";
|
1764 |
-
echo "<div id='wpd-bubble-add-message'>" . esc_html($this->options->phrases["wc_bubble_invite_message"]) . "<span id='wpd-bubble-add-message-close'><a href='#'>x</a></span></div>";
|
1765 |
-
echo "</div>";
|
1766 |
-
echo "<div id='wpd-bubble-notification'><svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-notification-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-notification-second' d='M0 0h24v24H0z' /></svg>";
|
1767 |
-
if ($this->options->live["bubbleShowNewCommentMessage"]) {
|
1768 |
-
echo "<div id='wpd-bubble-notification-message'>";
|
1769 |
-
echo "<div id='wpd-bubble-author'>";
|
1770 |
-
echo "<div>";
|
1771 |
-
echo "<span id='wpd-bubble-author-avatar'></span>";
|
1772 |
-
echo "<span id='wpd-bubble-author-name'></span>";
|
1773 |
-
echo "<span id='wpd-bubble-comment-date'>(<span class='wpd-bubble-spans'></span>)</span>";
|
1774 |
-
echo "</div>";
|
1775 |
-
echo "<span id='wpd-bubble-comment-close'><a href='#'>x</a></span>";
|
1776 |
-
echo "</div>";
|
1777 |
-
echo "<div id='wpd-bubble-comment'>";
|
1778 |
-
echo "<span id='wpd-bubble-comment-text'></span>";
|
1779 |
-
echo "<span id='wpd-bubble-comment-reply-link'>| <a href='#'>Reply</a></span>";
|
1780 |
-
echo "</div>";
|
1781 |
-
echo "</div>";
|
1782 |
-
}
|
1783 |
-
echo "</div>";
|
1784 |
-
echo "</div>";
|
1785 |
-
}
|
1786 |
-
}
|
1787 |
-
|
1788 |
-
public function registerRestRoutes() {
|
1789 |
-
$controller = new WpdiscuzRest($this->dbManager, $this->options, $this->helper, $this->wpdiscuzForm);
|
1790 |
-
$controller->registerRoutes();
|
1791 |
-
}
|
1792 |
-
|
1793 |
-
public function mceButton($buttons) {
|
1794 |
-
global $post;
|
1795 |
-
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1796 |
-
array_push($buttons, "|", "wpDiscuz");
|
1797 |
-
}
|
1798 |
-
return $buttons;
|
1799 |
-
}
|
1800 |
-
|
1801 |
-
public function mceExternalPlugin($plugin_array) {
|
1802 |
-
global $post;
|
1803 |
-
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1804 |
-
$plugin_array["wpDiscuz"] = esc_url_raw(plugins_url("assets/js/wpdiscuz-shortcode-tinymce.js", __FILE__));
|
1805 |
-
}
|
1806 |
-
return $plugin_array;
|
1807 |
-
}
|
1808 |
-
|
1809 |
-
public function gutenbergButton() {
|
1810 |
-
global $post;
|
1811 |
-
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1812 |
-
wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-shortcode-gutenberg.js"), ["wp-blocks", "wp-editor", "wp-components"]);
|
1813 |
-
wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js");
|
1814 |
-
wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", "wpdObject", ["shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE, "image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"), "tooltip" => $this->options->phrases["wc_feedback_shortcode_tooltip"], "popup_title" => $this->options->phrases["wc_feedback_popup_title"], "leave_feebdack" => $this->options->phrases["wc_please_leave_feebdack"]]);
|
1815 |
-
}
|
1816 |
-
}
|
1817 |
-
|
1818 |
-
public function feedbackDialog() {
|
1819 |
-
global $post;
|
1820 |
-
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1821 |
-
?>
|
1822 |
-
<style type="text/css">
|
1823 |
-
#TB_title{background:#E9E9E9!important; font-size:16px!important; font-weight:normal!important; line-height:20px!important; padding:5px 10px;}
|
1824 |
-
#TB_ajaxContent{width: 100% !important; box-sizing: border-box; height: 80vh !important; overflow-y: auto;}
|
1825 |
-
#TB_ajaxContent .wpd-put-shortcode-parent{padding-top: 20px; text-align: center;}
|
1826 |
-
#TB_ajaxContent p{padding: 0px; margin-top: 2px;}
|
1827 |
-
#TB_ajaxContent input[type="text"]{width: 98%; padding:7px 10px; box-sizing: border-box;}
|
1828 |
-
#TB_ajaxContent .wpd-shortcode-inline-form h3{font-size: 14px; color: #000000; padding-top: 0px; margin-bottom: 5px;}
|
1829 |
-
#TB_ajaxContent img.wpd-fbs-screen{width: 100%;}
|
1830 |
-
#TB_ajaxContent .wpd-inline-type{width: 100%;text-align: center;font-weight: 600;padding: 1px 0px 5px 0px;box-sizing: border-box;margin-top: 5px;line-height: 10px;}
|
1831 |
-
#wpd-inline-content{padding: 10px;background-color: #f5f5f5;margin: 10px 0px 0px 0px;max-height: 55px;overflow-y: auto;font-size: 12px;line-height: 15px;}
|
1832 |
-
#wpd-inline-content p{font-size: 12px;line-height: 15px;}
|
1833 |
-
#wpd-inline-content .wpd-text-error{color: #DD0000; font-size: 13px;}
|
1834 |
</style>
|
1835 |
<div id="wpdiscuz_feedback_dialog" style="display:none">
|
1836 |
<div class="wpd-shortcode-inline-form">
|
@@ -1842,188 +1968,233 @@ class WpdiscuzCore implements WpDiscuzConstants {
|
|
1842 |
<tr>
|
1843 |
<td colspan="2">
|
1844 |
<h3><?php esc_html_e("Your Question to Readers", "wpdiscuz"); ?></h3>
|
1845 |
-
<p class="description"
|
|
|
1846 |
</td>
|
1847 |
</tr>
|
1848 |
<tr>
|
1849 |
<td colspan="2">
|
1850 |
-
<input type="text" id="wpd-inline-question" name="wpd-inline-question"
|
|
|
1851 |
</td>
|
1852 |
</tr>
|
1853 |
<tr>
|
1854 |
<td colspan="2">
|
1855 |
<h3><?php esc_html_e("Feedback Button Display Type", "wpdiscuz"); ?></h3>
|
1856 |
-
<p class="description"
|
|
|
1857 |
</td>
|
1858 |
</tr>
|
1859 |
<tr>
|
1860 |
<td style="width: 50%;">
|
1861 |
<div class="wpd-inline-type">
|
1862 |
<label>
|
1863 |
-
<input type="radio" name="wpd-inline-type" value="0" checked="checked"
|
1864 |
-
|
1865 |
</label>
|
1866 |
</div>
|
1867 |
-
<img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-closed.png")) ?>"
|
|
|
1868 |
</td>
|
1869 |
<td style="width: 50%">
|
1870 |
<div class="wpd-inline-type">
|
1871 |
<label>
|
1872 |
-
<input type="radio" name="wpd-inline-type" value="1"
|
1873 |
-
|
1874 |
</label>
|
1875 |
</div>
|
1876 |
-
<img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-opened.png")) ?>"
|
|
|
1877 |
</td>
|
1878 |
</tr>
|
1879 |
</table>
|
1880 |
</div>
|
1881 |
<div class="wpd-put-shortcode-parent">
|
1882 |
-
<button type="button" class="button button-primary button-large"
|
|
|
1883 |
</div>
|
1884 |
</div>
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2027 |
|
2028 |
}
|
2029 |
|
2 |
/*
|
3 |
* Plugin Name: wpDiscuz
|
4 |
* Description: #1 WordPress Comment Plugin. Innovative, modern and feature-rich comment system to supercharge your website comment section.
|
5 |
+
* Version: 7.0.7
|
6 |
* Author: gVectors Team
|
7 |
* Author URI: https://gvectors.com/
|
8 |
* Plugin URI: https://wpdiscuz.com/
|
9 |
* Text Domain: wpdiscuz
|
10 |
* Domain Path: /languages/
|
11 |
+
* wpDiscuz Update: auto
|
12 |
*/
|
13 |
if (!defined("ABSPATH")) {
|
14 |
+
exit();
|
15 |
}
|
16 |
|
17 |
define("WPDISCUZ_DIR_PATH", dirname(__FILE__));
|
32 |
|
33 |
class WpdiscuzCore implements WpDiscuzConstants {
|
34 |
|
35 |
+
public $dbManager;
|
36 |
+
public $helper;
|
37 |
+
public $helperAjax;
|
38 |
+
public $helperEmail;
|
39 |
+
public $helperOptimization;
|
40 |
+
public $helperUpload;
|
41 |
+
public $wpdiscuzOptionsJs;
|
42 |
+
public $options;
|
43 |
+
public $commentsArgs;
|
44 |
+
private $version;
|
45 |
+
public $wpdiscuzForm;
|
46 |
+
public $form;
|
47 |
+
private $cache;
|
48 |
+
public $subscriptionData;
|
49 |
+
public $isWpdiscuzLoaded;
|
50 |
+
private $requestUri;
|
51 |
+
public static $CURRENT_BLOG_ID;
|
52 |
+
public static $DEFAULT_COMMENT_TYPE;
|
53 |
+
private static $_instance = null;
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @deprecated
|
57 |
+
*/
|
58 |
+
public $optionsSerialized;
|
59 |
+
|
60 |
+
private function __construct() {
|
61 |
+
add_option(self::OPTION_SLUG_VERSION, "1.0.0");
|
62 |
+
$this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
|
63 |
+
wp_cookie_constants();
|
64 |
+
self::$DEFAULT_COMMENT_TYPE = version_compare(get_bloginfo("version"), "5.5", ">=") ? "comment" : "";
|
65 |
+
$this->dbManager = new WpdiscuzDBManager();
|
66 |
+
$this->optionsSerialized = $this->options = new WpdiscuzOptions($this->dbManager);
|
67 |
+
$this->optionsSerialized->reCaptchaVersion = $this->options->recaptcha["version"];
|
68 |
+
$this->wpdiscuzForm = new wpDiscuzForm($this->options, $this->version);
|
69 |
+
$this->helper = new WpdiscuzHelper($this->options, $this->dbManager, $this->wpdiscuzForm);
|
70 |
+
$this->helperEmail = new WpdiscuzHelperEmail($this->options, $this->dbManager);
|
71 |
+
$this->helperOptimization = new WpdiscuzHelperOptimization($this->options, $this->dbManager, $this->helperEmail);
|
72 |
+
$this->helperAjax = new WpdiscuzHelperAjax($this->options, $this->dbManager, $this->helper, $this->helperEmail, $this->wpdiscuzForm);
|
73 |
+
$this->helperUpload = new WpdiscuzHelperUpload($this->options, $this->dbManager, $this->wpdiscuzForm, $this->helper);
|
74 |
+
$this->cache = new WpdiscuzCache($this->options, $this->helper, $this->dbManager);
|
75 |
+
$this->requestUri = !empty($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";
|
76 |
+
|
77 |
+
if ($this->options->thread_display["isLoadOnlyParentComments"]) {
|
78 |
+
add_action("wp_ajax_wpdShowReplies", [&$this, "showReplies"]);
|
79 |
+
add_action("wp_ajax_nopriv_wpdShowReplies", [&$this, "showReplies"]);
|
80 |
+
}
|
81 |
+
|
82 |
+
self::$CURRENT_BLOG_ID = get_current_blog_id();
|
83 |
+
register_activation_hook(__FILE__, [&$this, "pluginActivation"]);
|
84 |
+
|
85 |
+
/* GRAVATARS CACHE */
|
86 |
+
register_activation_hook(__FILE__, [&$this, "registerGravatarsJobs"]);
|
87 |
+
register_deactivation_hook(__FILE__, [&$this, "deregisterGravatarsJobs"]);
|
88 |
+
add_filter("cron_schedules", [&$this, "setGravatarsIntervals"]);
|
89 |
+
/* GRAVATARS CACHE */
|
90 |
+
add_action("wpmu_new_blog", [&$this, "addNewBlog"]);
|
91 |
+
add_action("delete_blog", [&$this, "deleteBlog"]);
|
92 |
+
add_action("wp_head", [&$this, "initCurrentPostType"]);
|
93 |
+
|
94 |
+
add_action("init", [&$this, "wpdiscuzTextDomain"]);
|
95 |
+
add_action("admin_init", [&$this, "pluginNewVersion"], 1);
|
96 |
+
add_action("admin_enqueue_scripts", [&$this, "backendFiles"], 100);
|
97 |
+
add_action("wp_enqueue_scripts", [&$this, "frontendFiles"]);
|
98 |
+
add_action("admin_menu", [&$this, "addPluginOptionsPage"], 1);
|
99 |
+
|
100 |
+
add_action("wp_ajax_wpdLoadMoreComments", [&$this, "loadMoreComments"]);
|
101 |
+
add_action("wp_ajax_nopriv_wpdLoadMoreComments", [&$this, "loadMoreComments"]);
|
102 |
+
add_action("wp_ajax_wpdSorting", [&$this, "sorting"]);
|
103 |
+
add_action("wp_ajax_nopriv_wpdSorting", [&$this, "sorting"]);
|
104 |
+
add_action("wp_ajax_wpdAddComment", [&$this, "addComment"]);
|
105 |
+
add_action("wp_ajax_nopriv_wpdAddComment", [&$this, "addComment"]);
|
106 |
+
add_action("wp_ajax_wpdGetSingleComment", [&$this, "getSingleComment"]);
|
107 |
+
add_action("wp_ajax_nopriv_wpdGetSingleComment", [&$this, "getSingleComment"]);
|
108 |
+
add_action("wp_ajax_wpdMostReactedComment", [&$this, "mostReactedComment"]);
|
109 |
+
add_action("wp_ajax_nopriv_wpdMostReactedComment", [&$this, "mostReactedComment"]);
|
110 |
+
add_action("wp_ajax_wpdHottestThread", [&$this, "hottestThread"]);
|
111 |
+
add_action("wp_ajax_nopriv_wpdHottestThread", [&$this, "hottestThread"]);
|
112 |
+
|
113 |
+
$plugin = plugin_basename(__FILE__);
|
114 |
+
add_filter("plugin_action_links_$plugin", [&$this, "addPluginSettingsLink"]);
|
115 |
+
add_filter("comments_clauses", [&$this, "commentsClauses"]);
|
116 |
+
|
117 |
+
add_action("wp_ajax_wpdSaveEditedComment", [&$this, "saveEditedComment"]);
|
118 |
+
add_action("wp_ajax_nopriv_wpdSaveEditedComment", [&$this, "saveEditedComment"]);
|
119 |
+
|
120 |
+
if ($this->options->live["commentListUpdateType"]) {
|
121 |
+
add_action("wp_ajax_wpdUpdateAutomatically", [&$this, "updateAutomatically"]);
|
122 |
+
add_action("wp_ajax_nopriv_wpdUpdateAutomatically", [&$this, "updateAutomatically"]);
|
123 |
+
}
|
124 |
+
|
125 |
+
add_action("wp_loaded", [&$this, "addNewRoles"]);
|
126 |
+
add_filter("comments_template_query_args", [&$this, "commentsTemplateQueryArgs"]);
|
127 |
+
add_action("pre_get_comments", [&$this, "preGetComments"]);
|
128 |
+
add_filter("found_comments_query", [&$this, "foundCommentsQuery"], 10, 2);
|
129 |
+
|
130 |
+
if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
|
131 |
+
add_action("rest_api_init", [&$this, "registerRestRoutes"], 10);
|
132 |
+
}
|
133 |
+
if ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"]) {
|
134 |
+
add_action("wp_ajax_wpdBubbleUpdate", [&$this, "bubbleUpdate"]);
|
135 |
+
add_action("wp_ajax_nopriv_wpdBubbleUpdate", [&$this, "bubbleUpdate"]);
|
136 |
+
}
|
137 |
+
|
138 |
+
add_action("admin_footer", [&$this, "feedbackDialog"]);
|
139 |
+
add_filter("mce_buttons", [&$this, "mceButton"]);
|
140 |
+
add_filter("mce_external_plugins", [&$this, "mceExternalPlugin"]);
|
141 |
+
add_shortcode(self::WPDISCUZ_FEEDBACK_SHORTCODE, [&$this, "feedbackShortcode"]);
|
142 |
+
add_action("wp_ajax_wpdAddInlineComment", [&$this, "addInlineComment"]);
|
143 |
+
add_action("wp_ajax_nopriv_wpdAddInlineComment", [&$this, "addInlineComment"]);
|
144 |
+
add_action("wp_footer", [&$this, "footerContents"]);
|
145 |
+
add_action("enqueue_block_editor_assets", [&$this, "gutenbergButton"]);
|
146 |
+
|
147 |
+
add_filter("extra_plugin_headers", [&$this, "extraPluginHeaders"]);
|
148 |
+
add_filter("auto_update_plugin", [&$this, "shouldUpdate"], 10, 2);
|
149 |
+
|
150 |
+
add_filter("preprocess_comment", [&$this, "validateRecaptcha"], 10, 2);
|
151 |
+
}
|
152 |
+
|
153 |
+
public static function getInstance() {
|
154 |
+
if (is_null(self::$_instance)) {
|
155 |
+
self::$_instance = new self();
|
156 |
+
}
|
157 |
+
|
158 |
+
return self::$_instance;
|
159 |
+
}
|
160 |
+
|
161 |
+
public function extraPluginHeaders($headers) {
|
162 |
+
$headers[] = "wpDiscuz Update";
|
163 |
+
|
164 |
+
return $headers;
|
165 |
+
}
|
166 |
+
|
167 |
+
public function shouldUpdate($shouldUpdate, $plugin) {
|
168 |
+
if (!isset($plugin->plugin, $plugin->new_version)) {
|
169 |
+
return $shouldUpdate;
|
170 |
+
}
|
171 |
+
|
172 |
+
if ("wpdiscuz/class.WpdiscuzCore.php" !== $plugin->plugin) {
|
173 |
+
return $shouldUpdate;
|
174 |
+
}
|
175 |
+
|
176 |
+
$pluginData = get_plugin_data(__FILE__);
|
177 |
+
|
178 |
+
if (isset($pluginData["wpDiscuz Update"]) && $pluginData["wpDiscuz Update"] === "manual") {
|
179 |
+
return false;
|
180 |
+
}
|
181 |
+
|
182 |
+
return $shouldUpdate;
|
183 |
+
}
|
184 |
+
|
185 |
+
public function pluginActivation($networkwide) {
|
186 |
+
if (function_exists("is_multisite") && is_multisite() && $networkwide) {
|
187 |
+
$oldBlogID = $this->dbManager->getBlogID();
|
188 |
+
$oldSitePluginVersion = $this->version;
|
189 |
+
$blogIDs = $this->dbManager->getBlogIDs();
|
190 |
+
foreach ($blogIDs as $k => $blogID) {
|
191 |
+
switch_to_blog($blogID);
|
192 |
+
$this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
|
193 |
+
$this->activateWpDiscuz();
|
194 |
+
}
|
195 |
+
switch_to_blog($oldBlogID);
|
196 |
+
$this->version = $oldSitePluginVersion;
|
197 |
+
|
198 |
+
return;
|
199 |
+
}
|
200 |
+
$this->activateWpDiscuz();
|
201 |
+
}
|
202 |
+
|
203 |
+
public function addNewBlog($blogID) {
|
204 |
+
if (is_plugin_active_for_network("wpdiscuz/class.WpdiscuzCore.php")) {
|
205 |
+
$oldBlogID = $this->dbManager->getBlogID();
|
206 |
+
$oldSitePluginVersion = $this->version;
|
207 |
+
switch_to_blog($blogID);
|
208 |
+
$this->version = get_option(self::OPTION_SLUG_VERSION, "1.0.0");
|
209 |
+
$this->activateWpDiscuz();
|
210 |
+
switch_to_blog($oldBlogID);
|
211 |
+
$this->version = $oldSitePluginVersion;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
public function deleteBlog($blogID) {
|
216 |
+
if (is_plugin_active_for_network("wpdiscuz/class.WpdiscuzCore.php")) {
|
217 |
+
$oldBlogID = $this->dbManager->getBlogID();
|
218 |
+
switch_to_blog($blogID);
|
219 |
+
$this->dbManager->dropTables();
|
220 |
+
switch_to_blog($oldBlogID);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
private function activateWpDiscuz() {
|
225 |
+
$this->dbManager->dbCreateTables();
|
226 |
+
$this->pluginNewVersion();
|
227 |
+
}
|
228 |
+
|
229 |
+
public function wpdiscuzTextDomain() {
|
230 |
+
load_plugin_textdomain("wpdiscuz", false, dirname(plugin_basename(__FILE__)) . "/languages/");
|
231 |
+
}
|
232 |
+
|
233 |
+
public function registerGravatarsJobs() {
|
234 |
+
if (!wp_next_scheduled(self::GRAVATARS_CACHE_ADD_ACTION)) {
|
235 |
+
wp_schedule_event(current_time("timestamp"), self::GRAVATARS_CACHE_ADD_KEY_RECURRENCE, self::GRAVATARS_CACHE_ADD_ACTION);
|
236 |
+
}
|
237 |
+
|
238 |
+
if (!wp_next_scheduled(self::GRAVATARS_CACHE_DELETE_ACTION)) {
|
239 |
+
wp_schedule_event(current_time("timestamp"), self::GRAVATARS_CACHE_DELETE_KEY_RECURRENCE, self::GRAVATARS_CACHE_DELETE_ACTION);
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
public function deregisterGravatarsJobs() {
|
244 |
+
if (wp_next_scheduled(self::GRAVATARS_CACHE_ADD_ACTION)) {
|
245 |
+
wp_clear_scheduled_hook(self::GRAVATARS_CACHE_ADD_ACTION);
|
246 |
+
}
|
247 |
+
|
248 |
+
if (wp_next_scheduled(self::GRAVATARS_CACHE_DELETE_ACTION)) {
|
249 |
+
wp_clear_scheduled_hook(self::GRAVATARS_CACHE_DELETE_ACTION);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
public function setGravatarsIntervals($schedules) {
|
254 |
+
$cacheAddInterval = [
|
255 |
+
"interval" => self::GRAVATARS_CACHE_ADD_RECURRENCE * HOUR_IN_SECONDS,
|
256 |
+
"display" => esc_html__("Every 3 hours", "wpdiscuz")
|
257 |
+
];
|
258 |
+
$cacheDeleteInterval = [
|
259 |
+
"interval" => self::GRAVATARS_CACHE_DELETE_RECURRENCE * HOUR_IN_SECONDS,
|
260 |
+
"display" => esc_html__("Every 48 hours", "wpdiscuz")
|
261 |
+
];
|
262 |
+
$schedules[self::GRAVATARS_CACHE_ADD_KEY_RECURRENCE] = $cacheAddInterval;
|
263 |
+
$schedules[self::GRAVATARS_CACHE_DELETE_KEY_RECURRENCE] = $cacheDeleteInterval;
|
264 |
+
|
265 |
+
return $schedules;
|
266 |
+
}
|
267 |
+
|
268 |
+
public function updateAutomatically() {
|
269 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
270 |
+
$loadLastCommentId = isset($_POST["loadLastCommentId"]) ? intval($_POST["loadLastCommentId"]) : 0;
|
271 |
+
if ($postId && $loadLastCommentId) {
|
272 |
+
$this->isWpdiscuzLoaded = true;
|
273 |
+
$visibleCommentIds = isset($_POST["visibleCommentIds"]) ? rtrim($_POST["visibleCommentIds"], ",") : "";
|
274 |
+
$cArgs = $this->getDefaultCommentsArgs($postId);
|
275 |
+
$lastCommentId = $this->dbManager->getLastCommentId($cArgs);
|
276 |
+
if ($lastCommentId > $loadLastCommentId) {
|
277 |
+
$response = [];
|
278 |
+
$response["loadLastCommentId"] = $lastCommentId;
|
279 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
280 |
+
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
281 |
+
$sentEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? trim($_COOKIE["comment_author_email_" . COOKIEHASH]) : "";
|
282 |
+
$email = !empty($commentListArgs["current_user"]->ID) ? $commentListArgs["current_user"]->user_email : $sentEmail;
|
283 |
+
$newCommentIds = $this->dbManager->getNewCommentIds($cArgs, $loadLastCommentId, $email, $visibleCommentIds);
|
284 |
+
$newCommentIds = apply_filters("wpdiscuz_live_update_new_comment_ids", $newCommentIds, $postId, $commentListArgs["current_user"]);
|
285 |
+
$response["message"] = [];
|
286 |
+
foreach ($newCommentIds as $k => $newCommentId) {
|
287 |
+
$comment = get_comment($newCommentId);
|
288 |
+
if (($comment->comment_parent && (in_array($comment->comment_parent, explode(",", $visibleCommentIds)) || in_array($comment->comment_parent, $newCommentIds))) || !$comment->comment_parent) {
|
289 |
+
$commentHtml = wp_list_comments($commentListArgs, [$comment]);
|
290 |
+
$commentObject = ["comment_parent" => $comment->comment_parent, "comment_html" => $commentHtml];
|
291 |
+
if ($comment->comment_parent) {
|
292 |
+
array_push($response["message"], $commentObject);
|
293 |
+
} else {
|
294 |
+
array_unshift($response["message"], $commentObject);
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
$response["wc_all_comments_count_new"] = esc_html(get_comments_number($postId));
|
299 |
+
$response["wc_all_comments_count_new_html"] = "<span class='wpdtc'>" . esc_html($response["wc_all_comments_count_new"]) . "</span> " . esc_html(1 == $response["wc_all_comments_count_new"] ? $this->form->getHeaderTextSingle() : $this->form->getHeaderTextPlural());
|
300 |
+
wp_send_json_success($response);
|
301 |
+
}
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
public function bubbleUpdate() {
|
306 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
307 |
+
$newCommentIds = isset($_POST["newCommentIds"]) ? trim($_POST["newCommentIds"]) : "";
|
308 |
+
if ($postId && $newCommentIds) {
|
309 |
+
$this->isWpdiscuzLoaded = true;
|
310 |
+
$newCommentIds = explode(",", trim($newCommentIds, ","));
|
311 |
+
$postId = intval($postId);
|
312 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
313 |
+
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
314 |
+
$response = ["message" => []];
|
315 |
+
foreach ($newCommentIds as $k => $newCommentId) {
|
316 |
+
$comment = get_comment($newCommentId);
|
317 |
+
$commentHtml = wp_list_comments($commentListArgs, [$comment]);
|
318 |
+
$response["message"][] = [
|
319 |
+
"comment_id" => $comment->comment_ID,
|
320 |
+
"comment_parent" => $comment->comment_parent,
|
321 |
+
"comment_html" => $commentHtml
|
322 |
+
];
|
323 |
+
}
|
324 |
+
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
325 |
+
wp_send_json_success($response);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
public function addComment() {
|
330 |
+
$isAnonymous = false;
|
331 |
+
$uniqueId = isset($_POST["wpdiscuz_unique_id"]) ? trim($_POST["wpdiscuz_unique_id"]) : "";
|
332 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : "";
|
333 |
+
$comment_content = isset($_POST["wc_comment"]) ? trim($_POST["wc_comment"]) : "";
|
334 |
+
|
335 |
+
if ($uniqueId && $postId && $comment_content) {
|
336 |
+
$form = $this->wpdiscuzForm->getForm($postId);
|
337 |
+
$form->initFormFields();
|
338 |
+
|
339 |
+
do_action("wpdiscuz_before_comment_post");
|
340 |
+
if (!comments_open($postId)) {
|
341 |
+
wp_die(esc_html($this->options->phrases["wc_commenting_is_closed"]));
|
342 |
+
}
|
343 |
+
|
344 |
+
if (function_exists("zerospam_get_key") && isset($_POST["wpdiscuz_zs"]) && ($wpdiscuzZS = $_POST["wpdiscuz_zs"])) {
|
345 |
+
$_POST["zerospam_key"] = $wpdiscuzZS === md5(zerospam_get_key()) ? zerospam_get_key() : "";
|
346 |
+
}
|
347 |
+
$commentDepth = isset($_POST["wpd_comment_depth"]) && intval($_POST["wpd_comment_depth"]) ? intval($_POST["wpd_comment_depth"]) : 1;
|
348 |
+
$isInSameContainer = "1";
|
349 |
+
$currentUser = WpdiscuzHelper::getCurrentUser();
|
350 |
+
$wooExists = class_exists("WooCommerce") && get_post_type($postId) === "product";
|
351 |
+
$replyForWoo = apply_filters("wpdiscuz_product_review_replies", true, $postId);
|
352 |
+
if ($wooExists && !$replyForWoo) {
|
353 |
+
$isInSameContainer = "0";
|
354 |
+
} else if ($commentDepth > $this->options->wp["threadCommentsDepth"]) {
|
355 |
+
$commentDepth = $this->options->wp["threadCommentsDepth"];
|
356 |
+
$isInSameContainer = "0";
|
357 |
+
} else if (!$this->options->wp["threadComments"]) {
|
358 |
+
$isInSameContainer = "0";
|
359 |
+
}
|
360 |
+
$notificationType = isset($_POST["wpdiscuz_notification_type"]) ? $_POST["wpdiscuz_notification_type"] : "";
|
361 |
+
|
362 |
+
$form->validateFields($currentUser);
|
363 |
+
|
364 |
+
$website_url = "";
|
365 |
+
if ($currentUser && $currentUser->ID) {
|
366 |
+
$user_id = $currentUser->ID;
|
367 |
+
$name = $this->helper->getCurrentUserDisplayName($currentUser);
|
368 |
+
$email = $currentUser->user_email;
|
369 |
+
} else {
|
370 |
+
$user_id = 0;
|
371 |
+
$name = urldecode($form->validateDefaultName($currentUser));
|
372 |
+
$email = urldecode($form->validateDefaultEmail($currentUser, $isAnonymous));
|
373 |
+
$website_url = $form->validateDefaultWebsite($currentUser);
|
374 |
+
}
|
375 |
+
|
376 |
+
$comment_content = ($this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop")) && !$this->options->showEditorToolbar() ? html_entity_decode($comment_content) : $comment_content;
|
377 |
+
$comment_content = $this->helper->replaceCommentContentCode($comment_content);
|
378 |
+
$comment_content = $this->helper->filterCommentText($comment_content);
|
379 |
+
if (!$comment_content) {
|
380 |
+
wp_send_json_error("wc_msg_required_fields");
|
381 |
+
}
|
382 |
+
$commentMinLength = intval($this->options->content["commentTextMinLength"]);
|
383 |
+
$commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
|
384 |
+
$contentLength = function_exists("mb_strlen") ? mb_strlen(strip_tags($comment_content)) : strlen(strip_tags($comment_content));
|
385 |
+
if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
|
386 |
+
wp_send_json_error("wc_msg_input_min_length");
|
387 |
+
}
|
388 |
+
|
389 |
+
if ($commentMaxLength > 0 && $contentLength > $commentMaxLength) {
|
390 |
+
wp_send_json_error("wc_msg_input_max_length");
|
391 |
+
}
|
392 |
+
|
393 |
+
if ($name && $email && $comment_content) {
|
394 |
+
$this->isWpdiscuzLoaded = true;
|
395 |
+
$website_url = $website_url ? urldecode($website_url) : "";
|
396 |
+
$stickyComment = isset($_POST["wc_sticky_comment"]) && ($sticky = intval($_POST["wc_sticky_comment"])) ? $sticky : "";
|
397 |
+
$closedComment = isset($_POST["wc_closed_comment"]) && ($closed = absint($_POST["wc_closed_comment"])) ? $closed : "";
|
398 |
+
$uid_data = $this->helper->getUIDData($uniqueId);
|
399 |
+
$comment_parent = intval($uid_data[0]);
|
400 |
+
$parentComment = $comment_parent ? get_comment($comment_parent) : null;
|
401 |
+
$comment_parent = isset($parentComment->comment_ID) ? $parentComment->comment_ID : 0;
|
402 |
+
if ($parentComment && intval(get_comment_meta($comment_parent, self::META_KEY_CLOSED, true))) {
|
403 |
+
wp_die(esc_html($this->options->phrases["wc_closed_comment_thread"]));
|
404 |
+
}
|
405 |
+
$this->helper->restrictCommentingPerUser($email, $comment_parent, $postId);
|
406 |
+
$wc_user_agent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
|
407 |
+
$new_commentdata = [
|
408 |
+
"user_id" => $user_id,
|
409 |
+
"comment_post_ID" => $postId,
|
410 |
+
"comment_parent" => $wooExists && !$replyForWoo ? 0 : $comment_parent,
|
411 |
+
"comment_author" => $name,
|
412 |
+
"comment_author_email" => $email,
|
413 |
+
"comment_content" => $comment_content,
|
414 |
+
"comment_author_url" => $website_url,
|
415 |
+
"comment_agent" => $wc_user_agent,
|
416 |
+
"comment_type" => $stickyComment ? self::WPDISCUZ_STICKY_COMMENT : self::$DEFAULT_COMMENT_TYPE,
|
417 |
+
];
|
418 |
+
|
419 |
+
$new_comment_id = wp_new_comment(wp_slash($new_commentdata));
|
420 |
+
if ($closedComment) {
|
421 |
+
add_comment_meta($new_comment_id, self::META_KEY_CLOSED, "1");
|
422 |
+
}
|
423 |
+
$form->saveCommentMeta($new_comment_id);
|
424 |
+
$newComment = get_comment($new_comment_id);
|
425 |
+
$held_moderate = 1;
|
426 |
+
if ($newComment->comment_approved === "1") {
|
427 |
+
$held_moderate = 0;
|
428 |
+
}
|
429 |
+
if ($notificationType === WpdiscuzCore::SUBSCRIPTION_POST && class_exists("Prompt_Comment_Form_Handling") && $this->options->subscription["usePostmaticForCommentNotification"]) {
|
430 |
+
$_POST[Prompt_Comment_Form_Handling::SUBSCRIBE_CHECKBOX_NAME] = 1;
|
431 |
+
Prompt_Comment_Form_Handling::handle_form($new_comment_id, $newComment->comment_approved);
|
432 |
+
} else if (!$isAnonymous && $notificationType) {
|
433 |
+
$subscriptionData = $this->dbManager->hasSubscription($postId, $email);
|
434 |
+
if (!$subscriptionData || ($subscriptionData && $subscriptionData["type"] === self::SUBSCRIPTION_COMMENT)) {
|
435 |
+
$noNeedMemberConfirm = ($currentUser->ID && !$this->options->subscription["enableMemberConfirm"]);
|
436 |
+
$noNeedGuestsConfirm = (!$currentUser->ID && !$this->options->subscription["enableGuestsConfirm"]);
|
437 |
+
if ($noNeedMemberConfirm || $noNeedGuestsConfirm) {
|
438 |
+
$this->dbManager->addEmailNotification($new_comment_id, $postId, $email, self::SUBSCRIPTION_COMMENT, 1);
|
439 |
+
} else {
|
440 |
+
$confirmData = $this->dbManager->addEmailNotification($new_comment_id, $postId, $email, self::SUBSCRIPTION_COMMENT);
|
441 |
+
if ($confirmData) {
|
442 |
+
$this->helperEmail->confirmEmailSender($confirmData["id"], $confirmData["activation_key"], $postId, $email);
|
443 |
+
}
|
444 |
+
}
|
445 |
+
}
|
446 |
+
}
|
447 |
+
$response = [];
|
448 |
+
$response["redirect"] = $this->options->general["redirectPage"];
|
449 |
+
$response["new_comment_id"] = $new_comment_id;
|
450 |
+
$response["comment_author"] = $name;
|
451 |
+
$response["comment_author_email"] = $email;
|
452 |
+
$response["comment_author_url"] = $website_url;
|
453 |
+
$response["is_main"] = $wooExists && !$replyForWoo ? 1 : ($comment_parent ? 0 : 1);
|
454 |
+
$response["held_moderate"] = $held_moderate;
|
455 |
+
$response["is_in_same_container"] = $isInSameContainer;
|
456 |
+
$response["wc_all_comments_count_new"] = esc_html(get_comments_number($postId));
|
457 |
+
$response["wc_all_comments_count_new_html"] = "<span class='wpdtc'>" . esc_html($response["wc_all_comments_count_new"]) . "</span> " . esc_html(1 == $response["wc_all_comments_count_new"] ? $form->getHeaderTextSingle() : $form->getHeaderTextPlural());
|
458 |
+
|
459 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
460 |
+
$commentListArgs["addComment"] = $commentDepth;
|
461 |
+
$commentListArgs["comment_author_email"] = $email;
|
462 |
+
if (apply_filters("wpdiscuz_enable_user_mentioning", true) && $this->options->subscription["enableUserMentioning"] && $this->options->subscription["sendMailToMentionedUsers"] && ($mentionedUsers = $this->helper->getMentionedUsers($newComment->comment_content))) {
|
463 |
+
$this->helperEmail->sendMailToMentionedUsers($mentionedUsers, $newComment);
|
464 |
+
}
|
465 |
+
$response["uniqueid"] = $uniqueId;
|
466 |
+
$response["message"] = wp_list_comments($commentListArgs, [$newComment]);
|
467 |
+
$response["message"] = wp_unslash($response["message"]);
|
468 |
+
do_action("wpdiscuz_after_comment_post", $newComment, $currentUser);
|
469 |
+
$response["callbackFunctions"] = [];
|
470 |
+
$response = apply_filters("wpdiscuz_comment_post", $response);
|
471 |
+
do_action("wpdiscuz_clean_post_cache", $postId, "comment_posted");
|
472 |
+
wp_send_json_success($response);
|
473 |
+
} else {
|
474 |
+
wp_send_json_error("wc_invalid_field");
|
475 |
+
}
|
476 |
+
} else {
|
477 |
+
wp_send_json_error("wc_msg_required_fields");
|
478 |
+
}
|
479 |
+
}
|
480 |
+
|
481 |
+
/**
|
482 |
+
* save edited comment via ajax
|
483 |
+
*/
|
484 |
+
public function saveEditedComment() {
|
485 |
+
$commentId = isset($_POST["commentId"]) ? intval($_POST["commentId"]) : 0;
|
486 |
+
$trimmedContent = isset($_POST["wc_comment"]) ? trim($_POST["wc_comment"]) : "";
|
487 |
+
if (!$trimmedContent || !strip_tags($trimmedContent)) {
|
488 |
+
wp_send_json_error("wc_msg_required_fields");
|
489 |
+
}
|
490 |
+
$trimmedContent = ($this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop")) && !$this->options->showEditorToolbar() ? html_entity_decode($trimmedContent) : $trimmedContent;
|
491 |
+
if ($commentId) {
|
492 |
+
$this->isWpdiscuzLoaded = true;
|
493 |
+
$comment = get_comment($commentId);
|
494 |
+
$currentUser = WpdiscuzHelper::getCurrentUser();
|
495 |
+
$uniqueId = $comment->comment_ID . "_" . $comment->comment_parent;
|
496 |
+
$highLevelUser = current_user_can("moderate_comments");
|
497 |
+
$isCurrentUserCanEdit = $this->helper->isCommentEditable($comment) && $this->helper->canUserEditComment($comment, $currentUser);
|
498 |
+
if (!intval(get_comment_meta($comment->comment_ID, self::META_KEY_CLOSED, true)) && ($highLevelUser || $isCurrentUserCanEdit)) {
|
499 |
+
$isInRange = $this->helper->isContentInRange($trimmedContent);
|
500 |
+
|
501 |
+
if (!$isInRange && !$highLevelUser) {
|
502 |
+
$commentMinLength = intval($this->options->content["commentTextMinLength"]);
|
503 |
+
$commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
|
504 |
+
$contentLength = function_exists("mb_strlen") ? mb_strlen(strip_tags($trimmedContent)) : strlen(strip_tags($trimmedContent));
|
505 |
+
if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
|
506 |
+
wp_send_json_error("wc_msg_input_min_length");
|
507 |
+
}
|
508 |
+
|
509 |
+
if ($commentMaxLength > 0 && $contentLength > $commentMaxLength) {
|
510 |
+
wp_send_json_error("wc_msg_input_max_length");
|
511 |
+
}
|
512 |
+
}
|
513 |
+
|
514 |
+
if ($isInRange || $highLevelUser) {
|
515 |
+
$response = [];
|
516 |
+
$form = $this->wpdiscuzForm->getForm($comment->comment_post_ID);
|
517 |
+
$form->initFormFields();
|
518 |
+
$form->validateFields($currentUser);
|
519 |
+
if ($trimmedContent !== $comment->comment_content) {
|
520 |
+
$trimmedContent = $this->helper->replaceCommentContentCode($trimmedContent);
|
521 |
+
$commentContent = $this->helper->filterCommentText($trimmedContent);
|
522 |
+
$userAgent = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
|
523 |
+
$commentarr = [
|
524 |
+
"comment_ID" => $commentId,
|
525 |
+
"comment_content" => $commentContent,
|
526 |
+
"comment_agent" => $userAgent,
|
527 |
+
"comment_approved" => $comment->comment_approved
|
528 |
+
];
|
529 |
+
wp_update_comment(wp_slash($commentarr));
|
530 |
+
$lastEditedAt = current_time("mysql", 1);
|
531 |
+
update_comment_meta($commentId, self::META_KEY_LAST_EDITED_AT, $lastEditedAt);
|
532 |
+
update_comment_meta($commentId, self::META_KEY_LAST_EDITED_BY, !empty($currentUser->ID) ? $currentUser->ID : $comment->comment_author_email);
|
533 |
+
if ($this->options->moderation["displayEditingInfo"]) {
|
534 |
+
if (!empty($currentUser->ID)) {
|
535 |
+
$lastEditedBy = get_user_by("id", $currentUser->ID);
|
536 |
+
} else {
|
537 |
+
$lastEditedBy = get_user_by("email", $currentUser->comment_author_email);
|
538 |
+
}
|
539 |
+
$username = $lastEditedBy ? $lastEditedBy->display_name : $comment->comment_author;
|
540 |
+
$response["lastEdited"] = "<div class='wpd-comment-last-edited'><i class='far fa-edit'></i>" . esc_html(sprintf($this->options->phrases["wc_last_edited"], $this->helper->dateDiff($lastEditedAt), $username)) . "</div>";
|
541 |
+
}
|
542 |
+
do_action("wpdiscuz_clean_post_cache", $comment->comment_post_ID, "comment_edited");
|
543 |
+
}
|
544 |
+
|
545 |
+
$form->saveCommentMeta($comment->comment_ID);
|
546 |
+
$commentContent = isset($commentContent) ? $commentContent : $trimmedContent;
|
547 |
+
if ($this->options->content["enableImageConversion"]) {
|
548 |
+
$commentContent = $this->helper->makeClickable($commentContent);
|
549 |
+
}
|
550 |
+
$commentLink = get_comment_link($comment);
|
551 |
+
$commentContent = apply_filters("comment_text", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
|
552 |
+
$commentReadMoreLimit = $this->options->content["commentReadMoreLimit"];
|
553 |
+
if (stripos($commentContent, "[/spoiler]") !== false) {
|
554 |
+
$commentReadMoreLimit = 0;
|
555 |
+
$commentContent = $this->helper->spoiler($commentContent);
|
556 |
+
}
|
557 |
+
if ($commentReadMoreLimit && WpdiscuzHelper::strWordCount(wp_strip_all_tags($commentContent)) > $commentReadMoreLimit) {
|
558 |
+
$commentContent = WpdiscuzHelper::getCommentExcerpt($commentContent, $uniqueId, $this->options);
|
559 |
+
}
|
560 |
+
$commentContent = apply_filters("wpdiscuz_after_read_more", $commentContent, $comment, ["is_wpdiscuz_comment" => true]);
|
561 |
+
if ($this->options->social["enableTwitterShare"]) {
|
562 |
+
$response["twitterShareLink"] = esc_url_raw("https://twitter.com/intent/tweet?text=" . $this->helper->getTwitterShareContent($commentContent, $commentLink) . "&url=" . urlencode($commentLink));
|
563 |
+
}
|
564 |
+
if ($this->options->social["enableWhatsappShare"]) {
|
565 |
+
$response["whatsappShareLink"] = esc_url_raw((wp_is_mobile() ? "https://api.whatsapp.com" : "https://web.whatsapp.com") . "/send?text=" . $this->helper->getWhatsappShareContent($commentContent, $commentLink));
|
566 |
+
}
|
567 |
+
|
568 |
+
$components = $this->helper->getComponents($form->getTheme(), $form->getLayout());
|
569 |
+
$inlineContent = "";
|
570 |
+
if ($inlineFormID = intval(get_comment_meta($comment->comment_ID, self::META_KEY_FEEDBACK_FORM_ID, true))) {
|
571 |
+
$feedbackForm = $this->dbManager->getFeedbackForm($inlineFormID);
|
572 |
+
$inlineContent = "<div class='wpd-inline-feedback-wrapper'><span class='wpd-inline-feedback-info'>" . esc_html($this->options->phrases["wc_feedback_content_text"]) . "</span> <i class='fas fa-quote-left'></i>" . wp_trim_words($feedbackForm->content, apply_filters("wpdiscuz_feedback_content_words_count", 20)) . "" <a class='wpd-feedback-content-link' data-feedback-content-id='{$feedbackForm->id}' href='#wpd-inline-{$feedbackForm->id}'>" . esc_html($this->options->phrases["wc_read_more"]) . "</a></div>";
|
573 |
+
}
|
574 |
+
$response["message"] = str_replace(["{TEXT_WRAPPER_CLASSES}", "{TEXT}"], [
|
575 |
+
"wpd-comment-text",
|
576 |
+
$inlineContent . $commentContent
|
577 |
+
], $components["text.html"]);
|
578 |
+
$response["callbackFunctions"] = [];
|
579 |
+
$response = apply_filters("wpdiscuz_comment_edit_save", $response);
|
580 |
+
wp_send_json_success($response);
|
581 |
+
} else {
|
582 |
+
wp_send_json_error("wc_comment_edit_not_possible");
|
583 |
+
}
|
584 |
+
} else {
|
585 |
+
wp_send_json_error("wc_comment_edit_not_possible");
|
586 |
+
}
|
587 |
+
}
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* Gets single comment with its full thread and displays in comment list
|
592 |
+
*/
|
593 |
+
public function getSingleComment() {
|
594 |
+
$commentId = isset($_POST["commentId"]) ? intval($_POST["commentId"]) : 0;
|
595 |
+
$comment = get_comment($commentId);
|
596 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
597 |
+
if ($commentId && $postId && $comment && $comment->comment_post_ID == $postId) {
|
598 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
599 |
+
$this->commentsArgs = $this->getDefaultCommentsArgs($postId);
|
600 |
+
$showUnapprovedComment = false;
|
601 |
+
$includeUnapproved = null;
|
602 |
+
if ($comment->comment_approved === "0") {
|
603 |
+
if ($commentListArgs["high_level_user"]) {
|
604 |
+
$showUnapprovedComment = true;
|
605 |
+
} else if (!empty($this->commentsArgs["include_unapproved"])) {
|
606 |
+
$includeUnapproved = $this->commentsArgs["include_unapproved"][0];
|
607 |
+
if (is_numeric($this->commentsArgs["include_unapproved"][0])) {
|
608 |
+
if ($comment->user_id == $this->commentsArgs["include_unapproved"][0]) {
|
609 |
+
$showUnapprovedComment = true;
|
610 |
+
}
|
611 |
+
} else if ($comment->comment_author_email === $this->commentsArgs["include_unapproved"][0]) {
|
612 |
+
$showUnapprovedComment = true;
|
613 |
+
}
|
614 |
+
}
|
615 |
+
}
|
616 |
+
if ($comment->comment_approved === "1" || $showUnapprovedComment) {
|
617 |
+
$this->isWpdiscuzLoaded = true;
|
618 |
+
$commentStatusIn = ["1"];
|
619 |
+
if ($this->commentsArgs["status"] === "all") {
|
620 |
+
$commentStatusIn[] = "0";
|
621 |
+
}
|
622 |
+
$parentComment = null;
|
623 |
+
if (!$this->options->wp["threadComments"]) {
|
624 |
+
$comments = [$comment];
|
625 |
+
$parentComment = $comment;
|
626 |
+
} else if ($parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved)) {
|
627 |
+
$args = [
|
628 |
+
"format" => "flat",
|
629 |
+
"status" => $this->commentsArgs["status"],
|
630 |
+
"orderby" => $this->commentsArgs["orderby"],
|
631 |
+
"post_id" => $this->commentsArgs["post_id"],
|
632 |
+
];
|
633 |
+
if (!empty($this->commentsArgs["include_unapproved"])) {
|
634 |
+
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
635 |
+
}
|
636 |
+
$tree = $parentComment->get_children($args);
|
637 |
+
$comments = array_merge([$parentComment], $tree);
|
638 |
+
}
|
639 |
+
if ($parentComment) {
|
640 |
+
$commentListArgs["isSingle"] = true;
|
641 |
+
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
642 |
+
if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
|
643 |
+
if (!empty($commentListArgs['current_user']->ID)) {
|
644 |
+
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
645 |
+
} else {
|
646 |
+
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
647 |
+
}
|
648 |
+
}
|
649 |
+
$response = [];
|
650 |
+
$response["message"] = wp_list_comments($commentListArgs, $comments);
|
651 |
+
$response["parentCommentID"] = $parentComment->comment_ID;
|
652 |
+
$response["callbackFunctions"] = [];
|
653 |
+
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
654 |
+
wp_send_json_success($response);
|
655 |
+
}
|
656 |
+
}
|
657 |
+
}
|
658 |
+
}
|
659 |
+
|
660 |
+
public function loadMoreComments() {
|
661 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
662 |
+
$lastParentId = isset($_POST["lastParentId"]) ? intval($_POST["lastParentId"]) : 0;
|
663 |
+
if ($lastParentId >= 0 && $postId) {
|
664 |
+
$this->isWpdiscuzLoaded = true;
|
665 |
+
$isFirstLoad = isset($_POST["isFirstLoad"]) ? intval($_POST["isFirstLoad"]) : 0;
|
666 |
+
// max value of php int for limit
|
667 |
+
$limit = ($isFirstLoad && $this->options->thread_display["commentListLoadType"] == 3) || (!$isFirstLoad && $this->options->thread_display["commentListLoadType"] == 1) ? PHP_INT_MAX - 1 : $this->options->wp["commentPerPage"];
|
668 |
+
$args = ["number" => $limit];
|
669 |
+
$args["wpdType"] = !empty($_POST["wpdType"]) ? trim($_POST["wpdType"]) : "";
|
670 |
+
if ($isFirstLoad) {
|
671 |
+
$args["first_load"] = true;
|
672 |
+
}
|
673 |
+
$sorting = isset($_POST["sorting"]) ? trim($_POST["sorting"]) : "";
|
674 |
+
if ($sorting === "newest") {
|
675 |
+
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
676 |
+
$args["order"] = "desc";
|
677 |
+
} else if ($sorting === "oldest") {
|
678 |
+
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
679 |
+
$args["order"] = "asc";
|
680 |
+
} else if ($sorting === "by_vote") {
|
681 |
+
$args["orderby"] = "by_vote";
|
682 |
+
$args["order"] = $this->options->wp["commentOrder"];
|
683 |
+
}
|
684 |
+
if (isset($args["orderby"]) && $args["orderby"] === "by_vote" && !empty($_POST["offset"]) && ($offset = intval($_POST["offset"]))) {
|
685 |
+
$args["offset"] = $offset * ($isFirstLoad && $this->options->thread_display["commentListLoadType"] == 3 ? 0 : $this->options->wp["commentPerPage"]);
|
686 |
+
}
|
687 |
+
$args["last_parent_id"] = $lastParentId;
|
688 |
+
$args["post_id"] = $postId;
|
689 |
+
$args = apply_filters("wpdiscuz_filter_args", $args);
|
690 |
+
$commentData = $this->getWPComments($args);
|
691 |
+
$commentData["loadLastCommentId"] = $this->dbManager->getLastCommentId($this->commentsArgs);
|
692 |
+
$commentData["callbackFunctions"] = [];
|
693 |
+
$commentData = apply_filters("wpdiscuz_ajax_callbacks", $commentData);
|
694 |
+
wp_send_json_success($commentData);
|
695 |
+
}
|
696 |
+
}
|
697 |
+
|
698 |
+
public function sorting() {
|
699 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
700 |
+
$sorting = isset($_POST["sorting"]) ? trim($_POST["sorting"]) : "";
|
701 |
+
if ($postId && $sorting) {
|
702 |
+
$this->isWpdiscuzLoaded = true;
|
703 |
+
$args = ["post_id" => $postId];
|
704 |
+
if ($sorting === "newest") {
|
705 |
+
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
706 |
+
$args["order"] = "desc";
|
707 |
+
} else if ($sorting === "oldest") {
|
708 |
+
$args["orderby"] = $this->options->thread_display["orderCommentsBy"];
|
709 |
+
$args["order"] = "asc";
|
710 |
+
} else if ($sorting === "by_vote") {
|
711 |
+
$args["orderby"] = "by_vote";
|
712 |
+
$args["order"] = $this->options->wp["commentOrder"];
|
713 |
+
}
|
714 |
+
$args["first_load"] = 1;
|
715 |
+
$args["wpdType"] = !empty($_POST["wpdType"]) ? trim($_POST["wpdType"]) : "";
|
716 |
+
$args = apply_filters("wpdiscuz_filter_args", $args);
|
717 |
+
$commentData = $this->getWPComments($args);
|
718 |
+
$response = [
|
719 |
+
"last_parent_id" => $commentData["last_parent_id"],
|
720 |
+
"is_show_load_more" => $commentData["is_show_load_more"],
|
721 |
+
"message" => $commentData["comment_list"],
|
722 |
+
"callbackFunctions" => [],
|
723 |
+
];
|
724 |
+
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
725 |
+
wp_send_json_success($response);
|
726 |
+
}
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* get comments by comment type
|
731 |
+
*/
|
732 |
+
public function getWPComments($args = []) {
|
733 |
+
global $post;
|
734 |
+
$postId = isset($args["post_id"]) ? $args["post_id"] : $post->ID;
|
735 |
+
$defaults = $this->getDefaultCommentsArgs($postId);
|
736 |
+
$this->commentsArgs = wp_parse_args($args, $defaults);
|
737 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
738 |
+
do_action("wpdiscuz_before_getcomments", $this->commentsArgs, $commentListArgs["current_user"], $args);
|
739 |
+
$commentData = [];
|
740 |
+
$commentList = $this->_getWPComments($commentListArgs, $commentData);
|
741 |
+
$commentData["comment_list"] = wp_list_comments($commentListArgs, $commentList);
|
742 |
+
$this->commentsArgs["caller"] = "";
|
743 |
+
if ($this->cache->doGravatarsCache && $this->cache->gravatars) {
|
744 |
+
$this->dbManager->addGravatars($this->cache->gravatars);
|
745 |
+
}
|
746 |
+
|
747 |
+
return $commentData;
|
748 |
+
}
|
749 |
+
|
750 |
+
public function _getWPComments(&$commentListArgs, &$commentData) {
|
751 |
+
$commentList = [];
|
752 |
+
if ($this->options->wp["isPaginate"]) {// PAGINATION
|
753 |
+
$page = get_query_var("cpage");
|
754 |
+
$this->commentsArgs["number"] = $this->options->wp["commentPerPage"];
|
755 |
+
$this->commentsArgs["order"] = "asc";
|
756 |
+
$this->commentsArgs["caller"] = "";
|
757 |
+
if ($this->options->wp["threadComments"]) {
|
758 |
+
$this->commentsArgs["parent"] = 0;
|
759 |
+
}
|
760 |
+
|
761 |
+
if ($page) {
|
762 |
+
$this->commentsArgs["offset"] = ($page - 1) * $this->options->wp["commentPerPage"];
|
763 |
+
} else if ($this->options->wp["defaultCommentsPage"] === "oldest") {
|
764 |
+
$this->commentsArgs["offset"] = 0;
|
765 |
+
}
|
766 |
+
|
767 |
+
$commentListArgs["page"] = 0;
|
768 |
+
$commentListArgs["per_page"] = 0;
|
769 |
+
$commentListArgs["reverse_top_level"] = $this->options->wp["commentOrder"] === "desc";
|
770 |
+
|
771 |
+
$commentList = get_comments($this->commentsArgs);
|
772 |
+
if ($this->options->wp["threadComments"] && $commentList) {
|
773 |
+
$commentList = $this->getChildren($commentList, $commentListArgs);
|
774 |
+
}
|
775 |
+
$this->getStickyComments(true, $commentList, $commentListArgs);
|
776 |
+
} else {
|
777 |
+
$limitBefore = $this->commentsArgs["number"];
|
778 |
+
if ($this->commentsArgs["number"]) {
|
779 |
+
$this->commentsArgs["number"] += 1;
|
780 |
+
}
|
781 |
+
if ($this->commentsArgs["wpdType"] === "inline") {
|
782 |
+
$this->commentsArgs["meta_query"] = [
|
783 |
+
[
|
784 |
+
"key" => self::META_KEY_FEEDBACK_FORM_ID,
|
785 |
+
"value" => 0,
|
786 |
+
"compare" => "!=",
|
787 |
+
],
|
788 |
+
];
|
789 |
+
}
|
790 |
+
$commentList = get_comments($this->commentsArgs);
|
791 |
+
$commentListCount = count($commentList);
|
792 |
+
if ($limitBefore && $commentListCount > $limitBefore) {
|
793 |
+
unset($commentList[$commentListCount - 1]);
|
794 |
+
$commentListCount --;
|
795 |
+
$commentData["is_show_load_more"] = true;
|
796 |
+
} else {
|
797 |
+
$commentData["is_show_load_more"] = false;
|
798 |
+
}
|
799 |
+
if ($commentList) {
|
800 |
+
$commentData["last_parent_id"] = $commentList[$commentListCount - 1]->comment_ID;
|
801 |
+
if ($this->options->wp["threadComments"]) {
|
802 |
+
$commentList = $this->getChildren($commentList, $commentListArgs);
|
803 |
+
}
|
804 |
+
} else {
|
805 |
+
$commentData["last_parent_id"] = 0;
|
806 |
+
}
|
807 |
+
$this->getStickyComments(false, $commentList, $commentListArgs);
|
808 |
+
$commentListArgs["page"] = 1;
|
809 |
+
$commentListArgs["last_parent_id"] = $commentData["last_parent_id"];
|
810 |
+
}
|
811 |
+
if ($commentList && $this->options->thread_layouts["highlightVotingButtons"]) {
|
812 |
+
if (!empty($commentListArgs['current_user']->ID)) {
|
813 |
+
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($commentList, $commentListArgs['current_user']->ID);
|
814 |
+
} else {
|
815 |
+
$commentListArgs['user_votes'] = $this->dbManager->getUserVotes($commentList, md5($this->helper->getRealIPAddr()));
|
816 |
+
}
|
817 |
+
}
|
818 |
+
|
819 |
+
return $commentList;
|
820 |
+
}
|
821 |
+
|
822 |
+
private function getChildren($commentList, &$commentListArgs) {
|
823 |
+
$parentComments = [];
|
824 |
+
$args = [
|
825 |
+
"format" => "flat",
|
826 |
+
"status" => $this->commentsArgs["status"],
|
827 |
+
"orderby" => $this->commentsArgs["orderby"],
|
828 |
+
"post_id" => $this->commentsArgs["post_id"],
|
829 |
+
];
|
830 |
+
if (!empty($this->commentsArgs["include_unapproved"])) {
|
831 |
+
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
832 |
+
}
|
833 |
+
foreach ($commentList as $k => $parentComment) {
|
834 |
+
$parentComments[] = $parentComment;
|
835 |
+
$children = $parentComment->get_children($args);
|
836 |
+
if ($this->options->thread_display["isLoadOnlyParentComments"]) {
|
837 |
+
$commentListArgs["wpdiscuz_child_count_" . $parentComment->comment_ID] = count($children);
|
838 |
+
} else {
|
839 |
+
$parentComments = array_merge($parentComments, $children);
|
840 |
+
}
|
841 |
+
}
|
842 |
+
|
843 |
+
return $parentComments;
|
844 |
+
}
|
845 |
+
|
846 |
+
public function commentsTemplateQueryArgs($args) {
|
847 |
+
global $post;
|
848 |
+
if ($this->isWpdiscuzLoaded) {
|
849 |
+
if ($this->options->wp["isPaginate"]) {
|
850 |
+
$args["caller"] = "wpdiscuz";
|
851 |
+
} else {
|
852 |
+
$args["post__not_in"] = $post->ID;
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
return $args;
|
857 |
+
}
|
858 |
+
|
859 |
+
public function preGetComments($queryObj) {
|
860 |
+
if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz-") {
|
861 |
+
$vars = $queryObj->query_vars;
|
862 |
+
$vars["comment__in"] = "";
|
863 |
+
$queryObj->query_vars = $vars;
|
864 |
+
}
|
865 |
+
}
|
866 |
+
|
867 |
+
public function foundCommentsQuery($q, $qObj) {
|
868 |
+
if ($this->options->wp["isPaginate"] && isset($qObj->query_vars["caller"]) && $qObj->query_vars["caller"] === "wpdiscuz" && empty($this->commentsArgs["sticky"])) {
|
869 |
+
global $wpdb, $post;
|
870 |
+
$where = "WHERE";
|
871 |
+
if (!empty($qObj->query_vars["include_unapproved"][0])) {
|
872 |
+
if (is_numeric($qObj->query_vars["include_unapproved"][0])) {
|
873 |
+
$where .= " (comment_approved = '1' OR " . $wpdb->prepare("(user_id = %d AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
|
874 |
+
} else {
|
875 |
+
$where .= " (comment_approved = '1' OR " . $wpdb->prepare("(comment_author_email = %s AND comment_approved = '0')", $qObj->query_vars["include_unapproved"][0]) . ")";
|
876 |
+
}
|
877 |
+
} else {
|
878 |
+
$where .= " comment_approved = '1'";
|
879 |
+
}
|
880 |
+
$where .= " AND comment_post_ID = {$post->ID}";
|
881 |
+
if ($this->options->wp["threadComments"]) {
|
882 |
+
$where .= " AND comment_parent = 0";
|
883 |
+
}
|
884 |
+
$typesNotIn = apply_filters("wpdiscuz_found_comments_query", [self::WPDISCUZ_STICKY_COMMENT]);
|
885 |
+
foreach ($typesNotIn as $k => &$type) {
|
886 |
+
$type = esc_sql($type);
|
887 |
+
}
|
888 |
+
$where .= " AND comment_type NOT IN ('" . implode("','", $typesNotIn) . "')";
|
889 |
+
$q = "SELECT COUNT(*) FROM {$wpdb->comments} $where";
|
890 |
+
}
|
891 |
+
|
892 |
+
return $q;
|
893 |
+
}
|
894 |
+
|
895 |
+
/**
|
896 |
+
* add comments clauses
|
897 |
+
* add new orderby clause when sort type is vote and wordpress comments order is older (ASC)
|
898 |
+
*/
|
899 |
+
public function commentsClauses($args) {
|
900 |
+
global $wpdb;
|
901 |
+
if (isset($this->commentsArgs["caller"]) && $this->commentsArgs["caller"] === "wpdiscuz" && !$this->options->wp["isPaginate"]) {
|
902 |
+
$orderby = "";
|
903 |
+
$args["caller"] = $this->commentsArgs["caller"] = "wpdiscuz-";
|
904 |
+
if ($this->options->thread_layouts["showVotingButtons"] && $this->commentsArgs["orderby"] === "by_vote") {
|
905 |
+
$args["join"] .= " LEFT JOIN " . $wpdb->commentmeta . " AS `cm` ON " . $wpdb->comments . ".comment_ID = `cm`.comment_id AND (`cm`.meta_key = '" . self::META_KEY_VOTES . "')";
|
906 |
+
$orderby = " IFNULL(`cm`.meta_value,0)+0 DESC, ";
|
907 |
+
} else if ($this->commentsArgs["last_parent_id"] && empty($this->commentsArgs["sticky"])) {
|
908 |
+
$args["where"] = $wpdb->comments . ".`comment_ID`" . ($this->commentsArgs["order"] === 'desc' ? " < " : " > ") . $this->commentsArgs["last_parent_id"] . ($args["where"] ? " AND " : "") . $args["where"];
|
909 |
+
}
|
910 |
+
$args["orderby"] = $orderby . $wpdb->comments . ".`{$this->options->thread_display["orderCommentsBy"]}` ";
|
911 |
+
$args["orderby"] .= isset($args["order"]) ? "" : $this->commentsArgs["order"];
|
912 |
+
}
|
913 |
+
|
914 |
+
return $args;
|
915 |
+
}
|
916 |
+
|
917 |
+
public function getDefaultCommentsArgs($postId = 0) {
|
918 |
+
global $user_ID;
|
919 |
+
$commenter = wp_get_current_commenter();
|
920 |
+
$args = [
|
921 |
+
"caller" => "wpdiscuz",
|
922 |
+
"post_id" => intval($postId),
|
923 |
+
"last_parent_id" => 0,
|
924 |
+
"orderby" => $this->options->thread_display["orderCommentsBy"],
|
925 |
+
"order" => $this->options->wp["commentOrder"],
|
926 |
+
// max value of php int for limit
|
927 |
+
"number" => $this->options->thread_display["commentListLoadType"] == 3 ? PHP_INT_MAX - 1 : $this->options->wp["commentPerPage"],
|
928 |
+
"status" => !$this->options->wp["isPaginate"] && current_user_can("moderate_comments") ? "all" : "approve",
|
929 |
+
"update_comment_meta_cache" => false,
|
930 |
+
"no_found_rows" => false,
|
931 |
+
"type__not_in" => [self::WPDISCUZ_STICKY_COMMENT],
|
932 |
+
"wpdType" => "",
|
933 |
+
];
|
934 |
+
if ($this->options->wp["threadComments"]) {
|
935 |
+
$args["parent"] = 0;
|
936 |
+
}
|
937 |
+
if (!current_user_can("moderate_comments")) {
|
938 |
+
if ($user_ID) {
|
939 |
+
$args["include_unapproved"] = [$user_ID];
|
940 |
+
} elseif (!empty($commenter["comment_author_email"])) {
|
941 |
+
$args["include_unapproved"] = [$commenter["comment_author_email"]];
|
942 |
+
}
|
943 |
+
}
|
944 |
+
|
945 |
+
return apply_filters("wpdiscuz_comments_args", $args);
|
946 |
+
}
|
947 |
+
|
948 |
+
/**
|
949 |
+
* register options page for plugin
|
950 |
+
*/
|
951 |
+
public function addPluginOptionsPage() {
|
952 |
+
add_menu_page("wpDiscuz", "wpDiscuz", "manage_options", self::PAGE_WPDISCUZ, "", "dashicons-admin-comments", 26);
|
953 |
+
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Dashboard", "wpdiscuz"), "» " . esc_html__("Dashboard", "wpdiscuz"), "manage_options", self::PAGE_WPDISCUZ, [
|
954 |
+
&$this->options,
|
955 |
+
"dashboard"
|
956 |
+
]);
|
957 |
+
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Settings", "wpdiscuz"), "» " . esc_html__("Settings", "wpdiscuz"), "manage_options", self::PAGE_SETTINGS, [
|
958 |
+
&$this->options,
|
959 |
+
"mainOptionsForm"
|
960 |
+
]);
|
961 |
+
if (!$this->options->general["isUsePoMo"]) {
|
962 |
+
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Phrases", "wpdiscuz"), "» " . esc_html__("Phrases", "wpdiscuz"), "manage_options", self::PAGE_PHRASES, [
|
963 |
+
&$this->options,
|
964 |
+
"phrasesOptionsForm"
|
965 |
+
]);
|
966 |
+
}
|
967 |
+
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Tools", "wpdiscuz"), "» " . esc_html__("Tools", "wpdiscuz"), "manage_options", self::PAGE_TOOLS, [
|
968 |
+
&$this->options,
|
969 |
+
"tools"
|
970 |
+
]);
|
971 |
+
add_submenu_page(self::PAGE_WPDISCUZ, "» " . esc_html__("Addons", "wpdiscuz"), "» " . esc_html__("Addons", "wpdiscuz"), "manage_options", self::PAGE_ADDONS, [
|
972 |
+
&$this->options,
|
973 |
+
"addons"
|
974 |
+
]);
|
975 |
+
}
|
976 |
+
|
977 |
+
/**
|
978 |
+
* Scripts and styles registration on administration pages
|
979 |
+
*/
|
980 |
+
public function backendFiles() {
|
981 |
+
global $typenow, $pagenow;
|
982 |
+
$wp_version = get_bloginfo("version");
|
983 |
+
$wpdiscuzWpPages = apply_filters("wpdiscuz_wp_admin_pages", ["edit-comments.php", "admin.php", "comment.php"]);
|
984 |
+
$wpdiscuzPages = apply_filters("wpdiscuz_admin_pages", [
|
985 |
+
self::PAGE_WPDISCUZ,
|
986 |
+
self::PAGE_SETTINGS,
|
987 |
+
self::PAGE_PHRASES,
|
988 |
+
self::PAGE_TOOLS,
|
989 |
+
self::PAGE_ADDONS
|
990 |
+
]);
|
991 |
+
wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
|
992 |
+
|
993 |
+
if ((isset($_GET["page"]) && in_array($_GET["page"], $wpdiscuzPages) && in_array($pagenow, $wpdiscuzWpPages)) || ($typenow === "wpdiscuz_form") || ($pagenow === self::PAGE_COMMENTS)) {
|
994 |
+
$args = [
|
995 |
+
"msgConfirmResetOptions" => esc_html__("Do you really want to reset all options?", "wpdiscuz"),
|
996 |
+
"msgConfirmResetTabOptions" => esc_html__("Do you really want to reset tab options?", "wpdiscuz"),
|
997 |
+
"msgConfirmRemoveVotes" => esc_html__("Do you really want to remove voting data?", "wpdiscuz"),
|
998 |
+
"msgConfirmResetPhrases" => esc_html__("Do you really want to reset phrases?", "wpdiscuz"),
|
999 |
+
"wmuMsgConfirmAttachmentDelete" => esc_html__("Do you really want to delet this attachment?", "wpdiscuz"),
|
1000 |
+
"msgConfirmPurgeGravatarsCache" => esc_html__("Do you really want to delete gravatars cache?", "wpdiscuz"),
|
1001 |
+
];
|
1002 |
+
// Media Upload Lightbox
|
1003 |
+
wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox.css"));
|
1004 |
+
wp_enqueue_style("wmu-colorbox-css");
|
1005 |
+
wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox.min.js"), ["jquery"]);
|
1006 |
+
wp_enqueue_script("wmu-colorbox-js");
|
1007 |
+
|
1008 |
+
wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-backend.css"));
|
1009 |
+
wp_enqueue_style("wpdiscuz-mu-css");
|
1010 |
+
wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-backend.js"), ["jquery"], $this->version, true);
|
1011 |
+
wp_localize_script("wpdiscuz-mu-js", "wpdiscuzMUJsObj", $args);
|
1012 |
+
wp_enqueue_script("wpdiscuz-mu-js");
|
1013 |
+
|
1014 |
+
wp_enqueue_style("wpdiscuz-font-awesome");
|
1015 |
+
wp_register_style("wpdiscuz-cp-index-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/css/index.css"), null, $this->version);
|
1016 |
+
wp_enqueue_style("wpdiscuz-cp-index-css");
|
1017 |
+
wp_register_style("wpdiscuz-cp-compatibility-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/css/compatibility.css"), null, $this->version);
|
1018 |
+
wp_enqueue_style("wpdiscuz-cp-compatibility-css");
|
1019 |
+
wp_register_script("wpdiscuz-cp-colors-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/js/colors.js"), ["jquery"], $this->version, false);
|
1020 |
+
wp_enqueue_script("wpdiscuz-cp-colors-js");
|
1021 |
+
wp_register_script("wpdiscuz-cp-colorpicker-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/js/jqColorPicker.min.js"), ["jquery"], $this->version, false);
|
1022 |
+
wp_enqueue_script("wpdiscuz-cp-colorpicker-js");
|
1023 |
+
wp_register_script("wpdiscuz-cp-index-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorpicker/js/index.js"), ["jquery"], $this->version, false);
|
1024 |
+
wp_enqueue_script("wpdiscuz-cp-index-js");
|
1025 |
+
wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
|
1026 |
+
wp_enqueue_style("wpdiscuz-options-css");
|
1027 |
+
wp_register_script("wpdiscuz-options-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-options.js"), ["jquery"], $this->version);
|
1028 |
+
wp_enqueue_script("wpdiscuz-options-js");
|
1029 |
+
wp_localize_script("wpdiscuz-options-js", "wpdiscuzObj", $args);
|
1030 |
+
wp_enqueue_script("thickbox");
|
1031 |
+
wp_register_script("wpdiscuz-contenthover", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/contenthover/jquery.contenthover.min.js"), ["jquery"], $this->version, true);
|
1032 |
+
wp_enqueue_script("wpdiscuz-contenthover");
|
1033 |
+
|
1034 |
+
if (isset($_GET["page"])) {
|
1035 |
+
wp_register_style("wpdiscuz-easy-responsive-tabs-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/css/easy-responsive-tabs.min.css"), null, $this->version);
|
1036 |
+
wp_enqueue_style("wpdiscuz-easy-responsive-tabs-css");
|
1037 |
+
wp_register_script("wpdiscuz-easy-responsive-tabs-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/easy-responsive-tabs/js/easy-responsive-tabs.js"), ["jquery"], $this->version, true);
|
1038 |
+
wp_enqueue_script("wpdiscuz-easy-responsive-tabs-js");
|
1039 |
+
wp_register_script("wpdiscuz-jquery-cookie", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
|
1040 |
+
wp_enqueue_script("wpdiscuz-jquery-cookie");
|
1041 |
+
wp_register_script("wpdiscuz-chart-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/chart/chart.min.js"), [], $this->version, true);
|
1042 |
+
wp_enqueue_script("wpdiscuz-chart-js");
|
1043 |
+
}
|
1044 |
+
} else if ($pagenow === "comment.php") {
|
1045 |
+
wp_register_style("wpdiscuz-options-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-options.css"), null, $this->version);
|
1046 |
+
wp_enqueue_style("wpdiscuz-options-css");
|
1047 |
+
wp_enqueue_style("wpdiscuz-font-awesome");
|
1048 |
+
}
|
1049 |
+
if (version_compare($wp_version, "4.2.0", ">=")) {
|
1050 |
+
wp_register_script("wpdiscuz-addon-notes", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-notes.js"), ["jquery"], $this->version, true);
|
1051 |
+
wp_enqueue_script("wpdiscuz-addon-notes");
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
if (!get_option(self::OPTION_SLUG_DEACTIVATION) && (strpos($this->requestUri, "/plugins.php") !== false)) {
|
1055 |
+
$reasonArgs = [
|
1056 |
+
"msgReasonRequired" => esc_html__("Please check one of reasons before sending feedback!", "wpdiscuz"),
|
1057 |
+
"msgReasonDescRequired" => esc_html__("Please provide more information", "wpdiscuz"),
|
1058 |
+
"adminUrl" => get_admin_url()
|
1059 |
+
];
|
1060 |
+
wp_register_style("wpdiscuz-lity-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.css"), null, $this->version);
|
1061 |
+
wp_enqueue_style("wpdiscuz-lity-css");
|
1062 |
+
wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity.js"), ["jquery"], $this->version);
|
1063 |
+
wp_enqueue_script("wpdiscuz-lity-js");
|
1064 |
+
wp_register_style("wpdiscuz-deactivation-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-deactivation.css"));
|
1065 |
+
wp_enqueue_style("wpdiscuz-deactivation-css");
|
1066 |
+
wp_register_script("wpdiscuz-deactivation-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-deactivation.js"), ["jquery"], $this->version);
|
1067 |
+
wp_enqueue_script("wpdiscuz-deactivation-js");
|
1068 |
+
wp_localize_script("wpdiscuz-deactivation-js", "deactivationObj", $reasonArgs);
|
1069 |
+
}
|
1070 |
+
wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", null);
|
1071 |
+
wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js");
|
1072 |
+
wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-js", "wpdObject", [
|
1073 |
+
"ajaxUrl" => admin_url("admin-ajax.php"),
|
1074 |
+
"shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE,
|
1075 |
+
"image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"),
|
1076 |
+
"tooltip" => $this->options->phrases["wc_feedback_shortcode_tooltip"],
|
1077 |
+
"popup_title" => $this->options->phrases["wc_feedback_popup_title"],
|
1078 |
+
"leave_feebdack" => $this->options->phrases["wc_please_leave_feebdack"],
|
1079 |
+
"no_text_selected" => esc_html__("No text is selected. Please select a part of text from post content.", "wpdiscuz")
|
1080 |
+
]);
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
/**
|
1084 |
+
* Styles and scripts registration to use on front page
|
1085 |
+
*/
|
1086 |
+
public function frontendFiles() {
|
1087 |
+
global $post;
|
1088 |
+
$this->isWpdiscuzLoaded = $this->helper->isLoadWpdiscuz($post);
|
1089 |
+
$suf = $this->options->general["loadMinVersion"] ? ".min" : "";
|
1090 |
+
wp_register_style("wpdiscuz-font-awesome", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fontawesome-all.min.css"), null, $this->version);
|
1091 |
+
wp_register_style("wpdiscuz-ratings", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings$suf.css"), null, $this->version);
|
1092 |
+
wp_register_style("wpdiscuz-ratings-rtl", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-ratings-rtl$suf.css"), null, $this->version);
|
1093 |
+
if (!$this->isWpdiscuzLoaded && $this->options->rating["ratingCssOnNoneSingular"]) {
|
1094 |
+
wp_enqueue_style("wpdiscuz-ratings");
|
1095 |
+
if (is_rtl()) {
|
1096 |
+
wp_enqueue_style("wpdiscuz-ratings-rtl");
|
1097 |
+
}
|
1098 |
+
}
|
1099 |
+
if ($this->isWpdiscuzLoaded) {
|
1100 |
+
$this->form = $this->wpdiscuzForm->getForm($post->ID);
|
1101 |
+
$this->form->initFormMeta();
|
1102 |
+
$this->wpdiscuzOptionsJs = $this->options->getOptionsForJs();
|
1103 |
+
$this->wpdiscuzOptionsJs["version"] = $this->version;
|
1104 |
+
$this->wpdiscuzOptionsJs["wc_post_id"] = $post->ID;
|
1105 |
+
$this->wpdiscuzOptionsJs["loadLastCommentId"] = 0;
|
1106 |
+
$this->wpdiscuzOptionsJs["isCookiesEnabled"] = has_action("set_comment_cookies");
|
1107 |
+
if ($this->options->live["commentListUpdateType"] || ($this->options->live["enableBubble"] && $this->options->live["bubbleLiveUpdate"])) {
|
1108 |
+
$cArgs = $this->getDefaultCommentsArgs($post->ID);
|
1109 |
+
$this->wpdiscuzOptionsJs["loadLastCommentId"] = $this->dbManager->getLastCommentId($cArgs);
|
1110 |
+
}
|
1111 |
+
if ($this->form->showRecaptcha() && apply_filters("wpdiscuz_recaptcha_site_key", $this->options->recaptcha["siteKey"]) && apply_filters("wpdiscuz_recaptcha_secret", $this->options->recaptcha["secretKey"])) {
|
1112 |
+
wp_register_script("wpdiscuz-google-recaptcha", apply_filters("wpdiscuz_recaptcha_url", $this->options->recaptcha["reCaptchaUrl"]), null, "1.0.0", true);
|
1113 |
+
wp_enqueue_script("wpdiscuz-google-recaptcha");
|
1114 |
+
}
|
1115 |
+
$this->wpdiscuzOptionsJs["dataFilterCallbacks"] = [];
|
1116 |
+
$this->wpdiscuzOptionsJs = apply_filters("wpdiscuz_js_options", $this->wpdiscuzOptionsJs, $this->options);
|
1117 |
+
$this->wpdiscuzOptionsJs["url"] = admin_url("admin-ajax.php");
|
1118 |
+
$this->wpdiscuzOptionsJs["customAjaxUrl"] = plugins_url(WPDISCUZ_DIR_NAME . "/utils/ajax/wpdiscuz-ajax.php");
|
1119 |
+
$this->wpdiscuzOptionsJs["bubbleUpdateUrl"] = rest_url("wpdiscuz/v1/update");
|
1120 |
+
$this->wpdiscuzOptionsJs["restNonce"] = wp_create_nonce("wp_rest");
|
1121 |
+
$loadQuill = $this->options->form["richEditor"] === "both" || (!wp_is_mobile() && $this->options->form["richEditor"] === "desktop");
|
1122 |
+
$customCSSSlug = "wpdiscuz-frontend-custom-css";
|
1123 |
+
$customFileName = "style-custom";
|
1124 |
+
if (is_rtl()) {
|
1125 |
+
$customCSSSlug = "wpdiscuz-frontend-custom-rtl-css";
|
1126 |
+
$customFileName = "style-custom-rtl";
|
1127 |
+
if ($this->options->thread_styles["theme"] === "wpd-minimal") {
|
1128 |
+
$cssSlug = "wpdiscuz-frontend-minimal-rtl-css";
|
1129 |
+
$fileName = "style-minimal-rtl";
|
1130 |
+
} else {
|
1131 |
+
$cssSlug = "wpdiscuz-frontend-rtl-css";
|
1132 |
+
$fileName = "style-rtl";
|
1133 |
+
}
|
1134 |
+
} else if ($this->options->thread_styles["theme"] === "wpd-minimal") {
|
1135 |
+
$cssSlug = "wpdiscuz-frontend-minimal-css";
|
1136 |
+
$fileName = "style-minimal";
|
1137 |
+
} else {
|
1138 |
+
$cssSlug = "wpdiscuz-frontend-css";
|
1139 |
+
$fileName = "style";
|
1140 |
+
}
|
1141 |
+
$this->helper->enqueueWpDiscuzStyle($cssSlug, $fileName, $this->version, $this->form);
|
1142 |
+
$this->helper->enqueueWpDiscuzStyle($customCSSSlug, $customFileName, $this->version, $this->form);
|
1143 |
+
wp_add_inline_style($cssSlug, $this->helper->initCustomCss());
|
1144 |
+
$ucArgs = [
|
1145 |
+
"msgConfirmDeleteComment" => esc_html($this->options->phrases["wc_confirm_comment_delete"]),
|
1146 |
+
"msgConfirmCancelSubscription" => esc_html($this->options->phrases["wc_confirm_cancel_subscription"]),
|
1147 |
+
"msgConfirmCancelFollow" => esc_html($this->options->phrases["wc_confirm_cancel_follow"]),
|
1148 |
+
"additionalTab" => (int) apply_filters("wpdiscuz_enable_content_modal", false),
|
1149 |
+
];
|
1150 |
+
if ($this->options->thread_styles["enableFontAwesome"]) {
|
1151 |
+
if ($this->form->hasIcon) {
|
1152 |
+
wp_enqueue_style("wpdiscuz-font-awesome");
|
1153 |
+
} else {
|
1154 |
+
wp_register_style("wpdiscuz-fa", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/font-awesome-5.13.0/css/fa.min.css"), null, $this->version);
|
1155 |
+
wp_enqueue_style("wpdiscuz-fa");
|
1156 |
+
}
|
1157 |
+
}
|
1158 |
+
if ($this->options->general["loadComboVersion"]) {
|
1159 |
+
$combo_js = "";
|
1160 |
+
$combo_css = "";
|
1161 |
+
if (!$loadQuill) {
|
1162 |
+
$combo_js .= "-no_quill";
|
1163 |
+
$combo_css .= "-no_quill";
|
1164 |
+
}
|
1165 |
+
wp_register_style("wpdiscuz-combo-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-combo$combo_css.min.css"));
|
1166 |
+
wp_enqueue_style("wpdiscuz-combo-css");
|
1167 |
+
wp_register_script("wpdiscuz-combo-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-combo$combo_js.min.js"), ["jquery"], $this->version, true);
|
1168 |
+
wp_enqueue_script("wpdiscuz-combo-js");
|
1169 |
+
wp_localize_script("wpdiscuz-combo-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
|
1170 |
+
wp_localize_script("wpdiscuz-combo-js", "wpdiscuzUCObj", $ucArgs);
|
1171 |
+
if ($loadQuill) {
|
1172 |
+
wp_add_inline_script("wpdiscuz-combo$combo_js-js", $this->options->editorOptions(), "before");
|
1173 |
+
}
|
1174 |
+
} else {
|
1175 |
+
wp_register_script("wpdiscuz-cookie-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/wpdccjs/wpdcc.js"), ["jquery"], $this->version, true);
|
1176 |
+
wp_enqueue_script("wpdiscuz-cookie-js");
|
1177 |
+
//
|
1178 |
+
if ($loadQuill) {
|
1179 |
+
wp_register_style("quill-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/quill/quill.snow$suf.css"), null, "1.3.6");
|
1180 |
+
wp_enqueue_style("quill-css");
|
1181 |
+
wp_register_script("quill", plugins_url("/assets/third-party/quill/quill$suf.js", __FILE__), ["wpdiscuz-cookie-js"], "1.3.6", true);
|
1182 |
+
wp_enqueue_script("quill");
|
1183 |
+
wp_add_inline_script("quill", $this->options->editorOptions(), "before");
|
1184 |
+
wp_register_script("wpd-editor", plugins_url("/assets/js/wpd-editor$suf.js", __FILE__), ["quill"], "1.3.6", true);
|
1185 |
+
wp_enqueue_script("wpd-editor");
|
1186 |
+
}
|
1187 |
+
wp_register_script("autogrowtextarea-js", plugins_url("/assets/third-party/autogrow/jquery.autogrowtextarea.min.js", __FILE__), ["jquery"], "1.3.6", true);
|
1188 |
+
wp_enqueue_script("autogrowtextarea-js");
|
1189 |
+
wp_register_script("wpdiscuz-ajax-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz$suf.js"), [$loadQuill ? "wpd-editor" : "jquery"], $this->version, true);
|
1190 |
+
wp_enqueue_script("wpdiscuz-ajax-js");
|
1191 |
+
wp_localize_script("wpdiscuz-ajax-js", "wpdiscuzAjaxObj", $this->wpdiscuzOptionsJs);
|
1192 |
+
//
|
1193 |
+
if ($this->options->content["wmuIsEnabled"]) {
|
1194 |
+
// Media Upload Lightbox
|
1195 |
+
if ($this->options->content["wmuIsLightbox"]) {
|
1196 |
+
wp_register_style("wmu-colorbox-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/colorbox$suf.css"));
|
1197 |
+
wp_enqueue_style("wmu-colorbox-css");
|
1198 |
+
wp_register_script("wmu-colorbox-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/colorbox/jquery.colorbox$suf.js"), ["jquery"], $this->version, true);
|
1199 |
+
wp_enqueue_script("wmu-colorbox-js");
|
1200 |
+
}
|
1201 |
+
wp_register_style("wpdiscuz-mu-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-mu-frontend$suf.css"));
|
1202 |
+
wp_enqueue_style("wpdiscuz-mu-css");
|
1203 |
+
wp_register_script("wpdiscuz-mu-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-mu-frontend$suf.js"), ["wpdiscuz-ajax-js"], $this->version, true);
|
1204 |
+
wp_enqueue_script("wpdiscuz-mu-js");
|
1205 |
+
}
|
1206 |
+
if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
|
1207 |
+
wp_register_style("wpdiscuz-user-content-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/css/wpdiscuz-user-content$suf.css"), null, $this->version);
|
1208 |
+
wp_enqueue_style("wpdiscuz-user-content-css");
|
1209 |
+
wp_register_script("wpdiscuz-lity-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/lity/lity$suf.js"), ["jquery"], $this->version, true);
|
1210 |
+
wp_enqueue_script("wpdiscuz-lity-js");
|
1211 |
+
wp_register_script("wpdiscuz-user-content-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-user-content$suf.js"), ["wpdiscuz-lity-js"], $this->version, true);
|
1212 |
+
wp_enqueue_script("wpdiscuz-user-content-js");
|
1213 |
+
wp_localize_script("wpdiscuz-user-content-js", "wpdiscuzUCObj", $ucArgs);
|
1214 |
+
}
|
1215 |
+
}
|
1216 |
+
if (!$loadQuill && $this->options->form["enableQuickTags"]) {
|
1217 |
+
wp_enqueue_script("quicktags");
|
1218 |
+
wp_register_script("wpdiscuz-quicktags", plugins_url("/assets/third-party/quicktags/wpdiscuz-quictags.js", __FILE__), [$this->options->general["loadComboVersion"] ? "wpdiscuz-combo-js" : "wpdiscuz-ajax-js"], $this->version, true);
|
1219 |
+
wp_enqueue_script("wpdiscuz-quicktags");
|
1220 |
+
}
|
1221 |
+
do_action("wpdiscuz_front_scripts", $this->options);
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
public function pluginNewVersion() {
|
1226 |
+
$pluginData = get_plugin_data(__FILE__);
|
1227 |
+
if (version_compare($pluginData["Version"], $this->version, ">")) {
|
1228 |
+
$this->dbManager->dbCreateTables();
|
1229 |
+
$this->wpdiscuzForm->createDefaultForm($this->version);
|
1230 |
+
$options = $this->changeOldOptions(get_option(self::OPTION_SLUG_OPTIONS), $pluginData);
|
1231 |
+
if ($this->version === "5.3.2") {
|
1232 |
+
$this->mergeOptions($options);
|
1233 |
+
} else {
|
1234 |
+
$this->addNewOptions($options);
|
1235 |
+
}
|
1236 |
+
$this->addNewPhrases();
|
1237 |
+
update_option(self::OPTION_SLUG_VERSION, $pluginData["Version"]);
|
1238 |
+
|
1239 |
+
if (version_compare($this->version, "2.1.2", "<=") && version_compare($this->version, "1.0.0", "!=")) {
|
1240 |
+
$this->dbManager->alterPhrasesTable();
|
1241 |
+
}
|
1242 |
+
|
1243 |
+
if (version_compare($this->version, "2.1.7", "<=") && version_compare($this->version, "1.0.0", "!=")) {
|
1244 |
+
$this->dbManager->alterVotingTable();
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
if (version_compare($this->version, "5.0.5", "<=") && version_compare($this->version, "1.0.0", "!=")) {
|
1248 |
+
$this->dbManager->alterNotificationTable();
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
if (version_compare($this->version, "5.1.2", "<=")) {
|
1252 |
+
$this->dbManager->deleteOldStatisticCaches();
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
if (version_compare($this->version, "7.0.0", "<")) {
|
1256 |
+
$this->deactivateAddons();
|
1257 |
+
if (version_compare($this->version, "1.0.0", "!=") && version_compare($this->version, "7.0.0-beta-1", "<")) {
|
1258 |
+
$this->dbManager->alterVotingTableForDateAndPostId();
|
1259 |
+
$this->options->replaceOldOptions($options);
|
1260 |
+
}
|
1261 |
+
$this->setRecaptchaOptions($options);
|
1262 |
+
$showVoteRegenerate = intval($this->dbManager->showVoteRegenerate());
|
1263 |
+
add_option(self::OPTION_SLUG_SHOW_VOTE_REG_MESSAGE, ($showVoteRegenerate ? "1" : "0"), "", "no");
|
1264 |
+
$showClosedRegenerate = intval($this->dbManager->showClosedRegenerate());
|
1265 |
+
add_option(self::OPTION_SLUG_SHOW_CLOSED_REG_MESSAGE, ($showClosedRegenerate ? "1" : "0"), "", "no");
|
1266 |
+
$showVoteDataRegenerate = intval($this->dbManager->showVoteDataRegenerate());
|
1267 |
+
add_option(self::OPTION_SLUG_SHOW_VOTE_DATA_REG_MESSAGE, ($showVoteDataRegenerate ? "1" : "0"), "", "no");
|
1268 |
+
add_option(self::OPTION_SLUG_SHOW_SYNC_COMMENTERS_MESSAGE, ($this->dbManager->usersHaveComments() ? "1" : "0"), "", "no");
|
1269 |
+
add_option(self::OPTION_SLUG_WIZARD_COMPLETED, "0", "", "no");
|
1270 |
+
add_option(self::OPTION_SLUG_WIZARD_AFTER_UPDATE, ($this->version === "1.0.0" ? "0" : "1"), "", "no");
|
1271 |
+
$this->removeOldFiles();
|
1272 |
+
$this->dbManager->deleteStatisticCaches();
|
1273 |
+
if (($advancedNocaptcha = get_option("anr_admin_options")) && !empty($advancedNocaptcha["enabled_forms"]) && ($key = array_search("comment", $advancedNocaptcha["enabled_forms"]))) {
|
1274 |
+
unset($advancedNocaptcha["enabled_forms"][$key]);
|
1275 |
+
update_option("anr_admin_options", $advancedNocaptcha);
|
1276 |
+
}
|
1277 |
+
if (($invisibleRecaptcha = get_option("ic-wordpress-settings")) && !empty($invisibleRecaptcha["CF"])) {
|
1278 |
+
unset($invisibleRecaptcha["CF"]);
|
1279 |
+
update_option("ic-wordpress-settings", $invisibleRecaptcha);
|
1280 |
+
}
|
1281 |
+
}
|
1282 |
+
if (version_compare($this->version, "7.0.3", "<") && version_compare($this->version, "1.0.0", "!=")) {
|
1283 |
+
$this->dbManager->alterSubscriptionTable();
|
1284 |
+
}
|
1285 |
+
do_action("wpdiscuz_clean_all_caches", $pluginData["Version"], $this->version);
|
1286 |
+
}
|
1287 |
+
do_action("wpdiscuz_check_version");
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
/**
|
1291 |
+
* remove old captcha files
|
1292 |
+
*/
|
1293 |
+
private function removeOldFiles() {
|
1294 |
+
$wpUploadsDir = wp_upload_dir();
|
1295 |
+
$captchaDir = $wpUploadsDir["basedir"] . "/wpdiscuz/captcha/";
|
1296 |
+
if (file_exists($captchaDir)) {
|
1297 |
+
$files = function_exists("scandir") ? scandir($captchaDir) : false;
|
1298 |
+
if ($files && is_array($files)) {
|
1299 |
+
foreach ($files as $k => $file) {
|
1300 |
+
if ($file !== "." && $file !== "..") {
|
1301 |
+
$fileName = $captchaDir . $file;
|
1302 |
+
if (is_file($fileName)) {
|
1303 |
+
@unlink($fileName);
|
1304 |
+
} else {
|
1305 |
+
@rmdir($fileName);
|
1306 |
+
}
|
1307 |
+
}
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
@rmdir($captchaDir);
|
1311 |
+
}
|
1312 |
+
}
|
1313 |
+
|
1314 |
+
private function deactivateAddons() {
|
1315 |
+
$plugins = [];
|
1316 |
+
if (is_plugin_active("wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php")) {
|
1317 |
+
$plugins[] = "wpdiscuz-ads-manager/class-WpdiscuzAdsManager.php";
|
1318 |
+
}
|
1319 |
+
if (is_plugin_active("wpdiscuz-advanced-likers/class.WpdiscuzVoters.php")) {
|
1320 |
+
$plugins[] = "wpdiscuz-advanced-likers/class.WpdiscuzVoters.php";
|
1321 |
+
}
|
1322 |
+
if (is_plugin_active("wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php")) {
|
1323 |
+
$plugins[] = "wpdiscuz-comment-author-info/wpdiscuz-comment-author-info.php";
|
1324 |
+
}
|
1325 |
+
if (is_plugin_active("wpdiscuz-comment-search/wpDiscuzCommentSearch.php")) {
|
1326 |
+
$plugins[] = "wpdiscuz-comment-search/wpDiscuzCommentSearch.php";
|
1327 |
+
}
|
1328 |
+
if (is_plugin_active("wpdiscuz-comment-translation/wpdiscuz-translate.php")) {
|
1329 |
+
$plugins[] = "wpdiscuz-comment-translation/wpdiscuz-translate.php";
|
1330 |
+
}
|
1331 |
+
if (is_plugin_active("wpdiscuz-emoticons/wpDiscuzSmile.php")) {
|
1332 |
+
$plugins[] = "wpdiscuz-emoticons/wpDiscuzSmile.php";
|
1333 |
+
}
|
1334 |
+
if (is_plugin_active("wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php")) {
|
1335 |
+
$plugins[] = "wpdiscuz-frontend-moderation/class.wpDiscuzFrontEndModeration.php";
|
1336 |
+
}
|
1337 |
+
if (is_plugin_active("wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php")) {
|
1338 |
+
$plugins[] = "wpdiscuz-media-uploader/class.WpdiscuzMediaUploader.php";
|
1339 |
+
}
|
1340 |
+
if (is_plugin_active("wpdiscuz-mycred/wpdiscuz-mc.php")) {
|
1341 |
+
$plugins[] = "wpdiscuz-mycred/wpdiscuz-mc.php";
|
1342 |
+
}
|
1343 |
+
if (is_plugin_active("wpdiscuz-online-users/wpdiscuz-ou.php")) {
|
1344 |
+
$plugins[] = "wpdiscuz-online-users/wpdiscuz-ou.php";
|
1345 |
+
}
|
1346 |
+
if (is_plugin_active("wpdiscuz-recaptcha/wpDiscuzReCaptcha.php")) {
|
1347 |
+
$plugins[] = "wpdiscuz-recaptcha/wpDiscuzReCaptcha.php";
|
1348 |
+
}
|
1349 |
+
if (is_plugin_active("wpdiscuz-report-flagging/wpDiscuzFlagComment.php")) {
|
1350 |
+
$plugins[] = "wpdiscuz-report-flagging/wpDiscuzFlagComment.php";
|
1351 |
+
}
|
1352 |
+
if (is_plugin_active("wpdiscuz-subscribe-manager/wpdSubscribeManager.php")) {
|
1353 |
+
$plugins[] = "wpdiscuz-subscribe-manager/wpdSubscribeManager.php";
|
1354 |
+
}
|
1355 |
+
if (is_plugin_active("wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php")) {
|
1356 |
+
$plugins[] = "wpdiscuz-user-comment-mentioning/WpdiscuzUCM.php";
|
1357 |
+
}
|
1358 |
+
if (is_plugin_active("wpdiscuz-widgets/wpDiscuzWidgets.php")) {
|
1359 |
+
$plugins[] = "wpdiscuz-widgets/wpDiscuzWidgets.php";
|
1360 |
+
}
|
1361 |
+
if ($plugins) {
|
1362 |
+
deactivate_plugins($plugins);
|
1363 |
+
add_option(self::OPTION_SLUG_WIZARD_SHOW_ADDONS_MSG, "1", "", "no");
|
1364 |
+
}
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
/**
|
1368 |
+
* set recaptcha options
|
1369 |
+
*/
|
1370 |
+
private function setRecaptchaOptions($options) {
|
1371 |
+
if (!$options[self::TAB_RECAPTCHA]["siteKey"] && ($recaptchaSettings = get_option("wpdiscuz_recaptcha"))) {
|
1372 |
+
$options[self::TAB_RECAPTCHA]["siteKey"] = $recaptchaSettings["site_key"];
|
1373 |
+
$options[self::TAB_RECAPTCHA]["secretKey"] = $recaptchaSettings["secret_key"];
|
1374 |
+
$options[self::TAB_RECAPTCHA]["theme"] = $recaptchaSettings["theme"];
|
1375 |
+
$options[self::TAB_RECAPTCHA]["lang"] = $recaptchaSettings["lang"];
|
1376 |
+
$options[self::TAB_RECAPTCHA]["showForGuests"] = 1;
|
1377 |
+
$options[self::TAB_RECAPTCHA]["requestMethod"] = $recaptchaSettings["request_method"];
|
1378 |
+
$options[self::TAB_RECAPTCHA]["isShowOnSubscribeForm"] = $recaptchaSettings["isShowOnSubscribeForm"] === "on" ? 1 : 0;
|
1379 |
+
$this->options->initOptions($options);
|
1380 |
+
$this->options->updateOptions();
|
1381 |
+
}
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
/**
|
1385 |
+
* merge old and new options
|
1386 |
+
*/
|
1387 |
+
private function addNewOptions(&$options) {
|
1388 |
+
$options = array_merge($this->options->getDefaultOptions(), $options);
|
1389 |
+
$this->options->initOptions($options);
|
1390 |
+
$this->options->updateOptions();
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
/**
|
1394 |
+
* merge old and new options recursively
|
1395 |
+
*/
|
1396 |
+
private function mergeOptions(&$options) {
|
1397 |
+
$newOptions = [];
|
1398 |
+
$defaults = $this->options->getDefaultOptions();
|
1399 |
+
foreach ($options as $key => $value) {
|
1400 |
+
$newOptions[$key] = array_merge($defaults[$key], $value);
|
1401 |
+
}
|
1402 |
+
$options = $newOptions;
|
1403 |
+
$this->options->initOptions($options);
|
1404 |
+
$this->options->updateOptions();
|
1405 |
+
}
|
1406 |
+
|
1407 |
+
/**
|
1408 |
+
* merge old and new phrases
|
1409 |
+
*/
|
1410 |
+
private function addNewPhrases() {
|
1411 |
+
if ($this->dbManager->isPhraseExists("wc_be_the_first_text")) {
|
1412 |
+
$wc_saved_phrases = $this->dbManager->getPhrases();
|
1413 |
+
$this->options->initPhrases();
|
1414 |
+
$wc_phrases = $this->options->phrases;
|
1415 |
+
$wc_new_phrases = array_merge($wc_phrases, $wc_saved_phrases);
|
1416 |
+
$this->dbManager->updatePhrases($wc_new_phrases);
|
1417 |
+
}
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
/**
|
1421 |
+
* change old options if needed
|
1422 |
+
*/
|
1423 |
+
private function changeOldOptions($options, $pluginData) {
|
1424 |
+
$oldOptions = maybe_unserialize($options);
|
1425 |
+
if (isset($oldOptions["wc_comment_list_order"])) {
|
1426 |
+
update_option("comment_order", $oldOptions["wc_comment_list_order"]);
|
1427 |
+
}
|
1428 |
+
if (isset($oldOptions["wc_comment_count"])) {
|
1429 |
+
update_option("comments_per_page", $oldOptions["wc_comment_count"]);
|
1430 |
+
}
|
1431 |
+
if (isset($oldOptions["wc_load_all_comments"])) {
|
1432 |
+
$this->options->commentListLoadType = 1;
|
1433 |
+
}
|
1434 |
+
if (isset($this->options->disableFontAwesome) && $this->options->disableFontAwesome && $pluginData["Version"] === "5.0.4") {
|
1435 |
+
$this->options->disableFontAwesome = 0;
|
1436 |
+
$oldOptions["disableFontAwesome"] = 0;
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
if (version_compare($this->version, "5.2.1", "<=")) {
|
1440 |
+
$oldOptions["isNativeAjaxEnabled"] = 1;
|
1441 |
+
}
|
1442 |
+
if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.2", "<")) {
|
1443 |
+
$oldOptions[self::TAB_RATING]["enablePostRatingSchema"] = 0;
|
1444 |
+
}
|
1445 |
+
if (version_compare($this->version, "7.0.0", ">=") && version_compare($this->version, "7.0.4", "<")) {
|
1446 |
+
$newMimeTypes = [];
|
1447 |
+
foreach ($oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] as $exts => $type) {
|
1448 |
+
foreach (explode('|', $exts) as $k => $ext) {
|
1449 |
+
$newMimeTypes[$ext] = $type;
|
1450 |
+
}
|
1451 |
+
}
|
1452 |
+
$oldOptions[self::TAB_CONTENT]["wmuMimeTypes"] = $newMimeTypes;
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
return $oldOptions;
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
// Add settings link on plugin page
|
1459 |
+
public function addPluginSettingsLink($links) {
|
1460 |
+
$links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_WPDISCUZ)) . "'>" . esc_html__("Dashboard", "wpdiscuz") . "</a>";
|
1461 |
+
$links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_SETTINGS)) . "'>" . esc_html__("Settings", "wpdiscuz") . "</a>";
|
1462 |
+
if (!$this->options->general["isUsePoMo"]) {
|
1463 |
+
$links[] = "<a href='" . esc_url_raw(admin_url("admin.php?page=" . self::PAGE_PHRASES)) . "'>" . esc_html__("Phrases", "wpdiscuz") . "</a>";
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
return $links;
|
1467 |
+
}
|
1468 |
+
|
1469 |
+
public function initCurrentPostType() {
|
1470 |
+
global $post;
|
1471 |
+
if ($this->isWpdiscuzLoaded) {
|
1472 |
+
$this->form = $this->wpdiscuzForm->getForm($post->ID);
|
1473 |
+
add_filter("comments_template", [&$this, "addCommentForm"], 9999999);
|
1474 |
+
}
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
public function addContentModal() {
|
1478 |
+
echo "<a href='javascript:void(0);' id='wpdUserContentInfoAnchor' style='display:none;' rel='#wpdUserContentInfo' data-wpd-lity>wpDiscuz</a>";
|
1479 |
+
echo "<div id='wpdUserContentInfo' style='overflow:auto;background:#FDFDF6;padding:20px;width:600px;max-width:100%;border-radius:6px;' class='lity-hide'></div>";
|
1480 |
+
}
|
1481 |
+
|
1482 |
+
public function saveLastVisit($post) {
|
1483 |
+
$currentUser = WpdiscuzHelper::getCurrentUser();
|
1484 |
+
if (!empty($currentUser->ID)) {
|
1485 |
+
$lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true);
|
1486 |
+
$lastVisit = is_array($lastVisit) ? $lastVisit : [];
|
1487 |
+
$lastVisit[$post->ID] = current_time("timestamp");
|
1488 |
+
update_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, $lastVisit);
|
1489 |
+
}
|
1490 |
+
}
|
1491 |
+
|
1492 |
+
public function addCommentForm($file) {
|
1493 |
+
return $this->helper->getCommentFormPath($this->form->getTheme());
|
1494 |
+
}
|
1495 |
+
|
1496 |
+
public function getCommentListArgs($postId) {
|
1497 |
+
$post = get_post($postId);
|
1498 |
+
$postsAuthors = $post->comment_count && $this->options->login["enableProfileURLs"] ? $this->dbManager->getPostsAuthors() : [];
|
1499 |
+
$voteSvgs = [
|
1500 |
+
"fa-plus|fa-minus" => [
|
1501 |
+
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='plus' class='svg-inline--fa fa-plus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
|
1502 |
+
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='minus' class='svg-inline--fa fa-minus fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z'></path></svg>",
|
1503 |
+
],
|
1504 |
+
"fa-chevron-up|fa-chevron-down" => [
|
1505 |
+
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-up' class='svg-inline--fa fa-chevron-up fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z'></path></svg>",
|
1506 |
+
"<svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='chevron-down' class='svg-inline--fa fa-chevron-down fa-w-14' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z'></path></svg>",
|
1507 |
+
],
|
1508 |
+
"fa-thumbs-up|fa-thumbs-down" => [
|
1509 |
+
"<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0V0z'/><path d='M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2z'/></svg>",
|
1510 |
+
"<svg xmlns='https://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' d='M0 0h24v24H0z'/><path d='M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z'/></svg>",
|
1511 |
+
],
|
1512 |
+
"fa-smile|fa-frown" => [
|
1513 |
+
"<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='smile' class='svg-inline--fa fa-smile fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z'></path></svg>",
|
1514 |
+
"<svg aria-hidden='true' focusable='false' data-prefix='far' data-icon='frown' class='svg-inline--fa fa-frown fa-w-16' role='img' xmlns='https://www.w3.org/2000/svg' viewBox='0 0 496 512'><path d='M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160-64c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-80 128c-40.2 0-78 17.7-103.8 48.6-8.5 10.2-7.1 25.3 3.1 33.8 10.2 8.4 25.3 7.1 33.8-3.1 16.6-19.9 41-31.4 66.9-31.4s50.3 11.4 66.9 31.4c8.1 9.7 23.1 11.9 33.8 3.1 10.2-8.5 11.5-23.6 3.1-33.8C326 321.7 288.2 304 248 304z'></path></svg>",
|
1515 |
+
],
|
1516 |
+
];
|
1517 |
+
$currentUser = WpdiscuzHelper::getCurrentUser();
|
1518 |
+
$currentUserEmail = "";
|
1519 |
+
$isUserLoggedIn = false;
|
1520 |
+
if (!empty($currentUser->ID)) {
|
1521 |
+
$currentUserEmail = $currentUser->user_email;
|
1522 |
+
$isUserLoggedIn = true;
|
1523 |
+
} else if (!empty($_COOKIE["comment_author_email_" . COOKIEHASH])) {
|
1524 |
+
$currentUserEmail = urldecode(trim($_COOKIE["comment_author_email_" . COOKIEHASH]));
|
1525 |
+
}
|
1526 |
+
$this->form = $this->wpdiscuzForm->getForm($postId);
|
1527 |
+
$high_level_user = current_user_can("moderate_comments");
|
1528 |
+
$can_stick_or_close = $post->post_author == $currentUser->ID;
|
1529 |
+
$post_permalink = get_permalink($postId);
|
1530 |
+
$theme = $this->form->getTheme();
|
1531 |
+
$layout = $this->form->getLayout();
|
1532 |
+
$replyForWoo = apply_filters("wpdiscuz_product_review_replies", true, $postId);
|
1533 |
+
include_once $this->helper->getWalkerPath($theme);
|
1534 |
+
$args = [
|
1535 |
+
"style" => "div",
|
1536 |
+
"echo" => false,
|
1537 |
+
"isSingle" => false,
|
1538 |
+
"reverse_top_level" => false,
|
1539 |
+
"post_id" => $postId,
|
1540 |
+
"reverse_children" => !$this->options->thread_display["reverseChildren"],
|
1541 |
+
"post_author" => $post->post_author,
|
1542 |
+
"posts_authors" => $postsAuthors,
|
1543 |
+
"voting_icons" => $voteSvgs[$this->options->thread_layouts["votingButtonsIcon"]],
|
1544 |
+
"high_level_user" => $high_level_user,
|
1545 |
+
"avatar_trackback" => apply_filters("wpdiscuz_avatar_trackback", plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/trackback.png")),
|
1546 |
+
"wpdiscuz_gravatar_size" => apply_filters("wpdiscuz_gravatar_size", 64),
|
1547 |
+
"can_stick_or_close" => $can_stick_or_close,
|
1548 |
+
"user_follows" => $this->dbManager->getUserFollows($currentUserEmail),
|
1549 |
+
"current_user" => $currentUser,
|
1550 |
+
"current_user_email" => $currentUserEmail,
|
1551 |
+
"is_share_enabled" => $this->options->isShareEnabled(),
|
1552 |
+
"post_permalink" => $post_permalink,
|
1553 |
+
"can_user_reply" => comments_open($post->ID) && $this->options->wp["threadComments"] && (($this->form ? $this->form->isUserCanComment($currentUser, $postId) : true) || $high_level_user) && !(class_exists("WooCommerce") && get_post_type($post) === "product" && !$replyForWoo),
|
1554 |
+
"can_user_follow" => $this->options->subscription["isFollowActive"] && $isUserLoggedIn && !empty($currentUserEmail),
|
1555 |
+
"can_user_vote" => $currentUser->ID || $this->options->thread_layouts["isGuestCanVote"],
|
1556 |
+
"wpd_stick_btn" => $this->options->moderation["enableStickButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_stick_btn wpd-cta-button'>%s</span>" : "",
|
1557 |
+
"wpd_close_btn" => $this->options->moderation["enableCloseButton"] && ($high_level_user || $can_stick_or_close) ? "<span class='wpd_close_btn wpd-cta-button'>%s</span>" : "",
|
1558 |
+
"is_wpdiscuz_comment" => true,
|
1559 |
+
"share_buttons" => "",
|
1560 |
+
"feedback_content_words_count" => apply_filters("wpdiscuz_feedback_content_words_count", 20),
|
1561 |
+
"user_votes" => [],
|
1562 |
+
"last_visit" => $this->options->thread_display["highlightUnreadComments"] && ($lastVisit = get_user_meta($currentUser->ID, self::USERMETA_LAST_VISIT, true)) && !empty($lastVisit[$postId]) ? $lastVisit[$postId] : "",
|
1563 |
+
"site_url" => get_site_url(),
|
1564 |
+
"layout" => $layout,
|
1565 |
+
"components" => $this->helper->getComponents($theme, $layout),
|
1566 |
+
"walker" => new WpdiscuzWalker($this->helper, $this->helperOptimization, $this->dbManager, $this->options),
|
1567 |
+
];
|
1568 |
+
if ($this->options->social["enableFbShare"] && $this->options->social["fbAppID"]) {
|
1569 |
+
$args["share_buttons"] .= "<span class='wc_fb'><i class='fab fa-facebook-f wpf-cta' aria-hidden='true' title='" . esc_attr($this->options->phrases["wc_share_facebook"]) . "'></i></span>";
|
1570 |
+
}
|
1571 |
+
if ($this->options->social["enableVkShare"]) {
|
1572 |
+
$args["share_buttons"] .= "<a class='wc_vk' rel='noreferrer' target='_blank' href='https://vk.com/share.php?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->phrases["wc_share_vk"]) . "'><i class='fab fa-vk wpf-cta' aria-hidden='true'></i></a>";
|
1573 |
+
}
|
1574 |
+
if ($this->options->social["enableOkShare"]) {
|
1575 |
+
$args["share_buttons"] .= "<a class='wc_ok' rel='noreferrer' target='_blank' href='https://connect.ok.ru/offer?url=" . esc_url_raw($post_permalink) . "' title='" . esc_attr($this->options->phrases["wc_share_ok"]) . "'><i class='fab fa-odnoklassniki wpf-cta' aria-hidden='true'></i></a>";
|
1576 |
+
}
|
1577 |
+
if ($this->options->social["enableWhatsappShare"]) {
|
1578 |
+
$args["whatsapp_url"] = wp_is_mobile() ? "https://api.whatsapp.com" : "https://web.whatsapp.com";
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
return apply_filters("wpdiscuz_comment_list_args", $args);
|
1582 |
+
}
|
1583 |
+
|
1584 |
+
public function addNewRoles() {
|
1585 |
+
global $wp_roles;
|
1586 |
+
$roles = apply_filters("editable_roles", $wp_roles->roles);
|
1587 |
+
$newBlogRoles = [];
|
1588 |
+
$newBlogRoleLabels = [];
|
1589 |
+
$newRolePhrases = [];
|
1590 |
+
foreach ($roles as $roleName => $roleInfo) {
|
1591 |
+
$newBlogRoles[$roleName] = isset($this->options->labels["blogRoles"][$roleName]) ? $this->options->labels["blogRoles"][$roleName] : "#00B38F";
|
1592 |
+
if ($roleName === "administrator") {
|
1593 |
+
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
|
1594 |
+
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Admin", "wpdiscuz");
|
1595 |
+
} elseif ($roleName === "post_author") {
|
1596 |
+
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
|
1597 |
+
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Author", "wpdiscuz");
|
1598 |
+
} elseif ($roleName === "editor") {
|
1599 |
+
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 1;
|
1600 |
+
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Editor", "wpdiscuz");
|
1601 |
+
} else {
|
1602 |
+
$newBlogRoleLabels[$roleName] = isset($this->options->labels["blogRoleLabels"][$roleName]) ? $this->options->labels["blogRoleLabels"][$roleName] : 0;
|
1603 |
+
$newRolePhrases["wc_blog_role_" . $roleName] = isset($this->options->phrases["wc_blog_role_" . $roleName]) ? $this->options->phrases["wc_blog_role_" . $roleName] : esc_html__("Member", "wpdiscuz");
|
1604 |
+
}
|
1605 |
+
}
|
1606 |
+
$newBlogRoles["post_author"] = isset($this->options->labels["blogRoles"]["post_author"]) ? $this->options->labels["blogRoles"]["post_author"] : "#00B38F";
|
1607 |
+
$newBlogRoleLabels["post_author"] = isset($this->options->labels["blogRoleLabels"]["post_author"]) ? $this->options->labels["blogRoleLabels"]["post_author"] : 1;
|
1608 |
+
$newBlogRoles["guest"] = isset($this->options->labels["blogRoles"]["guest"]) ? $this->options->labels["blogRoles"]["guest"] : "#00B38F";
|
1609 |
+
$newBlogRoleLabels["guest"] = isset($this->options->labels["blogRoleLabels"]["guest"]) ? $this->options->labels["blogRoleLabels"]["guest"] : 0;
|
1610 |
+
$newRolePhrases["wc_blog_role_post_author"] = isset($this->options->phrases["wc_blog_role_post_author"]) ? $this->options->phrases["wc_blog_role_post_author"] : esc_html__("Author", "wpdiscuz");
|
1611 |
+
$newRolePhrases["wc_blog_role_guest"] = isset($this->options->phrases["wc_blog_role_guest"]) ? $this->options->phrases["wc_blog_role_guest"] : esc_html__("Guest", "wpdiscuz");
|
1612 |
+
foreach ($this->options->phrases as $key => $value) {
|
1613 |
+
if (strpos("wc_blog_role_", $key) === 0) {
|
1614 |
+
unset($this->options->phrases[$key]);
|
1615 |
+
}
|
1616 |
+
}
|
1617 |
+
foreach ($newRolePhrases as $key => $value) {
|
1618 |
+
$this->options->phrases[$key] = $value;
|
1619 |
+
}
|
1620 |
+
$this->options->labels["blogRoles"] = $newBlogRoles;
|
1621 |
+
$this->options->labels["blogRoleLabels"] = $newBlogRoleLabels;
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
public function showReplies() {
|
1625 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
1626 |
+
$commentId = isset($_POST["commentId"]) ? intval($_POST["commentId"]) : 0;
|
1627 |
+
if ($postId) {
|
1628 |
+
$this->isWpdiscuzLoaded = true;
|
1629 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
1630 |
+
$cArgs = $this->getDefaultCommentsArgs($postId);
|
1631 |
+
$cArgs["parent"] = $commentId;
|
1632 |
+
$cArgs["number"] = null;
|
1633 |
+
$comment = get_comment($commentId);
|
1634 |
+
$args = [
|
1635 |
+
"format" => "flat",
|
1636 |
+
"status" => $cArgs["status"],
|
1637 |
+
"orderby" => $cArgs["orderby"],
|
1638 |
+
"post_id" => $cArgs["post_id"],
|
1639 |
+
];
|
1640 |
+
if (!empty($cArgs["include_unapproved"])) {
|
1641 |
+
$args["include_unapproved"] = $cArgs["include_unapproved"];
|
1642 |
+
}
|
1643 |
+
$children = $comment->get_children($args);
|
1644 |
+
$commentListArgs["wpdiscuz_child_count_" . $comment->comment_ID] = count($children);
|
1645 |
+
$comments = array_merge([$comment], $children);
|
1646 |
+
if ($comments) {
|
1647 |
+
$response = [];
|
1648 |
+
if ($this->options->thread_layouts["highlightVotingButtons"]) {
|
1649 |
+
if (!empty($commentListArgs['current_user']->ID)) {
|
1650 |
+
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
1651 |
+
} else {
|
1652 |
+
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
1653 |
+
}
|
1654 |
+
}
|
1655 |
+
$response["comment_list"] = wp_list_comments($commentListArgs, $comments);
|
1656 |
+
$response["callbackFunctions"] = [];
|
1657 |
+
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
1658 |
+
wp_send_json_success($response);
|
1659 |
+
}
|
1660 |
+
}
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
public function mostReactedComment() {
|
1664 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
1665 |
+
if ($postId) {
|
1666 |
+
$this->isWpdiscuzLoaded = true;
|
1667 |
+
$commentId = $this->dbManager->getMostReactedCommentId($postId);
|
1668 |
+
$comment = get_comment($commentId);
|
1669 |
+
if ($comment && $comment->comment_post_ID == $postId) {
|
1670 |
+
$this->commentsArgs = $this->getDefaultCommentsArgs($postId);
|
1671 |
+
$commentStatusIn = ["1"];
|
1672 |
+
if ($this->commentsArgs["status"] === "all") {
|
1673 |
+
$commentStatusIn[] = "0";
|
1674 |
+
}
|
1675 |
+
$args = [
|
1676 |
+
"format" => "flat",
|
1677 |
+
"status" => $this->commentsArgs["status"],
|
1678 |
+
"orderby" => $this->commentsArgs["orderby"],
|
1679 |
+
"post_id" => $this->commentsArgs["post_id"],
|
1680 |
+
];
|
1681 |
+
$includeUnapproved = null;
|
1682 |
+
if (!empty($this->commentsArgs["include_unapproved"])) {
|
1683 |
+
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
1684 |
+
$includeUnapproved = $this->commentsArgs["include_unapproved"];
|
1685 |
+
}
|
1686 |
+
$parentComment = $this->helperOptimization->getCommentRoot($commentId, $commentStatusIn, $includeUnapproved);
|
1687 |
+
$tree = $parentComment->get_children($args);
|
1688 |
+
$comments = array_merge([$parentComment], $tree);
|
1689 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
1690 |
+
$commentListArgs["isSingle"] = true;
|
1691 |
+
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
1692 |
+
$response = [];
|
1693 |
+
if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
|
1694 |
+
if (!empty($commentListArgs['current_user']->ID)) {
|
1695 |
+
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
1696 |
+
} else {
|
1697 |
+
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
1698 |
+
}
|
1699 |
+
}
|
1700 |
+
$response["message"] = wp_list_comments($commentListArgs, $comments);
|
1701 |
+
$response["commentId"] = $commentId;
|
1702 |
+
$response["parentCommentID"] = $parentComment->comment_ID;
|
1703 |
+
$response["callbackFunctions"] = [];
|
1704 |
+
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
1705 |
+
wp_send_json_success($response);
|
1706 |
+
}
|
1707 |
+
}
|
1708 |
+
}
|
1709 |
+
|
1710 |
+
public function hottestThread() {
|
1711 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : 0;
|
1712 |
+
if ($postId) {
|
1713 |
+
$this->isWpdiscuzLoaded = true;
|
1714 |
+
$this->commentsArgs = $this->getDefaultCommentsArgs($postId);
|
1715 |
+
$commentStatusIn = ["1"];
|
1716 |
+
if ($this->commentsArgs["status"] === "all") {
|
1717 |
+
$commentStatusIn[] = "0";
|
1718 |
+
}
|
1719 |
+
$parentCommentIds = $this->dbManager->getParentCommentsHavingReplies($postId, $commentStatusIn);
|
1720 |
+
$childCount = 0;
|
1721 |
+
$hottestCommentId = 0;
|
1722 |
+
$hottestChildren = [];
|
1723 |
+
foreach ($parentCommentIds as $k => $parentCommentId) {
|
1724 |
+
$tree = [];
|
1725 |
+
$children = $this->dbManager->getHottestTree($parentCommentId);
|
1726 |
+
$tmpCount = count($children);
|
1727 |
+
if ($childCount < $tmpCount) {
|
1728 |
+
$childCount = $tmpCount;
|
1729 |
+
$hottestCommentId = $parentCommentId;
|
1730 |
+
$hottestChildren = $children;
|
1731 |
+
}
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
if ($hottestCommentId && $hottestChildren) {
|
1735 |
+
$args = [
|
1736 |
+
"format" => "flat",
|
1737 |
+
"status" => $this->commentsArgs["status"],
|
1738 |
+
"orderby" => $this->commentsArgs["orderby"],
|
1739 |
+
"post_id" => $this->commentsArgs["post_id"],
|
1740 |
+
];
|
1741 |
+
$includeUnapproved = null;
|
1742 |
+
if (!empty($this->commentsArgs["include_unapproved"])) {
|
1743 |
+
$args["include_unapproved"] = $this->commentsArgs["include_unapproved"];
|
1744 |
+
$includeUnapproved = $this->commentsArgs["include_unapproved"];
|
1745 |
+
}
|
1746 |
+
$parentComment = $this->helperOptimization->getCommentRoot($hottestCommentId, $commentStatusIn, $includeUnapproved);
|
1747 |
+
$tree = $parentComment->get_children($args);
|
1748 |
+
$comments = array_merge([$parentComment], $tree);
|
1749 |
+
$commentListArgs = $this->getCommentListArgs($postId);
|
1750 |
+
$commentListArgs["isSingle"] = true;
|
1751 |
+
$commentListArgs["new_loaded_class"] = "wpd-new-loaded-comment";
|
1752 |
+
$response = [];
|
1753 |
+
if ($comments && $this->options->thread_layouts["highlightVotingButtons"]) {
|
1754 |
+
if (!empty($commentListArgs['current_user']->ID)) {
|
1755 |
+
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, $commentListArgs['current_user']->ID);
|
1756 |
+
} else {
|
1757 |
+
$commentListArgs["user_votes"] = $this->dbManager->getUserVotes($comments, md5($this->helper->getRealIPAddr()));
|
1758 |
+
}
|
1759 |
+
}
|
1760 |
+
$response["message"] = wp_list_comments($commentListArgs, $comments);
|
1761 |
+
$response["commentId"] = $hottestCommentId;
|
1762 |
+
$response["callbackFunctions"] = [];
|
1763 |
+
$response = apply_filters("wpdiscuz_ajax_callbacks", $response);
|
1764 |
+
wp_send_json_success($response);
|
1765 |
+
}
|
1766 |
+
}
|
1767 |
+
}
|
1768 |
+
|
1769 |
+
private function getStickyComments($isPaginate, &$commentList, &$commentListArgs) {
|
1770 |
+
if (!empty($this->commentsArgs["first_load"])) {
|
1771 |
+
$this->commentsArgs["sticky"] = 1;
|
1772 |
+
$this->commentsArgs["number"] = null;
|
1773 |
+
if ($isPaginate) {
|
1774 |
+
$this->commentsArgs["number"] = "";
|
1775 |
+
$this->commentsArgs["offset"] = "";
|
1776 |
+
$this->commentsArgs["parent"] = "";
|
1777 |
+
}
|
1778 |
+
$this->commentsArgs["caller"] = "wpdiscuz";
|
1779 |
+
$this->commentsArgs["type__not_in"] = [];
|
1780 |
+
$this->commentsArgs["type__in"] = [self::WPDISCUZ_STICKY_COMMENT];
|
1781 |
+
$stickyComments = get_comments($this->commentsArgs);
|
1782 |
+
if ($stickyComments) {
|
1783 |
+
if ($this->options->wp["threadComments"]) {
|
1784 |
+
$stickyComments = $this->getChildren($stickyComments, $commentListArgs);
|
1785 |
+
}
|
1786 |
+
$commentList = ($isPaginate && $this->options->wp["commentOrder"] === "desc") ? array_merge($commentList, $stickyComments) : array_merge($stickyComments, $commentList);
|
1787 |
+
}
|
1788 |
+
}
|
1789 |
+
}
|
1790 |
+
|
1791 |
+
public function footerContents() {
|
1792 |
+
if ($this->isWpdiscuzLoaded) {
|
1793 |
+
global $post;
|
1794 |
+
if ($this->options->login["showActivityTab"] || $this->options->login["showSubscriptionsTab"] || $this->options->login["showFollowsTab"] || apply_filters("wpdiscuz_enable_content_modal", false)) {
|
1795 |
+
$this->addContentModal();
|
1796 |
+
}
|
1797 |
+
if ($this->options->live["enableBubble"]) {
|
1798 |
+
$this->addBubble($post);
|
1799 |
+
}
|
1800 |
+
if ($this->options->thread_display["highlightUnreadComments"]) {
|
1801 |
+
$this->saveLastVisit($post);
|
1802 |
+
}
|
1803 |
+
echo "<div id='wpd-editor-source-code-wrapper-bg'></div><div id='wpd-editor-source-code-wrapper'><textarea id='wpd-editor-source-code'></textarea><button id='wpd-insert-source-code'>Insert</button><input type='hidden' id='wpd-editor-uid' /></div>";
|
1804 |
+
}
|
1805 |
+
}
|
1806 |
+
|
1807 |
+
public function addBubble($post) {
|
1808 |
+
if (comments_open($post->ID)) {
|
1809 |
+
echo "<div id='wpd-bubble-wrapper'>";
|
1810 |
+
$commentsNumber = get_comments_number($post->ID);
|
1811 |
+
echo "<span id='wpd-bubble-all-comments-count'" . ($commentsNumber ? "" : " style='display:none;'") . ">" . esc_html($commentsNumber) . "</span>";
|
1812 |
+
echo "<div id='wpd-bubble-count'>";
|
1813 |
+
echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-count-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-count-second' d='M0 0h24v24H0z' /></svg>";
|
1814 |
+
echo "<span class='wpd-new-comments-count'>0</span>";
|
1815 |
+
echo "</div>";
|
1816 |
+
echo "<div id='wpd-bubble'>";
|
1817 |
+
echo "<svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-plus-first' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/><path class='wpd-bubble-plus-second' d='M0 0h24v24H0z' /></svg>";
|
1818 |
+
echo "<div id='wpd-bubble-add-message'>" . esc_html($this->options->phrases["wc_bubble_invite_message"]) . "<span id='wpd-bubble-add-message-close'><a href='#'>x</a></span></div>";
|
1819 |
+
echo "</div>";
|
1820 |
+
echo "<div id='wpd-bubble-notification'><svg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-bubble-notification-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-bubble-notification-second' d='M0 0h24v24H0z' /></svg>";
|
1821 |
+
if ($this->options->live["bubbleShowNewCommentMessage"]) {
|
1822 |
+
echo "<div id='wpd-bubble-notification-message'>";
|
1823 |
+
echo "<div id='wpd-bubble-author'>";
|
1824 |
+
echo "<div>";
|
1825 |
+
echo "<span id='wpd-bubble-author-avatar'></span>";
|
1826 |
+
echo "<span id='wpd-bubble-author-name'></span>";
|
1827 |
+
echo "<span id='wpd-bubble-comment-date'>(<span class='wpd-bubble-spans'></span>)</span>";
|
1828 |
+
echo "</div>";
|
1829 |
+
echo "<span id='wpd-bubble-comment-close'><a href='#'>x</a></span>";
|
1830 |
+
echo "</div>";
|
1831 |
+
echo "<div id='wpd-bubble-comment'>";
|
1832 |
+
echo "<span id='wpd-bubble-comment-text'></span>";
|
1833 |
+
echo "<span id='wpd-bubble-comment-reply-link'>| <a href='#'>Reply</a></span>";
|
1834 |
+
echo "</div>";
|
1835 |
+
echo "</div>";
|
1836 |
+
}
|
1837 |
+
echo "</div>";
|
1838 |
+
echo "</div>";
|
1839 |
+
}
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
public function registerRestRoutes() {
|
1843 |
+
$controller = new WpdiscuzRest($this->dbManager, $this->options, $this->helper, $this->wpdiscuzForm);
|
1844 |
+
$controller->registerRoutes();
|
1845 |
+
}
|
1846 |
+
|
1847 |
+
public function mceButton($buttons) {
|
1848 |
+
global $post;
|
1849 |
+
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1850 |
+
array_push($buttons, "|", "wpDiscuz");
|
1851 |
+
}
|
1852 |
+
|
1853 |
+
return $buttons;
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
public function mceExternalPlugin($plugin_array) {
|
1857 |
+
global $post;
|
1858 |
+
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1859 |
+
$plugin_array["wpDiscuz"] = esc_url_raw(plugins_url("assets/js/wpdiscuz-shortcode-tinymce.js", __FILE__));
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
return $plugin_array;
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
public function gutenbergButton() {
|
1866 |
+
global $post;
|
1867 |
+
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1868 |
+
wp_register_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-shortcode-gutenberg.js"), [
|
1869 |
+
"wp-blocks",
|
1870 |
+
"wp-editor",
|
1871 |
+
"wp-components"
|
1872 |
+
]);
|
1873 |
+
wp_enqueue_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js");
|
1874 |
+
wp_localize_script(self::WPDISCUZ_FEEDBACK_SHORTCODE . "-shortcode-gutenberg-js", "wpdObject", [
|
1875 |
+
"shortcode" => self::WPDISCUZ_FEEDBACK_SHORTCODE,
|
1876 |
+
"image" => plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/shortcode.png"),
|
1877 |
+
"tooltip" => $this->options->phrases["wc_feedback_shortcode_tooltip"],
|
1878 |
+
"popup_title" => $this->options->phrases["wc_feedback_popup_title"],
|
1879 |
+
"leave_feebdack" => $this->options->phrases["wc_please_leave_feebdack"]
|
1880 |
+
]);
|
1881 |
+
}
|
1882 |
+
}
|
1883 |
+
|
1884 |
+
public function feedbackDialog() {
|
1885 |
+
global $post;
|
1886 |
+
if (!empty($post->ID) && comments_open($post->ID) && ($form = $this->wpdiscuzForm->getForm($post->ID)) && $form->getFormID()) {
|
1887 |
+
?>
|
1888 |
+
<style type="text/css">
|
1889 |
+
#TB_title {
|
1890 |
+
background: #E9E9E9 !important;
|
1891 |
+
font-size: 16px !important;
|
1892 |
+
font-weight: normal !important;
|
1893 |
+
line-height: 20px !important;
|
1894 |
+
padding: 5px 10px;
|
1895 |
}
|
1896 |
|
1897 |
+
#TB_ajaxContent {
|
1898 |
+
width: 100% !important;
|
1899 |
+
box-sizing: border-box;
|
1900 |
+
height: 80vh !important;
|
1901 |
+
overflow-y: auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1902 |
}
|
1903 |
+
|
1904 |
+
#TB_ajaxContent .wpd-put-shortcode-parent {
|
1905 |
+
padding-top: 20px;
|
1906 |
+
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1907 |
}
|
1908 |
+
|
1909 |
+
#TB_ajaxContent p {
|
1910 |
+
padding: 0px;
|
1911 |
+
margin-top: 2px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1912 |
}
|
1913 |
+
|
1914 |
+
#TB_ajaxContent input[type="text"] {
|
1915 |
+
width: 98%;
|
1916 |
+
padding: 7px 10px;
|
1917 |
+
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1918 |
}
|
1919 |
+
|
1920 |
+
#TB_ajaxContent .wpd-shortcode-inline-form h3 {
|
1921 |
+
font-size: 14px;
|
1922 |
+
color: #000000;
|
1923 |
+
padding-top: 0px;
|
1924 |
+
margin-bottom: 5px;
|
|
|
|
|
|
|
|
|
1925 |
}
|
1926 |
+
|
1927 |
+
#TB_ajaxContent img.wpd-fbs-screen {
|
1928 |
+
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1929 |
}
|
1930 |
+
|
1931 |
+
#TB_ajaxContent .wpd-inline-type {
|
1932 |
+
width: 100%;
|
1933 |
+
text-align: center;
|
1934 |
+
font-weight: 600;
|
1935 |
+
padding: 1px 0px 5px 0px;
|
1936 |
+
box-sizing: border-box;
|
1937 |
+
margin-top: 5px;
|
1938 |
+
line-height: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1939 |
}
|
1940 |
+
|
1941 |
+
#wpd-inline-content {
|
1942 |
+
padding: 10px;
|
1943 |
+
background-color: #f5f5f5;
|
1944 |
+
margin: 10px 0px 0px 0px;
|
1945 |
+
max-height: 55px;
|
1946 |
+
overflow-y: auto;
|
1947 |
+
font-size: 12px;
|
1948 |
+
line-height: 15px;
|
|
|
|
|
|
|
|
|
1949 |
}
|
1950 |
+
|
1951 |
+
#wpd-inline-content p {
|
1952 |
+
font-size: 12px;
|
1953 |
+
line-height: 15px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1954 |
}
|
1955 |
+
|
1956 |
+
#wpd-inline-content .wpd-text-error {
|
1957 |
+
color: #DD0000;
|
1958 |
+
font-size: 13px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1959 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1960 |
</style>
|
1961 |
<div id="wpdiscuz_feedback_dialog" style="display:none">
|
1962 |
<div class="wpd-shortcode-inline-form">
|
1968 |
<tr>
|
1969 |
<td colspan="2">
|
1970 |
<h3><?php esc_html_e("Your Question to Readers", "wpdiscuz"); ?></h3>
|
1971 |
+
<p class="description"
|
1972 |
+
style="line-height: 17px; color: #777; font-size: 12px;"><?php esc_html_e("A simple question or a call to leave a feedback on the selected part of text. Something like "By the way. Do you agree with this?" or "Would love your thoughts, please comment on this."", "wpdiscuz"); ?></p>
|
1973 |
</td>
|
1974 |
</tr>
|
1975 |
<tr>
|
1976 |
<td colspan="2">
|
1977 |
+
<input type="text" id="wpd-inline-question" name="wpd-inline-question"
|
1978 |
+
placeholder="<?php esc_attr_e("e.g: Any thoughts on this?", "wpdiscuz") ?>"/>
|
1979 |
</td>
|
1980 |
</tr>
|
1981 |
<tr>
|
1982 |
<td colspan="2">
|
1983 |
<h3><?php esc_html_e("Feedback Button Display Type", "wpdiscuz"); ?></h3>
|
1984 |
+
<p class="description"
|
1985 |
+
style="line-height: 17px; color: #777; font-size: 12px;"><?php esc_html_e("By default the inline feedback form is closed and only the button is displayed. Once reader scrolled and reached to the selected text part, this button animates with comment button size and color changes attracting readers attention. Readers click on the button and open your question with feedback form. Using this option you can keep opened the feedback form. Readers can close it using [x] button.", "wpdiscuz"); ?></p>
|
1986 |
</td>
|
1987 |
</tr>
|
1988 |
<tr>
|
1989 |
<td style="width: 50%;">
|
1990 |
<div class="wpd-inline-type">
|
1991 |
<label>
|
1992 |
+
<input type="radio" name="wpd-inline-type" value="0" checked="checked"/>
|
1993 |
+
<?php esc_html_e("CLOSED", "wpdiscuz") ?>
|
1994 |
</label>
|
1995 |
</div>
|
1996 |
+
<img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-closed.png")) ?>"
|
1997 |
+
class="wpd-fbs-screen">
|
1998 |
</td>
|
1999 |
<td style="width: 50%">
|
2000 |
<div class="wpd-inline-type">
|
2001 |
<label>
|
2002 |
+
<input type="radio" name="wpd-inline-type" value="1"/>
|
2003 |
+
<?php esc_html_e("OPENED", "wpdiscuz") ?>
|
2004 |
</label>
|
2005 |
</div>
|
2006 |
+
<img src="<?php echo esc_url_raw(plugins_url(WPDISCUZ_DIR_NAME . "/assets/img/dashboard/inline-feedback-opened.png")) ?>"
|
2007 |
+
class="wpd-fbs-screen">
|
2008 |
</td>
|
2009 |
</tr>
|
2010 |
</table>
|
2011 |
</div>
|
2012 |
<div class="wpd-put-shortcode-parent">
|
2013 |
+
<button type="button" class="button button-primary button-large"
|
2014 |
+
id="wpd-put-shortcode"><?php esc_html_e("Add Inline Feedback Button", "wpdiscuz"); ?></button>
|
2015 |
</div>
|
2016 |
</div>
|
2017 |
+
<?php
|
2018 |
+
}
|
2019 |
+
}
|
2020 |
+
|
2021 |
+
public function feedbackShortcode($atts, $content = "") {
|
2022 |
+
global $post;
|
2023 |
+
if ($this->isWpdiscuzLoaded && comments_open($post->ID)) {
|
2024 |
+
$atts = shortcode_atts([
|
2025 |
+
"id" => "",
|
2026 |
+
"question" => "",
|
2027 |
+
"opened" => 0
|
2028 |
+
], $atts, self::WPDISCUZ_FEEDBACK_SHORTCODE);
|
2029 |
+
if ($atts["id"] && $atts["question"] && ($inline_form = $this->dbManager->getFeedbackFormByUid($post->ID, $atts["id"]))) {
|
2030 |
+
$content = "<div class='wpd-inline-shortcode wpd-inline-" . ($inline_form->opened ? "opened" : "closed") . "' id='wpd-inline-" . $inline_form->id . "'>" . html_entity_decode($content);
|
2031 |
+
$content .= "<div class='wpd-inline-icon-wrapper'>";
|
2032 |
+
$content .= "<svg class='wpd-inline-icon" . ($this->options->inline["inlineFeedbackAttractionType"] === "blink" ? " wpd-ignored" : "") . "' xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path class='wpd-inline-icon-first' d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z'/><path class='wpd-inline-icon-second' d='M0 0h24v24H0z' /></svg>";
|
2033 |
+
$args = [
|
2034 |
+
"count" => true,
|
2035 |
+
"meta_query" => [
|
2036 |
+
[
|
2037 |
+
"key" => self::META_KEY_FEEDBACK_FORM_ID,
|
2038 |
+
"value" => $inline_form->id,
|
2039 |
+
"compare" => "=",
|
2040 |
+
],
|
2041 |
+
],
|
2042 |
+
];
|
2043 |
+
$count = get_comments($args);
|
2044 |
+
$content .= "<div class='wpd-inline-icon-count" . esc_attr($count ? " wpd-has-comments" : "") . "'>" . esc_html($count) . "</div>";
|
2045 |
+
$content .= "<div class='wpd-inline-form-wrapper'>";
|
2046 |
+
$content .= "<div class='wpd-inline-form-question'>" . esc_html($inline_form->question);
|
2047 |
+
$content .= "<span class='wpd-inline-form-close'><a href='#'>x</a></span>";
|
2048 |
+
$content .= "</div>";
|
2049 |
+
$content .= "</div>";
|
2050 |
+
$content .= "</div>";
|
2051 |
+
$content .= "</div>";
|
2052 |
+
}
|
2053 |
+
}
|
2054 |
+
|
2055 |
+
return $content;
|
2056 |
+
}
|
2057 |
+
|
2058 |
+
public function addInlineComment() {
|
2059 |
+
$inline_form_id = !empty($_POST["inline_form_id"]) ? intval($_POST["inline_form_id"]) : 0;
|
2060 |
+
if ($inline_form_id && ($inline_form = $this->dbManager->getFeedbackForm($inline_form_id))) {
|
2061 |
+
if (!empty($_POST["_wpd_inline_nonce"]) && wp_verify_nonce($_POST["_wpd_inline_nonce"], "wpd_inline_nonce_" . $inline_form->post_id)) {
|
2062 |
+
if (!comments_open($inline_form->post_id)) {
|
2063 |
+
wp_die(esc_html($this->options->phrases["wc_commenting_is_closed"]));
|
2064 |
+
}
|
2065 |
+
$currentUser = WpdiscuzHelper::getCurrentUser();
|
2066 |
+
$isAnonymous = false;
|
2067 |
+
if (!empty($currentUser->ID)) {
|
2068 |
+
$user_id = $currentUser->ID;
|
2069 |
+
$name = $this->helper->getCurrentUserDisplayName($currentUser);
|
2070 |
+
$email = $currentUser->user_email;
|
2071 |
+
} else {
|
2072 |
+
$user_id = 0;
|
2073 |
+
$name = !empty($_POST["wpd_inline_name"]) ? urldecode(trim($_POST["wpd_inline_name"])) : "";
|
2074 |
+
if (!empty($_POST["wpd_inline_email"]) && ($email = trim($_POST["wpd_inline_email"]))) {
|
2075 |
+
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
|
2076 |
+
wp_send_json_error("wc_error_email_text");
|
2077 |
+
}
|
2078 |
+
} else {
|
2079 |
+
$email = uniqid() . "@example.com";
|
2080 |
+
$isAnonymous = true;
|
2081 |
+
}
|
2082 |
+
$email = urldecode($email);
|
2083 |
+
}
|
2084 |
+
$comment_content = !empty($_POST["wpd_inline_comment"]) ? stripslashes(trim($_POST["wpd_inline_comment"])) : "";
|
2085 |
+
$comment_content = $this->helper->filterCommentText($comment_content);
|
2086 |
+
if (!$comment_content) {
|
2087 |
+
wp_send_json_error("wc_msg_required_fields");
|
2088 |
+
}
|
2089 |
+
$commentMinLength = intval($this->options->content["commentTextMinLength"]);
|
2090 |
+
$commentMaxLength = intval($this->options->content["commentTextMaxLength"]);
|
2091 |
+
$contentLength = function_exists("mb_strlen") ? mb_strlen($comment_content) : strlen($comment_content);
|
2092 |
+
if ($commentMinLength > 0 && $contentLength < $commentMinLength) {
|
2093 |
+
wp_send_json_error("wc_msg_input_min_length");
|
2094 |
+
}
|
2095 |
+
if ($commentMaxLength > 0 && $contentLength > $commentMaxLength) {
|
2096 |
+
wp_send_json_error("wc_msg_input_max_length");
|
2097 |
+
}
|
2098 |
+
|
2099 |
+
if ($name && $email && $comment_content) {
|
2100 |
+
$this->isWpdiscuzLoaded = true;
|
2101 |
+
$wc_user_agent = !empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
|
2102 |
+
$new_commentdata = [
|
2103 |
+
"user_id" => $user_id,
|
2104 |
+
"comment_post_ID" => $inline_form->post_id,
|
2105 |
+
"comment_parent" => 0,
|
2106 |
+
"comment_author" => $name,
|
2107 |
+
"comment_author_email" => $email,
|
2108 |
+
"comment_author_url" => "",
|
2109 |
+
"comment_content" => $comment_content,
|
2110 |
+
"comment_agent" => $wc_user_agent,
|
2111 |
+
"comment_type" => self::$DEFAULT_COMMENT_TYPE,
|
2112 |
+
];
|
2113 |
+
$this->helper->restrictCommentingPerUser($email, 0, $inline_form->post_id);
|
2114 |
+
$new_comment_id = wp_new_comment(wp_slash($new_commentdata));
|
2115 |
+
add_comment_meta($new_comment_id, self::META_KEY_FEEDBACK_FORM_ID, $inline_form->id);
|
2116 |
+
$args = [
|
2117 |
+
"count" => true,
|
2118 |
+
"meta_query" => [
|
2119 |
+
[
|
2120 |
+
"key" => self::META_KEY_FEEDBACK_FORM_ID,
|
2121 |
+
"value" => $inline_form->id,
|
2122 |
+
"compare" => "=",
|
2123 |
+
],
|
2124 |
+
],
|
2125 |
+
];
|
2126 |
+
$newComment = get_comment($new_comment_id);
|
2127 |
+
if (apply_filters("wpdiscuz_enable_user_mentioning", true) && $this->options->subscription["enableUserMentioning"] && $this->options->subscription["sendMailToMentionedUsers"] && ($mentionedUsers = $this->helper->getMentionedUsers($newComment->comment_content))) {
|
2128 |
+
$this->helperEmail->sendMailToMentionedUsers($mentionedUsers, $newComment);
|
2129 |
+
}
|
2130 |
+
$notifiyMe = isset($_POST["wpd_inline_notify_me"]) ? absint($_POST["wpd_inline_notify_me"]) : 0;
|
2131 |
+
if (!$isAnonymous && $notifiyMe) {
|
2132 |
+
$noNeedMemberConfirm = ($currentUser->ID && !$this->options->subscription["enableMemberConfirm"]);
|
2133 |
+
$noNeedGuestsConfirm = (!$currentUser->ID && !$this->options->subscription["enableGuestsConfirm"]);
|
2134 |
+
if ($noNeedMemberConfirm || $noNeedGuestsConfirm) {
|
2135 |
+
$this->dbManager->addEmailNotification($new_comment_id, $inline_form->post_id, $email, self::SUBSCRIPTION_COMMENT, 1);
|
2136 |
+
} else {
|
2137 |
+
$confirmData = $this->dbManager->addEmailNotification($new_comment_id, $inline_form->post_id, $email, self::SUBSCRIPTION_COMMENT);
|
2138 |
+
if ($confirmData) {
|
2139 |
+
$this->helperEmail->confirmEmailSender($confirmData["id"], $confirmData["activation_key"], $inline_form->post_id, $email);
|
2140 |
+
}
|
2141 |
+
}
|
2142 |
+
}
|
2143 |
+
if ($newComment->comment_approved === "spam" || $newComment->comment_approved === "trash") {
|
2144 |
+
wp_send_json_error();
|
2145 |
+
}
|
2146 |
+
$form = $this->wpdiscuzForm->getForm($inline_form->post_id);
|
2147 |
+
$response = [];
|
2148 |
+
$commentListArgs = $this->getCommentListArgs($inline_form->post_id);
|
2149 |
+
$response["message"] = wp_list_comments($commentListArgs, [$newComment]);
|
2150 |
+
$response["newCount"] = esc_html(get_comments($args));
|
2151 |
+
$response["new_comment_id"] = $new_comment_id;
|
2152 |
+
$response["notification"] = esc_html($this->options->phrases["wc_feedback_comment_success"]);
|
2153 |
+
$response["allCommentsCountNew"] = esc_html(get_comments_number($inline_form->post_id));
|
2154 |
+
$response["allCommentsCountNewHtml"] = "<span class='wpdtc'>" . esc_html($response["allCommentsCountNew"]) . "</span> " . esc_html(1 == $response["allCommentsCountNew"] ? $form->getHeaderTextSingle() : $form->getHeaderTextPlural());
|
2155 |
+
do_action("wpdiscuz_clean_post_cache", $inline_form->post_id, "inline_comment_posted");
|
2156 |
+
wp_send_json_success($response);
|
2157 |
+
} else {
|
2158 |
+
wp_send_json_error("wc_invalid_field");
|
2159 |
+
}
|
2160 |
+
}
|
2161 |
+
}
|
2162 |
+
wp_send_json_error("wc_msg_required_fields");
|
2163 |
+
}
|
2164 |
+
|
2165 |
+
public function validateRecaptcha($commentdata) {
|
2166 |
+
if (!current_user_can("moderate_comments")) {
|
2167 |
+
$postId = isset($_POST["postId"]) ? intval($_POST["postId"]) : "";
|
2168 |
+
if (!$postId) {
|
2169 |
+
global $post;
|
2170 |
+
if (!empty($post->ID)) {
|
2171 |
+
$postId = $post->ID;
|
2172 |
+
} else if (!empty($commentdata["comment_post_ID"])) {
|
2173 |
+
$postId = $commentdata["comment_post_ID"];
|
2174 |
+
}
|
2175 |
+
}
|
2176 |
+
if ($postId && ($post = get_post($postId))) {
|
2177 |
+
$form = $this->wpdiscuzForm->getForm($postId);
|
2178 |
+
if ($form->getFormID()) {
|
2179 |
+
$currentUser = WpdiscuzHelper::getCurrentUser();
|
2180 |
+
if (empty($currentUser->ID) || (!empty($currentUser->ID) && $currentUser->ID != $post->post_author)) {
|
2181 |
+
$inlineVerified = !empty($_POST["_wpd_inline_nonce"]) && wp_verify_nonce($_POST["_wpd_inline_nonce"], "wpd_inline_nonce_" . $postId);
|
2182 |
+
if (!$inlineVerified) {
|
2183 |
+
if (apply_filters("wpdiscuz_verify_recaptcha", true, $commentdata)) {
|
2184 |
+
$typesExclude = ["pingback", "trackback"];
|
2185 |
+
if (!empty($commentdata["comment_type"]) && in_array($commentdata["comment_type"], $typesExclude)) {
|
2186 |
+
return $commentdata;
|
2187 |
+
}
|
2188 |
+
$form->initFormFields();
|
2189 |
+
$form->validateDefaultCaptcha($currentUser);
|
2190 |
+
}
|
2191 |
+
}
|
2192 |
+
}
|
2193 |
+
}
|
2194 |
+
}
|
2195 |
+
}
|
2196 |
+
return $commentdata;
|
2197 |
+
}
|
2198 |
|
2199 |
}
|
2200 |
|
forms/wpDiscuzForm.php
CHANGED
@@ -60,7 +60,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
60 |
}
|
61 |
|
62 |
public function validateMetaCommentSavePre($commentContent) {
|
63 |
-
if (filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING)
|
64 |
$postID = filter_input(INPUT_POST, "comment_post_ID", FILTER_SANITIZE_NUMBER_INT);
|
65 |
$this->getForm($postID);
|
66 |
if ($this->form) {
|
@@ -73,7 +73,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
73 |
}
|
74 |
|
75 |
public function updateCommentMeta($commentID) {
|
76 |
-
if (filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING)
|
77 |
$postID = filter_input(INPUT_POST, "comment_post_ID", FILTER_SANITIZE_NUMBER_INT);
|
78 |
$this->getForm($postID);
|
79 |
if ($this->form) {
|
@@ -144,7 +144,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
144 |
}
|
145 |
|
146 |
public function saveFormData($postId, $post, $update) {
|
147 |
-
if ($post->post_type
|
148 |
return;
|
149 |
}
|
150 |
$this->canManageOptions();
|
@@ -181,7 +181,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
181 |
|
182 |
public function customFormAdminScripts() {
|
183 |
global $current_screen;
|
184 |
-
if ($current_screen->id
|
185 |
wp_register_style("fontawesome-iconpicker-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css"), [], "1.12.1");
|
186 |
wp_enqueue_style("fontawesome-iconpicker-css");
|
187 |
wp_register_script("fontawesome-iconpicker-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/fontawesome-iconpicker/js/fontawesome-iconpicker.js"), ["jquery"], "1.12.1", true);
|
@@ -197,7 +197,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
197 |
wp_enqueue_script("thickbox");
|
198 |
wp_enqueue_script("jquery-ui-sortable");
|
199 |
}
|
200 |
-
if ($current_screen->id
|
201 |
wp_register_script("wpdiscuz-form-menu-item", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-admin-menu-item.js"), ["jquery"], $this->pluginVersion, true);
|
202 |
wp_enqueue_script("wpdiscuz-form-menu-item");
|
203 |
}
|
@@ -205,7 +205,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
205 |
|
206 |
public function renderFormGeneralSettings($post) {
|
207 |
global $current_screen;
|
208 |
-
if ($current_screen->id
|
209 |
$this->form->setFormID($post->ID);
|
210 |
$this->form->renderFormStructure();
|
211 |
}
|
@@ -332,7 +332,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
332 |
}
|
333 |
|
334 |
public function deleteOrTrashForm($formId) {
|
335 |
-
if (get_post_type($formId)
|
336 |
return;
|
337 |
}
|
338 |
foreach ($this->formPostRel as $postId => $value) {
|
@@ -359,7 +359,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
359 |
}
|
360 |
|
361 |
public function createDefaultForm($version) {
|
362 |
-
if ($version
|
363 |
$oldForms = get_posts(["posts_per_page" => 1, "post_type" => self::WPDISCUZ_FORMS_CONTENT_TYPE]);
|
364 |
if ($oldForms) {
|
365 |
return;
|
@@ -445,7 +445,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
445 |
}
|
446 |
|
447 |
public function addCloneFormAction($actions, $post) {
|
448 |
-
if ($post->post_type
|
449 |
$url = wp_nonce_url(admin_url("admin-post.php") . "?form_id=" . $post->ID . "&action=cloneWpdiscuzForm", "clone-form_" . $post->ID, "clone_form_nonce");
|
450 |
$actions["inline hide-if-no-js"] = "<a href='" . esc_url_raw($url) . "'>" . esc_html__("Clone Form") . "</a>";
|
451 |
}
|
@@ -457,7 +457,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
457 |
$nonce = filter_input(INPUT_GET, "clone_form_nonce", FILTER_SANITIZE_STRING);
|
458 |
if ($formID && $nonce && wp_verify_nonce($nonce, "clone-form_" . $formID)) {
|
459 |
$form = get_post($formID);
|
460 |
-
if ($form && $form->post_type
|
461 |
$cform = [
|
462 |
"post_title" => $form->post_title . " ( " . esc_html__("Clone", "wpdiscuz") . " )",
|
463 |
"post_type" => wpdFormConst::WPDISCUZ_FORMS_CONTENT_TYPE,
|
@@ -523,9 +523,9 @@ class wpDiscuzForm implements wpdFormConst {
|
|
523 |
|
524 |
public function changeCommentStatus($new_status, $old_status, $comment) {
|
525 |
$rating = get_comment_meta($comment->comment_ID, "rating", true);
|
526 |
-
if ($old_status
|
527 |
$this->updatePostRating($comment, -1);
|
528 |
-
} else if ($new_status
|
529 |
$this->updatePostRating($comment, 1);
|
530 |
}
|
531 |
}
|
@@ -536,7 +536,7 @@ class wpDiscuzForm implements wpdFormConst {
|
|
536 |
$form->initFormFields();
|
537 |
$formFields = $form->getFormFields();
|
538 |
foreach ($formFields as $key => $value) {
|
539 |
-
if ($value["type"]
|
540 |
$postRatings = $this->chagePostSingleRating($key, $comment->comment_ID, $difference, $postRatings);
|
541 |
}
|
542 |
}
|
60 |
}
|
61 |
|
62 |
public function validateMetaCommentSavePre($commentContent) {
|
63 |
+
if (filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING) === "editedcomment") {
|
64 |
$postID = filter_input(INPUT_POST, "comment_post_ID", FILTER_SANITIZE_NUMBER_INT);
|
65 |
$this->getForm($postID);
|
66 |
if ($this->form) {
|
73 |
}
|
74 |
|
75 |
public function updateCommentMeta($commentID) {
|
76 |
+
if (filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING) === "editedcomment") {
|
77 |
$postID = filter_input(INPUT_POST, "comment_post_ID", FILTER_SANITIZE_NUMBER_INT);
|
78 |
$this->getForm($postID);
|
79 |
if ($this->form) {
|
144 |
}
|
145 |
|
146 |
public function saveFormData($postId, $post, $update) {
|
147 |
+
if ($post->post_type !== self::WPDISCUZ_FORMS_CONTENT_TYPE || (isset($_REQUEST["action"]) && $_REQUEST["action"] === "inline-save")) {
|
148 |
return;
|
149 |
}
|
150 |
$this->canManageOptions();
|
181 |
|
182 |
public function customFormAdminScripts() {
|
183 |
global $current_screen;
|
184 |
+
if ($current_screen->id === self::WPDISCUZ_FORMS_CONTENT_TYPE) {
|
185 |
wp_register_style("fontawesome-iconpicker-css", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css"), [], "1.12.1");
|
186 |
wp_enqueue_style("fontawesome-iconpicker-css");
|
187 |
wp_register_script("fontawesome-iconpicker-js", plugins_url(WPDISCUZ_DIR_NAME . "/assets/third-party/fontawesome-iconpicker/js/fontawesome-iconpicker.js"), ["jquery"], "1.12.1", true);
|
197 |
wp_enqueue_script("thickbox");
|
198 |
wp_enqueue_script("jquery-ui-sortable");
|
199 |
}
|
200 |
+
if ($current_screen->id === "edit-" . self::WPDISCUZ_FORMS_CONTENT_TYPE) {
|
201 |
wp_register_script("wpdiscuz-form-menu-item", plugins_url(WPDISCUZ_DIR_NAME . "/assets/js/wpdiscuz-admin-menu-item.js"), ["jquery"], $this->pluginVersion, true);
|
202 |
wp_enqueue_script("wpdiscuz-form-menu-item");
|
203 |
}
|
205 |
|
206 |
public function renderFormGeneralSettings($post) {
|
207 |
global $current_screen;
|
208 |
+
if ($current_screen->id === self::WPDISCUZ_FORMS_CONTENT_TYPE) {
|
209 |
$this->form->setFormID($post->ID);
|
210 |
$this->form->renderFormStructure();
|
211 |
}
|
332 |
}
|
333 |
|
334 |
public function deleteOrTrashForm($formId) {
|
335 |
+
if (get_post_type($formId) !== wpdFormConst::WPDISCUZ_FORMS_CONTENT_TYPE) {
|
336 |
return;
|
337 |
}
|
338 |
foreach ($this->formPostRel as $postId => $value) {
|
359 |
}
|
360 |
|
361 |
public function createDefaultForm($version) {
|
362 |
+
if ($version === "1.0.0" || version_compare($version, "4.0.0", "<")) {
|
363 |
$oldForms = get_posts(["posts_per_page" => 1, "post_type" => self::WPDISCUZ_FORMS_CONTENT_TYPE]);
|
364 |
if ($oldForms) {
|
365 |
return;
|
445 |
}
|
446 |
|
447 |
public function addCloneFormAction($actions, $post) {
|
448 |
+
if ($post->post_type === self::WPDISCUZ_FORMS_CONTENT_TYPE && $post->post_status === "publish") {
|
449 |
$url = wp_nonce_url(admin_url("admin-post.php") . "?form_id=" . $post->ID . "&action=cloneWpdiscuzForm", "clone-form_" . $post->ID, "clone_form_nonce");
|
450 |
$actions["inline hide-if-no-js"] = "<a href='" . esc_url_raw($url) . "'>" . esc_html__("Clone Form") . "</a>";
|
451 |
}
|
457 |
$nonce = filter_input(INPUT_GET, "clone_form_nonce", FILTER_SANITIZE_STRING);
|
458 |
if ($formID && $nonce && wp_verify_nonce($nonce, "clone-form_" . $formID)) {
|
459 |
$form = get_post($formID);
|
460 |
+
if ($form && $form->post_type === self::WPDISCUZ_FORMS_CONTENT_TYPE) {
|
461 |
$cform = [
|
462 |
"post_title" => $form->post_title . " ( " . esc_html__("Clone", "wpdiscuz") . " )",
|
463 |
"post_type" => wpdFormConst::WPDISCUZ_FORMS_CONTENT_TYPE,
|
523 |
|
524 |
public function changeCommentStatus($new_status, $old_status, $comment) {
|
525 |
$rating = get_comment_meta($comment->comment_ID, "rating", true);
|
526 |
+
if ($old_status === "approved" && $rating) {
|
527 |
$this->updatePostRating($comment, -1);
|
528 |
+
} else if ($new_status === "approved" && $rating) {
|
529 |
$this->updatePostRating($comment, 1);
|
530 |
}
|
531 |
}
|
536 |
$form->initFormFields();
|
537 |
$formFields = $form->getFormFields();
|
538 |
foreach ($formFields as $key => $value) {
|
539 |
+
if ($value["type"] === "wpdFormAttr\Field\RatingField") {
|
540 |
$postRatings = $this->chagePostSingleRating($key, $comment->comment_ID, $difference, $postRatings);
|
541 |
}
|
542 |
}
|
forms/wpdFormAttr/Field/CheckboxField.php
CHANGED
@@ -87,7 +87,7 @@ class CheckboxField extends Field {
|
|
87 |
$hasDesc = $args["desc"] ? true : false;
|
88 |
$required = $args["required"] ? " wpd-required-group" : "";
|
89 |
|
90 |
-
if (count($args["values"])
|
91 |
?>
|
92 |
<div class="wpdiscuz-item wpd-field-group wpd-field-checkbox wpd-field-single <?php echo esc_attr($name) . "-wrapper" . esc_attr($required) . ($hasDesc ? " wpd-has-desc" : ""); ?>">
|
93 |
<div class="wpd-field-group-title">
|
87 |
$hasDesc = $args["desc"] ? true : false;
|
88 |
$required = $args["required"] ? " wpd-required-group" : "";
|
89 |
|
90 |
+
if (count($args["values"]) === 1):
|
91 |
?>
|
92 |
<div class="wpdiscuz-item wpd-field-group wpd-field-checkbox wpd-field-single <?php echo esc_attr($name) . "-wrapper" . esc_attr($required) . ($hasDesc ? " wpd-has-desc" : ""); ?>">
|
93 |
<div class="wpd-field-group-title">
|
forms/wpdFormAttr/Field/DefaultField/Captcha.php
CHANGED
@@ -33,7 +33,7 @@ class Captcha extends Field {
|
|
33 |
}
|
34 |
|
35 |
private function createRequestMethod($generalOptions) {
|
36 |
-
if ($generalOptions->recaptcha["requestMethod"]
|
37 |
if ($generalOptions->recaptcha["requestMethod"] === "socket") {
|
38 |
return new ReCaptcha\RequestMethod\SocketPost();
|
39 |
} else if ($generalOptions->recaptcha["requestMethod"] === "curl") {
|
@@ -60,7 +60,7 @@ class Captcha extends Field {
|
|
60 |
$version = apply_filters("wpdiscuz_recaptcha_version", $options->recaptcha["version"]);
|
61 |
$key = apply_filters("wpdiscuz_recaptcha_site_key", $options->recaptcha["siteKey"]);
|
62 |
$secret = apply_filters("wpdiscuz_recaptcha_secret", $options->recaptcha["secretKey"]);
|
63 |
-
if ($this->isShowCaptcha($currentUser->ID, $options) && $key && $secret && $version
|
64 |
?>
|
65 |
<div class="wpd-field-captcha wpdiscuz-item">
|
66 |
<div class="wpdiscuz-recaptcha" id='wpdiscuz-recaptcha-<?php echo esc_attr($uniqueId); ?>'></div>
|
@@ -104,7 +104,7 @@ class Captcha extends Field {
|
|
104 |
];
|
105 |
foreach ($errors as $error) {
|
106 |
if (isset($errorMesages[$error])) {
|
107 |
-
$errorMesage .= $errorMesages[$error] . "<br>";
|
108 |
} else {
|
109 |
$errorMesage .= esc_html__("reCaptcha validation fails. Error code: ", "wpdiscuz") . $error . "<br>";
|
110 |
}
|
@@ -120,7 +120,7 @@ class Captcha extends Field {
|
|
120 |
$key = apply_filters("wpdiscuz_recaptcha_site_key", $options->recaptcha["siteKey"]);
|
121 |
$secret = apply_filters("wpdiscuz_recaptcha_secret", $options->recaptcha["secretKey"]);
|
122 |
if (!is_user_logged_in() && $options->recaptcha["isShowOnSubscribeForm"] && $key && $secret) {
|
123 |
-
if ($version
|
124 |
?>
|
125 |
<div class="wpd-field-captcha wpdiscuz-item">
|
126 |
<div class="wpdiscuz-recaptcha" id='wpdiscuz-recaptcha-subscribe-form'></div>
|
@@ -162,7 +162,7 @@ class Captcha extends Field {
|
|
162 |
|
163 |
private function reCaptchaVerify($token, $options, $action = "") {
|
164 |
$recaptchaVersion = apply_filters("wpdiscuz_recaptcha_version", $options->recaptcha["version"]);
|
165 |
-
if ($recaptchaVersion
|
166 |
$resp = $this->reCaptcha->verify($token, $this->getIP());
|
167 |
} else {
|
168 |
$score = apply_filters("wpdiscuz_recaptcha_score", $options->recaptcha["score"]);
|
33 |
}
|
34 |
|
35 |
private function createRequestMethod($generalOptions) {
|
36 |
+
if ($generalOptions->recaptcha["requestMethod"] !== "auto") {
|
37 |
if ($generalOptions->recaptcha["requestMethod"] === "socket") {
|
38 |
return new ReCaptcha\RequestMethod\SocketPost();
|
39 |
} else if ($generalOptions->recaptcha["requestMethod"] === "curl") {
|
60 |
$version = apply_filters("wpdiscuz_recaptcha_version", $options->recaptcha["version"]);
|
61 |
$key = apply_filters("wpdiscuz_recaptcha_site_key", $options->recaptcha["siteKey"]);
|
62 |
$secret = apply_filters("wpdiscuz_recaptcha_secret", $options->recaptcha["secretKey"]);
|
63 |
+
if ($this->isShowCaptcha($currentUser->ID, $options) && $key && $secret && $version === "2.0") {
|
64 |
?>
|
65 |
<div class="wpd-field-captcha wpdiscuz-item">
|
66 |
<div class="wpdiscuz-recaptcha" id='wpdiscuz-recaptcha-<?php echo esc_attr($uniqueId); ?>'></div>
|
104 |
];
|
105 |
foreach ($errors as $error) {
|
106 |
if (isset($errorMesages[$error])) {
|
107 |
+
$errorMesage .= esc_html__("reCaptcha validation fails. ", "wpdiscuz") . $errorMesages[$error] . "<br>";
|
108 |
} else {
|
109 |
$errorMesage .= esc_html__("reCaptcha validation fails. Error code: ", "wpdiscuz") . $error . "<br>";
|
110 |
}
|
120 |
$key = apply_filters("wpdiscuz_recaptcha_site_key", $options->recaptcha["siteKey"]);
|
121 |
$secret = apply_filters("wpdiscuz_recaptcha_secret", $options->recaptcha["secretKey"]);
|
122 |
if (!is_user_logged_in() && $options->recaptcha["isShowOnSubscribeForm"] && $key && $secret) {
|
123 |
+
if ($version === "2.0") {
|
124 |
?>
|
125 |
<div class="wpd-field-captcha wpdiscuz-item">
|
126 |
<div class="wpdiscuz-recaptcha" id='wpdiscuz-recaptcha-subscribe-form'></div>
|
162 |
|
163 |
private function reCaptchaVerify($token, $options, $action = "") {
|
164 |
$recaptchaVersion = apply_filters("wpdiscuz_recaptcha_version", $options->recaptcha["version"]);
|
165 |
+
if ($recaptchaVersion === "2.0") {
|
166 |
$resp = $this->reCaptcha->verify($token, $this->getIP());
|
167 |
} else {
|
168 |
$score = apply_filters("wpdiscuz_recaptcha_score", $options->recaptcha["score"]);
|
forms/wpdFormAttr/Field/DefaultField/Email.php
CHANGED
@@ -84,7 +84,7 @@ class Email extends Field {
|
|
84 |
}
|
85 |
}
|
86 |
|
87 |
-
if ($email
|
88 |
$messageArray["code"] = "wc_error_email_text";
|
89 |
wp_die(json_encode($messageArray));
|
90 |
}
|
84 |
}
|
85 |
}
|
86 |
|
87 |
+
if ($email !== "" && filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
|
88 |
$messageArray["code"] = "wc_error_email_text";
|
89 |
wp_die(json_encode($messageArray));
|
90 |
}
|
forms/wpdFormAttr/Field/DefaultField/Submit.php
CHANGED
@@ -60,7 +60,7 @@ class Submit extends Field {
|
|
60 |
$isShowSubscribeWrapper = false;
|
61 |
if ($options->subscription["showReplyCheckbox"]) {
|
62 |
if ($currentUser->ID) {
|
63 |
-
$isShowSubscribeWrapper = !$wpdiscuz->subscriptionData || ($wpdiscuz->subscriptionData && $wpdiscuz->subscriptionData["type"]
|
64 |
} else {
|
65 |
$isShowSubscribeWrapper = true;
|
66 |
}
|
60 |
$isShowSubscribeWrapper = false;
|
61 |
if ($options->subscription["showReplyCheckbox"]) {
|
62 |
if ($currentUser->ID) {
|
63 |
+
$isShowSubscribeWrapper = !$wpdiscuz->subscriptionData || ($wpdiscuz->subscriptionData && $wpdiscuz->subscriptionData["type"] === $wpdiscuz::SUBSCRIPTION_COMMENT);
|
64 |
} else {
|
65 |
$isShowSubscribeWrapper = true;
|
66 |
}
|
forms/wpdFormAttr/Field/DefaultField/Website.php
CHANGED
@@ -90,7 +90,7 @@ class Website extends Field {
|
|
90 |
|
91 |
public function validateFieldData($fieldName, $args, $options, $currentUser) {
|
92 |
$website_url = trim(filter_input(INPUT_POST, $fieldName, FILTER_SANITIZE_STRING));
|
93 |
-
if ($website_url
|
94 |
if (strpos($website_url, "http://") !== 0 && strpos($website_url, "https://") !== 0) {
|
95 |
$website_url = "http://" . $website_url;
|
96 |
}
|
90 |
|
91 |
public function validateFieldData($fieldName, $args, $options, $currentUser) {
|
92 |
$website_url = trim(filter_input(INPUT_POST, $fieldName, FILTER_SANITIZE_STRING));
|
93 |
+
if ($website_url !== "") {
|
94 |
if (strpos($website_url, "http://") !== 0 && strpos($website_url, "https://") !== 0) {
|
95 |
$website_url = "http://" . $website_url;
|
96 |
}
|
forms/wpdFormAttr/Field/Field.php
CHANGED
@@ -57,9 +57,9 @@ abstract class Field {
|
|
57 |
<div class="wpd-field-head">
|
58 |
<?php echo htmlentities($args["name"]); ?>
|
59 |
<?php
|
60 |
-
if ($args["type"]
|
61 |
esc_html_e(" (Submit Button)", "wpdiscuz");
|
62 |
-
} elseif ($args["type"]
|
63 |
esc_html_e("Google reCAPTCHA", "wpdiscuz");
|
64 |
} elseif (strpos($args["type"], "wpdFormAttr\Field\DefaultField") === false) {
|
65 |
$fieldLable = str_replace("wpdFormAttr\Field\\", "", $args["type"]);
|
@@ -170,7 +170,7 @@ abstract class Field {
|
|
170 |
$action = filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING);
|
171 |
if ($uniqueID) {
|
172 |
$commentParent = strstr($uniqueID, "_");
|
173 |
-
$isParent = ($action
|
174 |
}
|
175 |
return $isParent;
|
176 |
}
|
57 |
<div class="wpd-field-head">
|
58 |
<?php echo htmlentities($args["name"]); ?>
|
59 |
<?php
|
60 |
+
if ($args["type"] === "wpdFormAttr\Field\DefaultField\Submit") {
|
61 |
esc_html_e(" (Submit Button)", "wpdiscuz");
|
62 |
+
} elseif ($args["type"] === "wpdFormAttr\Field\DefaultField\Captcha") {
|
63 |
esc_html_e("Google reCAPTCHA", "wpdiscuz");
|
64 |
} elseif (strpos($args["type"], "wpdFormAttr\Field\DefaultField") === false) {
|
65 |
$fieldLable = str_replace("wpdFormAttr\Field\\", "", $args["type"]);
|
170 |
$action = filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING);
|
171 |
if ($uniqueID) {
|
172 |
$commentParent = strstr($uniqueID, "_");
|
173 |
+
$isParent = ($action === "editedcomment" && $commentParent === "_0") || ($action === "wpdSaveEditedComment" && $commentParent === "_0") || ($action === "wpdAddComment" && $uniqueID === "0_0") ? true : false;
|
174 |
}
|
175 |
return $isParent;
|
176 |
}
|
forms/wpdFormAttr/Field/HTMLField.php
CHANGED
@@ -42,6 +42,11 @@ class HTMLField extends Field {
|
|
42 |
if (isset($data["value"])) {
|
43 |
$cleanData["value"] = trim($data["value"]);
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
45 |
return wp_parse_args($cleanData, $this->fieldDefaultData);
|
46 |
}
|
47 |
|
42 |
if (isset($data["value"])) {
|
43 |
$cleanData["value"] = trim($data["value"]);
|
44 |
}
|
45 |
+
if (isset($data["is_show_sform"])) {
|
46 |
+
$cleanData["is_show_sform"] = intval($data["is_show_sform"]);
|
47 |
+
} else {
|
48 |
+
$cleanData["is_show_sform"] = 0;
|
49 |
+
}
|
50 |
return wp_parse_args($cleanData, $this->fieldDefaultData);
|
51 |
}
|
52 |
|
forms/wpdFormAttr/Form.php
CHANGED
@@ -80,7 +80,7 @@ class Form {
|
|
80 |
return;
|
81 |
}
|
82 |
$form = get_post($formID);
|
83 |
-
if ($form && $form->post_status
|
84 |
$this->formID = $formID;
|
85 |
do_action("wpdiscuz_form_init", $this);
|
86 |
} else {
|
@@ -257,7 +257,7 @@ class Form {
|
|
257 |
$commentApproved = $comment->comment_approved;
|
258 |
do_action("wpdiscuz_before_save_commentmeta", $comment, $this->fieldsBeforeSave);
|
259 |
foreach ($this->fieldsBeforeSave as $mettaKey => $data) {
|
260 |
-
if ($this->ratingsExists && $this->formCustomFields[$mettaKey]["type"]
|
261 |
$oldCommentRating = get_comment_meta($commentID, $mettaKey, true);
|
262 |
if ($oldCommentRating && $commentApproved === "1") {
|
263 |
$postID = $comment->comment_post_ID;
|
@@ -338,7 +338,7 @@ class Form {
|
|
338 |
foreach ($ratingMetaKeys as $key => $ratingMetaKey) {
|
339 |
$exists = false;
|
340 |
foreach ($ratings as $k => $rating) {
|
341 |
-
if ($rating["metakey"]
|
342 |
$exists = true;
|
343 |
break;
|
344 |
}
|
@@ -509,7 +509,7 @@ class Form {
|
|
509 |
$atts["show-label"] = false;
|
510 |
}
|
511 |
$html .= "<div class='wpdiscuz-post-rating-wrap wpd-custom-field'>";
|
512 |
-
if (!isset($atts["metakey"]) || $atts["metakey"]
|
513 |
$avg = 0;
|
514 |
$q = 0;
|
515 |
foreach ($ratingList as $key => $value) {
|
@@ -801,7 +801,7 @@ class Form {
|
|
801 |
$authorEmail = $currentUser->ID ? $currentUser->user_email : "unknown@example.com";
|
802 |
?>
|
803 |
<div class="wpd-avatar">
|
804 |
-
<?php echo get_avatar($currentUser->ID,
|
805 |
</div>
|
806 |
<?php
|
807 |
}
|
@@ -1004,10 +1004,10 @@ class Form {
|
|
1004 |
$blogRoles = get_editable_roles();
|
1005 |
$rolesCannotComment = isset($this->generalOptions["roles_cannot_comment"]) ? $this->generalOptions["roles_cannot_comment"] : [];
|
1006 |
foreach ($blogRoles as $role => $info) {
|
1007 |
-
if ($role
|
1008 |
?>
|
1009 |
<div style="float:<?php echo (is_rtl()) ? 'right' : 'left'; ?>; display:inline-block; padding:3px 5px 3px 7px; min-width:25%;">
|
1010 |
-
<input type="checkbox" <?php checked(in_array($role, $rolesCannotComment)
|
1011 |
<label for="wpd-<?php echo esc_attr($role); ?>" style="white-space:nowrap; font-size:13px;"><?php echo esc_html($info["name"]); ?></label>
|
1012 |
</div>
|
1013 |
<?php
|
@@ -1379,8 +1379,7 @@ class Form {
|
|
1379 |
|
1380 |
public function customFieldsExists() {
|
1381 |
$this->initFormFields();
|
1382 |
-
|
1383 |
-
return $exists;
|
1384 |
}
|
1385 |
|
1386 |
public function resetData() {
|
80 |
return;
|
81 |
}
|
82 |
$form = get_post($formID);
|
83 |
+
if ($form && $form->post_status === "publish" && $form->post_type === wpdFormConst::WPDISCUZ_FORMS_CONTENT_TYPE) {
|
84 |
$this->formID = $formID;
|
85 |
do_action("wpdiscuz_form_init", $this);
|
86 |
} else {
|
257 |
$commentApproved = $comment->comment_approved;
|
258 |
do_action("wpdiscuz_before_save_commentmeta", $comment, $this->fieldsBeforeSave);
|
259 |
foreach ($this->fieldsBeforeSave as $mettaKey => $data) {
|
260 |
+
if ($this->ratingsExists && $this->formCustomFields[$mettaKey]["type"] === "wpdFormAttr\Field\RatingField") {
|
261 |
$oldCommentRating = get_comment_meta($commentID, $mettaKey, true);
|
262 |
if ($oldCommentRating && $commentApproved === "1") {
|
263 |
$postID = $comment->comment_post_ID;
|
338 |
foreach ($ratingMetaKeys as $key => $ratingMetaKey) {
|
339 |
$exists = false;
|
340 |
foreach ($ratings as $k => $rating) {
|
341 |
+
if ($rating["metakey"] === $ratingMetaKey) {
|
342 |
$exists = true;
|
343 |
break;
|
344 |
}
|
509 |
$atts["show-label"] = false;
|
510 |
}
|
511 |
$html .= "<div class='wpdiscuz-post-rating-wrap wpd-custom-field'>";
|
512 |
+
if (!isset($atts["metakey"]) || $atts["metakey"] === "" || $atts["metakey"] === "all") {
|
513 |
$avg = 0;
|
514 |
$q = 0;
|
515 |
foreach ($ratingList as $key => $value) {
|
801 |
$authorEmail = $currentUser->ID ? $currentUser->user_email : "unknown@example.com";
|
802 |
?>
|
803 |
<div class="wpd-avatar">
|
804 |
+
<?php echo get_avatar($currentUser->ID, 56, "", $authorName, ["wpdiscuz_current_user" => $currentUser, "wpdiscuz_gravatar_user_email" => $authorEmail]); ?>
|
805 |
</div>
|
806 |
<?php
|
807 |
}
|
1004 |
$blogRoles = get_editable_roles();
|
1005 |
$rolesCannotComment = isset($this->generalOptions["roles_cannot_comment"]) ? $this->generalOptions["roles_cannot_comment"] : [];
|
1006 |
foreach ($blogRoles as $role => $info) {
|
1007 |
+
if ($role !== "administrator") {
|
1008 |
?>
|
1009 |
<div style="float:<?php echo (is_rtl()) ? 'right' : 'left'; ?>; display:inline-block; padding:3px 5px 3px 7px; min-width:25%;">
|
1010 |
+
<input type="checkbox" <?php checked(in_array($role, $rolesCannotComment)); ?> value="<?php echo esc_attr($role); ?>" name="<?php echo esc_attr(wpdFormConst::WPDISCUZ_META_FORMS_GENERAL_OPTIONS); ?>[roles_cannot_comment][]" id="wpd-<?php echo esc_attr($role); ?>" style="margin:0px; vertical-align: middle;" />
|
1011 |
<label for="wpd-<?php echo esc_attr($role); ?>" style="white-space:nowrap; font-size:13px;"><?php echo esc_html($info["name"]); ?></label>
|
1012 |
</div>
|
1013 |
<?php
|
1379 |
|
1380 |
public function customFieldsExists() {
|
1381 |
$this->initFormFields();
|
1382 |
+
return $this->formCustomFields ? true : false;
|
|
|
1383 |
}
|
1384 |
|
1385 |
public function resetData() {
|
forms/wpdFormAttr/Login/SocialLogin.php
CHANGED
@@ -190,7 +190,7 @@ class SocialLogin {
|
|
190 |
$providerData = Utils::getProviderByState($state);
|
191 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
192 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
193 |
-
if (!$state || ($provider
|
194 |
$this->redirect($postID, esc_html__("Facebook authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
195 |
}
|
196 |
if (!$code) {
|
@@ -265,7 +265,7 @@ class SocialLogin {
|
|
265 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
266 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
267 |
|
268 |
-
if (!$state || ($provider
|
269 |
$this->redirect($postID, esc_html__("Instagram authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
270 |
}
|
271 |
if (!$code) {
|
@@ -342,7 +342,7 @@ class SocialLogin {
|
|
342 |
$providerData = Utils::getProviderByState($state);
|
343 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
344 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
345 |
-
if (!$state || ($provider
|
346 |
$this->redirect($postID, esc_html__("Google authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
347 |
}
|
348 |
if (!$code) {
|
@@ -412,7 +412,7 @@ class SocialLogin {
|
|
412 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
413 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
414 |
|
415 |
-
if (!$state || ($provider
|
416 |
$this->redirect($postID, esc_html__("Linkedin authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
417 |
}
|
418 |
if (!$code) {
|
@@ -521,7 +521,7 @@ class SocialLogin {
|
|
521 |
$providerData = Utils::getProviderByState($state);
|
522 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
523 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
524 |
-
if (!$state || ($provider
|
525 |
$this->redirect($postID, esc_html__("Disqus authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
526 |
}
|
527 |
if (!$code) {
|
@@ -607,7 +607,7 @@ class SocialLogin {
|
|
607 |
$providerData = Utils::getProviderByState($state);
|
608 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
609 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
610 |
-
if (!$state || ($provider
|
611 |
$this->redirect($postID, esc_html__("Wordpress.com authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
612 |
}
|
613 |
if (!$code) {
|
@@ -747,7 +747,7 @@ class SocialLogin {
|
|
747 |
$providerData = Utils::getProviderByState($state);
|
748 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
749 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
750 |
-
if (!$state || ($provider
|
751 |
$this->redirect($postID, esc_html__("VK authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
752 |
}
|
753 |
if (!$code) {
|
@@ -824,7 +824,7 @@ class SocialLogin {
|
|
824 |
$providerData = Utils::getProviderByState($state);
|
825 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
826 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
827 |
-
if (!$state || ($provider
|
828 |
$this->redirect($postID, esc_html__("OK authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
829 |
}
|
830 |
if (!$code) {
|
@@ -906,7 +906,7 @@ class SocialLogin {
|
|
906 |
if ($error) {
|
907 |
$this->redirect($postID, esc_html($errorDesc));
|
908 |
}
|
909 |
-
if (!$state || ($provider
|
910 |
$this->redirect($postID, esc_html__("Yandex authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
911 |
}
|
912 |
if (!$code) {
|
@@ -996,7 +996,7 @@ class SocialLogin {
|
|
996 |
if ($error) {
|
997 |
$this->redirect($postID, esc_html($errorDesc));
|
998 |
}
|
999 |
-
if (!$state || ($provider
|
1000 |
$this->redirect($postID, esc_html__("Mail.ru authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1001 |
}
|
1002 |
if (!$code) {
|
@@ -1085,7 +1085,7 @@ class SocialLogin {
|
|
1085 |
if ($error) {
|
1086 |
$this->redirect($postID, esc_html($errorDesc));
|
1087 |
}
|
1088 |
-
if (!$state || ($provider
|
1089 |
$this->redirect($postID, esc_html__("WeChat authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1090 |
}
|
1091 |
if (!$code) {
|
@@ -1170,7 +1170,7 @@ class SocialLogin {
|
|
1170 |
if ($error) {
|
1171 |
$this->redirect($postID, esc_html($errorDesc));
|
1172 |
}
|
1173 |
-
if (!$state || ($provider
|
1174 |
$this->redirect($postID, esc_html__("QQ authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1175 |
}
|
1176 |
if (!$code) {
|
@@ -1276,7 +1276,7 @@ class SocialLogin {
|
|
1276 |
if ($error) {
|
1277 |
$this->redirect($postID, esc_html($errorDesc));
|
1278 |
}
|
1279 |
-
if (!$state || ($provider
|
1280 |
$this->redirect($postID, esc_html__("Weibo authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1281 |
}
|
1282 |
if (!$code) {
|
@@ -1365,7 +1365,7 @@ class SocialLogin {
|
|
1365 |
if ($error) {
|
1366 |
$this->redirect($postID, esc_html($errorDesc));
|
1367 |
}
|
1368 |
-
if (!$state || ($provider
|
1369 |
$this->redirect($postID, esc_html__("Baidu authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1370 |
}
|
1371 |
if (!$code) {
|
190 |
$providerData = Utils::getProviderByState($state);
|
191 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
192 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
193 |
+
if (!$state || ($provider !== "facebook")) {
|
194 |
$this->redirect($postID, esc_html__("Facebook authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
195 |
}
|
196 |
if (!$code) {
|
265 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
266 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
267 |
|
268 |
+
if (!$state || ($provider !== "instagram")) {
|
269 |
$this->redirect($postID, esc_html__("Instagram authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
270 |
}
|
271 |
if (!$code) {
|
342 |
$providerData = Utils::getProviderByState($state);
|
343 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
344 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
345 |
+
if (!$state || ($provider !== "google")) {
|
346 |
$this->redirect($postID, esc_html__("Google authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
347 |
}
|
348 |
if (!$code) {
|
412 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
413 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
414 |
|
415 |
+
if (!$state || ($provider !== "linkedin")) {
|
416 |
$this->redirect($postID, esc_html__("Linkedin authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
417 |
}
|
418 |
if (!$code) {
|
521 |
$providerData = Utils::getProviderByState($state);
|
522 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
523 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
524 |
+
if (!$state || ($provider !== "disqus")) {
|
525 |
$this->redirect($postID, esc_html__("Disqus authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
526 |
}
|
527 |
if (!$code) {
|
607 |
$providerData = Utils::getProviderByState($state);
|
608 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
609 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
610 |
+
if (!$state || ($provider !== "wordpress")) {
|
611 |
$this->redirect($postID, esc_html__("Wordpress.com authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
612 |
}
|
613 |
if (!$code) {
|
747 |
$providerData = Utils::getProviderByState($state);
|
748 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
749 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
750 |
+
if (!$state || ($provider !== "vk")) {
|
751 |
$this->redirect($postID, esc_html__("VK authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
752 |
}
|
753 |
if (!$code) {
|
824 |
$providerData = Utils::getProviderByState($state);
|
825 |
$provider = $providerData[wpdFormConst::WPDISCUZ_OAUTH_STATE_PROVIDER];
|
826 |
$postID = $providerData[wpdFormConst::WPDISCUZ_OAUTH_CURRENT_POSTID];
|
827 |
+
if (!$state || ($provider !== "ok")) {
|
828 |
$this->redirect($postID, esc_html__("OK authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
829 |
}
|
830 |
if (!$code) {
|
906 |
if ($error) {
|
907 |
$this->redirect($postID, esc_html($errorDesc));
|
908 |
}
|
909 |
+
if (!$state || ($provider !== "yandex")) {
|
910 |
$this->redirect($postID, esc_html__("Yandex authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
911 |
}
|
912 |
if (!$code) {
|
996 |
if ($error) {
|
997 |
$this->redirect($postID, esc_html($errorDesc));
|
998 |
}
|
999 |
+
if (!$state || ($provider !== "mailru")) {
|
1000 |
$this->redirect($postID, esc_html__("Mail.ru authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1001 |
}
|
1002 |
if (!$code) {
|
1085 |
if ($error) {
|
1086 |
$this->redirect($postID, esc_html($errorDesc));
|
1087 |
}
|
1088 |
+
if (!$state || ($provider !== "wechat")) {
|
1089 |
$this->redirect($postID, esc_html__("WeChat authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1090 |
}
|
1091 |
if (!$code) {
|
1170 |
if ($error) {
|
1171 |
$this->redirect($postID, esc_html($errorDesc));
|
1172 |
}
|
1173 |
+
if (!$state || ($provider !== "qq")) {
|
1174 |
$this->redirect($postID, esc_html__("QQ authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1175 |
}
|
1176 |
if (!$code) {
|
1276 |
if ($error) {
|
1277 |
$this->redirect($postID, esc_html($errorDesc));
|
1278 |
}
|
1279 |
+
if (!$state || ($provider !== "weibo")) {
|
1280 |
$this->redirect($postID, esc_html__("Weibo authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1281 |
}
|
1282 |
if (!$code) {
|
1365 |
if ($error) {
|
1366 |
$this->redirect($postID, esc_html($errorDesc));
|
1367 |
}
|
1368 |
+
if (!$state || ($provider !== "baidu")) {
|
1369 |
$this->redirect($postID, esc_html__("Baidu authentication failed (OAuth state does not exist).", "wpdiscuz"));
|
1370 |
}
|
1371 |
if (!$code) {
|
forms/wpdFormAttr/Login/twitter/Request.php
CHANGED
@@ -199,7 +199,7 @@ class Request
|
|
199 |
$first = true;
|
200 |
$out = 'Authorization: OAuth';
|
201 |
foreach ($this->parameters as $k => $v) {
|
202 |
-
if (substr($k, 0, 5)
|
203 |
continue;
|
204 |
}
|
205 |
if (is_array($v)) {
|
199 |
$first = true;
|
200 |
$out = 'Authorization: OAuth';
|
201 |
foreach ($this->parameters as $k => $v) {
|
202 |
+
if (substr($k, 0, 5) !== "oauth") {
|
203 |
continue;
|
204 |
}
|
205 |
if (is_array($v)) {
|
forms/wpdFormAttr/Login/twitter/SignatureMethod.php
CHANGED
@@ -51,7 +51,7 @@ abstract class SignatureMethod
|
|
51 |
return false;
|
52 |
}
|
53 |
|
54 |
-
if (strlen($built)
|
55 |
return false;
|
56 |
}
|
57 |
|
51 |
return false;
|
52 |
}
|
53 |
|
54 |
+
if (strlen($built) !== strlen($signature)) {
|
55 |
return false;
|
56 |
}
|
57 |
|
forms/wpdFormAttr/Row.php
CHANGED
@@ -33,7 +33,7 @@ class Row {
|
|
33 |
}
|
34 |
|
35 |
private function renderRow($id, $args) {
|
36 |
-
$isTwoCol = $args["column_type"]
|
37 |
?>
|
38 |
<div class="wpd-form-row-body <?php echo $isTwoCol ? "two-col" : ""; ?>">
|
39 |
<?php
|
@@ -80,7 +80,7 @@ class Row {
|
|
80 |
?>
|
81 |
<div class="wpd-form-row">
|
82 |
<?php
|
83 |
-
if ($args["column_type"]
|
84 |
$left = $args["left"];
|
85 |
$right = $args["right"];
|
86 |
$this->renderFrontFormCol("left", $left, $options, $currentUser, $uniqueId, $isMainForm);
|
@@ -144,7 +144,7 @@ class Row {
|
|
144 |
if (in_array($callableClass, $allowedFieldsType, true) && is_callable($callableClass . "::getInstance")) {
|
145 |
$field = call_user_func($callableClass . "::getInstance");
|
146 |
$fieldNewName = $this->changeFieldName($fieldName, $fieldData);
|
147 |
-
if ($fieldNewName
|
148 |
$args = $this->chageArrayKey($args, $fieldName, $fieldNewName);
|
149 |
$args[$fieldNewName] = $field->sanitizeFieldData($fieldData);
|
150 |
$fields[$fieldNewName] = $field->sanitizeFieldData($fieldData);
|
@@ -160,7 +160,7 @@ class Row {
|
|
160 |
private function changeFieldName($fieldName, $fieldData) {
|
161 |
if (isset($fieldData["meta_key"])) {
|
162 |
$metaKey = trim($fieldData["meta_key"]);
|
163 |
-
if ($metaKey && $fieldName
|
164 |
$newName = str_replace(['-', ' '], '_', remove_accents($metaKey));
|
165 |
$this->replaceMetaKeyInDB($fieldName, $newName, $fieldData);
|
166 |
$this->chagePostRatingKey($fieldName, $newName, $fieldData);
|
@@ -171,7 +171,7 @@ class Row {
|
|
171 |
}
|
172 |
|
173 |
private function chagePostRatingKey($oldName, $newName, $fieldData) {
|
174 |
-
if (str_replace("\\\\", "\\", $fieldData["type"])
|
175 |
if ($wpdiscuzRatingCount = $this->getPostRatingMeta()) {
|
176 |
foreach ($wpdiscuzRatingCount as $k => $row) {
|
177 |
$metaData = maybe_unserialize($row["meta_value"]);
|
33 |
}
|
34 |
|
35 |
private function renderRow($id, $args) {
|
36 |
+
$isTwoCol = $args["column_type"] === "two";
|
37 |
?>
|
38 |
<div class="wpd-form-row-body <?php echo $isTwoCol ? "two-col" : ""; ?>">
|
39 |
<?php
|
80 |
?>
|
81 |
<div class="wpd-form-row">
|
82 |
<?php
|
83 |
+
if ($args["column_type"] === "two") {
|
84 |
$left = $args["left"];
|
85 |
$right = $args["right"];
|
86 |
$this->renderFrontFormCol("left", $left, $options, $currentUser, $uniqueId, $isMainForm);
|
144 |
if (in_array($callableClass, $allowedFieldsType, true) && is_callable($callableClass . "::getInstance")) {
|
145 |
$field = call_user_func($callableClass . "::getInstance");
|
146 |
$fieldNewName = $this->changeFieldName($fieldName, $fieldData);
|
147 |
+
if ($fieldNewName !== $fieldName) {
|
148 |
$args = $this->chageArrayKey($args, $fieldName, $fieldNewName);
|
149 |
$args[$fieldNewName] = $field->sanitizeFieldData($fieldData);
|
150 |
$fields[$fieldNewName] = $field->sanitizeFieldData($fieldData);
|
160 |
private function changeFieldName($fieldName, $fieldData) {
|
161 |
if (isset($fieldData["meta_key"])) {
|
162 |
$metaKey = trim($fieldData["meta_key"]);
|
163 |
+
if ($metaKey && $fieldName !== $metaKey) {
|
164 |
$newName = str_replace(['-', ' '], '_', remove_accents($metaKey));
|
165 |
$this->replaceMetaKeyInDB($fieldName, $newName, $fieldData);
|
166 |
$this->chagePostRatingKey($fieldName, $newName, $fieldData);
|
171 |
}
|
172 |
|
173 |
private function chagePostRatingKey($oldName, $newName, $fieldData) {
|
174 |
+
if (str_replace("\\\\", "\\", $fieldData["type"]) === "wpdFormAttr\Field\RatingField" && isset($fieldData["meta_key_replace"]) && $fieldData["meta_key_replace"]) {
|
175 |
if ($wpdiscuzRatingCount = $this->getPostRatingMeta()) {
|
176 |
foreach ($wpdiscuzRatingCount as $k => $row) {
|
177 |
$metaData = maybe_unserialize($row["meta_value"]);
|
includes/class.WpdiscuzDBManager.php
CHANGED
@@ -147,7 +147,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
147 |
}
|
148 |
if ($args["post_id"]) {
|
149 |
$approved = "";
|
150 |
-
if ($args["status"]
|
151 |
$approved = " AND `c`.`comment_approved` IN('1','0')";
|
152 |
} else {
|
153 |
$approved = " AND `c`.`comment_approved` = '1'";
|
@@ -165,7 +165,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
165 |
public function getNewCommentIds($args, $loadLastCommentId, $email, $visibleCommentIds) {
|
166 |
$wpdiscuz = wpDiscuz();
|
167 |
$approved = "";
|
168 |
-
if ($args["status"]
|
169 |
$approved = " AND `comment_approved` IN('1','0')";
|
170 |
} else {
|
171 |
$approved = " AND `comment_approved` = '1'";
|
@@ -211,7 +211,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
211 |
if (strpos($email, "@example.com") !== false) {
|
212 |
return false;
|
213 |
}
|
214 |
-
if ($subscriptionType
|
215 |
$this->deleteCommentNotifications($subsriptionId, $email);
|
216 |
}
|
217 |
$activationKey = md5($email . uniqid() . time());
|
@@ -476,7 +476,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
476 |
$email = $subscription["email"];
|
477 |
$subscriptionId = $subscription["post_id"];
|
478 |
$postId = $subscription["post_id"];
|
479 |
-
$subscriptionType = $subscription["subscription_type"]
|
480 |
$activationKey = md5($email . uniqid() . time());
|
481 |
$subscriptionDate = $subscription["date"];
|
482 |
$confirm = $subscription["status"];
|
@@ -484,7 +484,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
484 |
$importedFrom = "subscribe-to-comments-reloaded"; // this is a slug in wp repo
|
485 |
|
486 |
if ($userSubscription) {
|
487 |
-
if ($userSubscription["type"]
|
488 |
continue;
|
489 |
} else {
|
490 |
$sql = "UPDATE `{$this->emailNotification}` SET `subscribtion_id` = %d, `post_id` = %d, `subscribtion_type` = %s, `imported_from` = %s WHERE `id` = %d;";
|
@@ -509,8 +509,6 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
509 |
|
510 |
/* === LSTC SUBSCRIPTIONS - Lightweight Subscribe To Comments === */
|
511 |
|
512 |
-
// TODO
|
513 |
-
|
514 |
public function getLstcAllSubscriptions() {
|
515 |
$sql = "SELECT COUNT(*) FROM `{$this->db->prefix}comment_notifier`;";
|
516 |
return $this->db->get_var($sql);
|
@@ -538,7 +536,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
538 |
$importedFrom = "comment-notifier-no-spammers"; // this is a slug in wp repo
|
539 |
|
540 |
if ($userSubscription) {
|
541 |
-
if ($userSubscription["type"]
|
542 |
continue;
|
543 |
} else {
|
544 |
$sql = "UPDATE `{$this->emailNotification}` SET `subscribtion_id` = %d, `post_id` = %d, `subscribtion_type` = %s, `imported_from` = %s WHERE `id` = %d;";
|
@@ -619,14 +617,14 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
619 |
|
620 |
public function getGraphAllComments($interval) {
|
621 |
$date = new DateTime();
|
622 |
-
if ($interval ===
|
623 |
-
$date->modify(
|
624 |
-
} else if ($interval ===
|
625 |
-
$date->modify(
|
626 |
-
} else if ($interval ===
|
627 |
-
$date->modify(
|
628 |
-
} else if ($interval ===
|
629 |
-
$date->modify(
|
630 |
}
|
631 |
$sql = "SELECT COUNT(`comment_ID`) AS `count`, SUBSTR(`comment_date_gmt`, 1, 10) AS `date` FROM `{$this->db->comments}` WHERE `comment_approved` = '1'" . ($interval === "all" ? "" : " AND `comment_date_gmt` > '{$date->format('Y-m-d')}'") . " GROUP BY `date`;";
|
632 |
$results = $this->db->get_results($sql, ARRAY_A);
|
@@ -639,14 +637,14 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
639 |
|
640 |
public function getGraphInlineComments($interval) {
|
641 |
$date = new DateTime();
|
642 |
-
if ($interval ===
|
643 |
-
$date->modify(
|
644 |
-
} else if ($interval ===
|
645 |
-
$date->modify(
|
646 |
-
} else if ($interval ===
|
647 |
-
$date->modify(
|
648 |
-
} else if ($interval ===
|
649 |
-
$date->modify(
|
650 |
}
|
651 |
$sql = "SELECT COUNT(`c`.`comment_ID`) AS `count`, SUBSTR(`c`.`comment_date_gmt`, 1, 10) AS `date` FROM `{$this->db->comments}` AS `c` INNER JOIN `{$this->db->commentmeta}` AS `cm` ON `cm`.`comment_id` = `c`.`comment_ID` AND `cm`.`meta_key` = '" . self::META_KEY_FEEDBACK_FORM_ID . "' WHERE `c`.`comment_approved` = '1'" . ($interval === "all" ? "" : " AND `c`.`comment_date_gmt` > '{$date->format('Y-m-d')}'") . " GROUP BY `date`;";
|
652 |
$results = $this->db->get_results($sql, ARRAY_A);
|
@@ -864,7 +862,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
864 |
$userOldEmail = trim($oldUser->user_email);
|
865 |
$userNewName = trim($user->display_name);
|
866 |
$userOldName = trim($oldUser->display_name);
|
867 |
-
if ($userNewEmail
|
868 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `user_email` = %s WHERE `user_email` = %s AND `follower_email` != %s;", $userNewEmail, $userOldEmail, $userNewEmail);
|
869 |
$this->db->query($sql);
|
870 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `follower_email` = %s WHERE `follower_email` = %s AND `user_email` != %s;", $userNewEmail, $userOldEmail, $userNewEmail);
|
@@ -873,7 +871,7 @@ class WpdiscuzDBManager implements WpDiscuzConstants {
|
|
873 |
$this->db->query($sql);
|
874 |
}
|
875 |
|
876 |
-
if ($userNewName
|
877 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `user_name` = %s WHERE `user_name` = %s;", $userNewName, $userOldName);
|
878 |
$this->db->query($sql);
|
879 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `follower_name` = %s WHERE `follower_name` = %s;", $userNewName, $userOldName);
|
147 |
}
|
148 |
if ($args["post_id"]) {
|
149 |
$approved = "";
|
150 |
+
if ($args["status"] === "all") {
|
151 |
$approved = " AND `c`.`comment_approved` IN('1','0')";
|
152 |
} else {
|
153 |
$approved = " AND `c`.`comment_approved` = '1'";
|
165 |
public function getNewCommentIds($args, $loadLastCommentId, $email, $visibleCommentIds) {
|
166 |
$wpdiscuz = wpDiscuz();
|
167 |
$approved = "";
|
168 |
+
if ($args["status"] === "all") {
|
169 |
$approved = " AND `comment_approved` IN('1','0')";
|
170 |
} else {
|
171 |
$approved = " AND `comment_approved` = '1'";
|
211 |
if (strpos($email, "@example.com") !== false) {
|
212 |
return false;
|
213 |
}
|
214 |
+
if ($subscriptionType !== self::SUBSCRIPTION_COMMENT) {
|
215 |
$this->deleteCommentNotifications($subsriptionId, $email);
|
216 |
}
|
217 |
$activationKey = md5($email . uniqid() . time());
|
476 |
$email = $subscription["email"];
|
477 |
$subscriptionId = $subscription["post_id"];
|
478 |
$postId = $subscription["post_id"];
|
479 |
+
$subscriptionType = $subscription["subscription_type"] === "y" ? self::SUBSCRIPTION_POST : self::SUBSCRIPTION_ALL_COMMENT;
|
480 |
$activationKey = md5($email . uniqid() . time());
|
481 |
$subscriptionDate = $subscription["date"];
|
482 |
$confirm = $subscription["status"];
|
484 |
$importedFrom = "subscribe-to-comments-reloaded"; // this is a slug in wp repo
|
485 |
|
486 |
if ($userSubscription) {
|
487 |
+
if ($userSubscription["type"] === self::SUBSCRIPTION_POST) {
|
488 |
continue;
|
489 |
} else {
|
490 |
$sql = "UPDATE `{$this->emailNotification}` SET `subscribtion_id` = %d, `post_id` = %d, `subscribtion_type` = %s, `imported_from` = %s WHERE `id` = %d;";
|
509 |
|
510 |
/* === LSTC SUBSCRIPTIONS - Lightweight Subscribe To Comments === */
|
511 |
|
|
|
|
|
512 |
public function getLstcAllSubscriptions() {
|
513 |
$sql = "SELECT COUNT(*) FROM `{$this->db->prefix}comment_notifier`;";
|
514 |
return $this->db->get_var($sql);
|
536 |
$importedFrom = "comment-notifier-no-spammers"; // this is a slug in wp repo
|
537 |
|
538 |
if ($userSubscription) {
|
539 |
+
if ($userSubscription["type"] === self::SUBSCRIPTION_POST) {
|
540 |
continue;
|
541 |
} else {
|
542 |
$sql = "UPDATE `{$this->emailNotification}` SET `subscribtion_id` = %d, `post_id` = %d, `subscribtion_type` = %s, `imported_from` = %s WHERE `id` = %d;";
|
617 |
|
618 |
public function getGraphAllComments($interval) {
|
619 |
$date = new DateTime();
|
620 |
+
if ($interval === "week") {
|
621 |
+
$date->modify("-7 days");
|
622 |
+
} else if ($interval === "month") {
|
623 |
+
$date->modify("-1 month");
|
624 |
+
} else if ($interval === "6months") {
|
625 |
+
$date->modify("-6 months");
|
626 |
+
} else if ($interval === "year") {
|
627 |
+
$date->modify("-1 year");
|
628 |
}
|
629 |
$sql = "SELECT COUNT(`comment_ID`) AS `count`, SUBSTR(`comment_date_gmt`, 1, 10) AS `date` FROM `{$this->db->comments}` WHERE `comment_approved` = '1'" . ($interval === "all" ? "" : " AND `comment_date_gmt` > '{$date->format('Y-m-d')}'") . " GROUP BY `date`;";
|
630 |
$results = $this->db->get_results($sql, ARRAY_A);
|
637 |
|
638 |
public function getGraphInlineComments($interval) {
|
639 |
$date = new DateTime();
|
640 |
+
if ($interval === "week") {
|
641 |
+
$date->modify("-7 days");
|
642 |
+
} else if ($interval === "month") {
|
643 |
+
$date->modify("-1 month");
|
644 |
+
} else if ($interval === "6months") {
|
645 |
+
$date->modify("-6 months");
|
646 |
+
} else if ($interval === "year") {
|
647 |
+
$date->modify("-1 year");
|
648 |
}
|
649 |
$sql = "SELECT COUNT(`c`.`comment_ID`) AS `count`, SUBSTR(`c`.`comment_date_gmt`, 1, 10) AS `date` FROM `{$this->db->comments}` AS `c` INNER JOIN `{$this->db->commentmeta}` AS `cm` ON `cm`.`comment_id` = `c`.`comment_ID` AND `cm`.`meta_key` = '" . self::META_KEY_FEEDBACK_FORM_ID . "' WHERE `c`.`comment_approved` = '1'" . ($interval === "all" ? "" : " AND `c`.`comment_date_gmt` > '{$date->format('Y-m-d')}'") . " GROUP BY `date`;";
|
650 |
$results = $this->db->get_results($sql, ARRAY_A);
|
862 |
$userOldEmail = trim($oldUser->user_email);
|
863 |
$userNewName = trim($user->display_name);
|
864 |
$userOldName = trim($oldUser->display_name);
|
865 |
+
if ($userNewEmail !== $userOldEmail) {
|
866 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `user_email` = %s WHERE `user_email` = %s AND `follower_email` != %s;", $userNewEmail, $userOldEmail, $userNewEmail);
|
867 |
$this->db->query($sql);
|
868 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `follower_email` = %s WHERE `follower_email` = %s AND `user_email` != %s;", $userNewEmail, $userOldEmail, $userNewEmail);
|
871 |
$this->db->query($sql);
|
872 |
}
|
873 |
|
874 |
+
if ($userNewName !== $userOldName) {
|
875 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `user_name` = %s WHERE `user_name` = %s;", $userNewName, $userOldName);
|
876 |
$this->db->query($sql);
|
877 |
$sql = $this->db->prepare("UPDATE `{$this->followUsers}` SET `follower_name` = %s WHERE `follower_name` = %s;", $userNewName, $userOldName);
|
includes/class.WpdiscuzRest.php
CHANGED
@@ -55,6 +55,7 @@ class WpdiscuzRest extends WP_REST_Controller {
|
|
55 |
$response["ids"] = $newCommentIds;
|
56 |
if ($this->options->live["bubbleShowNewCommentMessage"]) {
|
57 |
$comment = get_comment($commentId);
|
|
|
58 |
$comment->comment_content = strip_tags($comment->comment_content);
|
59 |
if (stripos($comment->comment_content, "[/spoiler]") === false) {
|
60 |
$user = "";
|
55 |
$response["ids"] = $newCommentIds;
|
56 |
if ($this->options->live["bubbleShowNewCommentMessage"]) {
|
57 |
$comment = get_comment($commentId);
|
58 |
+
$comment->comment_content = apply_filters("comment_text", $comment->comment_content, $comment, ["is_wpdiscuz_comment" => true]);
|
59 |
$comment->comment_content = strip_tags($comment->comment_content);
|
60 |
if (stripos($comment->comment_content, "[/spoiler]") === false) {
|
61 |
$user = "";
|
options/class.WpdiscuzOptions.php
CHANGED
@@ -980,7 +980,7 @@ class WpdiscuzOptions implements WpDiscuzConstants {
|
|
980 |
"wmuIsShowFilesDashboard" => 1,
|
981 |
"wmuSingleImageWidth" => "auto",
|
982 |
"wmuSingleImageHeight" => 200,
|
983 |
-
"wmuImageSizes" => $this->
|
984 |
],
|
985 |
self::TAB_LIVE => [
|
986 |
"enableBubble" => 0,
|
@@ -1422,8 +1422,8 @@ class WpdiscuzOptions implements WpDiscuzConstants {
|
|
1422 |
$this->content["wmuMimeTypes"] = isset($_POST[self::TAB_CONTENT]["wmuMimeTypes"]) ? $_POST[self::TAB_CONTENT]["wmuMimeTypes"] : [];
|
1423 |
$this->content["wmuMaxFileSize"] = isset($_POST[self::TAB_CONTENT]["wmuMaxFileSize"]) ? $_POST[self::TAB_CONTENT]["wmuMaxFileSize"] : $this->wmuUploadMaxFileSize / (1024 * 1024);
|
1424 |
$this->content["wmuIsShowFilesDashboard"] = isset($_POST[self::TAB_CONTENT]["wmuIsShowFilesDashboard"]) ? absint($_POST[self::TAB_CONTENT]["wmuIsShowFilesDashboard"]) : 0;
|
1425 |
-
$this->content["wmuSingleImageWidth"] = isset($_POST[self::TAB_CONTENT]["wmuSingleImageWidth"]) && ($v = trim($_POST[self::TAB_CONTENT]["wmuSingleImageWidth"])) && ($v
|
1426 |
-
$this->content["wmuSingleImageHeight"] = isset($_POST[self::TAB_CONTENT]["wmuSingleImageHeight"]) && ($v = trim($_POST[self::TAB_CONTENT]["wmuSingleImageHeight"])) && ($v
|
1427 |
$this->content["wmuImageSizes"] = isset($_POST[self::TAB_CONTENT]["wmuImageSizes"]) && is_array($_POST[self::TAB_CONTENT]["wmuImageSizes"]) && ($sizes = array_filter($_POST[self::TAB_CONTENT]["wmuImageSizes"])) ? $sizes : [];
|
1428 |
} else if (self::TAB_LIVE === $_POST["wpd_tab"]) {
|
1429 |
$this->live["enableBubble"] = isset($_POST[self::TAB_LIVE]["enableBubble"]) ? absint($_POST[self::TAB_LIVE]["enableBubble"]) : 0;
|
@@ -1895,7 +1895,7 @@ class WpdiscuzOptions implements WpDiscuzConstants {
|
|
1895 |
$lastHash = get_option("wpdiscuz-addon-note-dismissed");
|
1896 |
$lastHashArray = explode(",", $lastHash);
|
1897 |
$currentHash = "wpDiscuz Addon Bundle";
|
1898 |
-
if ($lastHash
|
1899 |
?>
|
1900 |
<div class="updated notice wpdiscuz_addon_note is-dismissible" style="margin-top:10px;">
|
1901 |
<p style="font-weight:normal; font-size:15px; border-bottom:1px dotted #DCDCDC; padding-bottom:10px; clear: both;">
|
@@ -1905,7 +1905,7 @@ class WpdiscuzOptions implements WpDiscuzConstants {
|
|
1905 |
<div style="font-size:14px;">
|
1906 |
<?php
|
1907 |
foreach ($this->addons as $key => $addon) {
|
1908 |
-
if ($addon["class"]
|
1909 |
continue;
|
1910 |
if (in_array($addon["title"], $lastHashArray))
|
1911 |
continue;
|
@@ -1974,7 +1974,7 @@ class WpdiscuzOptions implements WpDiscuzConstants {
|
|
1974 |
public function refreshAddonPage() {
|
1975 |
$lastHash = get_option("wpdiscuz-addon-note-dismissed");
|
1976 |
$currentHash = $this->addonHash();
|
1977 |
-
if ($lastHash
|
1978 |
?>
|
1979 |
<script language="javascript">jQuery(document).ready(function () {
|
1980 |
location.reload();
|
@@ -2091,7 +2091,7 @@ class WpdiscuzOptions implements WpDiscuzConstants {
|
|
2091 |
return intval($value);
|
2092 |
}
|
2093 |
|
2094 |
-
|
2095 |
return ["thumbnail", "medium", "medium_large", "large"];
|
2096 |
}
|
2097 |
|
980 |
"wmuIsShowFilesDashboard" => 1,
|
981 |
"wmuSingleImageWidth" => "auto",
|
982 |
"wmuSingleImageHeight" => 200,
|
983 |
+
"wmuImageSizes" => $this->getDefaultImageSizes(),
|
984 |
],
|
985 |
self::TAB_LIVE => [
|
986 |
"enableBubble" => 0,
|
1422 |
$this->content["wmuMimeTypes"] = isset($_POST[self::TAB_CONTENT]["wmuMimeTypes"]) ? $_POST[self::TAB_CONTENT]["wmuMimeTypes"] : [];
|
1423 |
$this->content["wmuMaxFileSize"] = isset($_POST[self::TAB_CONTENT]["wmuMaxFileSize"]) ? $_POST[self::TAB_CONTENT]["wmuMaxFileSize"] : $this->wmuUploadMaxFileSize / (1024 * 1024);
|
1424 |
$this->content["wmuIsShowFilesDashboard"] = isset($_POST[self::TAB_CONTENT]["wmuIsShowFilesDashboard"]) ? absint($_POST[self::TAB_CONTENT]["wmuIsShowFilesDashboard"]) : 0;
|
1425 |
+
$this->content["wmuSingleImageWidth"] = isset($_POST[self::TAB_CONTENT]["wmuSingleImageWidth"]) && ($v = trim($_POST[self::TAB_CONTENT]["wmuSingleImageWidth"])) && ($v === "auto" || ($v = absint($v))) ? $v : 320;
|
1426 |
+
$this->content["wmuSingleImageHeight"] = isset($_POST[self::TAB_CONTENT]["wmuSingleImageHeight"]) && ($v = trim($_POST[self::TAB_CONTENT]["wmuSingleImageHeight"])) && ($v === "auto" || ($v = absint($v))) ? $v : 200;
|
1427 |
$this->content["wmuImageSizes"] = isset($_POST[self::TAB_CONTENT]["wmuImageSizes"]) && is_array($_POST[self::TAB_CONTENT]["wmuImageSizes"]) && ($sizes = array_filter($_POST[self::TAB_CONTENT]["wmuImageSizes"])) ? $sizes : [];
|
1428 |
} else if (self::TAB_LIVE === $_POST["wpd_tab"]) {
|
1429 |
$this->live["enableBubble"] = isset($_POST[self::TAB_LIVE]["enableBubble"]) ? absint($_POST[self::TAB_LIVE]["enableBubble"]) : 0;
|
1895 |
$lastHash = get_option("wpdiscuz-addon-note-dismissed");
|
1896 |
$lastHashArray = explode(",", $lastHash);
|
1897 |
$currentHash = "wpDiscuz Addon Bundle";
|
1898 |
+
if ($lastHash !== $currentHash && !in_array("Addons Bundle", $lastHashArray)) {
|
1899 |
?>
|
1900 |
<div class="updated notice wpdiscuz_addon_note is-dismissible" style="margin-top:10px;">
|
1901 |
<p style="font-weight:normal; font-size:15px; border-bottom:1px dotted #DCDCDC; padding-bottom:10px; clear: both;">
|
1905 |
<div style="font-size:14px;">
|
1906 |
<?php
|
1907 |
foreach ($this->addons as $key => $addon) {
|
1908 |
+
if ($addon["class"] !== "Bundle")
|
1909 |
continue;
|
1910 |
if (in_array($addon["title"], $lastHashArray))
|
1911 |
continue;
|
1974 |
public function refreshAddonPage() {
|
1975 |
$lastHash = get_option("wpdiscuz-addon-note-dismissed");
|
1976 |
$currentHash = $this->addonHash();
|
1977 |
+
if ($lastHash !== $currentHash) {
|
1978 |
?>
|
1979 |
<script language="javascript">jQuery(document).ready(function () {
|
1980 |
location.reload();
|
2091 |
return intval($value);
|
2092 |
}
|
2093 |
|
2094 |
+
public function getDefaultImageSizes() {
|
2095 |
return ["thumbnail", "medium", "medium_large", "large"];
|
2096 |
}
|
2097 |
|
options/html-addons.php
CHANGED
@@ -37,8 +37,8 @@ if (!defined("ABSPATH")) {
|
|
37 |
<div class="wpdiscuz-addons-wrapper">
|
38 |
<?php
|
39 |
foreach ($this->addons as $key => $addon) {
|
40 |
-
$installed = class_exists($addon["class"])
|
41 |
-
if( $addon["class"]
|
42 |
?>
|
43 |
<div class="wpdiscuz-addon-block">
|
44 |
<div id="wpdiscuz-addon-<?php echo esc_attr($key); ?>" class="addon-thumb" style="background:url(<?php echo esc_url_raw($installed ? str_replace(".png", "-off.png", $addon["thumb"]) : $addon["thumb"]); ?>) top center no-repeat;">
|
@@ -54,7 +54,7 @@ if (!defined("ABSPATH")) {
|
|
54 |
<!--<li style="line-height:16px;"><?php //esc_html_e('Version', 'default'); ?>: <?php //echo $addon['version']; ?></li>-->
|
55 |
<li style="line-height:16px;">wpDiscuz: <?php esc_html_e("at least", "default"); ?> <?php echo esc_html($addon["requires"]); ?></li>
|
56 |
</ul>
|
57 |
-
<?php if( $addon["class"]
|
58 |
<a class="button button-primary addon-button" href="<?php echo esc_url_raw($addon["url"]); ?>" target="_blank" style="font-size:14px;"><?php echo esc_html__("More Info »", "wpdiscuz"); ?></a>
|
59 |
<?php else: ?>
|
60 |
<a class="button button-primary addon-button" href="<?php echo esc_url_raw($addon["url"]); ?>" target="_blank" style="font-size:14px;"><?php echo esc_html__("Live Preview | Buy", "wpdiscuz"); ?></a>
|
37 |
<div class="wpdiscuz-addons-wrapper">
|
38 |
<?php
|
39 |
foreach ($this->addons as $key => $addon) {
|
40 |
+
$installed = class_exists($addon["class"]);
|
41 |
+
if( $addon["class"] === "Bundle" ) continue;
|
42 |
?>
|
43 |
<div class="wpdiscuz-addon-block">
|
44 |
<div id="wpdiscuz-addon-<?php echo esc_attr($key); ?>" class="addon-thumb" style="background:url(<?php echo esc_url_raw($installed ? str_replace(".png", "-off.png", $addon["thumb"]) : $addon["thumb"]); ?>) top center no-repeat;">
|
54 |
<!--<li style="line-height:16px;"><?php //esc_html_e('Version', 'default'); ?>: <?php //echo $addon['version']; ?></li>-->
|
55 |
<li style="line-height:16px;">wpDiscuz: <?php esc_html_e("at least", "default"); ?> <?php echo esc_html($addon["requires"]); ?></li>
|
56 |
</ul>
|
57 |
+
<?php if( $addon["class"] === "Bundle" ): ?>
|
58 |
<a class="button button-primary addon-button" href="<?php echo esc_url_raw($addon["url"]); ?>" target="_blank" style="font-size:14px;"><?php echo esc_html__("More Info »", "wpdiscuz"); ?></a>
|
59 |
<?php else: ?>
|
60 |
<a class="button button-primary addon-button" href="<?php echo esc_url_raw($addon["url"]); ?>" target="_blank" style="font-size:14px;"><?php echo esc_html__("Live Preview | Buy", "wpdiscuz"); ?></a>
|
options/options-layouts/html-content.php
CHANGED
@@ -158,7 +158,7 @@ if (!defined("ABSPATH")) {
|
|
158 |
foreach ($mimes as $ext => $mime) {
|
159 |
?>
|
160 |
<div class="wpd-mublock-inline wpd-mu-mimes" style="margin-right: 2px;">
|
161 |
-
<input type="checkbox" <?php checked(isset($this->content["wmuMimeTypes"][$ext]) && $this->content["wmuMimeTypes"][$ext]
|
162 |
<label for="wmu-<?php echo esc_attr($ext); ?>" title="<?php echo esc_attr($ext); ?>" style="white-space:nowrap; font-size:13px;"><?php echo esc_html($ext); ?></label>
|
163 |
</div>
|
164 |
<?php
|
@@ -243,19 +243,27 @@ if (!defined("ABSPATH")) {
|
|
243 |
</div>
|
244 |
<div class="wpd-opt-input">
|
245 |
<?php
|
246 |
-
$allImageSizes
|
|
|
247 |
foreach ($allImageSizes as $imageSize) {
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
?>
|
256 |
<div class="wpd-mublock">
|
257 |
<input type="checkbox" <?php echo $checked; ?> <?php echo $disabled; ?> value="<?php echo esc_attr($imageSize); ?>" name="<?php echo esc_attr(WpdiscuzCore::TAB_CONTENT); ?>[wmuImageSizes][]" id="wmu<?php echo esc_attr($imageSize); ?>" style="margin:0px; vertical-align: middle;" />
|
258 |
-
<label for="wmu<?php echo esc_attr($imageSize); ?>"><?php echo esc_html($imageSize . " ( " .
|
259 |
</div>
|
260 |
<?php
|
261 |
}
|
158 |
foreach ($mimes as $ext => $mime) {
|
159 |
?>
|
160 |
<div class="wpd-mublock-inline wpd-mu-mimes" style="margin-right: 2px;">
|
161 |
+
<input type="checkbox" <?php checked(isset($this->content["wmuMimeTypes"][$ext]) && $this->content["wmuMimeTypes"][$ext] === $mime); ?> value="<?php echo esc_attr($mime); ?>" name="<?php echo esc_attr(WpdiscuzCore::TAB_CONTENT); ?>[wmuMimeTypes][<?php echo esc_attr($ext); ?>]" id="wmu-<?php echo esc_attr($ext); ?>" style="margin:0px; vertical-align: middle;" />
|
162 |
<label for="wmu-<?php echo esc_attr($ext); ?>" title="<?php echo esc_attr($ext); ?>" style="white-space:nowrap; font-size:13px;"><?php echo esc_html($ext); ?></label>
|
163 |
</div>
|
164 |
<?php
|
243 |
</div>
|
244 |
<div class="wpd-opt-input">
|
245 |
<?php
|
246 |
+
$allImageSizes = get_intermediate_image_sizes();
|
247 |
+
$additionalSizes = wp_get_additional_image_sizes();
|
248 |
foreach ($allImageSizes as $imageSize) {
|
249 |
+
$sizeWidth = 0;
|
250 |
+
$sizeHeight = 0;
|
251 |
+
if (in_array($imageSize, $this->getDefaultImageSizes())) {
|
252 |
+
$sizeWidth = intval(get_option("{$imageSize}_size_w"));
|
253 |
+
$sizeHeight = intval(get_option("{$imageSize}_size_h"));
|
254 |
+
} else if (isset($additionalSizes[$imageSize])) {
|
255 |
+
$sizeWidth = $additionalSizes[$imageSize]["width"];
|
256 |
+
$sizeHeight = $additionalSizes[$imageSize]["height"];
|
257 |
+
}
|
258 |
+
$disabled = "";
|
259 |
+
$checked = checked(in_array($imageSize, $this->content["wmuImageSizes"]), true, false);
|
260 |
+
if (!$sizeWidth && !$sizeHeight) {
|
261 |
+
$disabled = "disabled='disabled'";
|
262 |
+
}
|
263 |
?>
|
264 |
<div class="wpd-mublock">
|
265 |
<input type="checkbox" <?php echo $checked; ?> <?php echo $disabled; ?> value="<?php echo esc_attr($imageSize); ?>" name="<?php echo esc_attr(WpdiscuzCore::TAB_CONTENT); ?>[wmuImageSizes][]" id="wmu<?php echo esc_attr($imageSize); ?>" style="margin:0px; vertical-align: middle;" />
|
266 |
+
<label for="wmu<?php echo esc_attr($imageSize); ?>"><?php echo esc_html($imageSize . " ( " . $sizeWidth . " x " . $sizeHeight . " )"); ?></label>
|
267 |
</div>
|
268 |
<?php
|
269 |
}
|
options/options-layouts/html-general.php
CHANGED
@@ -231,8 +231,8 @@ if (!defined("ABSPATH")) {
|
|
231 |
</div>
|
232 |
<div class="wpd-opt-input">
|
233 |
<div class="wpd-switch-field">
|
234 |
-
<input type="radio" <?php checked($this->general["gravatarCacheMethod"]
|
235 |
-
<input type="radio" <?php checked($this->general["gravatarCacheMethod"]
|
236 |
</div>
|
237 |
</div>
|
238 |
<div class="wpd-opt-doc">
|
231 |
</div>
|
232 |
<div class="wpd-opt-input">
|
233 |
<div class="wpd-switch-field">
|
234 |
+
<input type="radio" <?php checked($this->general["gravatarCacheMethod"] === "runtime") ?> value="runtime" name="<?php echo esc_attr(WpdiscuzCore::TAB_GENERAL); ?>[gravatarCacheMethod]" id="gravatarCacheMethodRuntime" /><label for="gravatarCacheMethodRuntime"><?php esc_html_e("Runtime", "wpdiscuz"); ?></label>
|
235 |
+
<input type="radio" <?php checked($this->general["gravatarCacheMethod"] === "cronjob") ?> value="cronjob" name="<?php echo esc_attr(WpdiscuzCore::TAB_GENERAL); ?>[gravatarCacheMethod]" id="gravatarCacheMethodCronjob" /><label for="gravatarCacheMethodCronjob"><?php esc_html_e("Cron job", "wpdiscuz"); ?></label>
|
236 |
</div>
|
237 |
</div>
|
238 |
<div class="wpd-opt-doc">
|
options/options-layouts/html-inline.php
CHANGED
@@ -50,17 +50,17 @@ if (!defined("ABSPATH")) {
|
|
50 |
</div>
|
51 |
<div class="wpd-opt-input">
|
52 |
<div class="wpd-radio">
|
53 |
-
<input type="radio" value="disable" <?php checked("disable"
|
54 |
<label for="inlineFeedbackAttractionTypeDisable" class="wpd-radio-circle"></label>
|
55 |
<label for="inlineFeedbackAttractionTypeDisable"><?php esc_html_e("Disable", "wpdiscuz") ?></label>
|
56 |
</div>
|
57 |
<div class="wpd-radio">
|
58 |
-
<input type="radio" value="blink" <?php checked("blink"
|
59 |
<label for="inlineFeedbackAttractionTypeBlink" class="wpd-radio-circle"></label>
|
60 |
<label for="inlineFeedbackAttractionTypeBlink"><?php esc_html_e("Animate (blink and wiggle)", "wpdiscuz") ?></label>
|
61 |
</div>
|
62 |
<div class="wpd-radio">
|
63 |
-
<input type="radio" value="scroll_open" <?php checked("scroll_open"
|
64 |
<label for="inlineFeedbackAttractionTypeScrollOpen" class="wpd-radio-circle"></label>
|
65 |
<label for="inlineFeedbackAttractionTypeScrollOpen"><?php esc_html_e("Open the Feedback Form on scroll", "wpdiscuz") ?></label>
|
66 |
</div>
|
50 |
</div>
|
51 |
<div class="wpd-opt-input">
|
52 |
<div class="wpd-radio">
|
53 |
+
<input type="radio" value="disable" <?php checked("disable" === $this->inline["inlineFeedbackAttractionType"]); ?> name="<?php echo esc_attr(WpdiscuzCore::TAB_INLINE); ?>[inlineFeedbackAttractionType]" id="inlineFeedbackAttractionTypeDisable" class="inlineFeedbackAttractionType"/>
|
54 |
<label for="inlineFeedbackAttractionTypeDisable" class="wpd-radio-circle"></label>
|
55 |
<label for="inlineFeedbackAttractionTypeDisable"><?php esc_html_e("Disable", "wpdiscuz") ?></label>
|
56 |
</div>
|
57 |
<div class="wpd-radio">
|
58 |
+
<input type="radio" value="blink" <?php checked("blink" === $this->inline["inlineFeedbackAttractionType"]); ?> name="<?php echo esc_attr(WpdiscuzCore::TAB_INLINE); ?>[inlineFeedbackAttractionType]" id="inlineFeedbackAttractionTypeBlink" class="inlineFeedbackAttractionType"/>
|
59 |
<label for="inlineFeedbackAttractionTypeBlink" class="wpd-radio-circle"></label>
|
60 |
<label for="inlineFeedbackAttractionTypeBlink"><?php esc_html_e("Animate (blink and wiggle)", "wpdiscuz") ?></label>
|
61 |
</div>
|
62 |
<div class="wpd-radio">
|
63 |
+
<input type="radio" value="scroll_open" <?php checked("scroll_open" === $this->inline["inlineFeedbackAttractionType"]); ?> name="<?php echo esc_attr(WpdiscuzCore::TAB_INLINE); ?>[inlineFeedbackAttractionType]" id="inlineFeedbackAttractionTypeScrollOpen" class="inlineFeedbackAttractionType"/>
|
64 |
<label for="inlineFeedbackAttractionTypeScrollOpen" class="wpd-radio-circle"></label>
|
65 |
<label for="inlineFeedbackAttractionTypeScrollOpen"><?php esc_html_e("Open the Feedback Form on scroll", "wpdiscuz") ?></label>
|
66 |
</div>
|
options/options-layouts/html-live.php
CHANGED
@@ -45,11 +45,11 @@ if (!defined("ABSPATH")) {
|
|
45 |
</div>
|
46 |
<div class="wpd-opt-input">
|
47 |
<div class="wpd-switch-field">
|
48 |
-
<input type="radio" <?php checked($this->live["bubbleLocation"]
|
49 |
<label for="content_left" style="min-width:60px;"><?php esc_html_e("Content Left", "wpdiscuz"); ?></label>
|
50 |
-
<input type="radio" <?php checked($this->live["bubbleLocation"]
|
51 |
<label for="left_corner" style="min-width:60px;"><?php esc_html_e("Left Corner", "wpdiscuz"); ?></label>
|
52 |
-
<input type="radio" <?php checked($this->live["bubbleLocation"]
|
53 |
<label for="right_corner" style="min-width:60px;"><?php esc_html_e("Right Corner", "wpdiscuz"); ?></label>
|
54 |
</div>
|
55 |
</div>
|
45 |
</div>
|
46 |
<div class="wpd-opt-input">
|
47 |
<div class="wpd-switch-field">
|
48 |
+
<input type="radio" <?php checked($this->live["bubbleLocation"] === "content_left") ?> value="content_left" name="<?php echo esc_attr(WpdiscuzCore::TAB_LIVE); ?>[bubbleLocation]" id="content_left" class="content_left" style="vertical-align: bottom;"/>
|
49 |
<label for="content_left" style="min-width:60px;"><?php esc_html_e("Content Left", "wpdiscuz"); ?></label>
|
50 |
+
<input type="radio" <?php checked($this->live["bubbleLocation"] === "left_corner") ?> value="left_corner" name="<?php echo esc_attr(WpdiscuzCore::TAB_LIVE); ?>[bubbleLocation]" id="left_corner" class="left_corner" style="vertical-align: bottom;"/>
|
51 |
<label for="left_corner" style="min-width:60px;"><?php esc_html_e("Left Corner", "wpdiscuz"); ?></label>
|
52 |
+
<input type="radio" <?php checked($this->live["bubbleLocation"] === "right_corner") ?> value="right_corner" name="<?php echo esc_attr(WpdiscuzCore::TAB_LIVE); ?>[bubbleLocation]" id="right_corner" class="right_corner" style="vertical-align: bottom;"/>
|
53 |
<label for="right_corner" style="min-width:60px;"><?php esc_html_e("Right Corner", "wpdiscuz"); ?></label>
|
54 |
</div>
|
55 |
</div>
|
options/options-layouts/html-thread_layouts.php
CHANGED
@@ -135,13 +135,13 @@ if (!defined("ABSPATH")) {
|
|
135 |
</div>
|
136 |
<div class="wpd-opt-input">
|
137 |
<div class="wpd-switch-field" style="min-width: 220px;">
|
138 |
-
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"]
|
139 |
<label for="votingButtonsIconPlusMinus" style="min-width:50px;"><i class="fas fa-plus"></i> <i class="fas fa-minus"></i></label>
|
140 |
-
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"]
|
141 |
<label for="votingButtonsIconChevronUpDown" style="min-width:50px;"><i class="fas fa-chevron-up"></i> <i class="fas fa-chevron-down"></i></label>
|
142 |
-
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"]
|
143 |
<label for="votingButtonsIconThumbsUpDown" style="min-width:50px;"><i class="fas fa-thumbs-up"></i> <i class="fas fa-thumbs-down"></i></label>
|
144 |
-
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"]
|
145 |
<label for="votingButtonsIconSmileFrown" style="min-width:50px;"><i class="far fa-smile"></i> <i class="far fa-frown"></i></label>
|
146 |
</div>
|
147 |
</div>
|
135 |
</div>
|
136 |
<div class="wpd-opt-input">
|
137 |
<div class="wpd-switch-field" style="min-width: 220px;">
|
138 |
+
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"] === "fa-plus|fa-minus") ?> value="fa-plus|fa-minus" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_LAYOUTS); ?>[votingButtonsIcon]" id="votingButtonsIconPlusMinus" class="votingButtonsIconPlusMinus" style="vertical-align: bottom;"/>
|
139 |
<label for="votingButtonsIconPlusMinus" style="min-width:50px;"><i class="fas fa-plus"></i> <i class="fas fa-minus"></i></label>
|
140 |
+
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"] === "fa-chevron-up|fa-chevron-down") ?> value="fa-chevron-up|fa-chevron-down" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_LAYOUTS); ?>[votingButtonsIcon]" id="votingButtonsIconChevronUpDown" class="votingButtonsIconChevronUpDown" style="vertical-align: bottom;"/>
|
141 |
<label for="votingButtonsIconChevronUpDown" style="min-width:50px;"><i class="fas fa-chevron-up"></i> <i class="fas fa-chevron-down"></i></label>
|
142 |
+
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"] === "fa-thumbs-up|fa-thumbs-down") ?> value="fa-thumbs-up|fa-thumbs-down" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_LAYOUTS); ?>[votingButtonsIcon]" id="votingButtonsIconThumbsUpDown" class="votingButtonsIconThumbsUpDown" style="vertical-align: bottom;"/>
|
143 |
<label for="votingButtonsIconThumbsUpDown" style="min-width:50px;"><i class="fas fa-thumbs-up"></i> <i class="fas fa-thumbs-down"></i></label>
|
144 |
+
<input type="radio" <?php checked($this->thread_layouts["votingButtonsIcon"] === "fa-smile|fa-frown") ?> value="fa-smile|fa-frown" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_LAYOUTS); ?>[votingButtonsIcon]" id="votingButtonsIconSmileFrown" class="votingButtonsIconSmileFrown" style="vertical-align: bottom;"/>
|
145 |
<label for="votingButtonsIconSmileFrown" style="min-width:50px;"><i class="far fa-smile"></i> <i class="far fa-frown"></i></label>
|
146 |
</div>
|
147 |
</div>
|
options/options-layouts/html-thread_styles.php
CHANGED
@@ -23,9 +23,9 @@ if (!defined("ABSPATH")) {
|
|
23 |
</div>
|
24 |
<div class="wpd-opt-input">
|
25 |
<div class="wpd-switch-field">
|
26 |
-
<input <?php checked($this->thread_styles["theme"]
|
27 |
-
<input <?php checked($this->thread_styles["theme"]
|
28 |
-
<input <?php checked($this->thread_styles["theme"]
|
29 |
</div>
|
30 |
</div>
|
31 |
<div class="wpd-opt-doc">
|
23 |
</div>
|
24 |
<div class="wpd-opt-input">
|
25 |
<div class="wpd-switch-field">
|
26 |
+
<input <?php checked($this->thread_styles["theme"] === "wpd-minimal"); ?> value="wpd-minimal" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_STYLES); ?>[theme]" id="themeMinimal" type="radio"><label for="themeMinimal"><?php esc_html_e("Off", "wpdiscuz"); ?></label>
|
27 |
+
<input <?php checked($this->thread_styles["theme"] === "wpd-default"); ?> value="wpd-default" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_STYLES); ?>[theme]" id="themeDefault" type="radio"><label for="themeDefault"><?php esc_html_e("Default", "wpdiscuz"); ?></label>
|
28 |
+
<input <?php checked($this->thread_styles["theme"] === "wpd-dark"); ?> value="wpd-dark" name="<?php echo esc_attr(WpdiscuzCore::TAB_THREAD_STYLES); ?>[theme]" id="themeDark" type="radio"><label for="themeDark"><?php esc_html_e("Dark", "wpdiscuz"); ?></label>
|
29 |
</div>
|
30 |
</div>
|
31 |
<div class="wpd-opt-doc">
|
options/phrases-layouts/phrases-comment.php
CHANGED
@@ -52,13 +52,13 @@ if (!defined("ABSPATH")) {
|
|
52 |
foreach ($roles as $roleName => $color) {
|
53 |
$phraseRoleLabel = ucfirst(str_replace("_", " ", $roleName));
|
54 |
|
55 |
-
if ($roleName
|
56 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Admin", "wpdiscuz");
|
57 |
-
} elseif ($roleName
|
58 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Author", "wpdiscuz");
|
59 |
-
} elseif ($roleName
|
60 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Editor", "wpdiscuz");
|
61 |
-
} elseif ($roleName
|
62 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Guest", "wpdiscuz");
|
63 |
} else {
|
64 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Member", "wpdiscuz");
|
52 |
foreach ($roles as $roleName => $color) {
|
53 |
$phraseRoleLabel = ucfirst(str_replace("_", " ", $roleName));
|
54 |
|
55 |
+
if ($roleName === "administrator") {
|
56 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Admin", "wpdiscuz");
|
57 |
+
} elseif ($roleName === "post_author") {
|
58 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Author", "wpdiscuz");
|
59 |
+
} elseif ($roleName === "editor") {
|
60 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Editor", "wpdiscuz");
|
61 |
+
} elseif ($roleName === "guest") {
|
62 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Guest", "wpdiscuz");
|
63 |
} else {
|
64 |
$roleTitle = isset($this->phrases["wc_blog_role_" . $roleName]) ? $this->phrases["wc_blog_role_" . $roleName] : esc_html__("Member", "wpdiscuz");
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: gVectors Team
|
3 |
Tags: comment, comments, ajax comments, comment form, comment fields
|
4 |
Requires at least: 5.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 7.0.
|
7 |
Requires PHP: 5.4 and higher
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
@@ -179,11 +179,24 @@ Nothing will be lost! **Comments - wpDiscuz** will show all old comments.
|
|
179 |
|
180 |
== Changelog ==
|
181 |
|
182 |
-
= Comments - wpDiscuz v7.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
**IMPORTANT!**
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
187 |
|
188 |
* Changed: We've enabled replies by default for WooCommerce products review section. Do disable it you can use the new `wpdiscuz_product_review_replies` filter hook and return false.
|
189 |
* Changed: Some changes for sg optimizer cache clearing
|
@@ -204,11 +217,6 @@ We have got a report that, there is a security vulnerability issue in 7.0.0 > 7.
|
|
204 |
|
205 |
= Comments - wpDiscuz 7.0.4 =
|
206 |
|
207 |
-
**IMPORTANT!**
|
208 |
-
1. Please don't forget delete all caches and purge CDN after the update.
|
209 |
-
2. If you have custom CSS code for fixing mobile view, tooltips and addon related issues, please consider removing those after the update and check again. Some issues are already fixed in this version, and they may conflict with your custom CSS code.
|
210 |
-
3. If yo're updating from 5.x.x versions please read this topic: [https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/](https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/)
|
211 |
-
|
212 |
* Added: Quick tags for simple comment editor (if rich editor is disabled)
|
213 |
* Added: The wpDiscuz > Tools admin page is fully redesigned
|
214 |
* New Tool: Import subscribers from "Lightweight Subscribe To Comments" plugin
|
2 |
Contributors: gVectors Team
|
3 |
Tags: comment, comments, ajax comments, comment form, comment fields
|
4 |
Requires at least: 5.0
|
5 |
+
Tested up to: 5.5
|
6 |
+
Stable tag: 7.0.7
|
7 |
Requires PHP: 5.4 and higher
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
179 |
|
180 |
== Changelog ==
|
181 |
|
182 |
+
= Comments - wpDiscuz v7.0.7 =
|
183 |
+
|
184 |
+
* Added: Important changes for WordPress 5.5 compatibility
|
185 |
+
* Added: Option to choose thumbnail size for uploaded images
|
186 |
+
* Added: comment_text hook to bubble notification texts
|
187 |
+
* Adapted: Avoid conflicts with `scroll-behavior: smooth` CSS
|
188 |
+
* Fixed bug: Case-insensitive checking of file extensions
|
189 |
+
* Fixed bug: reCAPTCHA validation for other ways of commenting
|
190 |
+
* Fixed bug: Display unapproved comments to admins on live update
|
191 |
+
* Fixed bug: Loading of correct initial avatar size in comment form
|
192 |
+
|
193 |
|
194 |
**IMPORTANT!**
|
195 |
+
1. Please don't forget delete all caches and purge CDN after the update.
|
196 |
+
2. If you're updating from 5.x.x versions please read this topic: [https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/](https://wordpress.org/support/topic/before-updating-to-wpdiscuz-7-version/)
|
197 |
+
|
198 |
+
|
199 |
+
= Comments - wpDiscuz v7.0.6 =
|
200 |
|
201 |
* Changed: We've enabled replies by default for WooCommerce products review section. Do disable it you can use the new `wpdiscuz_product_review_replies` filter hook and return false.
|
202 |
* Changed: Some changes for sg optimizer cache clearing
|
217 |
|
218 |
= Comments - wpDiscuz 7.0.4 =
|
219 |
|
|
|
|
|
|
|
|
|
|
|
220 |
* Added: Quick tags for simple comment editor (if rich editor is disabled)
|
221 |
* Added: The wpDiscuz > Tools admin page is fully redesigned
|
222 |
* New Tool: Import subscribers from "Lightweight Subscribe To Comments" plugin
|
themes/default/class.WpdiscuzWalker.php
CHANGED
@@ -56,7 +56,7 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
56 |
$commentLink = get_comment_link($comment);
|
57 |
} else {
|
58 |
$commentLink = $args["post_permalink"] . "#comment-" . $comment->comment_ID;
|
59 |
-
if (!empty($args["last_visit"]) && !empty($args["current_user_email"]) && strtotime($comment->comment_date) > $args["last_visit"] && $args["current_user_email"]
|
60 |
$commentWrapperClass[] = "wpd-new-loaded-comment";
|
61 |
}
|
62 |
}
|
@@ -71,7 +71,7 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
71 |
} else if ($this->options->login["isUserByEmail"]) {
|
72 |
$user["user"] = get_user_by("email", $comment->comment_author_email);
|
73 |
}
|
74 |
-
$user["commentAuthorUrl"] = ("http://"
|
75 |
$user["commentAuthorUrl"] = apply_filters("get_comment_author_url", $user["commentAuthorUrl"], $comment->comment_ID, $comment);
|
76 |
$user["commentWrapClass"] = [];
|
77 |
$user["author_title"] = "";
|
@@ -112,17 +112,17 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
112 |
}
|
113 |
if ($this->options->social["displayIconOnAvatar"] && ($socialProvider = get_user_meta($user["user"]->ID, self::WPDISCUZ_SOCIAL_PROVIDER_KEY, true))) {
|
114 |
$user["commentWrapClass"][] = "wpd-soc-user-" . $socialProvider;
|
115 |
-
if ($socialProvider
|
116 |
$user["socIcon"] = "<i class='fab fa-facebook-f'></i>";
|
117 |
-
} elseif ($socialProvider
|
118 |
$user["socIcon"] = "<i class='wpd-soc-user-disqus'>D</i>";
|
119 |
-
} elseif ($socialProvider
|
120 |
$user["socIcon"] = "<i class='fab fa-odnoklassniki'></i>";
|
121 |
-
} elseif ($socialProvider
|
122 |
$user["socIcon"] = "<i class='fab fa-yandex-international'></i>";
|
123 |
-
} elseif ($socialProvider
|
124 |
$user["socIcon"] = "<i class='fas fa-at'></i>";
|
125 |
-
} elseif ($socialProvider
|
126 |
$user["socIcon"] = "<i class='fas fa-paw'></i>";
|
127 |
} else {
|
128 |
$user["socIcon"] = "<i class='fab fa-{$socialProvider}'></i>";
|
@@ -244,6 +244,17 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
244 |
$showReplyTo = true;
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
$showShare = false;
|
248 |
if ($isApproved) {
|
249 |
if ($args["is_share_enabled"]) {
|
@@ -265,7 +276,7 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
265 |
$statusIcons .= "<div class='wpd-unapproved'><i class='fas fa-exclamation-circle'></i>" . esc_html($this->options->phrases["wc_awaiting_for_approval"]) . "</div>";
|
266 |
}
|
267 |
|
268 |
-
$trackOrPingback = $comment->comment_type
|
269 |
|
270 |
if ($isInline) {
|
271 |
$commentWrapperClass[] = "wpd-inline-comment";
|
@@ -308,7 +319,7 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
308 |
}
|
309 |
|
310 |
$showFollow = false;
|
311 |
-
if ($args["can_user_follow"] && $args["current_user_email"]
|
312 |
if (is_array($args["user_follows"]) && in_array($comment->comment_author_email, $args["user_follows"])) {
|
313 |
$followClass = "wpd-unfollow wpd-follow-active";
|
314 |
$followTip = $this->options->phrases["wc_unfollow_user"];
|
@@ -471,17 +482,6 @@ class WpdiscuzWalker extends Walker_Comment implements WpDiscuzConstants {
|
|
471 |
$showTools = true;
|
472 |
}
|
473 |
|
474 |
-
$comment->comment_content = apply_filters("comment_text", $comment->comment_content, $comment, $args);
|
475 |
-
$commentReadMoreLimit = $this->options->content["commentReadMoreLimit"];
|
476 |
-
if (stripos($comment->comment_content, "[/spoiler]") !== false) {
|
477 |
-
$commentReadMoreLimit = 0;
|
478 |
-
$comment->comment_content = $this->helper->spoiler($comment->comment_content);
|
479 |
-
}
|
480 |
-
if ($commentReadMoreLimit && WpdiscuzHelper::strWordCount(wp_strip_all_tags($comment->comment_content)) > $commentReadMoreLimit) {
|
481 |
-
$comment->comment_content = WpdiscuzHelper::getCommentExcerpt($comment->comment_content, $uniqueId, $this->options);
|
482 |
-
}
|
483 |
-
$comment->comment_content = apply_filters("wpdiscuz_after_read_more", $comment->comment_content, $comment, $args);
|
484 |
-
|
485 |
$lastEdited = "";
|
486 |
if ($this->options->moderation["displayEditingInfo"] && isset($commentMetas[self::META_KEY_LAST_EDITED_AT]) && isset($commentMetas[self::META_KEY_LAST_EDITED_BY])) {
|
487 |
$lastEditUser = get_user_by(is_numeric($commentMetas[self::META_KEY_LAST_EDITED_BY][0]) ? "id" : "email", $commentMetas[self::META_KEY_LAST_EDITED_BY][0]);
|
56 |
$commentLink = get_comment_link($comment);
|
57 |
} else {
|
58 |
$commentLink = $args["post_permalink"] . "#comment-" . $comment->comment_ID;
|
59 |
+
if (!empty($args["last_visit"]) && !empty($args["current_user_email"]) && strtotime($comment->comment_date) > $args["last_visit"] && $args["current_user_email"] !== $comment->comment_author_email) {
|
60 |
$commentWrapperClass[] = "wpd-new-loaded-comment";
|
61 |
}
|
62 |
}
|
71 |
} else if ($this->options->login["isUserByEmail"]) {
|
72 |
$user["user"] = get_user_by("email", $comment->comment_author_email);
|
73 |
}
|
74 |
+
$user["commentAuthorUrl"] = ("http://" === $comment->comment_author_url) ? "" : $comment->comment_author_url;
|
75 |
$user["commentAuthorUrl"] = apply_filters("get_comment_author_url", $user["commentAuthorUrl"], $comment->comment_ID, $comment);
|
76 |
$user["commentWrapClass"] = [];
|
77 |
$user["author_title"] = "";
|
112 |
}
|
113 |
if ($this->options->social["displayIconOnAvatar"] && ($socialProvider = get_user_meta($user["user"]->ID, self::WPDISCUZ_SOCIAL_PROVIDER_KEY, true))) {
|
114 |
$user["commentWrapClass"][] = "wpd-soc-user-" . $socialProvider;
|
115 |
+
if ($socialProvider === "facebook") {
|
116 |
$user["socIcon"] = "<i class='fab fa-facebook-f'></i>";
|
117 |
+
} elseif ($socialProvider === "disqus") {
|
118 |
$user["socIcon"] = "<i class='wpd-soc-user-disqus'>D</i>";
|
119 |
+
} elseif ($socialProvider === "ok") {
|
120 |
$user["socIcon"] = "<i class='fab fa-odnoklassniki'></i>";
|
121 |
+
} elseif ($socialProvider === "yandex") {
|
122 |
$user["socIcon"] = "<i class='fab fa-yandex-international'></i>";
|
123 |
+
} elseif ($socialProvider === "mailru") {
|
124 |
$user["socIcon"] = "<i class='fas fa-at'></i>";
|
125 |
+
} elseif ($socialProvider === "baidu") {
|
126 |
$user["socIcon"] = "<i class='fas fa-paw'></i>";
|
127 |
} else {
|
128 |
$user["socIcon"] = "<i class='fab fa-{$socialProvider}'></i>";
|
244 |
$showReplyTo = true;
|
245 |
}
|
246 |
|
247 |
+
$comment->comment_content = apply_filters("comment_text", $comment->comment_content, $comment, $args);
|
248 |
+
$commentReadMoreLimit = $this->options->content["commentReadMoreLimit"];
|
249 |
+
if (stripos($comment->comment_content, "[/spoiler]") !== false) {
|
250 |
+
$commentReadMoreLimit = 0;
|
251 |
+
$comment->comment_content = $this->helper->spoiler($comment->comment_content);
|
252 |
+
}
|
253 |
+
if ($commentReadMoreLimit && WpdiscuzHelper::strWordCount(wp_strip_all_tags($comment->comment_content)) > $commentReadMoreLimit) {
|
254 |
+
$comment->comment_content = WpdiscuzHelper::getCommentExcerpt($comment->comment_content, $uniqueId, $this->options);
|
255 |
+
}
|
256 |
+
$comment->comment_content = apply_filters("wpdiscuz_after_read_more", $comment->comment_content, $comment, $args);
|
257 |
+
|
258 |
$showShare = false;
|
259 |
if ($isApproved) {
|
260 |
if ($args["is_share_enabled"]) {
|
276 |
$statusIcons .= "<div class='wpd-unapproved'><i class='fas fa-exclamation-circle'></i>" . esc_html($this->options->phrases["wc_awaiting_for_approval"]) . "</div>";
|
277 |
}
|
278 |
|
279 |
+
$trackOrPingback = $comment->comment_type === "pingback" || $comment->comment_type === "trackback";
|
280 |
|
281 |
if ($isInline) {
|
282 |
$commentWrapperClass[] = "wpd-inline-comment";
|
319 |
}
|
320 |
|
321 |
$showFollow = false;
|
322 |
+
if ($args["can_user_follow"] && $args["current_user_email"] !== $comment->comment_author_email) {
|
323 |
if (is_array($args["user_follows"]) && in_array($comment->comment_author_email, $args["user_follows"])) {
|
324 |
$followClass = "wpd-unfollow wpd-follow-active";
|
325 |
$followTip = $this->options->phrases["wc_unfollow_user"];
|
482 |
$showTools = true;
|
483 |
}
|
484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
$lastEdited = "";
|
486 |
if ($this->options->moderation["displayEditingInfo"] && isset($commentMetas[self::META_KEY_LAST_EDITED_AT]) && isset($commentMetas[self::META_KEY_LAST_EDITED_BY])) {
|
487 |
$lastEditUser = get_user_by(is_numeric($commentMetas[self::META_KEY_LAST_EDITED_BY][0]) ? "id" : "email", $commentMetas[self::META_KEY_LAST_EDITED_BY][0]);
|
themes/default/comment-form.php
CHANGED
@@ -234,14 +234,14 @@ if (!post_password_required($post->ID)) {
|
|
234 |
if ($wpdiscuz->subscriptionData) {
|
235 |
$isConfirmed = $wpdiscuz->subscriptionData["confirm"];
|
236 |
$subscriptionType = $wpdiscuz->subscriptionData["type"];
|
237 |
-
if ($subscriptionType
|
238 |
$unsubscribeLinkParams = $wpdiscuz->dbManager->getUnsubscribeLinkParams($post->ID, $currentUser->user_email);
|
239 |
}
|
240 |
}
|
241 |
?>
|
242 |
<div class="wpdiscuz-subscribe-bar wpdiscuz-hidden">
|
243 |
<?php
|
244 |
-
if ($subscriptionType
|
245 |
?>
|
246 |
<form action="<?php echo esc_url_raw(admin_url("admin-ajax.php") . "?action=wpdAddSubscription"); ?>" method="post" id="wpdiscuz-subscribe-form">
|
247 |
<div class="wpdiscuz-subscribe-form-intro"><?php echo esc_html($wpdiscuz->options->phrases["wc_notify_of"]); ?> </div>
|
@@ -294,9 +294,9 @@ if (!post_password_required($post->ID)) {
|
|
294 |
}
|
295 |
if (isset($unsubscribeLinkParams)) {
|
296 |
$subscribeMessage = $isConfirmed ? $wpdiscuz->options->phrases["wc_unsubscribe"] : $wpdiscuz->options->phrases["wc_ignore_subscription"];
|
297 |
-
if ($subscriptionType
|
298 |
$introText = $wpdiscuz->options->phrases["wc_subscribed_to"] . " " . $wpdiscuz->options->phrases["wc_notify_on_all_new_reply"];
|
299 |
-
} elseif ($subscriptionType
|
300 |
$introText = $wpdiscuz->options->phrases["wc_subscribed_to"] . " " . $wpdiscuz->options->phrases["wc_notify_on_new_comment"];
|
301 |
}
|
302 |
echo "<div class='wpdiscuz_subscribe_status'>" . esc_html($introText) . " | <a class='wpd-unsubscribe' data-sid='" . esc_attr($unsubscribeLinkParams["id"]) . "' data-skey='" . esc_attr($unsubscribeLinkParams["activation_key"]) . "' href='#'>" . esc_html($subscribeMessage) . "</a></div>";
|
234 |
if ($wpdiscuz->subscriptionData) {
|
235 |
$isConfirmed = $wpdiscuz->subscriptionData["confirm"];
|
236 |
$subscriptionType = $wpdiscuz->subscriptionData["type"];
|
237 |
+
if ($subscriptionType === WpdiscuzCore::SUBSCRIPTION_POST || $subscriptionType === WpdiscuzCore::SUBSCRIPTION_ALL_COMMENT) {
|
238 |
$unsubscribeLinkParams = $wpdiscuz->dbManager->getUnsubscribeLinkParams($post->ID, $currentUser->user_email);
|
239 |
}
|
240 |
}
|
241 |
?>
|
242 |
<div class="wpdiscuz-subscribe-bar wpdiscuz-hidden">
|
243 |
<?php
|
244 |
+
if ($subscriptionType !== WpdiscuzCore::SUBSCRIPTION_POST) {
|
245 |
?>
|
246 |
<form action="<?php echo esc_url_raw(admin_url("admin-ajax.php") . "?action=wpdAddSubscription"); ?>" method="post" id="wpdiscuz-subscribe-form">
|
247 |
<div class="wpdiscuz-subscribe-form-intro"><?php echo esc_html($wpdiscuz->options->phrases["wc_notify_of"]); ?> </div>
|
294 |
}
|
295 |
if (isset($unsubscribeLinkParams)) {
|
296 |
$subscribeMessage = $isConfirmed ? $wpdiscuz->options->phrases["wc_unsubscribe"] : $wpdiscuz->options->phrases["wc_ignore_subscription"];
|
297 |
+
if ($subscriptionType === "all_comment") {
|
298 |
$introText = $wpdiscuz->options->phrases["wc_subscribed_to"] . " " . $wpdiscuz->options->phrases["wc_notify_on_all_new_reply"];
|
299 |
+
} elseif ($subscriptionType === "post") {
|
300 |
$introText = $wpdiscuz->options->phrases["wc_subscribed_to"] . " " . $wpdiscuz->options->phrases["wc_notify_on_new_comment"];
|
301 |
}
|
302 |
echo "<div class='wpdiscuz_subscribe_status'>" . esc_html($introText) . " | <a class='wpd-unsubscribe' data-sid='" . esc_attr($unsubscribeLinkParams["id"]) . "' data-skey='" . esc_attr($unsubscribeLinkParams["activation_key"]) . "' href='#'>" . esc_html($subscribeMessage) . "</a></div>";
|
utils/class.WpdiscuzCache.php
CHANGED
@@ -30,7 +30,7 @@ class WpdiscuzCache implements WpDiscuzConstants {
|
|
30 |
wp_mkdir_p($this->avBaseDir);
|
31 |
add_filter("pre_get_avatar", [&$this, "preGetGravatar"], 10, 3);
|
32 |
add_filter("get_avatar", [&$this, "getAvatar"], 10, 6);
|
33 |
-
if ($this->options->general["gravatarCacheMethod"]
|
34 |
add_filter("get_avatar_url", [&$this, "gravatarsRunTime"], 10, 3);
|
35 |
} else {
|
36 |
add_filter("get_avatar_url", [&$this, "gravatarsCronJob"], 10, 3);
|
@@ -190,7 +190,7 @@ class WpdiscuzCache implements WpDiscuzConstants {
|
|
190 |
$files = function_exists("scandir") ? scandir($this->avBaseDir) : false;
|
191 |
if ($files && is_array($files)) {
|
192 |
foreach ($files as $k => $file) {
|
193 |
-
if ($file
|
194 |
@unlink($this->avBaseDir . $file);
|
195 |
}
|
196 |
}
|
30 |
wp_mkdir_p($this->avBaseDir);
|
31 |
add_filter("pre_get_avatar", [&$this, "preGetGravatar"], 10, 3);
|
32 |
add_filter("get_avatar", [&$this, "getAvatar"], 10, 6);
|
33 |
+
if ($this->options->general["gravatarCacheMethod"] === "runtime") {
|
34 |
add_filter("get_avatar_url", [&$this, "gravatarsRunTime"], 10, 3);
|
35 |
} else {
|
36 |
add_filter("get_avatar_url", [&$this, "gravatarsCronJob"], 10, 3);
|
190 |
$files = function_exists("scandir") ? scandir($this->avBaseDir) : false;
|
191 |
if ($files && is_array($files)) {
|
192 |
foreach ($files as $k => $file) {
|
193 |
+
if ($file !== "." && $file !== ".." && $file !== ".htaccess") {
|
194 |
@unlink($this->avBaseDir . $file);
|
195 |
}
|
196 |
}
|
utils/class.WpdiscuzHelper.php
CHANGED
@@ -183,8 +183,8 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
183 |
*/
|
184 |
public function isCommentEditable($comment) {
|
185 |
$commentTimestamp = strtotime($comment->comment_date);
|
186 |
-
$timeDiff =
|
187 |
-
$editableTimeLimit =
|
188 |
return $editableTimeLimit && ($timeDiff < $editableTimeLimit);
|
189 |
}
|
190 |
|
@@ -207,7 +207,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
207 |
|
208 |
$ip = apply_filters("pre_comment_user_ip", $ip);
|
209 |
|
210 |
-
if ($ip
|
211 |
$ip = "127.0.0.1";
|
212 |
}
|
213 |
return $ip;
|
@@ -331,14 +331,14 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
331 |
$html .= "<ul class='wc_social_login_by_the_champ'>";
|
332 |
foreach ($theChampLoginOptions["providers"] as $k => $provider) {
|
333 |
$html .= "<li><i ";
|
334 |
-
if ($provider
|
335 |
$html .= "id='theChamp" . esc_attr(ucfirst($provider)) . "Button' ";
|
336 |
}
|
337 |
$html .= "class='theChampLogin theChamp" . esc_attr(ucfirst($provider)) . "Background theChamp" . esc_attr(ucfirst($provider)) . "Login' ";
|
338 |
$html .= "alt='Login with ";
|
339 |
$html .= ucfirst($provider);
|
340 |
$html .= "' title='Login with ";
|
341 |
-
if ($provider
|
342 |
$html .= "Windows Live";
|
343 |
} else {
|
344 |
$html .= ucfirst($provider);
|
@@ -367,7 +367,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
367 |
} else {
|
368 |
$storedCookieEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? $_COOKIE["comment_author_email_" . COOKIEHASH] : "";
|
369 |
}
|
370 |
-
return !(!$this->options->moderation["enableEditingWhenHaveReplies"] && $comment->get_children(["post_id" => $comment->comment_post_ID])) && (($storedCookieEmail
|
371 |
}
|
372 |
|
373 |
public function addCommentTypes($args) {
|
@@ -377,7 +377,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
377 |
|
378 |
public function commentRowStickAction($actions, $comment) {
|
379 |
if (!$comment->comment_parent) {
|
380 |
-
$stickText = $comment->comment_type
|
381 |
if (intval(get_comment_meta($comment->comment_ID, self::META_KEY_CLOSED, true))) {
|
382 |
$closeText = $this->options->phrases["wc_open_comment"];
|
383 |
$closeIcon = "fa-lock";
|
@@ -639,14 +639,14 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
639 |
|
640 |
public static function fixEmailFrom($domain) {
|
641 |
$domain = strtolower($domain);
|
642 |
-
if (substr($domain, 0, 4)
|
643 |
$domain = substr($domain, 4);
|
644 |
}
|
645 |
return $domain;
|
646 |
}
|
647 |
|
648 |
public function fixLocalhostIp($ip) {
|
649 |
-
if (trim($ip)
|
650 |
$ip = "127.0.0.1";
|
651 |
}
|
652 |
return $ip;
|
@@ -899,7 +899,7 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
899 |
unset($scannedComponents[1]);
|
900 |
$components = [];
|
901 |
foreach ($scannedComponents as $k => $component) {
|
902 |
-
if ("index.html"
|
903 |
$components[$component] = $path . $component;
|
904 |
}
|
905 |
}
|
@@ -1076,8 +1076,8 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
1076 |
*/
|
1077 |
public function initCustomCss() {
|
1078 |
ob_start();
|
1079 |
-
$left =
|
1080 |
-
$right =
|
1081 |
$dark = $this->options->thread_styles["theme"] === "wpd-dark";
|
1082 |
$darkCommentAreaBG = $this->options->thread_styles["darkCommentAreaBG"] ? "background:" . $this->options->thread_styles["darkCommentAreaBG"] . ";" : "";
|
1083 |
$darkCommentTextColor = $this->options->thread_styles["darkCommentTextColor"] ? "color:" . $this->options->thread_styles["darkCommentTextColor"] . ";" : "";
|
@@ -1100,20 +1100,25 @@ class WpdiscuzHelper implements WpDiscuzConstants {
|
|
1100 |
echo "\r\n";
|
1101 |
echo "#wpdcom .wpd-blog-" . $role . " .wpd-comment-label{color: #ffffff; background-color: " . $color . "; border: none;}\r\n";
|
1102 |
echo "#wpdcom .wpd-blog-" . $role . " .wpd-comment-author, #wpdcom .wpd-blog-" . $role . " .wpd-comment-author a{color: " . $color . ";}\r\n";
|
1103 |
-
if ($role
|
1104 |
echo "#wpdcom .wpd-blog-post_author .wpd-avatar img{border-color: " . $color . ";}";
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
|
|
|
|
1108 |
echo "#wpdcom.wpd-layout-2 .wpd-comment.wpd-reply .wpd-comment-wrap.wpd-blog-" . $role . "{border-" . $left . ": 3px solid " . $color . ";}\r\n";
|
1109 |
-
|
1110 |
-
|
|
|
|
|
1111 |
echo "#wpdcom.wpd-layout-3 .wpd-blog-" . $role . " .wpd-comment-subheader{border-top: 1px dashed " . $color . ";}\r\n";
|
1112 |
-
if ($role
|
1113 |
-
|
|
|
1114 |
}
|
1115 |
?>
|
1116 |
-
<?php echo ( $this->options->thread_styles["commentTextSize"]
|
1117 |
<?php if ($dark) { ?>
|
1118 |
#comments, #respond, .comments-area, #wpdcom.wpd-dark{<?php echo $darkCommentAreaBG . $darkCommentTextColor ?>}
|
1119 |
#wpdcom .ql-editor > *{<?php echo $darkCommentFieldsTextColor ?>}
|
183 |
*/
|
184 |
public function isCommentEditable($comment) {
|
185 |
$commentTimestamp = strtotime($comment->comment_date);
|
186 |
+
$timeDiff = self::$current_time - $commentTimestamp;
|
187 |
+
$editableTimeLimit = $this->options->moderation["commentEditableTime"] === "unlimit" ? abs($timeDiff) + 1 : intval($this->options->moderation["commentEditableTime"]);
|
188 |
return $editableTimeLimit && ($timeDiff < $editableTimeLimit);
|
189 |
}
|
190 |
|
207 |
|
208 |
$ip = apply_filters("pre_comment_user_ip", $ip);
|
209 |
|
210 |
+
if ($ip === "::1") {
|
211 |
$ip = "127.0.0.1";
|
212 |
}
|
213 |
return $ip;
|
331 |
$html .= "<ul class='wc_social_login_by_the_champ'>";
|
332 |
foreach ($theChampLoginOptions["providers"] as $k => $provider) {
|
333 |
$html .= "<li><i ";
|
334 |
+
if ($provider === "google") {
|
335 |
$html .= "id='theChamp" . esc_attr(ucfirst($provider)) . "Button' ";
|
336 |
}
|
337 |
$html .= "class='theChampLogin theChamp" . esc_attr(ucfirst($provider)) . "Background theChamp" . esc_attr(ucfirst($provider)) . "Login' ";
|
338 |
$html .= "alt='Login with ";
|
339 |
$html .= ucfirst($provider);
|
340 |
$html .= "' title='Login with ";
|
341 |
+
if ($provider === "live") {
|
342 |
$html .= "Windows Live";
|
343 |
} else {
|
344 |
$html .= ucfirst($provider);
|
367 |
} else {
|
368 |
$storedCookieEmail = isset($_COOKIE["comment_author_email_" . COOKIEHASH]) ? $_COOKIE["comment_author_email_" . COOKIEHASH] : "";
|
369 |
}
|
370 |
+
return !(!$this->options->moderation["enableEditingWhenHaveReplies"] && $comment->get_children(["post_id" => $comment->comment_post_ID])) && (($storedCookieEmail === $comment->comment_author_email && $_SERVER["REMOTE_ADDR"] === $comment->comment_author_IP) || ($currentUser && $currentUser->ID && $currentUser->ID == $comment->user_id));
|
371 |
}
|
372 |
|
373 |
public function addCommentTypes($args) {
|
377 |
|
378 |
public function commentRowStickAction($actions, $comment) {
|
379 |
if (!$comment->comment_parent) {
|
380 |
+
$stickText = $comment->comment_type === self::WPDISCUZ_STICKY_COMMENT ? $this->options->phrases["wc_unstick_comment"] : $this->options->phrases["wc_stick_comment"];
|
381 |
if (intval(get_comment_meta($comment->comment_ID, self::META_KEY_CLOSED, true))) {
|
382 |
$closeText = $this->options->phrases["wc_open_comment"];
|
383 |
$closeIcon = "fa-lock";
|
639 |
|
640 |
public static function fixEmailFrom($domain) {
|
641 |
$domain = strtolower($domain);
|
642 |
+
if (substr($domain, 0, 4) === "www.") {
|
643 |
$domain = substr($domain, 4);
|
644 |
}
|
645 |
return $domain;
|
646 |
}
|
647 |
|
648 |
public function fixLocalhostIp($ip) {
|
649 |
+
if (trim($ip) === "::1") {
|
650 |
$ip = "127.0.0.1";
|
651 |
}
|
652 |
return $ip;
|
899 |
unset($scannedComponents[1]);
|
900 |
$components = [];
|
901 |
foreach ($scannedComponents as $k => $component) {
|
902 |
+
if ("index.html" !== $component) {
|
903 |
$components[$component] = $path . $component;
|
904 |
}
|
905 |
}
|
1076 |
*/
|
1077 |
public function initCustomCss() {
|
1078 |
ob_start();
|
1079 |
+
$left = is_rtl() ? "right" : "left";
|
1080 |
+
$right = is_rtl() ? "left" : "right";
|
1081 |
$dark = $this->options->thread_styles["theme"] === "wpd-dark";
|
1082 |
$darkCommentAreaBG = $this->options->thread_styles["darkCommentAreaBG"] ? "background:" . $this->options->thread_styles["darkCommentAreaBG"] . ";" : "";
|
1083 |
$darkCommentTextColor = $this->options->thread_styles["darkCommentTextColor"] ? "color:" . $this->options->thread_styles["darkCommentTextColor"] . ";" : "";
|
1100 |
echo "\r\n";
|
1101 |
echo "#wpdcom .wpd-blog-" . $role . " .wpd-comment-label{color: #ffffff; background-color: " . $color . "; border: none;}\r\n";
|
1102 |
echo "#wpdcom .wpd-blog-" . $role . " .wpd-comment-author, #wpdcom .wpd-blog-" . $role . " .wpd-comment-author a{color: " . $color . ";}\r\n";
|
1103 |
+
if ($role === "post_author") {
|
1104 |
echo "#wpdcom .wpd-blog-post_author .wpd-avatar img{border-color: " . $color . ";}";
|
1105 |
+
}
|
1106 |
+
if ($role !== "subscriber" && $role !== "guest") {
|
1107 |
+
echo "#wpdcom.wpd-layout-1 .wpd-comment .wpd-blog-" . $role . " .wpd-avatar img{border-color: " . $color . ";}\r\n";
|
1108 |
+
}
|
1109 |
+
if ($role === "administrator" || $role === "editor" || $role === "post_author") {
|
1110 |
echo "#wpdcom.wpd-layout-2 .wpd-comment.wpd-reply .wpd-comment-wrap.wpd-blog-" . $role . "{border-" . $left . ": 3px solid " . $color . ";}\r\n";
|
1111 |
+
}
|
1112 |
+
if ($role !== "guest") {
|
1113 |
+
echo "#wpdcom.wpd-layout-2 .wpd-comment .wpd-blog-" . $role . " .wpd-avatar img{border-bottom-color: " . $color . ";}\r\n";
|
1114 |
+
}
|
1115 |
echo "#wpdcom.wpd-layout-3 .wpd-blog-" . $role . " .wpd-comment-subheader{border-top: 1px dashed " . $color . ";}\r\n";
|
1116 |
+
if ($role !== "subscriber" && $role !== "guest") {
|
1117 |
+
echo "#wpdcom.wpd-layout-3 .wpd-reply .wpd-blog-" . $role . " .wpd-comment-right{border-" . $left . ": 1px solid " . $color . ";}\r\n";
|
1118 |
+
}
|
1119 |
}
|
1120 |
?>
|
1121 |
+
<?php echo ( $this->options->thread_styles["commentTextSize"] !== "14px") ? "#wpdcom .wpd-comment-text p{font-size:" . $this->options->thread_styles["commentTextSize"] . ";}\r\n" : ""; ?>
|
1122 |
<?php if ($dark) { ?>
|
1123 |
#comments, #respond, .comments-area, #wpdcom.wpd-dark{<?php echo $darkCommentAreaBG . $darkCommentTextColor ?>}
|
1124 |
#wpdcom .ql-editor > *{<?php echo $darkCommentFieldsTextColor ?>}
|
utils/class.WpdiscuzHelperAjax.php
CHANGED
@@ -82,8 +82,8 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
|
|
82 |
}
|
83 |
if ($userCanStickComment && $comment && isset($comment->comment_ID) && $comment->comment_ID && !$comment->comment_parent) {
|
84 |
$commentarr = ["comment_ID" => $commentId];
|
85 |
-
if ($comment->comment_type
|
86 |
-
$commentarr["comment_type"] =
|
87 |
$response = esc_html($this->options->phrases["wc_stick_comment"]);
|
88 |
} else {
|
89 |
$commentarr["comment_type"] = self::WPDISCUZ_STICKY_COMMENT;
|
@@ -313,14 +313,14 @@ class WpdiscuzHelperAjax implements WpDiscuzConstants {
|
|
313 |
$message = "";
|
314 |
$siteUrl = get_site_url();
|
315 |
$blogTitle = html_entity_decode(get_option("blogname"), ENT_QUOTES);
|
316 |
-
if ($guestAction
|
317 |
$link = $mainUrl . "wpdiscuzUrlAnchor&deleteComments=$hashValue";
|
318 |
$subject = $this->options->phrases["wc_user_settings_delete_all_comments"];
|
319 |
$message = $this->options->phrases["wc_user_settings_delete_all_comments_message"];
|
320 |
if (strpos($message, "[DELETE_COMMENTS_URL]") !== false) {
|
321 |
$message = str_replace("[DELETE_COMMENTS_URL]", $link, $message);
|
322 |
}
|
323 |
-
} elseif ($guestAction
|
324 |
$subject = $this->options->phrases["wc_user_settings_delete_all_subscriptions"];
|
325 |
$link = $mainUrl . "wpdiscuzUrlAnchor&deleteSubscriptions=$hashValue";
|
326 |
$message = $this->options->phrases["wc_user_settings_delete_all_subscriptions_message"];
|
82 |
}
|
83 |
if ($userCanStickComment && $comment && isset($comment->comment_ID) && $comment->comment_ID && !$comment->comment_parent) {
|
84 |
$commentarr = ["comment_ID" => $commentId];
|
85 |
+
if ($comment->comment_type === self::WPDISCUZ_STICKY_COMMENT) {
|
86 |
+
$commentarr["comment_type"] = WpdiscuzCore::$DEFAULT_COMMENT_TYPE;
|
87 |
$response = esc_html($this->options->phrases["wc_stick_comment"]);
|
88 |
} else {
|
89 |
$commentarr["comment_type"] = self::WPDISCUZ_STICKY_COMMENT;
|
313 |
$message = "";
|
314 |
$siteUrl = get_site_url();
|
315 |
$blogTitle = html_entity_decode(get_option("blogname"), ENT_QUOTES);
|
316 |
+
if ($guestAction === "deleteComments") {
|
317 |
$link = $mainUrl . "wpdiscuzUrlAnchor&deleteComments=$hashValue";
|
318 |
$subject = $this->options->phrases["wc_user_settings_delete_all_comments"];
|
319 |
$message = $this->options->phrases["wc_user_settings_delete_all_comments_message"];
|
320 |
if (strpos($message, "[DELETE_COMMENTS_URL]") !== false) {
|
321 |
$message = str_replace("[DELETE_COMMENTS_URL]", $link, $message);
|
322 |
}
|
323 |
+
} elseif ($guestAction === "deleteSubscriptions") {
|
324 |
$subject = $this->options->phrases["wc_user_settings_delete_all_subscriptions"];
|
325 |
$link = $mainUrl . "wpdiscuzUrlAnchor&deleteSubscriptions=$hashValue";
|
326 |
$message = $this->options->phrases["wc_user_settings_delete_all_subscriptions_message"];
|
utils/class.WpdiscuzHelperEmail.php
CHANGED
@@ -32,7 +32,7 @@ class WpdiscuzHelperEmail implements WpDiscuzConstants {
|
|
32 |
} else {
|
33 |
$email = filter_input(INPUT_POST, "wpdiscuzSubscriptionEmail");
|
34 |
}
|
35 |
-
if (!$currentUser->exists() && $form->isShowSubscriptionBarAgreement() && !$showSubscriptionBarAgreement && ($subscriptionType
|
36 |
$email = "";
|
37 |
}
|
38 |
$addSubscription = apply_filters("wpdiscuz_before_subscription_added", true);
|
@@ -132,7 +132,7 @@ class WpdiscuzHelperEmail implements WpDiscuzConstants {
|
|
132 |
$siteUrl = get_site_url();
|
133 |
$blogTitle = get_option("blogname");
|
134 |
$postTitle = get_the_title($comment->comment_post_ID);
|
135 |
-
if ($subscriptionType
|
136 |
$parentComment = get_comment($comment->comment_parent);
|
137 |
$subscriber = $parentComment && $parentComment->comment_author ? $parentComment->comment_author : $this->options->phrases["wc_anonymous"];
|
138 |
} else {
|
@@ -185,7 +185,7 @@ class WpdiscuzHelperEmail implements WpDiscuzConstants {
|
|
185 |
$parentCommentId = $comment->comment_parent;
|
186 |
$parentComment = get_comment($parentCommentId);
|
187 |
$parentCommentEmail = $parentComment->comment_author_email;
|
188 |
-
if ($parentCommentEmail
|
189 |
$this->notifyAllCommentSubscribers($postId, $commentId, $email);
|
190 |
$this->notifyCommentSubscribers($parentCommentId, $comment->comment_ID, $email);
|
191 |
}
|
@@ -270,14 +270,14 @@ class WpdiscuzHelperEmail implements WpDiscuzConstants {
|
|
270 |
$form = $wpdiscuz->wpdiscuzForm->getForm($post->ID);
|
271 |
$isLoadWpdiscuz = $form->getFormID() && (comments_open($post) || $post->comment_count) && post_type_supports($post->post_type, "comments");
|
272 |
}
|
273 |
-
if ($approved
|
274 |
$postId = $comment->comment_post_ID;
|
275 |
$email = $comment->comment_author_email;
|
276 |
$parentComment = $comment->comment_parent ? get_comment($comment->comment_parent) : 0;
|
277 |
$this->notifyPostSubscribers($postId, $commentId, $email);
|
278 |
if ($parentComment) {
|
279 |
$parentCommentEmail = $parentComment->comment_author_email;
|
280 |
-
if ($parentCommentEmail
|
281 |
$this->notifyAllCommentSubscribers($postId, $commentId, $email);
|
282 |
$this->notifyCommentSubscribers($parentComment->comment_ID, $commentId, $email);
|
283 |
}
|
@@ -443,7 +443,7 @@ class WpdiscuzHelperEmail implements WpDiscuzConstants {
|
|
443 |
$search = ["[MENTIONED_USER_NAME]", "[POST_TITLE]", "[COMMENT_URL]", "[COMMENT_AUTHOR]"];
|
444 |
$replace = ["", $post_title, $comment_link, $comment_data->comment_author];
|
445 |
foreach ($users as $k => $user) {
|
446 |
-
if ($user["email"]
|
447 |
if (apply_filters("wpducm_mail_to_mentioned_user", true, $user, $comment_data)) {
|
448 |
$replace[0] = $user["name"];
|
449 |
$body = str_replace($search, $replace, $message);
|
32 |
} else {
|
33 |
$email = filter_input(INPUT_POST, "wpdiscuzSubscriptionEmail");
|
34 |
}
|
35 |
+
if (!$currentUser->exists() && $form->isShowSubscriptionBarAgreement() && !$showSubscriptionBarAgreement && ($subscriptionType === WpdiscuzCore::SUBSCRIPTION_POST || $subscriptionType === WpdiscuzCore::SUBSCRIPTION_ALL_COMMENT)) {
|
36 |
$email = "";
|
37 |
}
|
38 |
$addSubscription = apply_filters("wpdiscuz_before_subscription_added", true);
|
132 |
$siteUrl = get_site_url();
|
133 |
$blogTitle = get_option("blogname");
|
134 |
$postTitle = get_the_title($comment->comment_post_ID);
|
135 |
+
if ($subscriptionType === self::SUBSCRIPTION_COMMENT) {
|
136 |
$parentComment = get_comment($comment->comment_parent);
|
137 |
$subscriber = $parentComment && $parentComment->comment_author ? $parentComment->comment_author : $this->options->phrases["wc_anonymous"];
|
138 |
} else {
|
185 |
$parentCommentId = $comment->comment_parent;
|
186 |
$parentComment = get_comment($parentCommentId);
|
187 |
$parentCommentEmail = $parentComment->comment_author_email;
|
188 |
+
if ($parentCommentEmail !== $email) {
|
189 |
$this->notifyAllCommentSubscribers($postId, $commentId, $email);
|
190 |
$this->notifyCommentSubscribers($parentCommentId, $comment->comment_ID, $email);
|
191 |
}
|
270 |
$form = $wpdiscuz->wpdiscuzForm->getForm($post->ID);
|
271 |
$isLoadWpdiscuz = $form->getFormID() && (comments_open($post) || $post->comment_count) && post_type_supports($post->post_type, "comments");
|
272 |
}
|
273 |
+
if ($approved === "1" && ($commentsPage || $postCommentsPage) && $comment && $isLoadWpdiscuz) {
|
274 |
$postId = $comment->comment_post_ID;
|
275 |
$email = $comment->comment_author_email;
|
276 |
$parentComment = $comment->comment_parent ? get_comment($comment->comment_parent) : 0;
|
277 |
$this->notifyPostSubscribers($postId, $commentId, $email);
|
278 |
if ($parentComment) {
|
279 |
$parentCommentEmail = $parentComment->comment_author_email;
|
280 |
+
if ($parentCommentEmail !== $email) {
|
281 |
$this->notifyAllCommentSubscribers($postId, $commentId, $email);
|
282 |
$this->notifyCommentSubscribers($parentComment->comment_ID, $commentId, $email);
|
283 |
}
|
443 |
$search = ["[MENTIONED_USER_NAME]", "[POST_TITLE]", "[COMMENT_URL]", "[COMMENT_AUTHOR]"];
|
444 |
$replace = ["", $post_title, $comment_link, $comment_data->comment_author];
|
445 |
foreach ($users as $k => $user) {
|
446 |
+
if ($user["email"] !== $comment_data->comment_author_email) {
|
447 |
if (apply_filters("wpducm_mail_to_mentioned_user", true, $user, $comment_data)) {
|
448 |
$replace[0] = $user["name"];
|
449 |
$body = str_replace($search, $replace, $message);
|
utils/class.WpdiscuzHelperOptimization.php
CHANGED
@@ -60,7 +60,7 @@ class WpdiscuzHelperOptimization implements WpDiscuzConstants {
|
|
60 |
* @param type $comment current comment object
|
61 |
*/
|
62 |
public function statusEventHandler($newStatus, $oldStatus, $comment) {
|
63 |
-
if ($newStatus
|
64 |
$this->notifyOnApprove($comment);
|
65 |
if ($this->options->subscription["isNotifyOnCommentApprove"]) {
|
66 |
$this->helperEmail->notifyOnApproving($comment);
|
@@ -81,7 +81,7 @@ class WpdiscuzHelperOptimization implements WpDiscuzConstants {
|
|
81 |
if ($comment->user_id == $includeUnapproved) {
|
82 |
$condition = true;
|
83 |
}
|
84 |
-
} else if ($comment->comment_author_email
|
85 |
$condition = true;
|
86 |
}
|
87 |
}
|
@@ -113,7 +113,7 @@ class WpdiscuzHelperOptimization implements WpDiscuzConstants {
|
|
113 |
$this->helperEmail->notifyPostSubscribers($postId, $commentId, $email);
|
114 |
if ($parentComment) {
|
115 |
$parentCommentEmail = $parentComment->comment_author_email;
|
116 |
-
if ($parentCommentEmail
|
117 |
$this->helperEmail->notifyAllCommentSubscribers($postId, $commentId, $email);
|
118 |
$this->helperEmail->notifyCommentSubscribers($parentComment->comment_ID, $commentId, $email);
|
119 |
}
|
60 |
* @param type $comment current comment object
|
61 |
*/
|
62 |
public function statusEventHandler($newStatus, $oldStatus, $comment) {
|
63 |
+
if ($newStatus !== $oldStatus && $newStatus === "approved") {
|
64 |
$this->notifyOnApprove($comment);
|
65 |
if ($this->options->subscription["isNotifyOnCommentApprove"]) {
|
66 |
$this->helperEmail->notifyOnApproving($comment);
|
81 |
if ($comment->user_id == $includeUnapproved) {
|
82 |
$condition = true;
|
83 |
}
|
84 |
+
} else if ($comment->comment_author_email === $includeUnapproved) {
|
85 |
$condition = true;
|
86 |
}
|
87 |
}
|
113 |
$this->helperEmail->notifyPostSubscribers($postId, $commentId, $email);
|
114 |
if ($parentComment) {
|
115 |
$parentCommentEmail = $parentComment->comment_author_email;
|
116 |
+
if ($parentCommentEmail !== $email) {
|
117 |
$this->helperEmail->notifyAllCommentSubscribers($postId, $commentId, $email);
|
118 |
$this->helperEmail->notifyCommentSubscribers($parentComment->comment_ID, $commentId, $email);
|
119 |
}
|
utils/class.WpdiscuzHelperUpload.php
CHANGED
@@ -10,7 +10,6 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
10 |
private $dbManager;
|
11 |
private $wpdiscuzForm;
|
12 |
private $helper;
|
13 |
-
private $imageSizes;
|
14 |
private $wpUploadsPath;
|
15 |
private $wpUploadsUrl;
|
16 |
private $currentUser;
|
@@ -22,7 +21,6 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
22 |
$this->dbManager = $dbManager;
|
23 |
$this->wpdiscuzForm = $wpdiscuzForm;
|
24 |
$this->helper = $helper;
|
25 |
-
$this->imageSizes = $this->getImageSizes();
|
26 |
$wpUploadsDir = wp_upload_dir();
|
27 |
$this->wpUploadsPath = $wpUploadsDir["path"];
|
28 |
$this->wpUploadsUrl = $wpUploadsDir["url"];
|
@@ -159,7 +157,7 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
159 |
if ($pagenow == self::PAGE_COMMENTS) {
|
160 |
$size = "thumbnail";
|
161 |
} else {
|
162 |
-
foreach ($this->
|
163 |
if (!intval($sizeValue["height"]) && !intval($sizeValue["width"])) {
|
164 |
continue;
|
165 |
}
|
@@ -321,7 +319,7 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
321 |
|
322 |
foreach ($files as $file) {
|
323 |
$error = false;
|
324 |
-
$extension = pathinfo($file["name"], PATHINFO_EXTENSION);
|
325 |
if ($mimeType = $this->isImage($file)) {
|
326 |
if ((strpos($mimeType, "image/") !== false) && empty($extension)) {
|
327 |
$file["name"] .= ".jpg";
|
@@ -412,6 +410,8 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
412 |
}
|
413 |
|
414 |
public function removeAttachmentPreview() {
|
|
|
|
|
415 |
$response = ["errorCode" => "", "error" => "", "attachmentsHtml" => ""];
|
416 |
$attachmentId = isset($_POST["attachmentId"]) ? intval($_POST["attachmentId"]) : 0;
|
417 |
$attachment = get_post($attachmentId);
|
@@ -422,9 +422,12 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
422 |
wp_send_json_error($response);
|
423 |
}
|
424 |
|
|
|
|
|
|
|
425 |
$ip = WpdiscuzHelper::getRealIPAddr();
|
426 |
$ownerIp = get_post_meta($attachmentId, self::METAKEY_ATTCHMENT_OWNER_IP, true);
|
427 |
-
if (!current_user_can("manage_options") && $
|
428 |
$response["errorCode"] = "msgPermissionDenied";
|
429 |
wp_send_json_error($response);
|
430 |
}
|
@@ -462,6 +465,8 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
462 |
}
|
463 |
|
464 |
public function deleteAttachment() {
|
|
|
|
|
465 |
$response = ["errorCode" => "", "error" => ""];
|
466 |
$attachmentId = isset($_POST["attachmentId"]) ? intval($_POST["attachmentId"]) : 0;
|
467 |
$attachment = get_post($attachmentId);
|
@@ -571,15 +576,23 @@ class WpdiscuzHelperUpload implements WpDiscuzConstants {
|
|
571 |
|
572 |
private function getImageSizes() {
|
573 |
$sizes = [];
|
|
|
|
|
|
|
574 |
foreach ($this->options->content["wmuImageSizes"] as $_size) {
|
575 |
-
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
577 |
}
|
578 |
return $sizes;
|
579 |
}
|
580 |
|
581 |
public function getImagesSizes() {
|
582 |
-
|
583 |
if ($sizes && is_array($sizes) && !in_array("full", $sizes)) {
|
584 |
$sizes[] = "full";
|
585 |
}
|
10 |
private $dbManager;
|
11 |
private $wpdiscuzForm;
|
12 |
private $helper;
|
|
|
13 |
private $wpUploadsPath;
|
14 |
private $wpUploadsUrl;
|
15 |
private $currentUser;
|
21 |
$this->dbManager = $dbManager;
|
22 |
$this->wpdiscuzForm = $wpdiscuzForm;
|
23 |
$this->helper = $helper;
|
|
|
24 |
$wpUploadsDir = wp_upload_dir();
|
25 |
$this->wpUploadsPath = $wpUploadsDir["path"];
|
26 |
$this->wpUploadsUrl = $wpUploadsDir["url"];
|
157 |
if ($pagenow == self::PAGE_COMMENTS) {
|
158 |
$size = "thumbnail";
|
159 |
} else {
|
160 |
+
foreach ($this->getImageSizes() as $sizeKey => $sizeValue) {
|
161 |
if (!intval($sizeValue["height"]) && !intval($sizeValue["width"])) {
|
162 |
continue;
|
163 |
}
|
319 |
|
320 |
foreach ($files as $file) {
|
321 |
$error = false;
|
322 |
+
$extension = strtolower(pathinfo($file["name"], PATHINFO_EXTENSION));
|
323 |
if ($mimeType = $this->isImage($file)) {
|
324 |
if ((strpos($mimeType, "image/") !== false) && empty($extension)) {
|
325 |
$file["name"] .= ".jpg";
|
410 |
}
|
411 |
|
412 |
public function removeAttachmentPreview() {
|
413 |
+
$nonceKey = ($key = get_home_url()) ? md5($key) : "wmu-nonce";
|
414 |
+
check_ajax_referer($nonceKey, "wmu_nonce");
|
415 |
$response = ["errorCode" => "", "error" => "", "attachmentsHtml" => ""];
|
416 |
$attachmentId = isset($_POST["attachmentId"]) ? intval($_POST["attachmentId"]) : 0;
|
417 |
$attachment = get_post($attachmentId);
|
422 |
wp_send_json_error($response);
|
423 |
}
|
424 |
|
425 |
+
if (empty($this->currentUser->ID)) {
|
426 |
+
$this->setCurrentUser(WpdiscuzHelper::getCurrentUser());
|
427 |
+
}
|
428 |
$ip = WpdiscuzHelper::getRealIPAddr();
|
429 |
$ownerIp = get_post_meta($attachmentId, self::METAKEY_ATTCHMENT_OWNER_IP, true);
|
430 |
+
if (!current_user_can("manage_options") && (($attachment->post_author != 0 && $attachment->post_author != $this->currentUser->ID) || ($attachment->post_author == 0 && $ownerIp !== $ip))) {
|
431 |
$response["errorCode"] = "msgPermissionDenied";
|
432 |
wp_send_json_error($response);
|
433 |
}
|
465 |
}
|
466 |
|
467 |
public function deleteAttachment() {
|
468 |
+
$nonceKey = ($key = get_home_url()) ? md5($key) : "wmu-nonce";
|
469 |
+
check_ajax_referer($nonceKey, "wmu_nonce");
|
470 |
$response = ["errorCode" => "", "error" => ""];
|
471 |
$attachmentId = isset($_POST["attachmentId"]) ? intval($_POST["attachmentId"]) : 0;
|
472 |
$attachment = get_post($attachmentId);
|
576 |
|
577 |
private function getImageSizes() {
|
578 |
$sizes = [];
|
579 |
+
$this->options->content["wmuImageSizes"] = array_filter($this->options->content["wmuImageSizes"], function ($v) {
|
580 |
+
return in_array($v, get_intermediate_image_sizes());
|
581 |
+
});
|
582 |
foreach ($this->options->content["wmuImageSizes"] as $_size) {
|
583 |
+
if (in_array($_size, $this->options->getDefaultImageSizes())) {
|
584 |
+
$sizes[$_size]["width"] = intval(get_option("{$_size}_size_w"));
|
585 |
+
$sizes[$_size]["height"] = intval(get_option("{$_size}_size_h"));
|
586 |
+
} else if (isset($additionalSizes[$_size])) {
|
587 |
+
$sizes[$_size]["width"] = $additionalSizes[$_size]["width"];
|
588 |
+
$sizes[$_size]["height"] = $additionalSizes[$_size]["height"];
|
589 |
+
}
|
590 |
}
|
591 |
return $sizes;
|
592 |
}
|
593 |
|
594 |
public function getImagesSizes() {
|
595 |
+
$sizes = $this->options->content["wmuImageSizes"];
|
596 |
if ($sizes && is_array($sizes) && !in_array("full", $sizes)) {
|
597 |
$sizes[] = "full";
|
598 |
}
|
utils/layouts/subscriptions/content.php
CHANGED
@@ -19,7 +19,7 @@ if ($items && is_array($items)) {
|
|
19 |
$sPostId = $item->post_id;
|
20 |
$sType = $item->subscribtion_type;
|
21 |
$sKey = $item->activation_key;
|
22 |
-
if ($sType
|
23 |
$object = get_comment($scId);
|
24 |
$link = get_comment_link($scId);
|
25 |
$author = $object->comment_author;
|
@@ -33,7 +33,7 @@ if ($items && is_array($items)) {
|
|
33 |
$author = $postAuthor->display_name ? $postAuthor->display_name : $postAuthor->user_login;
|
34 |
$postedDate = $this->getPostDate($object);
|
35 |
$content = $object->post_title;
|
36 |
-
$sTypeInfo =
|
37 |
}
|
38 |
if ($object && !is_wp_error($object)) {
|
39 |
include WPDISCUZ_DIR_PATH . "/utils/layouts/subscriptions/item.php";
|
19 |
$sPostId = $item->post_id;
|
20 |
$sType = $item->subscribtion_type;
|
21 |
$sKey = $item->activation_key;
|
22 |
+
if ($sType === "reply") {
|
23 |
$object = get_comment($scId);
|
24 |
$link = get_comment_link($scId);
|
25 |
$author = $object->comment_author;
|
33 |
$author = $postAuthor->display_name ? $postAuthor->display_name : $postAuthor->user_login;
|
34 |
$postedDate = $this->getPostDate($object);
|
35 |
$content = $object->post_title;
|
36 |
+
$sTypeInfo = $sType === "all_comment" ? $this->options->phrases["wc_user_settings_subscribed_to_replies_own"] : $this->options->phrases["wc_user_settings_subscribed_to_all_comments"];
|
37 |
}
|
38 |
if ($object && !is_wp_error($object)) {
|
39 |
include WPDISCUZ_DIR_PATH . "/utils/layouts/subscriptions/item.php";
|
utils/layouts/subscriptions/subscriptions-page.php
CHANGED
@@ -31,7 +31,7 @@ if ($action && $currentUserEmail) {
|
|
31 |
$sType = $item->subscribtion_type;
|
32 |
$sKey = $item->activation_key;
|
33 |
|
34 |
-
if ($sType
|
35 |
$object = get_comment($scId);
|
36 |
$link = get_comment_link($scId);
|
37 |
$author = $object->comment_author;
|
@@ -45,7 +45,7 @@ if ($action && $currentUserEmail) {
|
|
45 |
$author = $postAuthor->display_name ? $postAuthor->display_name : $postAuthor->user_login;
|
46 |
$postedDate = $this->getPostDate($object);
|
47 |
$content = $object->post_title;
|
48 |
-
$sTypeInfo =
|
49 |
}
|
50 |
|
51 |
if ($object && !is_wp_error($object)) {
|
31 |
$sType = $item->subscribtion_type;
|
32 |
$sKey = $item->activation_key;
|
33 |
|
34 |
+
if ($sType === "reply") {
|
35 |
$object = get_comment($scId);
|
36 |
$link = get_comment_link($scId);
|
37 |
$author = $object->comment_author;
|
45 |
$author = $postAuthor->display_name ? $postAuthor->display_name : $postAuthor->user_login;
|
46 |
$postedDate = $this->getPostDate($object);
|
47 |
$content = $object->post_title;
|
48 |
+
$sTypeInfo = $sType === "all_comment" ? $this->options->phrases["wc_user_settings_subscribed_to_replies_own"] : $this->options->phrases["wc_user_settings_subscribed_to_all_comments"];
|
49 |
}
|
50 |
|
51 |
if ($object && !is_wp_error($object)) {
|