403Webshell
Server IP : 65.109.86.83  /  Your IP : 37.27.51.148
Web Server : nginx/1.14.1
System : Linux libra 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 20:24:04 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.31
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/thrive-comments/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/thrive-comments/assets/js/moderation.min.js
(()=>{var e;(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}var t;window.ThriveComments=window.ThriveComments||{},ThriveComments.util=ThriveComments.util||{},_.templateSettings={evaluate:/<#([\s\S]+?)#>/g,interpolate:/<#=([\s\S]+?)#>/g,escape:/<#-([\s\S]+?)#>/g},t=jQuery,ThriveComments.util.tpl=function(e,n){var i=t("script#"+e.replace(/\//g,"-")).html()||"";return n?_.template(i)(n):_.template(i)},ThriveComments.util.nested=function(e,t){var n=this;return e instanceof Backbone.Model?this.nested(e.attributes,t):_.each(t,(function(t){t.children&&(e[t.name]=n.nested(e[t.name],t.children)),_.isArray(e)?_.each(e,(function(e){e[t.name]=new t.obj(e[t.name])})):e[t.name]=new t.obj(e[t.name])})),e},ThriveComments.util.validateInput=function(e,n,i){var o=(e=e instanceof jQuery?e:t(e)).val(),s=!0;return""==(o=o.trim())?(n||(n=ThriveComments.util.render_label("isRequired")),s=!1,e.removeClass("tcm-valid"),e.addClass("tcm-invalid"),e.prev(".tcm-error-message").show().html(n)):(e.removeClass("tcm-invalid"),e.prev(".tcm-error-message").hide(n)),s},ThriveComments.util.validateInputUrl=function(e,n,i){var o=(e=e instanceof jQuery?e:t(e)).val(),s=!0;return null!=o&&0==this.isValidUrl(this.addHttp(o))?(n||(n=ThriveComments.util.render_label("isRequired")),s=!1,e.removeClass("tcm-valid"),e.addClass("tcm-invalid"),e.prev(".tcm-error-message").show().html(n)):(e.removeClass("tcm-invalid"),e.prev(".tcm-error-message").hide(n)),s},ThriveComments.util.validateStoringConsent=function(e,n){var i=(e=e instanceof jQuery?e:t(e)).is(":checked"),o=e.siblings(".tcm-consent-text"),s=ThriveComments.util.get_cookie("tcm_cookie_user_name"),r=!0;return""===ThriveComments.settings.storing_consent||0===ThriveComments.settings.storing_consent||(i||""!==s?(o.removeClass("tcm-not-selected"),e.prev(".tcm-error-message").hide(n)):(n||(n=ThriveComments.util.render_label("isRequired")),r=!1,o.removeClass("tcm-not-selected"),o.addClass("tcm-not-selected"),e.prev(".tcm-error-message").show().html(n))),r},ThriveComments.util.validateEmail=function(e,n){var i=(e=e instanceof jQuery?e:t(e)).val();return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(i)?(e.removeClass("tcm-invalid"),e.prev(".tcm-error-message").hide(),!0):(e.removeClass("tcm-valid"),e.addClass("tcm-invalid"),e.prev(".tcm-error-message").show().html(n),!1)},ThriveComments.util.valuesToArray=function(e){return Object.keys(e).map((function(t){return e[t]}))},ThriveComments.util.set_avatar_url=function(e){e.length&&e.attr("data-src")===ThriveComments.default_author_picture_url&&this.checkGravatar(e.attr("data-email-hash")).done((function(t){e.css("background-image",'url("'+t+'")')}))},ThriveComments.util.previousUser=function(){return""!==ThriveComments.util.get_cookie("social-login")||!!ThriveComments.current_user.ID||void 0},ThriveComments.util.set_cookie=function(t,n,i,o){o=o||"/",i=i||2592e3;var s,r=new Date;i=parseInt(i),r.setTime(r.getTime()+1e3*i),s=r.toUTCString(),"object"===e(n)&&(n=JSON.stringify(n)),document.cookie=encodeURIComponent(t)+"="+n+";expires="+s+";path="+o},ThriveComments.util.get_cookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""},ThriveComments.util.search_comment=function(e,t){return void 0!==e.models&&this.search_recursive(e.models,t)},ThriveComments.util.search_recursive=function(e,t){for(var n=0,i=0;!n&&i<e.length;i++)e[i].get("comment_ID")==t?n=e[i]:e[i].get("children")&&e[i].get("children").length&&(n=n||this.search_recursive(e[i].get("children"),t));return n},ThriveComments.util.elem_viewport=function(e){var n=e.offset(),i=n?n.top:0,o=i+e.outerHeight(),s=t(window).scrollTop(),r=s+t(window).height();return o>s&&i<r},ThriveComments.util.focusElement=function(e){var n,i=e.offset().top,o=e.height(),s=t(window).height();n=o<s?i-(s/2-o/2):i,t("html, body").animate({scrollTop:n},300,"easeOutQuint")},ThriveComments.util.save_setting_model=function(e,t,n,i){if(!e)return!1;(i=i||{}).success||(i.success=ThriveComments.translations.settings_saved_success_toast),i.fail||(i.fail=ThriveComments.translations.settings_saved_fail_toast),new ThriveComments.models.Settings({name:e,value:t}).save().done((function(o){"NoMessage"!==i.success&&TVE_Dash.success(i.success),-1!==ThriveComments.tcm_sync_settings.indexOf(e)&&n.where({name:e}).shift().set("value",t)})).fail((function(e){TVE_Dash.err(i.fail)}))},ThriveComments.util.render_label=function(e,t,n){var i,o,s,r,a,m;if(t||(t=""),!(i=window.parent.ThriveComments?void 0===window.parent.ThriveComments.objects.Settings?ThriveComments.tcm_customize_labels:window.parent.ThriveComments.objects.Settings.get(ThriveComments.tcm_labels_key).get("value"):ThriveComments.tcm_customize_labels)||!i.hasOwnProperty(e))return"";if(-1===(a=i[e].text).indexOf("{"))return a;switch(s=a.indexOf("{"),r=a.indexOf("}"),n){case"before":m=a.substr(0,s);break;case"after":m=a.substr(r+1,a.length-1);break;default:o=a.substring(s,r+1),m=a.replace(o,t)}return m},ThriveComments.util.showCommentsNumber=function(e){var n=t(".tcm-comments-number");n.length&&n.html(n.html().replace("comment_count",e)).show()},ThriveComments.util.tcm_show_loader=function(){t(".tcm-dot-loader").show()},ThriveComments.util.tcm_hide_loader=function(){t(".tcm-dot-loader").hide(),t(".thrive-comments-content").show()},ThriveComments.util.tcm_hide_textareas=function(e){var n=t(e.currentTarget).closest(".tcm-reply-container").find(".tcm-reply-btn").attr("data-id");t("textarea[name=tcm-post-content]").each((function(){var e=t(this).closest(".tcm-comment-wrapper"),i=t(this).closest(".tcm-reply-container").find(".tcm-reply-btn").attr("data-id"),o=e.find(".tcm-create-post-container").attr("data-position");void 0!==n&&t(this).closest(".comment-id-0").find(".tcm-comment-additional-fields").hide(),""!=o&&"top"===o||n==i||(t(this).closest(".tcm-comment-wrapper").slideUp(),t(this).closest(".tcm-reply-container").find(".tcm-reply-btn").attr("data-clicked",0))}))},ThriveComments.util.after_ajax_login_actions=function(){t(".tcm-lazy-comments").empty(),t.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},cache:!1,url:ThriveComments.routes.generate_nonce,dataType:"JSON",data:{action:"refresh_nonce"},type:"GET"}).done((function(e){var n=window.parent.ThriveComments.util.commentId,i=n?"comments/"+n:"";ThriveComments.current_user=e.current_user,ThriveComments.nonce=e.nonce,Backbone.history.loadUrl(i),t(".tcm-comment-item").each((function(){var e=t(this);e.find(".tcm-comment-wrapper").hide(),e.find(".tcm-error-heading").hide()}))}))},ThriveComments.util.focusAfterLogin=function(){if(this.commentId&&parseInt(this.commentId)===this.commentId){var e=t("div[data-comment-id="+this.commentId+"]");e.find(".tcm-reply-btn").click(),e.find("#tcm-post-content").val(this.content).focus()}if("bottom"===this.position){var n=t(".add-comment");n.click(),n.closest(".tcm-lazy-comments").find("textarea#tcm-post-content").val(this.content).focus()}"top"===this.position&&t("textarea#tcm-post-content").focus(),this.position=null},ThriveComments.util.scrollToElement=function(e){e.length&&t("body, html").animate({scrollTop:e.offset().top-t(window).height()/2+30},{duration:500,complete:function(){var t=e.parent();t.addClass("tcm-highlight-item"),setTimeout((function(){return t.removeClass("tcm-highlight-item")}),800)}})},ThriveComments.util.showCommentConversion=function(e){var t=new ThriveComments.views.CommentConversion({commentView:e});t.handleAfterShowAction(),e.$el.prepend(t.$el)},ThriveComments.util.isValidUrl=function(e){return!(null===e.match(/(http(s)?:\/\/.)(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g))},ThriveComments.util.addHttp=function(e){return(e=t.trim(e))&&!/^(?:f|ht)tps?\:\/\//.test(e)&&(e="http://"+e),e},ThriveComments.util.err=function(e,n,i){t(".tvd-toast").remove(),Toasts.init(e,n||3e3,"tvd-toast tvd-red",i,"bottom"),t(".tvd-toast").parent().addClass("tcm-frontend-toast")},ThriveComments.util.getDropDownItems=function(e){var t;if(e.meta_query.tcm_delegate)t={approve:1,unapprove:1,no_reply_needed:1,featured:1,delegate:1,spam:1,trash:1};else if(e.meta_query.tcm_featured)t={stop_featured:1,no_reply_needed:1,delegate:1};else switch(e.status){case"all":case"hold":case"tcm_unreplied":t={approve:1,unapprove:1,no_reply_needed:1,featured:1,delegate:1,spam:1,trash:1};break;case"featured":t={no_reply_needed:1,stop_featured:1,delegate:1};break;case"spam":t={not_spam:1,delete:1};break;case"trash":t={spam:1,restore:1,delete:1}}return t},ThriveComments.util.dynamicSortByProperty=function(e){var t=1;return"-"===e[0]&&(t=-1,e=e.substr(1)),function(n,i){return(n[e]<i[e]?-1:n[e]>i[e]?1:0)*t}},ThriveComments.util.insertAtCaret=function(e,t){if(e.length){var n=e[0],i=n.scrollTop,o=0,s=n.selectionStart||"0"==n.selectionStart?"ff":!!document.selection&&"ie";if("ie"==s){n.focus();var r=document.selection.createRange();r.moveStart("character",-n.value.length),o=r.text.length}else"ff"==s&&(o=n.selectionStart);var a=n.value.substring(0,o),m=n.value.substring(o,n.value.length);if(n.value=a+t+m,o+=t.length,"ie"==s){n.focus();var c=document.selection.createRange();c.moveStart("character",-n.value.length),c.moveStart("character",o),c.moveEnd("character",0),c.select()}else"ff"==s&&(n.selectionStart=o,n.selectionEnd=o,n.focus());n.scrollTop=i}},ThriveComments.util.ajaxurl=function(e){var t=-1!==ajaxurl.indexOf("?")?"&":"?";return e&&e.length?(e=e.replace(/^(\?|&)/,""),e+="&_nonce="+ThriveComments.admin_nonce,ajaxurl+t+e):ajaxurl+t+"_nonce="+ThriveComments.admin_nonce},ThriveComments.util.toCamelCase=function(e){return(e=e.replace(/_/g," ")).toLowerCase().replace(/(?:(^.))/g,(function(e){return e.charAt(e.length-1).toUpperCase()}))},ThriveComments.util.formatSelection=function(e){var t,n,i,o=e instanceof jQuery?e[0]:document.getElementById(e);return void 0!==document.selection?(o.focus(),t=document.selection.createRange().text):void 0!==o.selectionStart&&(n=o.selectionStart,i=o.selectionEnd,t=o.value.substring(n,i)),{selectedText:t,startPos:n,endPos:i}},ThriveComments.util.set_subscriber_cookies=function(e){var t=ThriveComments.util.get_cookie("subscribed_posts");if(""!==t&&(t=JSON.parse(t)),0===e){var n=t.indexOf(ThriveComments.post.ID);n>-1&&(t.splice(n,1),ThriveComments.util.set_cookie("subscribed_posts",JSON.stringify(t),31104e3))}else""===t?t=[ThriveComments.post.ID]:t.push(ThriveComments.post.ID),ThriveComments.util.set_cookie("subscribed_posts",JSON.stringify(t),31104e3)},ThriveComments.util.checkGravatar=function(e){var n=this,i=t.Deferred();if(this.gravatarCache=this.gravatarCache||{},this.gravatarCache[e])this.gravatarCache[e].success?i.resolve(this.gravatarCache[e].url):i.reject();else{var o="https://www.gravatar.com/avatar/"+e+"?s=512";t.ajax({type:"HEAD",url:o+"&d=404"}).done((function(t){n.gravatarCache[e]={url:o,success:!0},i.resolve(o)})).fail((function(){n.gravatarCache[e]={url:"",success:!1},i.reject()}))}return i}})(),(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}window.ThriveComments=window.ThriveComments||{},ThriveComments.models=ThriveComments.models||{},ThriveComments.collections=ThriveComments.collections||{},jQuery,ThriveComments.models.Base=Backbone.Model.extend({idAttribute:"id",sync:function(e,t,n){var i;return(n=n||{}).cache=!1,!t.has("id")||"delete"!==e&&"update"!==e||(n.url=this.url()+"/"+t.get("id")),_.isUndefined(ThriveComments.nonce)||_.isNull(ThriveComments.nonce)||(i=n.beforeSend,n.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",ThriveComments.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,n)},save:function(t,n,i){var o;null==t||"object"===e(t)?(o=t,i=n):(o={})[t]=n;var s=(i=_.extend({validate:!0,parse:!0},i)).wait;if(o&&!s){if(!this.set(o,i))return!1}else if(!this._validate(o,i))return!1;var r=this,a=i.success,m=this.attributes;i.success=function(e){r.attributes=m;var t=i.parse?r.parse(e,i):e;if(s&&(t=_.extend({},o,t)),t&&!r.set(t,i))return!1;a&&a.call(i.context,r,e,i),o&&(o.sync||void 0===o.sync)&&r.trigger("sync",r,e,i)},function(e,t){var n=t.error;t.error=function(i){n&&n.call(t.context,e,i,t),e.trigger("error",e,i,t)}}(this,i),o&&s&&(this.attributes=_.extend({},m,o));var c=this.isNew()?"create":i.patch?"patch":"update";"patch"!==c||i.attrs||(i.attrs=o);var l=this.sync(c,this,i);return this.attributes=m,l}}),ThriveComments.collections.Base=Backbone.Collection.extend({sync:function(e,t,n){var i;return(n=n||{}).cache=!1,n.url=this.url(),_.isUndefined(ThriveComments.nonce)||_.isNull(ThriveComments.nonce)||(i=n.beforeSend,n.beforeSend=function(e){if(e.setRequestHeader("X-WP-Nonce",ThriveComments.nonce),i)return i.apply(this,arguments)}),Backbone.sync(e,t,n)}}),ThriveComments.models.Comment=ThriveComments.models.Base.extend({defaults:{children:[],comment_post_ID:"",comment_author:"",comment_author_email:"",comment_author_url:"",comment_date:"",comment_content:"",comment_karma:0,comment_type:"",comment_parent:0,top_parent_id:0,level:"",user_id:0,tcm_meta:{},undo_action:""},url:function(){return ThriveComments.moderation_routes.comments},parse:function(e){return e.comment_content=e.content.rendered.replace(/<\/?[^>]+(>|$)/g,""),delete e.author,delete e.author_ip,e},toJSON:function(){var e=Backbone.Model.prototype.toJSON.call(this);return delete e.author_ip,e}}),ThriveComments.collections.Comments=ThriveComments.collections.Base.extend({model:ThriveComments.models.Comment,url:function(){return ThriveComments.moderation_routes.comments}}),ThriveComments.models.Settings=ThriveComments.models.Base.extend({idAttribute:"name",defaults:{name:"",value:""},url:function(){return ThriveComments.routes.settings}}),ThriveComments.models.KeyboardSettings=ThriveComments.models.Base.extend({idAttribute:"name",defaults:{name:"",value:""},url:function(){return ThriveComments.routes.settings+"/keyboard-tooltip"}}),ThriveComments.collections.Settings=ThriveComments.collections.Base.extend({model:ThriveComments.models.Settings,url:function(){return ThriveComments.routes.settings}})})(),window.ThriveComments=window.ThriveComments||{},ThriveComments.views=ThriveComments.views||{},ThriveComments.objects=ThriveComments.objects||{},e=jQuery,ThriveComments.views.Base=Backbone.View.extend({render:function(e){return this._render(e),TVE_Dash.materialize(this.$el),this},close:function(){this.$el.empty(),this.unbind()}}),ThriveComments.views.CommentsModeration=ThriveComments.views.Base.extend({className:"tcm-admin-moderation-wrapper",template:ThriveComments.util.tpl("moderation/comments-moderation"),events:{"click a.toggle-stuff":"showHideElem","click .tcm-sort-by":"changeSorting","click .to-top":"scrollToTop","click .tcm-comment-checkbox":"activateBulk","click .filter-by-post":"filterByPost","click .keyboard-tooltip-title":"showKeyboardTooltip","click .clear-post-autocomplete":"postCleared"},keyboardEvents:ThriveComments.moderation_keyboard,initialize:function(){this._render()},_render:function(){this.$el.html(this.template()),this.keyboardTooltipContainer=new ThriveComments.views.KeyboardTooltipContainer({el:this.$(".keyboard-tooltip-container"),moderation_view:this}),ThriveComments.objects.Comments=new ThriveComments.collections.Comments,this.commentsList=ThriveComments.objects.CommentsList=new ThriveComments.views.CommentsList({collection:ThriveComments.objects.Comments,el:this.$(".tcm-moderation-container")}),this.commentsPagination=ThriveComments.objects.CommentsPagination=new ThriveComments.views.CommentsPagination({collection:ThriveComments.objects.Comments,view:ThriveComments.objects.CommentsList,moderation_view:this}),this.bulkActions=new ThriveComments.views.BulkActions({el:this.$(".bulk-section"),bulklist:ThriveComments.util.getDropDownItems({status:"all",meta_query:0}),commentsList:this.commentsList,commentsPagination:this.commentsPagination}),this.showOverlay(),this.commentsPagination.fetchComments(),this.stickyHeader(),this.renderViewCommentsOnFilter(),this.bindSearchEvent(),new ThriveComments.views.KeyboardNotification({el:this.$(".keyboard-notification-container"),moderation_view:this}).bindKeyboardEvents()},showKeyboardTooltip:function(t){t.preventDefault?t.preventDefault():t.returnValue=!1,this.unbindKeyboardEvents(),this.keyboardTooltipContainer.bindKeyboardEvents(),e("body").css("overflow","hidden"),this.$(".keyboard-tooltip-container").show(),this.$(".keyboard-notification-container").hide()},showOverlay:function(){this.$(".tcm-moderation-loader").show()},hideOverlay:function(){this.$(".tcm-moderation-loader").hide()},actionKey:function(t){var n=this.$(".tcm-focused-element"),i=n.find('[data-key="'+t.key+'"]'),o=!0;return 113===t.keyCode?(n.find(".edit-status").click(),!1):(27===t.keyCode&&this.$(".keyboard-notification-container").hide(),i.length>1?i.each((function(){var t=e(this);(t.is(":focus")||t.is(":visible"))&&(o=!1,t.click())})):(o=!1,(-1!==["f","t","s","d"].indexOf(t.key)||i.is(":visible"))&&i.click()),13===t.keyCode&&o&&n.find("a.tcm-focus-action").click(),!1)},leftRight:function(e){var t=this.$(".tcm-focused-element"),n=t.find(".tcm-focus-action"),i=n.next(),o=n.prev();39===e.keyCode?this.handleRightArrow(i,n,t):this.handleLeftArrow(o,n,t),n.removeClass("tcm-focus-action")},handleRightArrow:function(e,t,n){var i=n.find(".moderation-dropdown");e.hasClass("moderation-dropdown")&&e.find("ul.inner").css("display","block"),(t.hasClass("moderation-dropdown")||i.find(".tcm-focus-action").length)&&(i.find("ul.inner").css("display",""),e=i.next()),0===e.length&&(e=n.find(".moderation-footer a").first()),e.addClass("tcm-focus-action")},handleLeftArrow:function(e,t,n){var i=n.find(".moderation-dropdown");e.hasClass("moderation-dropdown")&&e.find("ul.inner").css("display","block"),(t.hasClass("moderation-dropdown")||i.find(".tcm-focus-action").length)&&(i.find("ul.inner").css("display",""),e=i.prev()),0===e.length&&(e=n.find(".moderation-footer a").last()),e.addClass("tcm-focus-action")},upDown:function(e){var t=this.$(".tcm-focused-element"),n=t.find(".moderation-dropdown");if(n.hasClass("tcm-focus-action")||n.find(".tcm-focus-action").length){var i=t.find(".tcm-focus-action");return 106===e.keyCode||40===e.keyCode?this.moderationUp(n,i):this.moderationDown(n,i),!1}return 106===e.keyCode||40===e.keyCode?this.changeFocus(t,t.next(".tcm-admin-moderation-comment-item")):this.changeFocus(t,t.prev(".tcm-admin-moderation-comment-item")),!1},moderationUp:function(e,t){var n={};if(e.hasClass("tcm-focus-action"))n=e.find("ul.inner li").first().find("a"),e.removeClass("tcm-focus-action");else{var i=t.parent().next();n=i.length?i.find("a"):e.find("ul.inner li").first().find("a")}t.removeClass("tcm-focus-action"),n.addClass("tcm-focus-action")},moderationDown:function(e,t){var n=t.parent().prev(),i={};i=n.length?n.find("a"):e.find("ul.inner li").last().find("a"),t.removeClass("tcm-focus-action"),i.addClass("tcm-focus-action")},changeFocus:function(t,n){if(!n.length)return!1;var i,o=n.offset().top,s=n.height(),r=e(window).height();return i=s<r?o-(r/2-s/2)-81:o,t.removeClass("tcm-focused-element"),n.addClass("tcm-focused-element"),t.find("ul.inner").css("display",""),t.find(".tcm-focus-action").removeClass("tcm-focus-action"),t.find(".moderation-footer a").first().addClass("tcm-focus-action"),n.prev().length||(i=0),e("html, body").animate({scrollTop:i},300,"easeOutQuint"),!1},filterByPost:function(e){var t=e.currentTarget.getAttribute("data-post-id"),n=e.currentTarget.getAttribute("data-post-title"),i=this.$("#tcm_post_autocomplete"),o={post_id:t,tva_term:e.currentTarget.getAttribute("data-term-id")};return this.commentsPagination.fetchAndEmpty(e,o),i.val(n),this.commentsList.allCollections.reset(),!1},changeSorting:function(e){this.$(".current-sorting").text(e.currentTarget.textContent),this.commentsList.allCollections.reset(),this.commentsPagination.fetchAndEmpty(e,{order:e.currentTarget.getAttribute("data-value")})},showHideElem:function(t){return e(t.currentTarget).parent().toggleClass("hideit"),!1},scrollToTop:function(){e("html, body").animate({scrollTop:0},"slow")},activateBulk:function(){var t=this.$("#tcm-bulk-checkbox");this.$(".tcm-comment-checkbox:checked").length?(t.prop("indeterminate",!0),t.addClass("indeterminate"),this.$(".tcm-apply-bulk").css("display","inline-block"),e(".tcm-bulk-action").show(),this.$(".tcm-moderation-mid").removeClass("hideit"),e(".tcm-comment-checkbox:checked").length===e(".tcm-comment-checkbox").length&&(t.prop("indeterminate",!1),t.removeClass("indeterminate"),t.prop("checked",!0))):(t.prop("indeterminate",!1),t.prop("checked",!1),t.removeClass("indeterminate"),this.$(".tcm-apply-bulk").hide(),e(".tcm-bulk-action").hide(),this.bulkActions.$el.parent().hasClass("sticky")&&this.bulkActions.$(".tcm-moderation-mid").addClass("hideit"))},stickyHeader:function(){if(e(window).width()>960){var t=this;e(window).scroll((function(){var n=e(window).scrollTop(),i=t.$("#tcm-header").height(),o=t.$(".tcm-moderation-header"),s=o.parent().outerWidth(),r=t.$("#tcm-holder");o.toggleClass("sticky",n>=i).css("width",s),t.$(".tcm-comment-checkbox:checked").length||o.find(".tcm-moderation-mid").toggleClass("hideit",n>=i),o.hasClass("sticky")?r.css("padding-top",o.outerHeight()+34):r.css("padding-top","")}))}},renderViewCommentsOnFilter:function(){var e=ThriveComments.routes.settings+"/redirect_autocomplete",t=this.$(".tcm-autocomplete");this.LinkAutocomplete(e,t,0)},bindSearchEvent:function(){var e=this,t=this.$("#tcm-keyword-search"),n=this.$(".search"),i=this.$(".tcm-reset-search").hide();return t.keydown((function(n){if(i.show(),13===n.keyCode)return e.doTheSearch(n,t,i)})),n.click((function(n){return e.doTheSearch(n,t,i)})),i.click((function(n){return i.hide(),""===t.val()||(t.val(""),e.commentsPagination.fetchAndEmpty(n,{search:""})),!1})),this},doTheSearch:function(e,t,n){var i=t.val();return""===i&&n.hide(),this.commentsPagination.fetchAndEmpty(e,{search:i}),!1},delegateModalData:function(t){var n=this;void 0===ThriveComments.tcm_moderators?(this.showOverlay(),e.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},cache:!1,dataType:"JSON",url:ThriveComments.moderation_routes.get_moderators,type:"GET"}).done((function(e){ThriveComments.tcm_moderators=e,n.showDelegateModal(t),n.hideOverlay()}))):this.showDelegateModal(t)},showDelegateModal:function(e){TVE_Dash.modal(ThriveComments.views.DelegateModal,e)},getPostNameById:function(t){var n=ThriveComments.routes.settings+"/get_post_name_by_id";jQuery.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},url:n,type:"POST",data:{postId:t}}).done((function(t){e("#tcm_post_autocomplete").removeClass("ui-autocomplete-loading")})).fail((function(e){TVE_Dash.err(JSON.parse(e.responseText).message)})).always((function(){TVE_Dash.hideLoader()}))},LinkAutocomplete:function(t,n){var i=this;n.autocomplete({delay:50,select:function(e,t){var n={post_id:t.item.id,tva_term:void 0!==t.item.tva_term};i.commentsList.allCollections.reset(),i.commentsPagination.fetchAndEmpty(e,n)},source:function(n,o){i.$(".clear-post-autocomplete").show(),e.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},url:t,dataType:"json",data:{q:n.term},type:"POST"}).done((function(e){i.commentsList.allCollections.reset(),o(e)})).fail((function(e){TVE_Dash.err(JSON.parse(e.responseText).message)}))}}),n.on("keyup",(function(e){""===n.val()&&i.postCleared(e)}))},postCleared:function(e){this.$(".clear-post-autocomplete").hide(),this.$(".tcm-autocomplete").val(""),this.commentsList.allCollections.reset(),this.commentsPagination.fetchAndEmpty(e,{post_id:0,tva_term:!1})}}),ThriveComments.views.CommentsList=ThriveComments.views.Base.extend({className:"tcm-comments-list",template:ThriveComments.util.tpl("moderation/comment-list"),events:{"click .tcm-admin-moderation-comment-item":"focusCommentAtClick"},commentsViews:[],initialize:function(){this.allCollections=new ThriveComments.collections.Comments},_render:function(t){var n=this;return t.forEach((function(e,t){n.renderOne(e,t)})),0===t.length&&0===this.$(".tcm-admin-moderation-comment-item").length&&(this.noCommentsMessage=new ThriveComments.views.NoCommentsMessage({el:n.$el})),this.mergeCollections(t),this.lazy_images(),e(window).trigger("scroll"),this},renderOne:function(e,t){var n=new ThriveComments.views.CommentItem({model:e}),i=n.render().$el;return 0!==t||this.$(".tcm-focused-element").length||i.addClass("tcm-focused-element"),i.attr("data-index",t),this.$el.append(i),this.commentsViews[e.get("id")]=n,this},mergeCollections:function(e){return this.allCollections.add(e.models),this},focusCommentAtClick:function(t){var n=e(t.currentTarget);n.addClass("tcm-focused-element"),n.siblings().removeClass("tcm-focused-element")},lazy_images:function(){var t=this;e(window).on("scroll",(function(){t.show_images()}))},show_images:function(){var t=this;e("div.no-image").each((function(n,i){var o=e(i);!0!==o.data("social-avatar")&&ThriveComments.util.elem_viewport(o)&&(t.set_avatar_url(o),o.removeClass("no-image"))}))},set_avatar_url:function(e){var t=this;e.length&&e.attr("data-src")===ThriveComments.default_author_picture_url&&ThriveComments.util.checkGravatar(e.attr("data-email-hash")).done((function(n){var i='url("'+n+'")';e.css("background-image",i),t.setImageOnModel(e,i)}))},setImageOnModel:function(e,t){var n=e.closest(".tcm-moderation-comment").attr("data-comment-id"),i=this.allCollections.findWhere({id:parseInt(n)});void 0!==i&&i.set("author-background-image",t)}}),ThriveComments.views.CommentsCounters=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/comment-counters"),events:{"click .tcm-filters li":"changeTab"},active_tab_class:"total",initialize:function(e){this.counters=e.counters,this.commentsPagination=e.commentsPagination,this.moderation_view=e.moderation_view,this.render()},_render:function(e){var t=void 0!==e?this.getCountersFromHeaders(e):this.counters;return t.active_class=this.active_tab_class,this.$el.empty().append(this.template({items:t})),this},getCountersFromHeaders:function(e){var t=void 0!==e.xhr?e.xhr:e;return{pending:t.getResponseHeader("X-WP-PENDING"),pendingMyReply:t.getResponseHeader("X-WP-PENDING-MY-REPLY"),total:t.getResponseHeader("X-WP-Total"),unreplied:t.getResponseHeader("X-WP-UNREPLIED"),featured:t.getResponseHeader("X-WP-FEATURED"),spam:t.getResponseHeader("X-WP-SPAM"),trash:t.getResponseHeader("X-WP-TRASH")}},changeTab:function(e){var t,n=e.currentTarget.getAttribute("data-status"),i={},o=e.currentTarget.getAttribute("data-meta");o&&(t=o===ThriveComments.const.moderation.tcm_delegate?ThriveComments.current_user.ID:1,i[o]=t);var s={meta_query:i,status:n};return this.setActiveTabClass(e),this.commentsPagination.view.allCollections.reset(),this.commentsPagination.fetchAndEmpty(e,s),this.moderation_view.bulkActions.render({bulklist:ThriveComments.util.getDropDownItems(s)}),!1},setActiveTabClass:function(e){var t=e.currentTarget.className.split(/\s+/);return this.active_tab_class=t[0],this}}),ThriveComments.views.CommentItemMessages=ThriveComments.views.Base.extend({className:"pending-no-collapse",template:ThriveComments.util.tpl("moderation/comment-messages"),events:{"click .tcm-see-content":"showContent"},initialize:function(e){this.parentView=e.parentView,this.previousAction=e.previousAction,this.render()},render:function(){this.$el.html(this.template())},showContent:function(){return"reply"===this.previousAction&&this.parentView.replyAction(),"edit_comment"===this.previousAction&&this.parentView.editComment(),!1}}),ThriveComments.views.CommentItem=ThriveComments.views.Base.extend({className:"tcm-admin-moderation-comment-item",template:ThriveComments.util.tpl("moderation/comment-item"),events:{"click .expand-reply":"expandReply","click .change-status":"changeStatus","click .delete-comment":"deleteComment","click .edit-status":"editComment","click .undo-action":"undoAction","click .cancel-edit":"closeEdit","click .save-edit":"saveEdit","click .reply-action":"replyAction","click .cancel-reply":"closeReply","click .save-reply":"submitReply","click .delegate-comment":"delegateComment","click .tvo-comment-button":"saveTestimonial","keydown .tcm-comment-content":"escEditComment","keydown .tcm-comment-content-reply":"escReplyComment","click .tcm-tooltip-link":"clickCopyMail","focus .tcm-last-tabindex":"focusTextArea","focus .tcm-last-edit-tabindex":"focusEditArea","mousedown .tcm-hyperlink":"openHyperLink"},actions:{approved:ThriveComments.translations.approved,hold:ThriveComments.translations.unapproved,edit_comment:ThriveComments.translations.edit,delegate_comment:ThriveComments.translations.delegate,no_reply_needed:ThriveComments.translations.no_reply_needed,needs_reply:ThriveComments.translations.reply_needed,reply:ThriveComments.translations.reply,featured:ThriveComments.translations.feature_text,stop_featuring:ThriveComments.translations.stop_feature_text},initialize:function(){this.counters=ThriveComments.objects.CommentsCounters,this.comments_list=ThriveComments.objects.CommentsList,this.filters=ThriveComments.objects.CommentsPagination.filters,this.moderation_view=ThriveComments.objects.CommentsPagination.moderation_view,this.listenTo(this.model,"sync",this.modelSynced)},_render:function(){return this.setExpandReplyContent(),this.$el.html(this.template({comment:this.model})),"delete"===this.model.get("status")&&this.remove(),this.setImageSrc(),this.cooltips(),new ClipboardJS(".tcm-tooltip-link"),this.model.get("is_minified")&&this.minimizeComment(this.model,this.counters.active_tab_class.replace(/-/g,"_")),this},modelSynced:function(){var e=this;if("content"in this.model.changed){var t=this.comments_list.allCollections.where({parent:parseInt(this.model.get("id"))});_.each(t,(function(t){t.get("tcm_parent_comment").comment_content=e.model.get("content").raw,t.trigger("sync")}))}this.setImageSrc(),this.render()},setImageSrc:function(){var e=this.$(".moderation-img");this.model.get("author-background-image")&&e.css("background-image",this.model.get("author-background-image"))},escReplyComment:function(e){return 27!==e.keyCode||(this.$("a.cancel-reply").click(),!1)},escEditComment:function(e){return 27!==e.keyCode||(this.$("a.cancel-edit").click(),!1)},cooltips:function(){var e,t=this.$("[class^='tooltipelem']"),n=t.find(".tooltiptext");t.bind({mouseenter:function(t){clearInterval(e),n.hide(),jQuery(t.currentTarget).find(".tooltiptext").show()},mouseleave:function(t){e=setTimeout((function(){jQuery(t.currentTarget).find(".tooltiptext").hide()}),1e3)}})},setExpandReplyContent:function(){if(0!==this.model.get("parent")&&this.model.get("tcm_parent_comment")){var e=this.model.get("tcm_parent_comment").comment_content;if(e&&e.length>140){var t=e.substring(0,140);t=t.split(" ").slice(0,-1).join(" ")+"&nbsp;&hellip;",this.model.set("parent_excerpt",t)}}},expandReply:function(t){return e(t.currentTarget).toggleClass("expanded"),this.$(".tcm-short-content").slideToggle(),this.$(".tcm-parent-all-content").slideToggle(),!1},changeStatus:function(e){var t=e.currentTarget.getAttribute("data-status"),n=e.currentTarget.getAttribute("data-value");return"function"==typeof this[t]&&this[t](e,n),!1},changeApprove:function(e,t){var n,i=this,o=null,s={};return ThriveComments.const.moderation.unapprove===t&&"0"!==this.model.get("tcm_featured")&&(this.model.set("tcm_featured",0),o={update_meta:"tcm_featured"},s.tcm_featured=0),(o=_.extend({},this.filters,o)).action_status=t,o.sync=!1,n=this.model.toJSON(),this.model.set("status",t).save(o,{success:function(e,t,n){i.counters.render(n),i.actionsAfterSuccess()},error:function(e,t,o){i.ajaxError(t,o,n)}}),s.status=t,s.previousAction=t===ThriveComments.const.moderation.unapprove?ThriveComments.const.moderation.unapprove:ThriveComments.const.moderation.approve,this.actionsAfterAjax(s),this},ajaxError:function(e,t,n){void 0!==n&&this.model.set(n);var i=this.getErrorMessage(e,t);this.actionsAfterError(i)},actionsAfterSuccess:function(){var t=this;this.childView.isMin||this.model.trigger("sync");var n=this.$(".tcm-pending-save"),i=this.$(".replace-after-success");n.length&&i.length&&(n.addClass("tcm-request-success"),setTimeout((function(){n.find("span.tcm-text").fadeOut(0),""!==i.html().trim()?n.parent().parent().html(i.html()):t.childView.isMin?n.find("span.tcm-check").fadeIn(1500):n.find("span.tcm-check").fadeIn(1500,(function(){e(this).delay(1500).fadeOut(1500)}))}),1e3))},actionsAfterError:function(e){this.childView.isMin||this.model.trigger("sync");var t,n=this.$(".tcm-pending-save"),i=this.$(".tcm-pending-error"),o=this.$(".tcm-pending-error .tooltiptext"),s=e;e=this.generateErrorMessage(e),TVE_Dash.err(s,5e3),n.addClass("tcm-request-error"),n.find("span.tcm-text").html(ThriveComments.translations.error).hide(),i.css("display","inline"),o.html(e),i.bind({mouseenter:function(e){clearInterval(t),o.hide(),jQuery(e.currentTarget).find(".tooltiptext").show()},mouseleave:function(e){t=setTimeout((function(){jQuery(e.currentTarget).find(".tooltiptext").hide()}),1e3)}})},generateErrorMessage:function(e){if(this.childView.isMin)return e;var t,n=this.childView.model.get("previousAction");return t=e+ThriveComments.translations.moderation_error+": "+this.actions[n],"reply"===n&&(t+="<a href='#' class='tcm-see-content'>"+ThriveComments.translations.see_comment_reply+"</a>"),"edit_comment"===n&&(t+="<a href='#' class='tcm-see-content'>"+ThriveComments.translations.see_comment_edit+"</a>"),t},spamComment:function(e,t){var n=this,i=_.extend({action_status:t,sync:!1},this.filters,i),o=this.model.toJSON(),s={};return this.model.set("can-undo",1),this.model.set("undo-action",ThriveComments.translations.spam),this.model.set("status",t).save(i,{success:function(e,t,i){n.counters.render(i),n.actionsAfterSuccess()},error:function(e,t,i){n.ajaxError(t,i,o),n.changeUndo()}}),s.status=t,this.actionsAfterAjax(s),this},unspam:function(e,t){var n,i=this,o=_.extend({sync:!1},this.filters),s={};return n=this.model.toJSON(),o.action_status=t,this.model.set("status",t).save(o,{success:function(e,t,n){i.counters.render(n),i.actionsAfterSuccess()},error:function(e,t,o){i.ajaxError(t,o,n)}}),s.status=t,s.previousAction="unspam",this.actionsAfterAjax(s),this},featured:function(e,t){var n,i=this,o={},s=_.extend({sync:!1},this.filters,{update_meta:"tcm_featured"});return n=this.model.toJSON(),this.model.get("status")!==ThriveComments.const.moderation.approve&&(this.model.set("status",ThriveComments.const.moderation.approve),s.action_status=ThriveComments.const.moderation.approve),this.model.set("tcm_featured",parseInt(t)),this.model.save(s,{success:function(e,t,n){i.counters.render(n),i.actionsAfterSuccess()},error:function(e,t,o){i.ajaxError(t,o,n)}}),o.status=ThriveComments.const.moderation.approve,o.previousAction="featured",this.actionsAfterAjax(o),this},stopFeaturing:function(e,t){var n=this,i=_.extend({sync:!1},this.filters,{update_meta:"tcm_featured"}),o={},s=this.model.toJSON();return this.model.set("tcm_featured",parseInt(t)),this.model.save(i,{success:function(e,t,i){n.counters.render(i),n.actionsAfterSuccess()},error:function(e,t,i){n.ajaxError(t,i,s)}}),o.status=s.status,o.previousAction="stop_featuring",this.actionsAfterAjax(o),this},undoAction:function(){var e=this,t="trash"===this.model.get("status")?"untrash":"unspam",n=_.extend({},this.filters);return n.action_status=t,this.model.set("status",t),this.model.save(n,{success:function(t,n,i){t.set("can-undo",0),e.counters.render(i)},error:this.saveSettingError}),!1},trashComment:function(e,t){var n=this,i=_.extend({action_status:t,sync:!1},this.filters),o=this.model.toJSON(),s={};return this.model.set("status",t),this.model.set("can-undo",1),this.model.set("undo-action",ThriveComments.translations.trash),this.model.save(i,{success:function(e,t,i){n.counters.render(i),n.actionsAfterSuccess()},error:function(e,t,i){n.ajaxError(t,i,o),n.changeUndo()}}),s.status=t,s.previousAction="trash",this.actionsAfterAjax(s),this},restoreComment:function(e,t){var n=this,i=_.extend({sync:!1},this.filters),o=this.model.toJSON(),s={};return i.action_status=t,this.model.set("status",t).save(i,{success:function(e,t,i){n.counters.render(i),n.actionsAfterSuccess()},error:function(e,t,i){n.ajaxError(t,i,o)}}),s.status=t,s.previousAction="restore",this.actionsAfterAjax(s),!1},deleteComment:function(){var t=this,n={force:!0};return this.filters.post_id&&(n.post_id=this.filters.post_id),this.model.destroy({data:n,processData:!0}).done((function(n,i,o){var s=e("li.active").attr("data-arg"),r=t.counters.getCountersFromHeaders(o);t.remove(),t.counters.render(o),"0"===r[s]&&(this.noCommentsMessage=new ThriveComments.views.NoCommentsMessage({el:e(".tcm-moderation-container")})),e(window).trigger("scroll")})).fail(this.saveSettingError),this},replyNeeded:function(e,t){var n,i=this,o={},s=_.extend({sync:!1},this.filters,{update_meta:"tcm_needs_reply"});return n=this.model.toJSON(),2===parseInt(t)&&"hold"===this.model.get("status")&&(s.action_status=ThriveComments.const.moderation.approve,this.model.set("status",ThriveComments.const.moderation.approve),o.status=ThriveComments.const.moderation.approve),this.model.set("tcm_needs_reply",parseInt(t)),this.model.save(s,{success:function(e,t,n){i.counters.render(n),i.actionsAfterSuccess()},error:function(e,t,o){i.ajaxError(t,o,n)}}),void 0===o.status&&(o.status=n.status),o.tcm_needs_reply=parseInt(t),o.previousAction=1===parseInt(t)?"needs_reply":"no_reply_needed",this.actionsAfterAjax(o),this},getErrorMessage:function(e,t){var n="";if(e.responseJSON.message)n=e.responseJSON.message;else if(e.responseText)try{n="parsererror"===status?"Could not parse response: "+e.responseText:JSON.parse(e.responseText).message}catch(e){}return n||(n=(e.statusText||status)+(e.status?" ("+e.status+")":"")),n},editComment:function(){var t=this.$(".edit-section");e(".reply-action").show(),e(".edit-section").hide(),e(".reply-section").hide(),t.show().find("textarea").focus()},closeEdit:function(){return this.$(".edit-section").hide(),!1},saveEdit:function(){var e,t=this,n=this,i=this.$(".tcm-comment-content"),o=this.$(".tcm-edit-name"),s=this.$(".tcm-edit-email"),r=this.$(".tcm-edit-website"),a=r.val(),m=!0,c={};return ThriveComments.util.validateInput(i,ThriveComments.translations.comment_content_missing,!0)||(m=!1),ThriveComments.util.validateInput(o,ThriveComments.translations.author_name_required,!0)||(m=!1),""!==s.val()&&ThriveComments.util.validateEmail(s,ThriveComments.util.render_label("isRequired"))||(s.prev(".tcm-error-message").show().html(ThriveComments.util.render_label("isRequired")),m=!1),""!==r.val()&&(a=ThriveComments.util.addHttp(a),ThriveComments.util.isValidUrl(a)||(r.prev(".tcm-error-message").show().html(ThriveComments.util.render_label("isRequired")),m=!1)),!!m&&(e=this.model.toJSON(),c.content=_.clone(this.model.get("content")),c.content.raw=i.val(),c.content.rendered="<p>"+i.val()+"</p>",c.author_name=o.val(),c.author_email=s.val(),c.author_url=a,this.model.get("author_ip")||this.model.set("author_ip","127.0.0.1"),this.model.set(c),this.model.save({sync:!1},{success:function(){t.actionsAfterSuccess()},error:function(o,s,r){t.ajaxError(s,r,e),n.$(".tcm-comment-content").val(i.val())}}),c.previousAction="edit_comment",c.status=e.status,this.actionsAfterAjax(c),!0)},replyAction:function(){var t,n,i,o,s=this.$(".reply-section"),r=s.find("textarea");return e(".reply-action").show(),e(".edit-section").hide(),e(".reply-section").hide(),this.$(".reply-action").hide(),setTimeout((function(){s.find("grammarly-btn").length&&s.find(".textarea-container").addClass("tcm-has-grammarly")}),1e3),s.show(),r.focus(),t=r.offset().top,o=(n=r.height())<(i=e(window).height())?t-(i/2-n/2):t,e("html, body").animate({scrollTop:o},500),!1},closeReply:function(){return this.$(".reply-section").hide(),this.$(".reply-action").show(),!1},submitReply:function(){var e,t=this,n={};this.model.set("tcm_comments_author_count",this.model.get("tcm_comments_author_count")+1);var i={children:[],content:this.$(".tcm-comment-content-reply").val(),comment_author:ThriveComments.current_user.display_name,comment_author_email:ThriveComments.current_user.user_email,parent:this.model.get("id"),post:this.model.get("post"),user_id:ThriveComments.current_user.ID,tcm_needs_reply:2},o=_.extend({},this.filters);return e=this.model.toJSON(),o.action_status=ThriveComments.const.moderation.approve,this.model.get("tva_term_id")&&(o.tva_term_id=this.model.get("tva_term_id")),o.sync=!1,(i=new ThriveComments.models.Comment(i)).save(o,{success:function(e,n){if(t.comments_list){t.comments_list.allCollections.add(e);var i=new ThriveComments.views.CommentItem({model:e}),o=i.render().$el;t.$el.after(o),t.comments_list.commentsViews[e.get("id")]=i}t.actionsAfterSuccess(),t.updateParent()},error:function(n,i,o){t.ajaxError(i,o,e),t.$(".tcm-comment-content-reply").html(n.get("content"))}}),n.status=ThriveComments.const.moderation.approve,n.previousAction="reply",this.actionsAfterAjax(n),!1},actionsAfterAjax:function(e){this.$("#tcm-comment-content").val(""),this.$(".reply-section").hide(),this.model.set(e),this.model.set("is_minified",1),this.model.trigger("sync")},changeUndo:function(){var e=this.$(".undo-action");e.html(ThriveComments.translations.moderation_expand),e.removeClass("undo-action").addClass("expand-action"),e.data("data-key","x")},updateParent:function(){var e=this,t=_.extend({},this.filters),n=this.model.toJSON();this.model.get("status")!==ThriveComments.const.moderation.approve&&this.model.set("status",ThriveComments.const.moderation.approve),t.action_status=ThriveComments.const.moderation.approve,t.sync=!1,this.model.set("update_meta","tcm_needs_reply"),this.model.set("tcm_needs_reply",0).save(t,{success:function(t,n,i){e.counters.render(i),e.actionsAfterSuccess()},error:function(t,i,o){e.ajaxError(i,o,n)}})},replyError:function(e){var t,n=this.$(".min-comment .tcm-pending-save"),i=this.$(".min-comment .tcm-pending-error"),o=this.$(".tooltiptext");TVE_Dash.err(e,5e3),n.addClass("tcm-request-error"),n.find("span").html("Error"),i.show(),o.html(e),i.bind({mouseenter:function(e){clearInterval(t),o.hide(),jQuery(e.currentTarget).find(".tooltiptext").show()},mouseleave:function(e){t=setTimeout((function(){jQuery(e.currentTarget).find(".tooltiptext").hide()}),1e3)}})},delegateComment:function(){this.moderation_view.unbindKeyboardEvents(),this.moderation_view.delegateModalData({model:this.model,dismissible:!1,className:"tvd-modal tcm-modal-delegate",counters:this.counters,commentView:this})},saveTestimonial:function(){"undefined"!=typeof ThriveOvation&&ThriveOvation.comments.addEditTestimonial(this.model.get("id"))},clickCopyMail:function(){TVE_Dash.success(ThriveComments.translations.email_copied)},focusTextArea:function(){e(".tcm-comment-content-reply").focus()},focusEditArea:function(){e(".tcm-comment-content").focus()},openHyperLink:function(){this.hyperlink=new ThriveComments.views.HyperLink({el:this.$(".tcm-hyperlink-dropdown"),selected_text:ThriveComments.util.formatSelection(this.$(".tcm-comment-content-reply")),commentView:this}),this.$(".tcm-hyperlink-dropdown").show().addClass("dropdown")},minimizeComment:function(t,n){this.childView=new ThriveComments.views.CommentMinimum({el:this.$(".min-comment"),model:t,parentView:this,activeTab:n}),this.childView.render(),e(window).trigger("scroll")}}),ThriveComments.views.CommentMinimum=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/comment-item-min"),events:{"click .expand-action":"expandParent","click .undo-action":"undoAction"},isMin:0,initialize:function(e){this.parentView=e.parentView,this.activeTab=e.activeTab},render:function(){var e=this,t=this.afterActionMessage();if(t){var n=this.parentView.$(".tcm-moderation-comment-container");this.$el.html(this.template({comment:this.model,text:t})),n.animate({height:"80px"},{queue:!1,duration:400,complete:function(){n.fadeOut((function(){e.$el.show()}))}}),this.isMin=1}else this.notCollapsingComments(),this.isMin=0;return this},notCollapsingComments:function(){var e,t=this.model.get("previousAction"),n=this.parentView.$(".pending-no-collapse"),i=this.parentView.$(".replace-after-success");switch(t){case"hold":case"approved":case"edit_comment":case"featured":case"stop_featuring":e=this.parentView.$(".awaiting-moderation");break;case"needs_reply":case"no_reply_needed":case"reply":e=this.parentView.$(".no-reply-needed");break;case"delegate_comment":e=this.parentView.$(".assigned-to")}this.commentMessages=new ThriveComments.views.CommentItemMessages({parentView:this.parentView,previousAction:t}),e&&(i.html(e.html()),e.html(this.commentMessages.$el),n.show())},expandParent:function(){return this.parentView.model.set("is_minified",0),this.parentView.render(),this.parentView.$(".tcm-moderation-comment-container").hide().slideDown(),!1},undoAction:function(){var e=this,t="trash"===this.parentView.model.get("status")?"untrash":"unspam",n=_.extend({},this.filters),i=this.parentView.model.toJSON();return n.action_status=t,n.sync=!1,this.parentView.model.set("status",t),this.parentView.model.save(n,{success:function(t,n,i){e.parentView.counters.render(i),e.expandParent()},error:function(t,n,o){var s=e.parentView.getErrorMessage(n,o);e.parentView.actionsAfterError(s),e.parentView.model.set(i)}}),!1},afterActionMessage:function(){var e;return(e=this.handleSpamTrash())?e:"function"==typeof this[this.activeTab]&&this[this.activeTab]()},handleSpamTrash:function(){var e=this.model.get("status");if(e===ThriveComments.const.moderation.spam||e===ThriveComments.const.moderation.trash){var t=e===ThriveComments.const.moderation.spam?ThriveComments.translations.moderation_spam:ThriveComments.translations.moderation_trash;return this.getMessage(t)}return!1},total:function(){return!1},pending:function(){return this.model.changedAttributes(),this.model.get("status")===ThriveComments.const.moderation.approve&&("reply"===this.model.get("previousAction")?this.getMessage(ThriveComments.translations.moderation_replied):"no_reply_needed"===this.model.get("previousAction")?this.getMessage(ThriveComments.translations.moderation_no_replied):"featured"===this.model.get("previousAction")?this.getMessage(ThriveComments.translations.moderation_featured):this.getMessage(ThriveComments.translations.moderation_approved))},unreplied:function(){var e=!1;switch(this.model.get("previousAction")){case"no_reply_needed":e=this.getMessage(ThriveComments.translations.moderation_no_replied);break;case"reply":e=this.getMessage(ThriveComments.translations.moderation_replied)}return e},pending_my_reply:function(){var e=this.model.changedAttributes();return"reply"===this.model.get("previousAction")?this.getMessage(ThriveComments.translations.moderation_replied):"no_reply_needed"===this.model.get("previousAction")?this.getMessage(ThriveComments.translations.moderation_no_replied):"delegate_comment"===this.model.get("previousAction")&&this.getMessage(ThriveComments.translations.moderation_delegate+" "+e.tcm_delegate_author)},tcm_featured:function(){return this.model.changed,"stop_featuring"===this.model.get("previousAction")?this.getMessage(ThriveComments.translations.moderation_no_featured):"hold"===this.model.get("previousAction")&&this.getMessage(ThriveComments.translations.moderation_unapproved)},tcm_spam:function(){return"unspam"===this.model.get("previousAction")&&this.getMessage(ThriveComments.translations.moderation_not_spam)},tcm_trash:function(){return"restore"===this.model.get("previousAction")&&this.getMessage(ThriveComments.translations.moderation_restored)},getMessage:function(e){return ThriveComments.translations.comment_by+" "+this.model.get("author_name")+" "+e}}),ThriveComments.views.HyperLink=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/hyperlink"),events:{"click .hyperlink-close":"closeHyperLink","click .hyperlink-save":"saveHyperLink"},initialize:function(e){this.parentView=e&&e.commentView?e.commentView:null,this.selected_text=e.selected_text,this.render()},render:function(){return this.$el.html(this.template({selected_text:this.selected_text.selectedText})),TVE_Dash.materialize(this.$el),this.initAutocomplete(),this.disableSave(),this},closeHyperLink:function(){this.viewRemove(),e(".tcm-hyperlink-dropdown").hide().removeClass("dropdown")},disableSave:function(){var t=e("#tcm_hyperlink_url"),n=e(".hyperlink-save");t.bind("change keyup input",(function(){""===t.val()?n.attr("disabled",!0):n.attr("disabled",!1)}))},saveHyperLink:function(){var e=this.$("#hyperlink-error"),t=this.$("#hyperlink-new-tab"),n=this.$("#hyperlink-no-follow"),i=ThriveComments.util.addHttp(this.$("#tcm_hyperlink_url").val()),o=this.$("#tcm_hyperlink_text").val(),s=this.parentView.$("#tcm-comment-content-reply");if(!ThriveComments.util.isValidUrl(i))return e.show(),!1;e.hide(),""===o&&(o=i);var r='<a href = "'+i+'"';if(t.is(":checked")&&(r+=' target="_blank"'),n.is(":checked")&&(r+=' rel="nofollow"'),r+=">"+o+"</a>",""===this.selected_text.selectedText)ThriveComments.util.insertAtCaret(s,r);else{var a=s.val();s.val(a.substring(0,this.selected_text.startPos)+r+a.substring(this.selected_text.endPos,a.length))}this.closeHyperLink()},getPostNameById:function(t){var n=ThriveComments.routes.settings+"/get_post_name_by_id";jQuery.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},url:n,type:"POST",data:{postId:t}}).done((function(t){e("#tcm_hyperlink").removeClass("ui-autocomplete-loading")})).fail((function(e){TVE_Dash.err(JSON.parse(e.responseText).message)})).always((function(){TVE_Dash.hideLoader()}))},LinkAutocomplete:function(t,n){var i=this,o=location.href.split("/");n.autocomplete({delay:50,select:function(e,t){return i.$("#link-error").hide(),i.$("#tcm_hyperlink_url").val(o[0]+"//"+o[2]+"?p="+t.item.id),i.$("#tcm_hyperlink_text").val(t.item.label),!1},source:function(n,i){e.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},url:t,dataType:"json",data:{q:n.term},type:"POST"}).done((function(t){e("#hyperlink-error").hide(),i(t)})).fail((function(e){TVE_Dash.err(JSON.parse(e.responseText).message)}))}})},initAutocomplete:function(){var e=ThriveComments.routes.settings+"/redirect_autocomplete",t=this.$(".tcm-autocomplete");this.LinkAutocomplete(e,t)},viewRemove:function(){return this.$el.empty(),this.undelegateEvents(),this.unbind(),this}}),ThriveComments.views.DelegateModal=TVE_Dash.views.Modal.extend({template:ThriveComments.util.tpl("moderation/delegate-comment"),events:{"click .tcm-delegate":"delegate_comment","click .moderation-doe":"focusAtClick"},keyboardEvents:{up:"upDown",down:"upDown",esc:"escAction",enter:"enterAction"},afterInitialize:function(e){"undefined"!==e.bulkActions&&(this.bulkActions=e.bulkActions),this.counters=e.counters,this.commentView=e.commentView},onClose:function(){ThriveComments.objects.ModerationView.delegateEvents()},onOpen:function(){if("0"===this.model.get("tcm_delegate"))return this.$(".moderators-list div").first().addClass("tcm-focused"),this;var e=this.$("#"+this.model.get("tcm_delegate")),t=this.$(".moderators-container");return e.addClass("tcm-focused"),t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-t.height()/2}),this},escAction:function(){return this.$(".tcm-back-btn").click(),!1},enterAction:function(){return this.$(".tvd-modal-submit").click(),!1},upDown:function(e){var t=this.$(".tcm-focused");return 106===e.keyCode||40===e.keyCode?this.changeFocus(t,t.next(".moderation-doe")):this.changeFocus(t,t.prev(".moderation-doe")),!1},focusAtClick:function(){var t=document.activeElement;e(".moderation-doe").removeClass("tcm-focused"),e(t).addClass("tcm-focused")},changeFocus:function(e,t){var n=this.$(".moderators-container");if(!t.length)return!1;var i,o=t.offset().top,s=t.height(),r=n.height();return i=s<r?o-(r/2-s/2):o,e.removeClass("tcm-focused"),t.addClass("tcm-focused"),n.animate({scrollTop:i},300,"easeOutQuint"),!0},delegate_comment:function(){var e=this,t=this.$(".tcm-focused").attr("id"),n=this.$(".tcm-focused").attr("data-name"),i=this.model.toJSON(),o={},s=_.extend({sync:!1},ThriveComments.objects.CommentsPagination.filters,{update_meta:"tcm_delegate"});void 0!==this.bulkActions?(this.bulkActions.ajaxData.value=t,this.bulkActions.ajaxData.delegator_name=n,this.bulkActions.bulkAjax(this.bulkActions.ajaxData)):(this.model.set("tcm_delegate",t).save(s,{success:function(t,n,i){e.counters.render(i),e.commentView.actionsAfterSuccess()},error:function(t,n,o){e.commentView.ajaxError(n,o,i)}}),o.status=i.status,o.tcm_delegate=t,o.previousAction="delegate_comment",this.commentView.actionsAfterAjax(o))}}),ThriveComments.views.CommentsPagination=ThriveComments.views.Base.extend({className:"tcm-admin-moderation-pagination",template:ThriveComments.util.tpl("moderation/comment-pagination"),events:{},comments_loaded:1,filters:{per_page:10,status:"all",order:"desc",orderby:"date",lastDate:0,context:"edit"},default_counters:{pending:0,pendingMyReply:0,total:0,unreplied:0,featured:0,spam:0,trash:0},initialize:function(e){this.collection=e.collection,this.view=e.view,this.moderation_view=e.moderation_view,ThriveComments.objects.CommentsCounters=new ThriveComments.views.CommentsCounters({el:this.moderation_view.$(".tcm-filters-container"),counters:this.default_counters,commentsPagination:this,moderation_view:e.moderation_view}),this.counters=ThriveComments.objects.CommentsCounters,this.initPagination()},_render:function(){return this.$el.html(this.template()),this.view.$el.append(this.$el),this},showCollection:function(e,t){this.view.render(this.collection),this.collection.length>=this.filters.per_page?this.render():this.$el.remove()},initPagination:function(){var e=this;jQuery(window).scroll((function(){e.comments_loaded&&ThriveComments.util.elem_viewport(e.$el)&&(e.nextPage(),e.comments_loaded=0)}))},fetchComments:function(t,n){var i=this;n=_.extend(this.filters,n),this.lastDate?"desc"===n.order?(n.before=this.lastDate,delete n.after):(n.after=this.lastDate,delete n.before):(delete n.before,delete n.after),ThriveComments.objects.Comments.fetch({data:n,reset:!0}).done((function(t,n,o){i.counters.render(o),i.showCollection();var s=i.counters.getCountersFromHeaders(o),r=e("li.active").attr("data-arg"),a=t.length?t[t.length-1].date:0;i.lastDate=a,i.initialCounter=s[r],i.comments_loaded=1,i.moderation_view.hideOverlay()}))},fetchAndEmpty:function(e,t){return this.view.$el.empty(),this.resetFilters(),this.moderation_view.showOverlay(),this.fetchComments(e,t),this},nextPage:function(){this.moderation_view.showOverlay(),this.fetchComments(null,{per_page:this.filters.per_page})},resetFilters:function(){this.lastDate=0}}),ThriveComments.views.BulkActions=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/bulk-actions"),events:{"click #tcm-bulk-checkbox":"activateBulk","click .tcm-apply-bulk":"applyAction","click .tcm-bulk-action":"changeOption"},commentIds:[],ajaxData:{},initialize:function(e){this.bulklist=e.bulklist,this.commentsList=e.commentsList,this.commentsPagination=e.commentsPagination,this.counters=ThriveComments.objects.CommentsCounters,this._render({bulklist:e.bulklist})},_render:function(e){this.$el.html(this.template(e)),this.$(".tcm-bulk-action").hide()},changeOption:function(e){var t=this.$(".current-bulk-option");t.text(e.currentTarget.textContent),t.attr("data-value",e.currentTarget.dataset.value),t.attr("data-status",e.currentTarget.dataset.status),t.attr("data-action",e.currentTarget.dataset.action)},activateBulk:function(){var t=this.$("#tcm-bulk-checkbox"),n=this.$(".tcm-apply-bulk"),i=e(".tcm-comment-checkbox"),o=e(".tcm-bulk-action");if(!e(".tcm-comment-checkbox").length)return!1;t.hasClass("indeterminate")?(t.removeClass("indeterminate"),t.prop("checked",!1),i.prop("checked",!1),o.hide(),n.hide()):t.is(":checked")&&this.commentsList.collection.length?(i.prop("checked",!0),o.show(),n.css("display","inline-block")):(i.prop("checked",!1),n.hide(),o.hide())},bulkAjax:function(t){var n=this,i=this.buildPreviousAttributes(t.comment_ids);e.ajax({headers:{"X-WP-Nonce":ThriveComments.nonce},cache:!1,dataType:"JSON",url:ThriveComments.moderation_routes.bulk_actions,type:"POST",data:t}).done((function(t,i,o){var s=t.data;s.length===n.commentsList.collection.length&&"delete"===s[0].new_value&&(n.noCommentsMessage=new ThriveComments.views.NoCommentsMessage({el:e(".tcm-moderation-container")})),s.forEach((function(e){void 0!==n.commentsList.commentsViews[e.id]&&n.commentsList.commentsViews[e.id].actionsAfterSuccess()})),n.counters.render(o)})).fail((function(e,o){var s,r;e.responseJSON.data&&(s=e.responseJSON.data.comment_id);for(var a=0;a<t.comment_ids.length;a++){var m=t.comment_ids[a];(s===m||r)&&(void 0!==n.commentsList.commentsViews[m]&&n.commentsList.commentsViews[m].ajaxError(e,o,i[m]),r=!0)}})).always((function(){n.commentIds=[];var t=n.$("#tcm-bulk-checkbox");e(".tcm-comment-checkbox").prop("checked",!1),t.prop("indeterminate",!1),t.prop("checked",!1),t.removeClass("indeterminate"),n.$(".tcm-apply-bulk").hide()})),this.actionsAfterBulkAjax(t)},actionsAfterBulkAjax:function(e){var t=this;e.comment_ids.forEach((function(n){var i=t.getSuccessAttributes(e);void 0!==t.commentsList.commentsViews[n]&&t.commentsList.commentsViews[n].actionsAfterAjax(i)}))},getSuccessAttributes:function(e){var t=[];return t[e.status]=e.value,t.previousAction=e.previousAction,void 0!==e.delegator_name&&(t.tcm_delegate_author=e.delegator_name),"status"===e.status&&ThriveComments.const.moderation.unapprove===e.value&&(t.tcm_featured=0),"tcm_featured"===e.status&&1===parseInt(e.value)&&(t.status=ThriveComments.const.moderation.approve),t},buildPreviousAttributes:function(e){var t=this,n=[];return void 0===e||e.forEach((function(e){var i=t.commentsList.allCollections.findWhere({id:parseInt(e)});void 0!==i&&(n[e]=i.toJSON())})),n},applyAction:function(t){var n=this.$(".current-bulk-option"),i=n.attr("data-status"),o=n.attr("data-value"),s=n.attr("data-action"),r=this;e(".tcm-comment-checkbox:checked").each((function(){r.commentIds.push(this.id)})),this.ajaxData=_.extend({},r.commentsPagination.filters,{comment_ids:this.commentIds,status:i,value:o,previousAction:s}),"tcm_delegate"===i?this.commentsPagination.moderation_view.delegateModalData({model:ThriveComments.objects.Comments.first(),bulkActions:this,dismissible:!1,"max-width":"25%",counters:this.counters}):this.bulkAjax(this.ajaxData),this.$(".tcm-bulk-action").hide()}}),ThriveComments.views.KeyboardTooltipContainer=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/keyboard-tooltip"),events:{"click .esc":"hide"},keyboardEvents:{esc:"hide",up:"returnFalse",down:"returnFalse"},returnFalse:function(){return!1},initialize:function(e){this.moderation_view=e.moderation_view,this._render(),this.moderation_view.bindKeyboardEvents()},_render:function(){return this.$el.html(this.template({})),e(document).ready((function(){e(".scrollbar-inner").scrollbar()})),this},hide:function(){e(".keyboard-tooltip-container").hide(),e("body").css("overflow","visible"),this.moderation_view.bindKeyboardEvents()}}),ThriveComments.views.KeyboardNotification=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/keyboard-notification"),events:{"click #show-keyboard-notification-checkbox":"saveKeyboardNotificationSetting","click .esc":"hideKeyboardNotification","click .keyboard-notification-close":"hideKeyboardNotification",hover:"preventHide",mouseover:"preventHide"},hide_notification:!1,timeout:null,initialize:function(){e(window).on("resize",this.render.bind(this)).ready(this.render.bind(this));var t=ThriveComments.tcm_display_keyboard_notification_tooltip;if(t.length&&(this.hide_notification=_.find(JSON.parse(t),(function(e){return e===parseInt(ThriveComments.current_user.ID)}))),this.$el.css("opacity","0"),!this.hide_notification){var n=this;setTimeout((function(){n.showKeyboardNotification()}),1e3),this.timeout=setTimeout((function(){n.hideKeyboardNotification()}),4e3)}},render:function(){var t=e(".plus");return this.hide_notification||(this.$el.offset({top:t.offset().top,left:t.offset().left-this.$el.outerWidth()/2}),this.$el.html(this.template())),this},preventHide:function(e){clearTimeout(this.timeout);var t=this;this.timeout=setTimeout((function(){t.hideKeyboardNotification()}),5e3)},saveKeyboardNotificationSetting:function(e){new ThriveComments.models.KeyboardSettings({name:ThriveComments.const.moderation.tcm_keyboard_tooltip,value:e.currentTarget.checked}).save().done((function(e){TVE_Dash.success(ThriveComments.translations.settings_saved_success_toast)})).fail((function(e){TVE_Dash.err(ThriveComments.translations.settings_saved_fail_toast)}))},hideKeyboardNotification:function(e){this.$el.removeClass("tooltipDown").addClass("tooltipUp")},showKeyboardNotification:function(e){this.$el.removeClass("tooltipUp").addClass("tooltipDown")}}),ThriveComments.views.NoCommentsMessage=ThriveComments.views.Base.extend({template:ThriveComments.util.tpl("moderation/comment-list"),events:{},initialize:function(){this._render()},_render:function(){return this.$el.append(this.template()),this}}),window.ThriveComments=window.ThriveComments||{},ThriveComments.objects=ThriveComments.objects||{},function(e){var t=Backbone.Router.extend({view:null,$el:e("#tcm-admin-moderation-wrapper"),routes:{commentsModeration:"commentsModeration"},params:{},initialize:function(){},commentsModeration:function(){this.view&&this.view.remove(),this.view=new ThriveComments.views.CommentsModeration,this.$el.html(this.view.$el),ThriveComments.objects.ModerationView=this.view}});e((function(){ThriveComments.router=new t,Backbone.history.start({hashchange:!0}),Backbone.history.fragment||ThriveComments.router.navigate("#commentsModeration",{trigger:!0})}))}(jQuery)})();

Youez - 2016 - github.com/yon3zu
LinuXploit