Anspress v3a1 LATEST (a minute ago)

5.44K viewsIssues
0
  1. It seems that the answer doesn’t work at all.
  2. Add Anspress to Menu (Questions, Ask etc) doesn’t work at all.
  3. BasePage listing of Questions is empty.
  4. Uninstall crashes hard
  5. The Admin black top bar is GONE when visiting Anspress pages !!!

0

Ok, the latest update fixed some problems.

Still i can’t (and nobody can) Answer ANY Question.

The console shows maybe some problem at:

function ap_default(a,b){return"undefined"!=typeof a?a:b}function apLoadingDot(){i=0,setInterval(function(){jQuery(".ap-loading-dot").html(Array(++i%4+1).join("."))},300)}function apAjaxData(a){return a+="&action=ap_ajax"}function apQueryStringToJSON(a){var b=a.split("&"),c={};return b.forEach(function(a){a=a.split("="),c[a[0]]=encodeURIComponent(a[1]||"")}),JSON.parse(JSON.stringify(c))}function apGetValueFromStr(a,b){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c=new RegExp("[\\?&]"+b+"=([^&#]*)"),d=c.exec(a);return null==d?!1:decodeURIComponent(d[1].replace(/\+/g," "))}function apCenterBox(a){var a=jQuery(a),b=a.parent();b.css({position:"relative"}),a.css("left",(b.width()-a.width())/2),a.css("top",(b.height()-a.height())/2)}function apIsJsonString(a){try{JSON.parse(a)}catch(b){return!1}return!0}function apLoadCssJs(a,b){if("js"==b){var c=document.createElement("script");c.setAttribute("type","text/javascript"),c.setAttribute("src",a)}else if("css"==b){var c=document.createElement("link");c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href",a)}"undefined"!=typeof c&&document.getElementsByTagName("head")[0].appendChild(c)}function apLoadTemplate(a,b,c){c=c||!1,0===jQuery("#template-"+a).length?jQuery.get(b,function(b){jQuery('<script id="template-'+a+'" type="text/html">'+b+"</script>").appendTo("body"),jQuery(a).trigger(a,b),c&&c(b)}):c&&c(jQuery("#template-"+a).html())}function apParseAjaxResponse(a){if(a=jQuery(a),"undefined"==typeof a.filter("#ap-response"))return console.log("Not a valid AnsPress ajax response."),{};var b=a.filter("#ap-response").html();return"undefined"!=typeof b&&b.length>2?JSON.parse(b):{}}function apCamelize(a){return a.replace(/(?:^\w|[A-Z]|\b\w)/g,function(a,b){return 0==b?a.toLowerCase():a.toUpperCase()}).replace(/\s+/g,"")}function apMergeObj(a,b){for(var c in b)try{b[c].constructor==Object?a[c]=MergeRecursive(a[c],b[c]):a[c]=b[c]}catch(d){a[c]=b[c]}return a}!function(a){a.fn.aptip=function(b){function c(b){"undefined"!=typeof a(b).attr("title")&&(a(b).data("aptiptitle",a(b).attr("title")),a(b).removeAttr("title"))}function d(b){var c=a(window).height(),d=a(b).offset(),e=a(b).outerHeight(),g=a(b).outerWidth(),h=a(b).data("tipposition")||!1,i=f.position.split(/ +/);h&&(i=h.split(/ +/));var j="top";switch(i[0]){case"bottom":j=d.top+e+10;break;case"center":j=d.top+e/2-tip.outerHeight()/2;break;default:j=d.top-tip.outerHeight()-10}var k="right";switch(i[1]){case"left":k=d.left-g;break;case"center":k=d.left+g/2-tip.outerWidth()/2;break;default:k=d.left+g}tip.addClass("x-"+i[0]+" y-"+i[1]);var l=a(document).scrollTop();0>k&&(k=5),l>j&&(j=d.top+g);var m=a(window).scrollTop()+c-tip.outerHeight();j>m&&(j-=tip.outerHeight()),tip.css({overflow:"absolute",top:j,left:k}),tip.find(".arrow").css({top:j,left:k})}function e(b){var e=a(b),h=e.data("userid")||e.data("catid")||!1,i=(e.data("action")||!1,e.data("tipquery")||!1);if(h&&!i){var j=e.data("catid")||!1;j=j?"&type=cat":"",e.data("tipquery","action=ap_ajax&ap_ajax_action=hover_card&id="+h+j),i=e.data("tipquery")}if(i!==!1&&(f.ajax=i),c(b),""==f.title)var k=e.data("aptiptitle");else var k=f.title;if(0!=k.length){if(tip=a('<div class="ap-tooltip '+f.theme+'"><div class="ap-tooltip-in">'+k+"</div></div>"),""!=f.ajax&&!g.ajax_running)if(0==a(e.attr("data-ajax")).length&&0==a("#"+h+"_card").length)g.ajax_running=!0,a.ajax({type:"POST",url:ajaxurl,data:f.ajax+"&ap_ajax_nonce="+ap_nonce,success:function(c){var f=a(c),c={},h=f.filter("#ap-response").html();"undefined"!=typeof h&&h.length>2&&(c=JSON.parse(h)),c.apTemplate&&"object"==typeof c.apTemplate&&apLoadTemplate(c.apTemplate.name,c.apTemplate.template,function(f){var h=a(Ta.render(f,c.apData));console.log(h);var i=parseInt(a(".aptip-data").length);g.data_id="aptipd-"+(i+1),h.addClass("aptip-data "+g.data_id),e.attr("data-ajax","."+g.data_id),a("body").append(h.clone()),tip.find(".ap-tooltip-in").html(h.show()),d(b)}),g.ajax_running=!1}});else{var l=a("#"+h+"_card").html();tip.find(".ap-tooltip-in").html(a(l).show())}if(""!=f.before){var m=f.before;m(tip,b,function(){d(b)})}tip.appendTo("body"),d(b)}}var f=a.extend({theme:"",delay:"",title:"",before:"",ajax:"",position:"top center"},b);this.ajax_running=!1;var g=this;return this.each(function(){$this=a(this);var b=this;$this.mouseenter(function(){""!=f.delay?delay=setTimeout(function(){e(b)},f.delay):e(this)}).mouseleave(function(){"undefined"!=typeof tip&&tip.remove(),"undefined"!=typeof delay&&clearTimeout(delay)})}),this},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(g>f)this.scrollTop=0,b.animate?e.stop().animate({height:g},b.speed):e.innerHeight(g);else if(!c||8==c.which||46==c.which||c.ctrlKey&&88==c.which)if(f>h){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(),h>g&&(g=h),f>g&&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",e,c),d},a.fn.center=function(){return this.css({position:"fixed"}),a(window).height()>a(this).outerHeight()?this.css("top",Math.max(0,(a(window).height()-a(this).outerHeight())/2)+"px"):(this.css("top",50),this.css("height",a(window).height()-80)),this.css("left",Math.max(0,(a(window).width()-a(this).outerWidth())/2+a(window).scrollLeft())+"px"),this},a.fn.apAjaxQueryString=function(){var b=a(this).data("query").split("::"),c={};c.action="ap_ajax",c.ap_ajax_action=b[0],c.__nonce=b[1],c.args={};var d=0;return a.each(b,function(a){0!=a&&1!=a&&(c.args[d]=b[a],d++)}),c}}(jQuery);var Tangular={};Tangular.helpers={},Tangular.version="v1.5.2",Tangular.cache={},Tangular.debug=!1,Tangular.settings={delimiters:["{{","}}"]},Tangular.register=function(a,b){return Tangular.helpers[a]=b,Tangular},Tangular.compile=function(a){a||(a="");for(var b,c=-1,d=[],e=-1,f=0,g=a.length,h=0,i=Tangular.settings.delimiters[0].length;g>c++;){var j=a.substring(c,c+i);if(-1===e)if(j!==Tangular.settings.delimiters[0]);else{if(-1!==e){h++;continue}b=a.substring(f,c),d.push(b?'unescape("'+escape(b)+'")':'""'),e=c+i}else if(j===Tangular.settings.delimiters[1]){if(h>0){h--;continue}d.push(a.substring(e,c).trim()),f=c+i,e=-1;continue}}b=a.substring(f,g),d.push(b?'unescape("'+escape(b)+'")':'""'),g=d.length;for(var k="$output+=",l='var $s=this,$output="",$t,$v;',m=[],n=!1,o=0,p=0;g>p;p++)if(p%2!==0){var q=d[p],r=!1,c=q.lastIndexOf("|"),s=null,t=q.substring(0,3);"if "===t&&(q="if( "+q.substring(3)+"){",r=!0),"foreach "===q.substring(0,8)&&(s=q.split(" "),"var"===s[1]&&s.splice(1,1),m.push(s[1]),r=!0,n=!0,o++);var u=q.substring(0,5);if("endif"===u||"fi"===q?(q="}",r=!0):"else"===u?(q="} else {",r=!0):"else if"===q.substring(0,7)?(q="}else if( "+q.substring(8)+"){",r=!0):("end"===t||"endfor"===q.substring(0,6))&&(q=m.length?"}})()}":"}}",m.pop(),r=!0,o--,0===o&&(n=!1)),q=r?Tangular.append(q,m,n,"$s").trim():Tangular.helper(q,m,n,"$s"),r){if(s){var v=Tangular.append(s[3],m,n,"$s");q="if ("+v+"&&"+v+".length){(function(){for(var i=0,length="+v+".length;i<length;i++){var "+s[1]+"="+v+"[i];var $index=i;"}l+=q}else l+=k+q+";"}else l+=k+d[p]+";";var w=59===l.charCodeAt(l.length-1);return Tangular.debug&&(console.log("Tangular:"),console.log("function(helpers,$) {"+l+(w?"":";")+"return $output;"),console.log(a.trim()),console.log("---------------------------"),console.log("")),function(a,b){return new Function("helpers","$",l+(w?"":";")+"return $output;").call(a,function(a){var b=Tangular.helpers[a];return b?b:(console.warn('Tangular helper "'+a+'" not found.'),function(a){return void 0===a?"undefined":null===a?"null":a.toString()})},b)}},Tangular.helper=function(a,b,c){var d,e=a.indexOf("|");if(-1===e)return d=Tangular.append(a.trim(),b,c,"$s").trim(),'helpers("encode").call($s,'+d+")";d=Tangular.append(a.substring(0,e).trim(),b,c).trim(),a=a.substring(e+1).trim().split("|");for(var f="",g=0,h=a.length;h>g;g++){var i,j=a[g].trim().replace("()","");e=j.indexOf("("),-1===e?(i=j,j=".call($s,$t)"):(i=j.substring(0,e),j=".call($s,$t,"+j.substring(e+1)),j='$t=helpers("'+i+'")'+j,f+=j+";"}return'"";$t='+d+";"+f+"$output+=$t"},Tangular.append=function(a,b,c,d){return void 0===b&&(b=[]),a?a.replace(/[\_\$a-zÑ-žÁ-ŽA-Z0-9\s\.]+/g,function(a,c,e){var f=e.substring(c-1,c),g=!1,h=a.trim();switch(('"'===f||"'"===f||"."===f)&&(g=!0),a.trim()){case"else":case"end":case"endfor":case"endif":case"fi":case"foreach":case"if":case"else if":return a;case"$index":if(!g)return a}if(""===h)return"";if(g)return a;g=!1;for(var i=0,j=b.length;j>i;i++){var k=b[i].length;if(h.substring(0,k)===b[i]){if(h.length!==k){var f=h.substring(k,k+1);if("."!==f&&"+"!==f)continue}g=!0;break}}if("$"===h)return"Tangular.$wrap($)";if("$."===h.substring(0,2)&&(d="$",h=h.substring(2)),g)return h;f=h.substring(0,1);var l=f.charCodeAt(0);return l>47&&58>l?h:"Tangular.$wrap("+(d||"$s")+',"'+h+'")'}):"Tangular.$wrap("+(d||"$s")+")"},Tangular.$wrap=function(a,b,c){if(!a)return a;if(!b)return a;var d=Tangular.cache[b];if(null===d)return a[b];if(d||(d=b.split("."),Tangular.cache[b]=1===d.length?null:d),1===d.length)return a[b];for(var e=a,f=0,g=d.length;g>f;f++){var h=d[f];if(e=e[h],!e)return f+1===g?e:c}return e},Tangular.render=function(a,b,c){return(void 0===b||null===b)&&(b={}),"string"==typeof a&&(a=Tangular.compile(a)),a(b,c)},Tangular.register("encode",function(a){return(void 0===a||null===a)&&(a=""),a.toString().replace(/[<>&"]/g,function(a){switch(a){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;"}return a})}),Tangular.register("raw",function(a){return(void 0===a||null===a)&&(a=""),a}),"undefined"!=typeof global?global.Tangular=global.Ta=Tangular:"undefined"!=typeof window&&(window.Tangular||(window.Tangular=Tangular),window.Ta=Tangular),Tangular.debug=!0,Ta.register("objLength",function(a){return Object.keys(a).length}),function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):(window.WatchJS=a(),window.watch=window.WatchJS.watch,window.unwatch=window.WatchJS.unwatch,window.callWatchers=window.WatchJS.callWatchers)}(function(){function a(){v=null;for(var a=0;a<u.length;a++)u[a]();u.length=0}var b={noMore:!1,useDirtyCheck:!1},c=[],d=[],e=[],f=!1;try{f=Object.defineProperty&&Object.defineProperty({},"x",{})}catch(g){}var h=function(a){var b={};return a&&"[object Function]"==b.toString.call(a)},i=function(a){return"[object Array]"===Object.prototype.toString.call(a)},j=function(a){return"[object Object]"==={}.toString.apply(a)},k=function(a,b){var c=[],d=[];if("string"!=typeof a&&"string"!=typeof b){if(i(a))for(var e=0;e<a.length;e++)void 0===b[e]&&c.push(e);else for(e in a)a.hasOwnProperty(e)&&void 0===b[e]&&c.push(e);if(i(b))for(var f=0;f<b.length;f++)void 0===a[f]&&d.push(f);else for(f in b)b.hasOwnProperty(f)&&void 0===a[f]&&d.push(f)}return{added:c,removed:d}},l=function(a){if(null==a||"object"!=typeof a)return a;var b,c=a.constructor();for(b in a)c[b]=a[b];return c},m=function(a,b,c,d){try{Object.observe(a,function(a){a.forEach(function(a){a.name===b&&d(a.object[a.name])})})}catch(e){try{Object.defineProperty(a,b,{get:c,set:function(a){d.call(this,a,!0)},enumerable:!0,configurable:!0})}catch(f){try{Object.prototype.__defineGetter__.call(a,b,c),Object.prototype.__defineSetter__.call(a,b,function(a){d.call(this,a,!0)})}catch(g){o(a,b,d)}}}},n=function(a,b,c){try{Object.defineProperty(a,b,{enumerable:!1,configurable:!0,writable:!1,value:c})}catch(d){a[b]=c}},o=function(a,b,c){d[d.length]={prop:b,object:a,orig:l(a[b]),callback:c}},p=function(a,b,c,d){if("string"!=typeof a&&(a instanceof Object||i(a))){if(i(a)){if(A(a,"__watchall__",b,c),void 0===c||c>0)for(var e=0;e<a.length;e++)p(a[e],b,c,d)}else{var g=[];for(e in a)"$val"==e||!f&&"watchers"===e||Object.prototype.hasOwnProperty.call(a,e)&&g.push(e);q(a,g,b,c,d)}d&&K(a,"$$watchlengthsubjectroot",b,c)}},q=function(a,b,c,d,e){if("string"!=typeof a&&(a instanceof Object||i(a)))for(var f=0;f<b.length;f++)r(a,b[f],c,d,e)},r=function(a,b,c,d,e){"string"!=typeof a&&(a instanceof Object||i(a))&&!h(a[b])&&(null!=a[b]&&(void 0===d||d>0)&&p(a[b],c,void 0!==d?d-1:d),A(a,b,c,d),e&&(void 0===d||d>0)&&K(a,b,c,d))},s=function(a,b){if(!(a instanceof String)&&(a instanceof Object||i(a)))if(i(a)){for(var c=["__watchall__"],d=0;d<a.length;d++)c.push(d);t(a,c,b)}else{var e=function(a){var c,d=[];for(c in a)a.hasOwnProperty(c)&&(a[c]instanceof Object?e(a[c]):d.push(c));t(a,d,b)};e(a)}},t=function(a,b,c){for(var d in b)b.hasOwnProperty(d)&&F(a,b[d],c)},u=[],v=null,w=function(){return v||(v=setTimeout(a)),v},x=function(a){null==v&&w(),u[u.length]=a},y=function(a,b,c,d){var e=null,f=-1,g=i(a);p(a,function(c,d,h,i){var j=w();if(f!==j&&(f=j,e={type:"update"},e.value=a,e.splices=null,x(function(){b.call(this,e),e=null})),g&&a===this&&null!==e){if("pop"===d||"shift"===d)h=[],i=[i];else if("push"===d||"unshift"===d)h=[h],i=[];else if("splice"!==d)return;e.splices||(e.splices=[]),e.splices[e.splices.length]={index:c,deleteCount:i?i.length:0,addedCount:h?h.length:0,added:h,deleted:i}}},1==c?void 0:0,d)},z=function(a,b,c,d,e){a&&b&&(r(a,b,function(a,b,f,g){a={type:"update"},a.value=f,a.oldvalue=g,(d&&j(f)||i(f))&&y(f,c,d,e),c.call(this,a)},0),(d&&j(a[b])||i(a[b]))&&y(a[b],c,d,e))},A=function(a,c,d,e){var f=!1,g=i(a);for(a.watchers||(n(a,"watchers",{}),g&&E(a,function(b,d,f,g){if(I(a,b,d,f,g),0!==e&&f&&(j(f)||i(f))){var h,k;for(b=a.watchers[c],(g=a.watchers.__watchall__)&&(b=b?b.concat(g):g),k=b?b.length:0,g=0;k>g;g++)if("splice"!==d)p(f,b[g],void 0===e?e:e-1);else for(h=0;h<f.length;h++)p(f[h],b[g],void 0===e?e:e-1)}})),a.watchers[c]||(a.watchers[c]=[],g||(f=!0)),g=0;g<a.watchers[c].length;g++)if(a.watchers[c][g]===d)return;if(a.watchers[c].push(d),f){var h=a[c];d=function(){return h},f=function(d,f){var g=h;if(h=d,0!==e&&a[c]&&(j(a[c])||i(a[c]))&&!a[c].watchers){var k,l=a.watchers[c].length;for(k=0;l>k;k++)p(a[c],a.watchers[c][k],void 0===e?e:e-1)}a.watchers&&(a.watchers.__wjs_suspend__||a.watchers["__wjs_suspend__"+c])?G(a,c):b.noMore||g===d||(f?I(a,c,"set",d,g):B(a,c,"set",d,g),b.noMore=!1)},b.useDirtyCheck?o(a,c,f):m(a,c,d,f)}},B=function(a,b,c,d,e){if(void 0!==b){var f,g=a.watchers[b];(f=a.watchers.__watchall__)&&(g=g?g.concat(f):f),f=g?g.length:0;for(var h=0;f>h;h++)g[h].call(a,b,c,d,e)}else for(b in a)a.hasOwnProperty(b)&&B(a,b,c,d,e)},C="pop push reverse shift sort slice unshift splice".split(" "),D=function(a,b,c,d){n(a,c,function(){var e,f,g,h=0;if("splice"===c){for(g=arguments[0],f=a.slice(g,g+arguments[1]),e=[],h=2;h<arguments.length;h++)e[h-2]=arguments[h];h=g}else e=0<arguments.length?arguments[0]:void 0;return g=b.apply(a,arguments),"slice"!==c&&("pop"===c?(f=g,h=a.length):"push"===c?h=a.length-1:"shift"===c?f=g:"unshift"!==c&&void 0===e&&(e=g),d.call(a,h,c,e,f)),g})},E=function(a,b){if(h(b)&&a&&!(a instanceof String)&&i(a))for(var c,d=C.length;d--;)c=C[d],D(a,a[c],c,b)},F=function(a,b,e){if(void 0===e&&a.watchers[b])delete a.watchers[b];else for(var f=0;f<a.watchers[b].length;f++)a.watchers[b][f]==e&&a.watchers[b].splice(f,1);for(f=0;f<c.length;f++){var g=c[f];g.obj==a&&g.prop==b&&g.watcher==e&&c.splice(f,1)}for(e=0;e<d.length;e++)f=d[e],g=f.object.watchers,(f=f.object==a&&f.prop==b&&g&&(!g[b]||0==g[b].length))&&d.splice(e,1)},G=function(a,b){x(function(){delete a.watchers.__wjs_suspend__,delete a.watchers["__wjs_suspend__"+b]})},H=null,I=function(a,b,c,d,f){e[e.length]={obj:a,prop:b,mode:c,newval:d,oldval:f},null===H&&(H=setTimeout(J))},J=function(){var a=null;H=null;for(var b=0;b<e.length;b++)a=e[b],B(a.obj,a.prop,a.mode,a.newval,a.oldval);a&&(e=[])},K=function(a,b,d,e){var f;f=l("$$watchlengthsubjectroot"===b?a:a[b]),c.push({obj:a,prop:b,actual:f,watcher:d,level:e})};return setInterval(function(){for(var a=0;a<c.length;a++){var b=c[a];if("$$watchlengthsubjectroot"===b.prop){var e=k(b.obj,b.actual);(e.added.length||e.removed.length)&&(e.added.length&&q(b.obj,e.added,b.watcher,b.level-1,!0),b.watcher.call(b.obj,"root","differentattr",e,b.actual)),b.actual=l(b.obj)}else{if(e=k(b.obj[b.prop],b.actual),e.added.length||e.removed.length){if(e.added.length)for(var g=0;g<b.obj.watchers[b.prop].length;g++)q(b.obj[b.prop],e.added,b.obj.watchers[b.prop][g],b.level-1,!0);B(b.obj,b.prop,"differentattr",e,b.actual)}b.actual=l(b.obj[b.prop])}}for(a in d){var b=d[a],e=b.object[b.prop],g=b.orig,h=e,i=void 0,m=!0;if(g!==h)if(j(g)){for(i in g)if((f||"watchers"!==i)&&g[i]!==h[i]){m=!1;break}}else m=!1;m||(b.orig=l(e),b.callback(e))}},50),b.watch=function(){h(arguments[1])?p.apply(this,arguments):i(arguments[1])?q.apply(this,arguments):r.apply(this,arguments)},b.unwatch=function(){h(arguments[1])?s.apply(this,arguments):i(arguments[1])?t.apply(this,arguments):F.apply(this,arguments)},b.callWatchers=B,b.suspend=function(a,b){a.watchers&&(a.watchers["__wjs_suspend__"+(void 0!==b?b:"")]=!0)},b.onChange=function(){(h(arguments[2])?z:y).apply(this,arguments)},b});;function apAutloadTemplate(a){return"undefined"!=typeof a.disableAutoLoad&&a.disableAutoLoad}var apData={};!function(a){apFunctions={},a(function(){AnsPress.site=new AnsPress.site,AnsPress.site.initialize()}),window.AnsPress={},AnsPress.site=function(){},AnsPress.site.prototype={initialize:function(){ApSite=this,this.ajax_id=new Object,this.loading=new Object,this.errors,this.ajaxData,this.appendFormError(),this.appendMessageBox(),this.ajaxBtn(),this.ap_comment_form(),this.afterPostingAnswer(),this.ap_ajax_form(),this.load_comment_form(),this.delete_comment(),this.vote(),this.select_answer(),this.ap_delete_post(),this.ap_upload_field(),this.avatarUploadCallback(),this.change_status(),this.load_profile_field(),this.ap_post_upload_field(),this.tinyMCEeditorToggle(),this.tab(),this.set_featured(),this.modal(),this.expand(),this.follow(),this.updateCover(),this.hoverCard(),this.delete_notification(),this.mark_as_read(),this.cancel_comment(),this.questionSuggestion(),this.checkboxUncheck(),this.listFilter()},doAjax:function(b,c,d,e,f){d=d||!1,c=c||!1,e=e||!1,f=f||!1;var g=apGetValueFromStr(b,"ap_ajax_action");f&&"undefined"!=typeof ApSite.ajax_id[g]&&ApSite.ajax_id[g].abort();var h=a.ajax({type:"POST",url:ajaxurl,data:b,beforeSend:function(){d&&ApSite.showLoading(d),"function"==typeof e&&e()},success:function(b){ApSite.hideLoading(d);var e=apParseAjaxResponse(b);"function"==typeof c&&(b=a.isEmptyObject(e)?b:e,c(b,d))},context:d,cache:!1});return ApSite.ajax_id[g]=h,h},doAction:function(b){var c=this,b="undefined"!=typeof b?'[data-action="'+b+'"]':"[data-action]",d=new Object;a(b).each(function(b){var e=a(this).attr("data-action");"undefined"==typeof d[e]&&(d[e]="1",c[e]('[data-action="'+e+'"]'))})},uniqueId:function(){return a(".ap-uid").length},showLoading:function(b){AnsPress.site.hideLoading(b);var c=a(b).data("loadclass")||"",d=this.uniqueId(),e=a('<div class="ap-loading-icon ap-uid '+c+'" id="apuid-'+d+'"><i class="apicon-sync"><i></div>');a("body").append(e);var f=a(b).offset(),g=a(b).outerHeight(),h=a(b).outerWidth();return e.css({top:f.top,left:f.left,height:g,width:h}),a(b).data("loading","#apuid-"+d),"#apuid-"+d},hideLoading:function(b){"all"==b?a(".ap-loading-icon").hide():a(a(b).data("loading")).hide()},ap_ajax_form:function(){a("body").delegate('[data-action="ap_ajax_form"]',"submit",function(){if(AnsPress.site.showLoading(this),a(this).is("[data-before]")){var b=a(this).data("before");if("function"==typeof ApSite[b]&&!1===ApSite[b](this))return!1}return a(this).append('<input type="hidden" name="ap_ajax_action" value="'+a(this).attr("name")+'">'),a(this).append('<input type="hidden" name="action" value="ap_ajax">'),"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave(),a(this).ajaxSubmit({type:"POST",url:ajaxurl,success:function(a){AnsPress.site.hideLoading(this),"undefined"!=typeof tinyMCE&&"undefined"!=typeof a.type&&"success"==a.type&&tinyMCE.activeEditor.setContent("")},error:function(a,b,c){console.log(c),AnsPress.site.hideLoading(this)},dataType:"html",context:this,global:!0,cache:!1}),!1})},appendFormError:function(){a(document).on("ap_after_ajax",function(b,c){"undefined"!=typeof c&&"undefined"!=typeof c.errors&&(ApSite.clearFormErrors(c.form),a.each(c.errors,function(b,d){var e=a("#"+c.form).find("#"+b).closest(".ap-form-fields");e.addClass("ap-have-error"),ApSite.helpBlock(e,d)}))})},helpBlock:function(b,c){a(b).find(".ap-form-error-message").length>0&&a(b).find(".ap-form-error-message").remove(),a(b).append('<p class="ap-form-error-message">'+c+"</p>")},clearFormErrors:function(b){var c=a("#"+b).find(".ap-have-error");c.find(".ap-form-error-message").remove(),c.removeClass("ap-have-error")},appendMessageBox:function(){"0"==a("#ap-notify").length&&a("body").append('<div id="ap-notify"></div>')},addMessage:function(b,c){var d=aplang[c];a('<div class="ap-notify-item '+c+'"><i class="'+d+'"></i><div class="ap-notify-content">'+b+"</div></div>").appendTo("#ap-notify").animate({"margin-left":0},500).delay(1e3).fadeOut(200)},redirect:function(a){"undefined"!=typeof a&&window.location.replace(a)},reload:function(a){location.reload()},append:function(b){"undefined"!=typeof b.container&&a(b.container).append(b.html)},updateText:function(b,c){""!=c&&a(b).text(c)},replaceWith:function(b,c){a(b).replaceWith(c)},updateHtml:function(b,c){"undefined"!=typeof c.html&&a(b).html(c.html)},toggle_active_class:function(b,c){"undefined"!=typeof b&&(a(b).find("li").removeClass("active"),a(b).find(c).addClass("active"),a(b).toggleClass("active"))},removeClass:function(b,c){a(b).length>0&&a(b).removeClass(c)},addClass:function(b,c){a(b).length>0&&a(b).addClass(c)},append_before:function(b,c){"undefined"!=typeof b&&a(b).before(c.html)},remove_if_exists:function(b){"undefined"!=typeof b&&a(b).length>0&&a(b).remove()},clearForm:function(a){"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor.setContent("")},scrollToCommentForm:function(){a("#ap-commentform").length>0&&a("html, body").animate({scrollTop:a("#ap-commentform").offset().top-150},500)},ajaxBtn:function(){a("body").delegate('[data-action="ajax_btn"]',"click",function(b){if(!a(this).is(".ajax-disabled")){b.preventDefault();var c=a(this).apAjaxQueryString();ApSite.doAjax(c,function(b,c){if(a(c).data("cb")){var d=a(c).data("cb");console.log(apFunctions[d]),"function"==typeof apFunctions[d]&&apFunctions[d](b,c)}},this)}})},load_comment_form:function(){a("body").delegate('[data-action="load_comment_form"]',"click",function(b){b.preventDefault(),a("#ap-commentform").length>0&&a("#ap-commentform").remove();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(b){var c=a(this);a(this).addClass("loaded"),a(b.container).addClass("have-comments"),a(b.container).removeClass("no-comments"),a(b.container).append(b.html),ApSite.scrollToCommentForm(),jQuery("textarea.autogrow, textarea#post_content").keyup(),"undefined"!=typeof c.attr("data-toggle")&&a(c.attr("data-toggle")).hide(),a("#ap-comment-textarea").focus(),a(c.attr("href")).addClass("have-comments").removeClass("no-comment")},this,!1,!0)})},ap_comment_form:function(){a("body").delegate("#ap-commentform","submit",function(){return"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave(),ApSite.doAjax(apAjaxData(a(this).formSerialize()),function(b){ApSite.hideLoading(this),"new_comment"==b.action&&"success"==b.message_type?a("#post-c-"+b.comment_post_ID).append(a(b.html).hide().slideDown(100)):"edit_comment"==b.action&&"success"==b.message_type&&(a("#comment-"+b.comment_ID+" .ap-comment-texts").html(b.html),a("#comment-"+b.comment_ID).slideDown(400),a(".ap-comment-form").remove()),a(".ap-comment-form").fadeOut(200,function(){a(this).remove()}),a('a[href="#comments-'+b.comment_post_ID+'"]').removeClass("loaded")},this),!1})},delete_comment:function(){a("body").delegate('[data-action="delete_comment"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query"),d=a(this);ApSite.doAjax(apAjaxData(c),function(b){"undefined"!=typeof d.attr("data-toggle")&&"success"==b.message_type&&a(d.attr("data-toggle")).hide()},this,!1,!0)})},ap_subscribe:function(){a('[data-action="ap_subscribe"]').click(function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(b){AnsPress.site.hideLoading(this),"subscribed"==b.action?(a(this).addClass("active"),a(this).closest(".ap-subscribe").addClass("active")):(a(this).removeClass("active"),a(this).closest(".ap-subscribe").removeClass("active"))},this,function(){a(this).closest(".ap-subscribe").toggleClass("active")})})},vote:function(){a("body").delegate('[data-action="vote"] a',"click",function(b){b.preventDefault();var c=a(this).attr("data-query"),d=a(this);ApSite.doAjax(apAjaxData(c),function(a){var b=d.parent();b.find(".ap-vote-fade").remove(),("undefined"!=typeof a.action&&"voted"==a.action||"undo"==a.action)&&("voted"==a.action?(d.addClass("voted"),"vote_up"==a.type&&b.find(".vote-down").addClass("disable"),"vote_down"==a.type&&b.find(".vote-up").addClass("disable"),d.trigger("voted",a)):"undo"==a.action&&(d.removeClass("voted"),"vote_up"==a.type&&b.find(".vote-down").removeClass("disable"),"vote_down"==a.type&&b.find(".vote-up").removeClass("disable"),d.trigger("undo_vote",a)),b.find(".net-vote-count").text(a.count))},this,!1)})},afterPostingAnswer:function(){a(document).on("ap_after_ajax",function(b,c){"undefined"!=typeof c&&"undefined"!=typeof c.action&&"new_answer"==c.action&&(a("#description").val(""),0===a("#answers").length?(a("#question").after(a(c.html)),a(c.div_id).hide(),a(c.div_id).slideDown(500)):(a("#answers").append(a(c.html).hide()),a(c.div_id).slideDown(500)))})},select_answer:function(){a("body").delegate('[data-action="select_answer"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),!1,this)})},ap_delete_post:function(){a("#anspress").delegate('[data-action="ap_delete_post"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(b){"undefined"!=typeof b.action&&"delete_answer"==b.action&&a(b.div_id).slideUp(500).fadeOut(300,function(){a(this).remove()})},this,!1)})},ap_upload_field:function(){a('[data-action="ap_upload_field"]').change(function(){a(this).closest("form").submit()}),a('[data-action="ap_upload_form"]').submit(function(){return a(this).ajaxSubmit({success:function(b){b=a(b),b=JSON.parse(b.filter("#ap-response").html()),a("body").trigger("uploadForm",b)},url:ajaxurl}),!1})},avatarUploadCallback:function(){a(document).on("uploadForm",function(b,c){if("undefined"!=typeof c.action&&"avatar_uploaded"===c.action){var d=a(c.html).attr("src");a('[data-view="user_avatar_'+c.user_id+'"]').attr("src",d)}})},change_status:function(){a("body").delegate('[data-action="ap_change_status"]',"click",function(b){b.preventDefault();var c=a(this).closest("ul").prev(),d=a(this).attr("data-query");ApSite.doAjax(apAjaxData(d),function(a){AnsPress.site.hideLoading(c)},this,!1,!0)})},load_profile_field:function(){a("body").delegate('[data-action="ap_load_user_field_form"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(a){AnsPress.site.hideLoading(this)},this,!1)})},ap_post_upload_field:function(){a("body").on("click",'[data-action="ap_post_upload_field"]',function(b){b.preventDefault(),a('input[name="post_upload_image"]').trigger("click")}),a("body").delegate('[name="post_upload_image"]',"change",function(b){a("#hidden-post-upload").submit()}),a("body").delegate("#hidden-post-upload","submit",function(){var b=a('[data-action="ap_post_upload_field"]').closest(".ap-upload-o");return a(this).ajaxSubmit({beforeSubmit:function(){ApSite.showLoading(b)},success:function(c){ApSite.hideLoading(b),c=a(c),c=JSON.parse(c.filter("#ap-response").html()),a("body").trigger("postUploadForm",c),"undefined"!=typeof c.html&&(ApSite.addImageInEditor(c.html),a(".ap-post-upload-form").append('<input type="hidden" name="attachment_ids[]" value="'+c.attachment_id+'" />'))},url:ajaxurl,type:"POST"}),!1}),a("body").delegate('.ap-upload-remote-link, [data-action="post_image_close"]',"click",function(b){b.preventDefault(),a(".ap-upload-link-rc").toggle()}),a("body").delegate('[data-action="post_image_ok"]',"click",function(b){b.preventDefault(),a(".ap-upload-link-rc").toggle(),""!=a(this).prev().val()&&ApSite.addImageInEditor('<img src="'+a(this).prev().val()+'" />')})},addImageInEditor:function(b){"undefined"!=typeof tinyMCE?tinyMCE.activeEditor.execCommand("mceInsertContent",!1,b):a(".wp-editor-area").val(a(".wp-editor-area").val()+b)},previewLocalImage:function(a){if(a.files&&a.files[0]){var b=new FileReader;b.onload=function(a){ApSite.addImageInEditor('<img src="'+a.target.result+'" />')},b.readAsDataURL(a.files[0])}},tinyMCEeditorToggle:function(){a("body").delegate('[data-action="ap_fullscreen_toggle"]',"click",function(b){b.preventDefault(),a(this).toggleClass("active"),tinyMCE.activeEditor.execCommand("mceFullscreen")})},tab:function(){a("body").delegate(".ap-tab-nav a","click",function(b){b.preventDefault();var c=a(this).attr("href");a(".ap-tab-container > *").removeClass("active"),a(".ap-tab-nav >li").removeClass("active"),a(this).parent().addClass("active"),a(c).toggleClass("active")})},set_featured:function(){a("body").delegate('[data-action="set_featured"]',"click",function(b){b.preventDefault();var c=(a(this).closest("ul").prev(),a(this).attr("data-query"));ApSite.doAjax(apAjaxData(c),function(a){},this,!1,!0)})},modal:function(){a("body").delegate('[data-action="ap_modal"]',"click",function(b){b.preventDefault();var c=a(a(this).data("toggle"));c.addClass("open");var d=c.find(".ap-modal-inner"),e=d.width(),f=d.height(),g=a(window).width(),h=a(window).height();d.css({left:(g-e)/2,top:h/2-f/2})}),a("body").delegate('[data-action="ap_modal_close"]',"click",function(b){a(".ap-modal").removeClass("open")})},expand:function(){a("body").delegate('[data-action="ap_expand"]',"click",function(b){b.preventDefault();var c=a(this).data("expand"),d=a(c).parent();a(d).animate({height:a(c).height()}),a(this).hide()})},follow:function(){a("body").delegate('[data-action="ap_follow"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(b){AnsPress.site.hideLoading(this),"follow"==b.action?a(this).addClass("active"):a(this).removeClass("active")},this,function(){a(this).toggleClass("active")})})},updateCover:function(){a(document).on("uploadForm",function(b,c){"undefined"!=typeof c.action&&"cover_uploaded"===c.action&&a('[data-view="user_cover_'+c.user_id+'"]').css({"background-image":"url("+c.image+")"})})},hoverCard:function(){disable_hover_card||a("[data-userid], [data-catid]").aptip({theme:"ap-hover-card",interactive:!0,delay:500,position:"bottom right",title:'<div class="hovercard-loading-bg"></div>'})},delete_notification:function(){a("body").delegate('[data-action="ap_delete_notification"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(b){AnsPress.site.hideLoading(this),"undefined"!=typeof b.container&&a(b.container).slideUp("400",function(){a(b.container).remove()})},this)})},mark_as_read:function(){a("body").delegate('[data-action="ap_markread_notification"]',"click",function(b){b.preventDefault();var c=a(this).attr("data-query");ApSite.doAjax(apAjaxData(c),function(a){AnsPress.site.hideLoading(this)},this)}),a(document).on("ap_after_ajax",function(b,c){"undefined"!=typeof c.action&&("mark_read_notification"===c.action?(a(c.container).removeClass("unread"),a(c.container).find(".ap-btn-markread").remove()):"mark_all_read"===c.action&&(a(".ap-notification-item").removeClass("unread"),a(".ap-notification-item").find(".ap-btn-markread").remove()))})},cancel_comment:function(){a("body").delegate('[data-action="cancel-comment"]',"click",function(b){b.preventDefault();var c=a(this).data("id");a('[href="#comments-'+c+'"]').removeClass("loaded"),a(this).closest(".ap-comment-form").remove()})},questionSuggestion:function(){a('[data-action="suggest_similar_questions"]').on("blur",function(){var b=a(this).val();0!=b.length&&ApSite.doAjax(apAjaxData("action=ap_ajax&ap_ajax_action=suggest_similar_questions&ap_ajax_nonce="+ap_nonce+"&value="+b),function(b){a("#similar_suggestions").html(b.html)},this,!1,!0)})},notificationAsRead:function(){var b=a('input[name="ap_loaded_notifications"]').val();0==b.length||a(this).parent().is(".open")||ApSite.doAjax(apAjaxData("ap_ajax_action=set_notifications_as_read&__nonce="+ap_nonce+"&ids="+b))},checkboxUncheck:function(){a('#anspress input[type="checkbox"]').click(function(){var b=a(this).attr("name");a(this).is(":checked")?a('input[name="'+b+'"][type="hidden"]').attr("name","_hidden_"+b):a('input[name="_hidden_'+b+'"]').attr("name",b)})},listFilter:function(){a("body").delegate('[data-action="load_filter"]',"click",function(b){if(!a(this).is(".ajax-disabled")){b.preventDefault();var c=a(this).apAjaxQueryString();c.current_filter=a("#current_filter").html(),ApSite.doAjax(c,function(b,c){if(a(c).data("cb")){var d=a(c).data("cb");console.log(apFunctions[d]),"function"==typeof apFunctions[d]&&apFunctions[d](b,c)}},this)}}),a("body").delegate("#ap-filter .ap-dropdown-menu a","click",function(b){b.preventDefault();var c=a(this).closest(".ap-dropdown-menu"),d=c.data("key"),e=a(this).data("value")||!1;if(e){var f=c.data("multiple");f?c.find('input[name="ap_filter['+d+'][]"][value="'+e+'"]').length>0?c.find('input[name="ap_filter['+d+'][]"][value="'+e+'"]').remove():c.append('<input value="'+e+'" type="hidden" name="ap_filter['+d+'][]" />'):c.find('input[type="hidden"]').val(e),a(this).closest("form").submit()}}),a("body").delegate("#ap-question-sorting-reset","click",function(b){b.preventDefault(),a("#ap-filters").find('input[type="hidden"]').val(""),a(this).closest("form").submit()});var b=0;a("body").delegate(".ap-filter-search","keyup",function(c){var d=a(this).val();a(this).data("query","filter_search::"+ap_nonce+"::"+d);var e=(a(this).apAjaxQueryString(),a(this).closest(".ap-dropdown-menu").data("key"));clearTimeout(b),b=setTimeout(function(){a.ajax({url:ajaxurl,type:"POST",data:{action:"ap_ajax",ap_ajax_action:"filter_search",__nonce:ap_nonce,val:d,filter:e},success:function(a){a=apParseAjaxResponse(a),a.apData&&apMergeObj(apData[e+"Filter"],a.apData)}})},500)}),a("body").delegate("#ap-question-sorting","submit",function(){AnsPress.site.showLoading(this);var b=a(this).serialize().replace(/[^&]+=&/g,"").replace(/&[^&]+=$/g,"");return a.ajax({type:"GET",dataType:"html",data:b,success:function(c){AnsPress.site.hideLoading("#ap-question-sorting");var d=a(c);window.history.replaceState("","","?"+b),a("#anspress").html(d.find("#anspress")),a(document).trigger("apAfterSorting")}}),!1})}}}(jQuery),function(a){function b(a,b,c){c=c||"","function"==typeof ApSite[a]&&("object"==typeof b?(b.data=c,ApSite[a].apply(ApSite,b)):ApSite[a](b,c))}a(document).ajaxComplete(function(c,d,e){var f=apParseAjaxResponse(d.responseText);if(console.log(f),f.apTemplate&&"object"==typeof f.apTemplate&&!apAutloadTemplate(f)&&apLoadTemplate(f.apTemplate.name,f.apTemplate.template,function(b){if(f.apData&&f.key){var c="undefined"==typeof apData[f.key];apData[f.key]=f.apData,c&&(console.log("Watching object "+f.key+" for change."),watch(apData,f.key,function(){var c=a(Ta.render(b,apData[f.key]));a(apData[f.key].elm).replaceWith(c),apData[f.key].elm=c}))}var d=a(Ta.render(b,f.apData));a(f.appendTo).append(d),apData[f.key].elm=d}),"undefined"!=typeof f.message_type&&(""!=f.message_type&&""!=f.message&&ApSite.addMessage(f.message,f.message_type),"undefined"!=typeof grecaptcha&&"success"!==f.message_type&&grecaptcha.reset(widgetId1),a(document).trigger("ap_after_ajax",f),AnsPress.site.hideLoading("all")),"undefined"!=typeof f["do"]){var g=f["do"];"object"==typeof g?a.each(g,function(c,d){"function"==typeof ApSite[c]?b(c,d,f):"object"==typeof d&&a.each(d,function(a,c){"undefined"!=typeof c.action&&"function"==typeof ApSite[c.action]&&b(c.action,c.args,f)})}):"function"==typeof ApSite[g]&&ApSite[g](f)}"undefined"!=typeof f&&"undefined"!=typeof f.is_ap_ajax&&"undefined"!=typeof f.view&&a.each(f.view,function(b,c){try{var d=a(c)}catch(e){}"undefined"!=typeof f.view_html&&"undefined"!=typeof d&&d.is('[data-view="'+b+'"]')?(d=d.children(),a('[data-view="'+b+'"]').html(d)):(a('[data-view="'+b+'"]').text(c),a('[data-view="'+b+'"]').removeClass("ap-view-count-0"))})})}(jQuery);
You are viewing 1 out of 3 answers, click here to view all answers.