How hard would it be to hack into an encrypted digital trunking system?

©2019 The1.Site - Brought to you by... atomnetworks.ca

People Who Like Thisx

Loading...

People Who viewed ThisX

Log in with your credentials

or    

Forgot your details?

Create Account

').appendTo("body"),jQuery.get(apTemplateUrl+"/"+a+".html",function(a){var b=jQuery("#apTemplate");b.text(a+b.text()),AnsPress.trigger("templateLoaded")})},getTemplate:function(a){return function(){if(0==jQuery("#apTemplate").length)return"";var b=new RegExp("#START BLOCK "+a+" #([\\S\\s]*?)#END BLOCK "+a+" #","g"),c=b.exec(jQuery("#apTemplate").text());return null==c?"":c[1]?c[1]:void 0}},isJSONString:function(a){try{return jQuery.parseJSON(a)}catch(a){return!1}},ajaxResponse:function(a){if(a=jQuery(a),"undefined"==typeof a.filter("#ap-response"))return console.log("Not a valid AnsPress ajax response."),{};var b=this.isJSONString(a.filter("#ap-response").html());return b&&"undefined"!==b&&_.isObject(b)?b:{}},ajax:function(a){var b=this;a=_.defaults(a,{url:ajaxurl,method:"POST"}),_.isString(a.data)&&(a.data=jQuery.apParseParams(a.data)),"undefined"==typeof a.data.action&&(a.data.action="ap_ajax");var c=a.success;return delete a.success,a.success=function(d){var e=a.context||null,f=b.ajaxResponse(d);f.snackbar&&AnsPress.trigger("snackbar",f),"function"==typeof c&&(d=jQuery.isEmptyObject(f)?d:f,c(d,e))},jQuery.ajax(a)},uniqueId:function(){return jQuery(".ap-uid").length},showLoading:function(a){AnsPress.hideLoading(a);var b=jQuery(a).data("loadclass")||"",c=jQuery(a).is('input[type="text"]'),d=this.uniqueId();if(!jQuery(a).is("button")&&!jQuery(a).is(".ap-btn")){var e=jQuery('
');jQuery("body").append(e);var f=jQuery(a).offset(),g=jQuery(a).outerHeight(),h=c?40:jQuery(a).outerWidth();return e.css({top:f.top,left:c?f.left+jQuery(a).outerWidth()-40:f.left,height:g,width:h}),jQuery(a).data("loading","#apuid-"+d),"#apuid-"+d}jQuery(a).addClass("show-loading"),$loading=jQuery(''),$loading.height(jQuery(a).height()),$loading.width(jQuery(a).height()),jQuery(a).append($loading)},hideLoading:function(a){jQuery(a).is("button")||jQuery(a).is(".ap-btn")?(jQuery(a).removeClass("show-loading"),jQuery(a).find(".ap-loading-span").remove(),jQuery(a).prop("disabled",!1)):"all"==a?jQuery(".ap-loading-icon").hide():jQuery(jQuery(a).data("loading")).hide()},getUrlParam:function(a){var b=jQuery.apParseParams(window.location.href);return"undefined"!=typeof a?"undefined"!=typeof b[a]?b[a]:null:b},modal:function(a,b){return b=b||{},"undefined"!=typeof this.modals[a]?this.modals[a]:(this.modals[a]=new AnsPress.views.Modal(_.extend({id:"ap-modal-"+a,title:aplang.loading,content:"",size:"medium"},b)),jQuery("body").append(this.modals[a].render().$el),this.modals[a])},hideModal:function(a,b){"undefined"==typeof b&&(b=!0),"undefined"!=typeof this.modals[a]&&(this.modals[a].hide(b),delete this.modals[a])},removeHash:function(){var a,b,c=window.location;a=document.body.scrollTop,b=document.body.scrollLeft,"pushState"in history?(history.pushState("",document.title,c.pathname+c.search),Backbone.history.navigate("/")):c.hash="",document.body.scrollTop=a,document.body.scrollLeft=b},loadCSS:function(a){var b=document.createElement("link");b.rel="stylesheet",b.href=a;var c=document.getElementsByTagName("head")[0];c.parentNode.insertBefore(b,c)}},Backbone.Events),_.templateSettings={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g},function(a){a.fn.autogrow=function(b){function c(c){var d,e=a(this),f=e.innerHeight(),g=this.scrollHeight,h=e.data("autogrow-start-height")||0;if(fh){d=e.clone().addClass(b.cloneClass).css({position:"absolute",zIndex:-10,height:""}).val(e.val()),e.after(d);do g=d[0].scrollHeight-1,d.innerHeight(g);while(g===d[0].scrollHeight);g++,d.remove(),e.focus(),gg&&b.animate?e.stop().animate({height:g},b.speed):e.innerHeight(g)}else e.innerHeight(h)}var d=a(this).css({overflow:"hidden",resize:"none"}),e=d.selector,f={context:a(document),animate:!0,speed:50,fixMinHeight:!0,cloneClass:"autogrowclone",onInitialize:!1};return b=a.isPlainObject(b)?b:{context:b?b:a(document)},b=a.extend({},f,b),d.each(function(d,e){var f,g;e=a(e),e.is(":visible")||parseInt(e.css("height"),10)>0?f=parseInt(e.css("height"),10)||e.innerHeight():(g=e.clone().addClass(b.cloneClass).val(e.val()).css({position:"absolute",visibility:"hidden",display:"block"}),a("body").append(g),f=g.innerHeight(),g.remove()),b.fixMinHeight&&e.data("autogrow-start-height",f),e.css("height",f),b.onInitialize&&e.length&&c.call(e[0])}),b.context.on("keyup paste focus",e,c),d},jQuery.fn.apScrollTo=function(b,c,d){c=c||!1;var e=a(this).scrollTop()-a(this).offset().top,f=c?a(this).offset().top+a(this).height():a(this).offset().top;return a("html, body").stop(),a("html, body").animate({scrollTop:f},void 0==d?1e3:d),void 0!=b&&a(this).animate({scrollTop:e+a(b).offset().top},void 0==d?1e3:d),this},AnsPress.views.Snackbar=Backbone.View.extend({id:"ap-snackbar",template:'
{{message}}
',hover:!1,initialize:function(){AnsPress.on("snackbar",this.show,this)},events:{mouseover:"toggleHover",mouseout:"toggleHover"},show:function(a){var b=this;this.data=a.snackbar,this.data.success=a.success,this.$el.removeClass("snackbar-show"),this.render(),setTimeout(function(){b.$el.addClass("snackbar-show")},0),this.hide()},toggleHover:function(){clearTimeout(this.hoveTimeOut),this.hover=!this.hover,this.hover||this.hide()},hide:function(){var a=this;a.hover||(this.hoveTimeOut=setTimeout(function(){a.$el.removeClass("snackbar-show")},5e3))},render:function(){if(this.data){var a=_.template(this.template);this.$el.html(a(this.data))}return this}}),AnsPress.views.Modal=Backbone.View.extend({className:"ap-modal",template:'
<# if(typeof title !== \'undefined\' ){ #>{{title}}<# } #>
<# if(typeof content !== \'undefined\'){ #>{{{content}}}<# } #>
',events:{'click [ap="close-modal"]':"clickHide",'click [ap="modal-click"]':"clickAction"},initialize:function(a){a.title=a.title||aplang.loading,this.data=a},render:function(){a("html").css("overflow","hidden");var b=_.template(this.template);return this.$el.html(b(this.data)),this},clickHide:function(a){a.preventDefault(),this.hide()},hide:function(b){"undefined"==typeof b&&(b=!0),this.remove(),a("html").css("overflow",""),this.data.hideCb&&b&&this.data.hideCb(this);var c=this.data.id.replace("ap-modal-","");"undefined"!=typeof AnsPress.modals[c]&&delete AnsPress.modals[c]},setContent:function(a){this.$el.find(".ap-modal-content").html(a)},setTitle:function(a){this.$el.find(".ap-modal-header strong").text(a)},setFooter:function(a){this.$el.find(".ap-modal-footer").html(a)},clickAction:function(b){b.preventDefault();var c=a(b.target);q=c.data("apquery"),q.cb&&(q.element=c,AnsPress.trigger(q.cb,q))}});var b=/([^&=]+)=?([^&]*)/g,c=function(a){return decodeURIComponent(a.replace(/\+/g," "))};a.apParseParams=function(d){function e(b,c,d){if(c+="",c.indexOf(".")!==-1){var f=c.split("."),g=c.split(/\.(.+)?/)[1];b[f[0]]||(b[f[0]]={}),""!==g?e(b[f[0]],g,d):console.warn('parseParams :: empty property in key "'+c+'"')}else if(c.indexOf("[")!==-1){var f=c.split("[");c=f[0];var f=f[1].split("]"),h=f[0];""==h?(b||(b={}),b[c]&&a.isArray(b[c])||(b[c]=[]),b[c].push(d)):(b||(b={}),b[c]&&a.isArray(b[c])||(b[c]=[]),b[c][parseInt(h)]=d)}else b||(b={}),b[c]=d}d+="",""===d&&(d=window.location+"");var f,g={};if(d){if(d.indexOf("#")!==-1&&(d=d.substr(0,d.indexOf("#"))),d.indexOf("?")===-1)return{};if(d=d.substr(d.indexOf("?")+1,d.length),""==d)return{};for(;f=b.exec(d);){var h=c(f[1]),i=c(f[2]);e(g,h,i)}}return g}}(jQuery),function(a){AnsPress.Common={init:function(){AnsPress.on("showImgPreview",this.showImgPreview),AnsPress.on("formPosted",this.imageUploaded),AnsPress.on("ajaxBtnDone",this.uploadModal),AnsPress.on("ajaxBtnDone",this.commentModal),AnsPress.on("showModal",this.showModal)},readUrl:function(a,b){if(a.files&&a.files[0]){var c=new FileReader;c.onload=function(a){AnsPress.trigger("showImgPreview",a.target.result,b.find(".ap-upload-list"))},c.readAsDataURL(a.files[0])}},uploadModal:function(a){if("ap_upload_modal"==a.action&&a.html){$modal=AnsPress.modal("imageUpload",{title:a.title,content:a.html,size:"small"});var b=$modal.$el.find('input[type="file"]');b.on("change",function(){$modal.$el.find(".ap-img-preview").remove(),AnsPress.Common.readUrl(this,$modal.$el)})}},showImgPreview:function(b,c){a('').appendTo(c)},imageUploaded:function(b){"ap_image_upload"===b.action&&"undefined"!=typeof tinymce&&(b.files&&a.each(b.files,function(a,b){tinymce.activeEditor.insertContent('')}),AnsPress.hideModal("imageUpload"))},showModal:function(a){a.size=a.size||"medium",AnsPress.modal(a.name,{title:a.title,content:a.content,size:a.size})}}}(jQuery),jQuery(document).ready(function(a){AnsPress.Common.init();var b=new AnsPress.views.Snackbar;a("body").append(b.render().$el),a(document).click(function(b){b.stopPropagation(),a(b.target).is(".ap-dropdown-toggle")||a(b.target).closest(".open").is(".open")||a(b.target).closest("form").is("form")||a(".ap-dropdown").removeClass("open")}),a("body").on("click",".ap-dropdown-toggle, .ap-dropdown-menu > a",function(b){b.preventDefault(),a(".ap-dropdown").not(a(this).closest(".ap-dropdown")).removeClass("open"),a(this).closest(".ap-dropdown").toggleClass("open")}),a("[apsubscribe]").click(function(b){b.preventDefault();var c=a(this),d=JSON.parse(c.attr("apquery"));d.ap_ajax_action="subscribe",AnsPress.ajax({data:d,success:function(a){a.count&&c.next().text(a.count),a.label&&c.text(a.label)}})}),a("body").on("click",".ap-droptogg",function(b){b.preventDefault(),a(this).closest(".ap-dropdown").removeClass("open"),a(this).closest("#noti-dp").hide()}),a("body").on("click","[apajaxbtn]",function(b){var c=this;if(b.preventDefault(),"false"==a(this).attr("aponce")||!a(this).is(".loaded")){var c=a(this),d=JSON.parse(c.attr("apquery"));AnsPress.showLoading(c),AnsPress.ajax({data:d,success:function(d){"false"!=a(this).attr("aponce")&&a(c).addClass("loaded"),AnsPress.hideLoading(b.target),AnsPress.trigger("ajaxBtnDone",d),"undefined"!=typeof d.btn&&d.btn.hide&&c.hide(),"undefined"!=typeof d.cb&&AnsPress.trigger(d.cb,d,b.target),d.modal&&AnsPress.trigger("showModal",d.modal)}})}}),a('[data-role="ap-repeatable"]').each(function(){a(this).find(".ap-repeatable-add").on("click",function(b){b.preventDefault();var c=a(this),d=JSON.parse(c.attr("apquery"));AnsPress.showLoading(c),$count=a('[name="'+d.id+'-groups"]'),d.current_groups=$count.val(),$count.val(parseInt(d.current_groups)+1),$nonce=a('[name="'+d.id+'-nonce"]'),d.current_nonce=$nonce.val(),AnsPress.ajax({data:d,success:function(d){AnsPress.hideLoading(b.target),a(d.html).insertBefore(c),$nonce.val(d.nonce)}})}),a(this).on("click",".ap-repeatable-delete",function(b){b.preventDefault(),a(this).closest(".ap-form-group").remove()})}),a("body").on("click",".ap-form-group",function(){a(this).removeClass("ap-have-errors")}),a("body").on("click","button.show-loading",function(a){a.preventDefault()}),a("body").on("submit","[apform]",function(b){b.preventDefault();var c=a(this),d=a(this).find('button[type="submit"]');d.length>0&&AnsPress.showLoading(d),a(this).ajaxSubmit({url:ajaxurl,beforeSerialize:function(){"undefined"!=typeof tinymce&&tinymce.triggerSave(),a(".ap-form-errors, .ap-field-errors").remove(),a(".ap-have-errors").removeClass("ap-have-errors")},success:function(b){d.length>0&&AnsPress.hideLoading(d),b=AnsPress.ajaxResponse(b),b.snackbar&&AnsPress.trigger("snackbar",b),"undefined"!=typeof grecaptcha&&"undefined"!=typeof widgetId1&&grecaptcha.reset(widgetId1),AnsPress.trigger("formPosted",b),"undefined"!=typeof b.form_errors?($formError=a('
').prependTo(c),a.each(b.form_errors,function(a,b){$formError.append(''+b+"")}),a.each(b.fields_errors,function(b,c){a(".ap-field-"+b).addClass("ap-have-errors"),a(".ap-field-"+b).find(".ap-field-errorsc").html('
'),a.each(c.error,function(c,d){a(".ap-field-"+b).find(".ap-field-errors").append(''+d+"")})}),c.apScrollTo()):void 0!==typeof b.hide_modal&&AnsPress.hideModal(b.hide_modal),"undefined"!=typeof b.redirect&&(window.location=b.redirect)}})}),a(document).keyup(function(b){27==b.keyCode&&($lastModal=a(".ap-modal").last(),$lastModal.length>0&&($name=$lastModal.attr("id").replace("ap-modal-",""),AnsPress.hideModal($name)))}),AnsPress.on("loadedMoreActivities",function(b,c){a(b.html).insertAfter(a(".ap-activities:last-child")),a(c).closest(".ap-activity-item").remove()}),AnsPress.tagsPreset={tags:{delimiter:",",valueField:"term_id",labelField:"name",searchField:"name",persist:!1,render:{option:function(a,b){return'
'+b(a.name)+''+b(a.count)+''+b(a.description)+"
"}},create:!1,maxItems:4}},AnsPress.tagElements=function(b){var c=b.data("type"),d=b.data("options"),e=a("#"+d.id+"-options").length>0?JSON.parse(a("#"+d.id+"-options").html()):{},f=AnsPress.tagsPreset[c];f.options=e,f.maxItems=d.maxItems,!1!==d.create&&(f.create=function(a){return{term_id:a,name:a,description:"",count:0}}),f.load=function(a,b){return a.length?void jQuery.ajax({url:ajaxurl,type:"GET",dataType:"json",data:{action:"ap_search_tags",q:a,__nonce:d.nonce,form:d.form,field:d.field},error:function(){b()},success:function(a){b(a)}}):b()},b.selectize(f)},a("[aptagfield]").each(function(){AnsPress.tagElements(a(this))}),a("#anspress").on("click",".ap-remove-parent",function(b){b.preventDefault(),a(this).parent().remove()})}),window.AnsPress.Helper={toggleNextClass:function(a){jQuery(a).closest(".ap-field-type-group").find(".ap-fieldgroup-c").toggleClass("show")}},function(a){AnsPress.models.Action=Backbone.Model.extend({defaults:{cb:"",post_id:"",title:"",label:"",query:"",active:!1,header:!1,href:"#",count:"",prefix:"",checkbox:"",multiple:!1}}),AnsPress.collections.Actions=Backbone.Collection.extend({model:AnsPress.models.Action}),AnsPress.views.Action=Backbone.View.extend({id:function(){return this.postID},className:function(){var a="";return this.model.get("header")&&(a+=" ap-dropdown-header"),this.model.get("active")&&(a+=" active"),a},tagName:"li",template:'<# if(!header){ #>{{{prefix}}}{{label}}<# if(count){ #>{{count}}<# } #><# } else { #>{{label}}<# } #>',initialize:function(a){this.model=a.model,this.postID=a.postID,this.model.on("change",this.render,this),this.listenTo(this.model,"remove",this.removed)},events:{"click a":"triggerAction"},render:function(){var a=_.template(this.template);return this.$el.html(a(this.model.toJSON())),this.$el.attr("class",this.className()),this},triggerAction:function(a){var b=this.model.get("query");if(!_.isEmpty(b)){a.preventDefault();var c=this;AnsPress.showLoading(a.target);var d=this.model.get("cb");b.ap_ajax_action="action_"+d,AnsPress.ajax({data:b,success:function(b){AnsPress.hideLoading(a.target),b.redirect&&(window.location=b.redirect),!b.success||"status"!=d&&"toggle_delete_post"!=d||AnsPress.trigger("changedPostStatus",{postID:c.postID,data:b,action:c.model}),b.action&&c.model.set(b.action),c.renderPostMessage(b),b.deletePost&&AnsPress.trigger("deletePost",b.deletePost),b.answersCount&&AnsPress.trigger("answerCountUpdated",b.answersCount)}})}},renderPostMessage:function(b){_.isEmpty(b.postmessage)?a('[apid="'+this.postID+'"]').find("postmessage").html(""):a('[apid="'+this.postID+'"]').find("postmessage").html(b.postmessage)},removed:function(){this.remove()}}),AnsPress.views.Actions=Backbone.View.extend({id:function(){return this.postID},searchTemplate:'',tagName:"ul",className:"ap-actions",events:{"keyup [search-filter]":"searchInput"},initialize:function(a){this.model=a.model,this.postID=a.postID,this.multiple=a.multiple,this.action=a.action,this.nonce=a.nonce,AnsPress.on("changedPostStatus",this.postStatusChanged,this),this.listenTo(this.model,"add",this.added)},renderItem:function(a){var b=new AnsPress.views.Action({model:a,postID:this.postID});this.$el.append(b.render().$el)},render:function(){var a=this;return this.multiple&&this.$el.append(this.searchTemplate),this.model.each(function(b){a.renderItem(b)}),this},postStatusChanged:function(b){if(b.postID===this.postID){a("#post-"+this.postID).removeClass(function(){return this.className.split(" ").filter(function(a){return a.match(/status-/)}).join(" ")}),a("#post-"+this.postID).addClass("status-"+b.data.newStatus);var c=this.model.where({cb:"status",active:!0});c.forEach(function(a){a.set({active:!1})})}},searchInput:function(b){var c=this;clearTimeout(this.searchTO),this.searchTO=setTimeout(function(){c.search(a(b.target).val(),b.target)},600)},search:function(a,b){var c=this,d={nonce:this.nonce,ap_ajax_action:this.action,search:a,filter:this.filter,post_id:this.postID};AnsPress.showLoading(b),AnsPress.ajax({data:d,success:function(a){if(console.log(a),AnsPress.hideLoading(b),a.success){for(c.nonce=a.nonce;m=c.model.first();)c.model.remove(m);c.model.add(a.actions)}}})},added:function(a){this.renderItem(a)}}),AnsPress.models.Post=Backbone.Model.extend({idAttribute:"ID",defaults:{actionsLoaded:!1,hideSelect:""}}),AnsPress.views.Post=Backbone.View.extend({idAttribute:"ID",templateId:"answer",tagName:"div",actions:{view:{},model:{}},id:function(){return"post-"+this.model.get("ID")},initialize:function(a){this.listenTo(this.model,"change:vote",this.voteUpdate),this.listenTo(this.model,"change:hideSelect",this.selectToggle)},events:{"click [ap-vote] > a":"voteClicked",'click [ap="actiontoggle"]:not(.loaded)':"postActions",'click [ap="select_answer"]':"selectAnswer"},voteClicked:function(b){if(b.preventDefault(),!a(b.target).is(".disable")){self=this;var c=a(b.target).is(".vote-up")?"vote_up":"vote_down",d=_.clone(self.model.get("vote")),e=_.clone(d);"vote_up"===c?e.net="vote_up"===e.active?e.net-1:e.net+1:e.net="vote_down"===e.active?e.net+1:e.net-1,self.model.set("vote",e);var f=a.parseJSON(a(b.target).parent().attr("ap-vote"));f.ap_ajax_action="vote",f.type=c,AnsPress.ajax({data:f,success:function(a){a.success&&_.isObject(a.voteData)?self.model.set("vote",a.voteData):self.model.set("vote",d)}})}},voteUpdate:function(a){var b=this;this.$el.find('[ap="votes_net"]').text(this.model.get("vote").net),_.each(["up","down"],function(a){b.$el.find(".vote-"+a).removeClass("voted disable").addClass(b.voteClass("vote_"+a))})},voteClass:function(a){a=a||"vote_up";var b=this.model.get("vote").active,c="";return"vote_up"===b&&"vote_up"===a&&(c="active"),"vote_down"===b&&"vote_down"===a&&(c="active"),a!==b&&""!==b&&(c+=" disable"),c+" prist"},render:function(){var b=this.$el.find("[ap-vote]").attr("ap-vote");return this.model.set("vote",a.parseJSON(b),{silent:!0}),this},postActions:function(b){var c=this,d=a.parseJSON(a(b.target).attr("apquery"));"undefined"==typeof d.ap_ajax_action&&(d.ap_ajax_action="post_actions"),AnsPress.ajax({data:d,success:function(d){AnsPress.hideLoading(b.target),a(b.target).addClass("loaded"),c.actions.model=new AnsPress.collections.Actions(d.actions),c.actions.view=new AnsPress.views.Actions({model:c.actions.model,postID:c.model.get("ID")}),c.$el.find("postActions .ap-actions").html(c.actions.view.render().$el)}})},selectAnswer:function(b){b.preventDefault();var c=this,d=a.parseJSON(a(b.target).attr("apquery"));d.action="ap_toggle_best_answer",AnsPress.showLoading(b.target),AnsPress.ajax({data:d,success:function(d){AnsPress.hideLoading(b.target),d.success&&(d.selected?(c.$el.addClass("best-answer"),a(b.target).addClass("active").text(d.label),AnsPress.trigger("answerToggle",[c.model,!0])):(c.$el.removeClass("best-answer"),a(b.target).removeClass("active").text(d.label),AnsPress.trigger("answerToggle",[c.model,!1])))}})},selectToggle:function(){this.model.get("hideSelect")?this.$el.find('[ap="select_answer"]').addClass("hide"):this.$el.find('[ap="select_answer"]').removeClass("hide")}}),AnsPress.collections.Posts=Backbone.Collection.extend({model:AnsPress.models.Post,initialize:function(){var b=[];a('[ap="question"],[ap="answer"]').each(function(c){b.push({ID:a(this).attr("apId")})}),this.add(b)}}),AnsPress.views.SingleQuestion=Backbone.View.extend({initialize:function(){this.listenTo(this.model,"add",this.renderItem),AnsPress.on("answerToggle",this.answerToggle,this),AnsPress.on("deletePost",this.deletePost,this),AnsPress.on("answerCountUpdated",this.answerCountUpdated,this),AnsPress.on("formPosted",this.formPosted,this),this.listenTo(AnsPress,"commentApproved",this.commentApproved),this.listenTo(AnsPress,"commentDeleted",this.commentDeleted),this.listenTo(AnsPress,"commentCount",this.commentCount),this.listenTo(AnsPress,"formPosted",this.submitComment)},events:{'click [ap="loadEditor"]':"loadEditor"},renderItem:function(a){var b=new AnsPress.views.Post({model:a,el:'[apId="'+a.get("ID")+'"]'});b.render()},render:function(){var a=this;return this.model.each(function(b){a.renderItem(b)}),a},loadEditor:function(b){AnsPress.showLoading(b.target),AnsPress.ajax({data:a(b.target).data("apquery"),success:function(c){AnsPress.hideLoading(b.target),a("#ap-form-main").html(c),a(b.target).closest(".ap-minimal-editor").removeClass("ap-minimal-editor")}})},formPosted:function(b){b.success&&"answer"===b.form&&(AnsPress.trigger("answerFormPosted",b),a("apanswersw").show(),tinymce.remove(),a("#ap-form-main").html(""),a("#answer-form-c").addClass("ap-minimal-editor"),a("apanswers").append(a(b.html).hide()),a(b.div_id).slideDown(300),a(b.div_id).apScrollTo(null,!0),this.model.add({ID:b.ID}),AnsPress.trigger("answerCountUpdated",b.answersCount))},answerToggle:function(a){this.model.forEach(function(b,c){a[0]!==b&&b.set("hideSelect",a[1])})},deletePost:function(b){this.model.remove(b),a("#post-"+b).slideUp(400,function(){a(this).remove()})},answerCountUpdated:function(b){a('[ap="answers_count_t"]').text(b.text)},commentApproved:function(b,c){a("#comment-"+b.comment_ID).removeClass("unapproved"),a(c).remove(),b.commentsCount&&AnsPress.trigger("commentCount",{count:b.commentsCount,postID:b.post_ID})},commentDeleted:function(b,c){a(c).closest("apcomment").css("background","red"),setTimeout(function(){a(c).closest("apcomment").remove()},1e3),b.commentsCount&&AnsPress.trigger("commentCount",{count:b.commentsCount,postID:b.post_ID})},commentCount:function(b){var c=a('[apid="'+b.postID+'"]');c.find("[ap-commentscount-text]").text(b.count.text),b.count.unapproved>0?c.find("[ap-un-commentscount]").addClass("have"):c.find("[ap-un-commentscount]").removeClass("have"),c.find("[ap-un-commentscount]").text(b.count.unapproved)},submitComment:function(b){"new-comment"===b.action&&"edit-comment"===b.action||b.success&&(AnsPress.hideModal("commentForm"),"new-comment"===b.action&&a("#comments-"+b.post_id).html(b.html),"edit-comment"===b.action&&($old=a("#comment-"+b.comment_id),a(b.html).insertAfter($old),$old.remove(),a("#comment-"+b.comment_id).css("backgroundColor","rgba(255, 235, 59, 1)"),setTimeout(function(){a("#comment-"+b.comment_id).removeAttr("style")},500)),b.commentsCount&&AnsPress.trigger("commentCount",{count:b.commentsCount,postID:b.post_id}))}});var b=Backbone.Router.extend({routes:{"comment/:commentID":"commentRoute","comments/:postID/all":"commentsRoute","comments/:postID":"commentsRoute"},commentRoute:function(a){self=this,AnsPress.hideModal("comment",!1),$modal=AnsPress.modal("comment",{content:"",size:"medium",hideCb:function(){AnsPress.removeHash()}}),$modal.$el.addClass("single-comment"),AnsPress.showLoading($modal.$el.find(".ap-modal-content")),AnsPress.ajax({data:{comment_id:a,ap_ajax_action:"load_comments"},success:function(a){a.success&&($modal.setTitle(a.modal_title),$modal.setContent(a.html),AnsPress.hideLoading($modal.$el.find(".ap-modal-content")))}})},commentsRoute:function(b,c){self=this,AnsPress.ajax({data:{post_id:b,ap_ajax_action:"load_comments"},success:function(c){a("#comments-"+b).html(c.html)}})},editCommentsRoute:function(a){self=this,AnsPress.hideModal("commentForm",!1),AnsPress.modal("commentForm",{hideCb:function(){AnsPress.removeHash()}}),AnsPress.showLoading(AnsPress.modal("commentForm").$el.find(".ap-modal-content")),AnsPress.ajax({data:{comment:a,ap_ajax_action:"comment_form"},success:function(a){AnsPress.hideLoading(AnsPress.modal("commentForm").$el.find(".ap-modal-content")),AnsPress.modal("commentForm").setTitle(a.modal_title),AnsPress.modal("commentForm").setContent(a.html)}})}});a('[ap="actiontoggle"]').click(function(){a(this).is(".loaded")||AnsPress.showLoading(this)}),a(document).ready(function(){var a=new AnsPress.collections.Posts,c=new AnsPress.views.SingleQuestion({model:a,el:"#anspress"});c.render();new b;Backbone.History.started||Backbone.history.start()})}(jQuery),function(a){AnsPress.views.AskView=Backbone.View.extend({initialize:function(){},events:{'keyup [data-action="suggest_similar_questions"]':"questionSuggestion"},suggestTimeout:null,questionSuggestion:function(b){var c=this;if(!disable_q_suggestion){var d=a(b.target).val();0!=d.length&&(null!=c.suggestTimeout&&clearTimeout(c.suggestTimeout),c.suggestTimeout=setTimeout(function(){c.suggestTimeout=null,AnsPress.ajax({data:{ap_ajax_action:"suggest_similar_questions",__nonce:ap_nonce,value:d},success:function(c){a("#similar_suggestions").remove(),c.html&&0===a("#similar_suggestions").length&&a(b.target).parent().append('
'),a("#similar_suggestions").html(c.html)}})},800))}}});new AnsPress.views.AskView({el:"#ap-ask-page"})}(jQuery),function(a){AnsPress.models.Filter=Backbone.Model.extend({defaults:{active:!1,label:"",value:""}}),AnsPress.collections.Filters=Backbone.Collection.extend({model:AnsPress.models.Filter}),AnsPress.activeListFilters=a("#ap_current_filters").length>0?JSON.parse(a("#ap_current_filters").html()):{},AnsPress.views.Filter=Backbone.View.extend({id:function(){return this.model.id},nameAttr:function(){return this.multiple?""+this.model.get("key")+"[]":this.model.get("key")},isActive:function(){if(this.model.get("active"))return this.model.get("active");if(this.active)return this.active;var a=AnsPress.getUrlParam(this.model.get("key"));if(!_.isEmpty(a)){var b=this.model.get("value");if(!_.isArray(a)&&a===b)return!0;if(_.contains(a,b))return this.active=!0,!0}return this.active=!1,!1},className:function(){return this.isActive()?"active":""},inputType:function(){return this.multiple?"checkbox":"radio"},initialize:function(a){this.model=a.model,this.multiple=a.multiple,this.listenTo(this.model,"remove",this.removed)},template:'',events:{"change input":"clickFilter"},render:function(){var a=_.template(this.template),b=this.model.toJSON();return b.name=this.nameAttr(),b.active=this.isActive(),b.inputType=this.inputType(),this.removeHiddenField(),this.$el.html(a(b)),this},removeHiddenField:function(){a('input[name="'+this.nameAttr()+'"][value="'+this.model.get("value")+'"]').remove()},clickFilter:function(b){b.preventDefault(),a(b.target).closest("form").submit()},removed:function(){this.remove()}}),AnsPress.views.Filters=Backbone.View.extend({className:"ap-dropdown-menu",searchTemplate:'',template:'',initialize:function(a){this.model=a.model,this.multiple=a.multiple,this.filter=a.filter,this.nonce=a.nonce,this.listenTo(this.model,"add",this.added)},events:{"keypress [search-filter]":"searchInput"},renderItem:function(a){var b=new AnsPress.views.Filter({model:a,multiple:this.multiple});this.$el.find("filter-items").append(b.render().$el)},render:function(){var a=this;return this.multiple&&this.$el.append(this.searchTemplate),this.$el.append(this.template),this.model.each(function(b){a.renderItem(b)}),this},search:function(a,b){var c=this,d={__nonce:this.nonce,ap_ajax_action:"load_filter_"+this.filter,search:a,filter:this.filter};AnsPress.showLoading(b),AnsPress.ajax({data:d,success:function(a){if(AnsPress.hideLoading(b),a.success){for(c.nonce=a.nonce;model=c.model.first();)model.destroy();c.model.add(a.items)}}})},searchInput:function(b){var c=this;clearTimeout(this.searchTO),this.searchTO=setTimeout(function(){c.search(a(b.target).val(),b.target)},600)},added:function(a){this.renderItem(a)}}),AnsPress.views.List=Backbone.View.extend({el:"#ap-filters",initialize:function(){},events:{"click [ap-filter]:not(.loaded)":"loadFilter","click #ap-filter-reset":"resetFilter"},loadFilter:function(b){b.preventDefault();AnsPress.showLoading(b.currentTarget);var c=a.parseJSON(a(b.currentTarget).attr("apquery"));c.ap_ajax_action="load_filter_"+c.filter,AnsPress.ajax({data:c,success:function(d){AnsPress.hideLoading(b.currentTarget),a(b.currentTarget).addClass("loaded");var e=new AnsPress.collections.Filters(d.items),f=new AnsPress.views.Filters({model:e,multiple:d.multiple,filter:c.filter,nonce:d.nonce});a(b.currentTarget).after(f.render().$el)}})},resetFilter:function(b){a('#ap-filters input[type="hidden"]').remove(),a('#ap-filters input[type="checkbox"]').prop("checked",!1)}}),a(document).ready(function(){new AnsPress.views.List})}(jQuery),function(a){AnsPress.models.Notification=Backbone.Model.extend({idAttribute:"ID",defaults:{ID:"",verb:"",verb_label:"",icon:"",avatar:"",hide_actor:"",actor:"",ref_title:"",ref_type:"",points:"",date:"",permalink:"",seen:""}}),AnsPress.collections.Notifications=Backbone.Collection.extend({model:AnsPress.models.Notification}),AnsPress.views.Notification=Backbone.View.extend({id:function(){return"noti-"+this.model.id},template:'
<# if(ref_type === \'reputation\') { #>
{{points}}
<# } else if(hide_actor) { #>
<# } else { #>
{{{avatar}}}
<# } #><# if(ref_type !== \'reputation\'){ #>{{actor}}<# } #> {{verb_label}} {{ref_title}}
',initialize:function(a){this.model=a.model},render:function(){var a=_.template(this.template);return this.$el.html(a(this.model.toJSON())),this}}),AnsPress.views.Notifications=Backbone.View.extend({template:'
{{aplang.notifications}}<# if(total > 0) { #>{{total}}{{aplang.mark_all_seen}}<# } #>
',initialize:function(a){this.model=a.model,this.mark_args=a.mark_args,this.total=a.total,this.listenTo(this.model,"add",this.newNoti),this.listenTo(AnsPress,"notificationAllRead",this.allRead)},renderItem:function(a){var b=new AnsPress.views.Notification({model:a});return this.$el.find(".scroll-wrap").append(b.render().$el),b},render:function(){var a=this,b=_.template(this.template);return this.$el.html(b({mark_args:this.mark_args,total:this.total})),this.model.length>0&&this.model.each(function(b){a.renderItem(b)}),this},newNoti:function(a){this.renderItem(a)},allRead:function(){this.total=0,this.model.each(function(a){a.set("seen",1)}),this.render()}}),AnsPress.views.NotiDropdown=Backbone.View.extend({id:"noti-dp",initialize:function(a){this.anchor=a.anchor,this.fetched=!1},dpPos:function(){var a=this.anchor.offset();a.top=a.top+this.anchor.height(),a.left=a.left-this.$el.width()+this.anchor.width(),this.$el.css(a)},fetchNoti:function(a,b){if(this.fetched)return void this.dpPos();var c=this;AnsPress.ajax({data:ajaxurl+"?action=ap_ajax&ap_ajax_action=get_notifications",success:function(a){if(c.fetched=!0,a.success){var b=new AnsPress.collections.Notifications(a.notifications),d=new AnsPress.views.Notifications({model:b,mark_args:a.mark_args,total:a.total});c.$el.html(d.render().$el),c.dpPos(),c.$el.show()}}})},render:function(){return this.$el.hide(),this}}),a(document).ready(function(){var b=a('a[href="#apNotifications"]'),c=new AnsPress.views.NotiDropdown({anchor:b});a("body").append(c.render().$el),b.click(function(a){a.preventDefault(),c.fetchNoti(),c.fetched&&c.$el.toggle()}),a(document).mouseup(function(a){b.is(a.target)||c.$el.is(a.target)||0!==c.$el.has(a.target).length||c.$el.hide()})})}(jQuery)})