/*
MOOT v1.0.7-beta (April 12, 2013)
Forums & commenting re-imagined
http://moot.it | (c) 2013 Moot Inc
*/!function(e,t){"use strict";function n(e,n){var o={},i=[].slice;return e=e||{},t.extend(e,{on:function(n,i,a){if(n=n.split(" "),t.isFunction(i)&&(a=i,i=0),t.isFunction(a)){for(var r,s=0,c=n.length;c>s;s++)r=t.trim(n[s]),(o[r]=o[r]||[]).push(a),c>1&&(a.typed=!0);i&&(a.typed?a("inline",i):a(i))}return e},off:function(n,i){if("*"==n)return o={};n=n.split(" ");for(var a,r=0;n.length>r;r++)if(a=t.trim(n[r]),i){for(var s=o[a]||[],c=-1,l=0,u=s.length;u>l;l++)if(s[l]===i||s[l].listener===i){c=l;break}c>=0&&s.splice(c,1)}else o[a]=[];return e},one:function(n,o){function i(){e.off(n,o),o.apply(e,arguments)}return n=n,t.isFunction(o)&&(i.listener=o,e.on(n,i)),e},emit:function(t){t=t;var n=i.call(arguments,1),a=o[t]||[],r=o["*"];r&&(a=a.concat(r));for(var s,c,l=0,u=a.length;u>l;++l)if(s=a[l]){c=s.typed?[t].concat(n):n;try{if(s.apply(e,c)===!1)return e}catch(p){throw p}}return e}}),t.each(n||[],function(n,o){e[o]=function(n){return t.isFunction(n)?e.on(o,n):e.emit.apply(e,[o].concat([].slice.call(arguments)))}}),e}function o(o){function i(e){if(!e)return s.emit("heartbeat");if("string"==typeof e&&(e=JSON.parse(e)),e.params&&"ping"==e.params[0])return s.emit("heartbeat");if(t.isArray(e))return t.each(e,function(e,t){i(t)});s.emit("receive",e),e.session&&(c=e.session,t.cookie2(k,c.sessionId)),o.pollUrl=o.pollUrl||e.pollUrl;var n=p[e.id];n?(n.always(e.result,e.error),void 0!==e.result&&n.done(e.result)):"emit"==e.method&&l.emit.apply(null,e.params),void 0!==e.error&&(n&&n.fail(e.error,e.data),s.error(e.error,e.data)),r||(e.result&&s.ready(e.result),r=!0)}if(t.isFunction(o))return x.push(o);var a,r,s=n(this,["ready","error","close","reconnect","destroy"]),c={sessionId:t.cookie2(k)},l=n({}),u=0,p={};"string"==typeof o&&(o={url:o}),s.conf=o=t.extend({transports:"upgrade,xdomain",remote:!0,pollUrl:null,secure:!0},o);var d=o.url;if(d="http"+(o.secure?"s":"")+"://"+d.hostname+(d.port&&80!=d.port?":"+d.port:""),t.each(o.transports.split(","),function(e,t){var n=_[t];!a&&n&&n.supported&&(a=new n(d,s,i),s.transport=t)}),!a)throw Error("json-rpc: no support for "+o.transports);s.event=function(e,t){return l.on(e,t),s},s.session=function(){return t.extend({},c)},s.reload=function(){return u=0,a.destroy(),a.ping(),s},s.poll=function(){var e=o.pollUrl;-1==e.indexOf("://")&&(e=d+e),a.poll(e,t.extend({},c,{transport:a.name}))},s.call=function(e){if(s.is_closed||s.is_destroyed)throw Error("connection "+(s.is_closed?"closed":"destroyed"));var o,i=[].slice.call(arguments),l=i.slice(-1)[0],d={method:e,params:i.slice(1,-1)};return t.isFunction(l)?(o=n({},["done","fail","always"]).done(l),d.id="#"+ ++u,p[d.id]=o):(void 0!==l&&(d.params=i.slice(1)),l=void 0),d.params.length||delete d.params,d.session=c,r||(d.jsonrpc="2.1.0"),d.transport=s.transport,s.emit("send",e,d.params,o),a.send(JSON.stringify(d)),o},t.each(x,function(){this.call(s,a)});var m=e;e||t(window).load(function(){m=!0}),s.destroy(function(){s.is_destroyed=!0,a.destroy()}).error(function(e){"error_invalid_channel"==e&&(t.cookie2(k,""),s.inited=!1,s.reconnect())}).close(function(){r=!1}).ready(function(){t.isFunction(a.poll)&&(e?s.poll():setTimeout(s.poll,m?1e3:3e3))})}function i(e,t,n){e/=n?S:2,e+=~~(e/t);for(var o=D-C,i=~~(o*q/2),a=0;e>i;a+=D)e=~~(e/o);var r=(D-C+1)*e,s=e+O;return a+~~(r/s)}function a(e,t){for(var n=1114112,o=0,i=e.length;i>o;++o){var a=e[o];a>=t&&n>a&&(n=a)}return n}function r(e){return e+(26>e?97:22)}function s(e,t){return t+C>=e?C:e>=t+q?q:e-t}function c(e,t){for(var n=[],o=D,i=t;;o+=D){var a=s(o,e);if(a>i){n.push(r(i));break}n.push(r(a+(i-a)%(D-a))),i=~~((i-a)/(D-a))}return n}function l(e){e=e.split("").map(function(e){return e.charCodeAt(0)});for(var t=[],n=[],o=0,r=e.length;r>o;++o){var s=e[o];128>s?t.push(s):n.push(s)}var l,u;l=u=t.length,l&&t.push(45);for(var p=F,d=I,m=0,r=e.length;r>u;++p,++m){var f=a(n,p);m+=(f-p)*(u+1),p=f;for(var o=0;r>o;++o){var s=e[o];p>s?++m:s==p&&(t=t.concat(c(d,m)),d=i(m,u+1,l==u),m=0,u++)}}return String.fromCharCode.apply(String,t)}function u(e,n){return t.isFunction(e)&&e.apply(n,[].slice.call(arguments,2)),n}function p(e){var t=e.split("#");t[1]&&(e=t[0]+"#"+d(t[1])),e=A(e),"/"==e.href.slice(-1)&&(e.href=e.href.slice(0,-1),e.pathname=e.pathname.slice(0,-1));var n=e.href,o=n.split("/"),i="//"==n.slice(0,2)||n.indexOf("://")>0?n.slice(8).indexOf("/")+8:n.indexOf("/");return e.path=n.slice(i),e.host=o[2],e}function d(e){e=t.trim(e.toLowerCase().slice(0,10*E)),e=e.replace(/?/g,"");var n={a:/[áàâãªäå]/g,o:/[òóôõºöø]/g,e:/[éèê]/g,i:/[íìîı]/g,u:/[úùûü]/g,c:/[ç]/g,n:/[ñ]/g,"-":/[_\s]+/g};return t.each(n,function(t,n){e=e.replace(n,t)}),e=l(e).slice(0,10*E),e.replace(/[^a-z0-9-]/g,"").replace(/^-|-$/g,"").replace(/\-{2,}/g,"-")}function m(e,n){if(void 0===e||"number"==typeof e)return U[1*e||0];if(t.isFunction(e)&&(n=e,e="ready"),"string"==typeof e)if(-1!=e.indexOf("/"))e={url:e};else if(t.isFunction(n))return(W[e]=W[e]||[]).push(n);if(t.isPlainObject(e)){e=t.extend({url:"https://playground.moot.it/playground"},e),"object"!=typeof console&&(e.debug=0);var o=new f(e);return t.isFunction(n)&&W.ready.unshift(n),t.each(W,function(e,n){t.each(n,function(){o.on(e,this)})}),o.emit("before:init",o),U.push(o),o}}function f(e){"string"==typeof e&&(e={url:e});var i,a=n(this),r=p(e.url),s=r.pathname.split("/");e.url=r,t.extend(a,{version:"1.0.7",channel:null,name:s[1],path:"/"+s[1],is_commenting:!!r.hash,is_forum:!r.hash&&3>s.length,is_page:!r.hash&&s.length>2,conf:function(){return e},load:function(e,t){if(a.is_stub)throw Error("Forum not created");var n=new y(a,e,i);a.emit("before:load",n),i.call("moots",{path:n.path},function(e){n.emit("load",e),a.one("load",t).emit("load",n)})},search:function(e,t){return a.load("/?"+e,t)},create:function(n,o,r){if(t.isFunction(o)&&(r=o,o=0),!a.user.is_logged)throw Error("not logged");if(t.trim(n)){var s=m.parse(n,!0);s.key=d(s.title),o?"/"!=o[0]&&(o=a.path+"/"+o):o=a.page.path,s.path=o,a.is_page&&!a.page.size&&t.extend(s,{pageLocation:e.pageUrl,pageTitle:e.pageTitle,mootTitle:e.mootTitle});var c=new v(a,o+"#"+s.key,s,i,!0);return a.page.emit("before:moot",c),i.call("createMoot",s,function(e){c.emit("key",e),c.seed.emit("key",e),a.page.one("moot",r).emit("moot",c,!0)})}},createForum:function(e,n){var o=e.categories;return"string"==typeof o[0]&&(o=t.grep(o,function(e){return!!e}),e.categories=o=t.map(o,function(e){return{title:e.slice(0,40),path:a.path+"/"+d(e)}})),i.call("createForum",e,function(){a.is_stub=!1,a.categories=o,a.emit("categories",o),u(n,a,o)})},getCategory:function(e){return e=e.split("#")[0],t.grep(a.categories,function(t){return t.path==e})[0]},setCategories:function(e,n){return t.each(e,function(e,t){t.path||(t.path=d(t.title)),-1==t.path.indexOf(a.path)&&(t.path=a.path+"/"+t.path)}),i.call("setCategories",{path:a.path,categories:e},function(){a.emit("categories",e),u(n,a,e)})},reload:function(e){return a.channel.off("*"),a.off("before:load load error waiting destroy categories"),a.page.length=0,t.isFunction(e)&&(a.one("load",e),e=null),e&&(e.moots||e.user)?(a.page=new y(a,a.page.path,i),a.emit("init",e)):a.emit("before:init",a),a},destroy:function(){i.destroy(),a.is_destroyed=!0,a.emit("destroy")}}).on("before:init",function(){i||(i=new o({url:r,transports:e.transports,secure:!(t.browser.msie&&"https"!=e.pageUrl.slice(0,5))}),a.channel=new h(a,i),i.reconnect(a.reload),a.page=new y(a,r.path,i),a.is_forum&&e.path&&(a.page=new y(a,e.path,i))),a.page.is_init=!0;var n={version:a.version,path:a.page.path,currentForum:a.name,pageLocation:e.pageUrl};e.sso&&(n.sso=e.sso,n.api_key=e.api_key),i.call("init",n,function(e){a.emit("init",e)}).fail(function(e){a.emit("error",e[0])})}).on("init",function(e){a.page.is_init=!0,t.extend(a,e),a.is_stub=!e.moots,a.user=new b(a,e.user,i),a.emit("ready",a),a.emit("before:load",a.page),a.page.emit("load",e.moots),a.emit("load",a.page),delete a.moots}).on("load",function(e){a.page=e}).on("categories",function(e){e&&(a.categories=e,a.is_stub=!1)})}function h(e,o){var i=n(this),a=e.conf().debug;o.event("moot",function(t,n){t.from_channel=n.from_channel=!0;var a=new v(e,t,n,o),r=e.page;e.is_forum&&i.emit("moot",a),"feed"!=r.type&&(r.path==a.page.path||r.title==a.seed.user.displayname||"all"==r.type&&e.getCategory(t.path))&&(e.is_forum||i.emit("moot",a),r.emit("moot",a,!0))}).event("reply",function(t,n){var a=e.page.find(t);if(!a){if(e.is_commenting)return!1;if(e.is_page){if(t.split("#")[0]!=e.page.path)return!1}else if(!e.getCategory(t))return!1;a=new v(e,t,{},o)}n.from_channel=!0,n=new w(a,n,o),a.emit("reply",n),i.emit("reply",n)}).event("like unlike remove spam unspam",function(t,n,o){var a=e.page.find(n);a&&a.seed&&(a=a.seed),a&&a.emit(t,o),i.emit(t,a||n,o)}).event("error",function(e,t){a&&console.error(arguments),i.emit("error",e,t)}).event("enter leave away return login join",function(e,t,n){i.emit(e,t,n)}).on("send",function(n,o,i){if(i){var a,r=+new Date;t.each([3e3,5e3,8e3,12e3],function(t,o){setTimeout(function(){!a&&+new Date-r>o&&(0==t&&e.emit("waiting",n,i),i.emit("progress",t,o))},o)}),i.done(function(){a=1}).fail(function(){a=1})}}).ready(function(){i.session=o.session()}).on("login close reconnect error",i.emit),a&&o.on("send",function(e,t){console.info(">",e,t&&1==t.length?t[0]:t)}).on("receive",function(e){e&&console.info("<",e.result||e.params||e)})}function g(e,n,o,i){var a=this,r=e.path,s=e.app.page,c=e.match_count>=0&&i;a.is_gap=!0,a.size=a.available=n,c&&(a.match_count=e.match_count,t.each(e.replies,function(){this.is_gap||a.match_count--})),a.more=function(n){if(!a.available)return u(n);for(var i,c=e.reply_count,l=Math.min(a.available,5),p=e.replies.length-1,d=p;d>=0&&(i=e.replies[d],i!=a);d--)c-=i.is_gap?i.available:1,p--;var m={path:r,start:c,end:c-l+1};return a.match_count>0&&(m.path+="search"==s.type?"?"+s.title:"@"+s.username,delete m.end),o.call("moreReplies",m,function(i){i=t.map(i,function(t){var n=t.reply_count;return a.available-=n||1,!n&&a.match_count&&a.match_count--,n?new g(e,n,o):new w(e,t,o)}),0>a.available&&(a.available=0),e.one("more",n).emit("more",i,p)})}}function v(e,o,i,a,r){function s(){if(r)throw Error("Not saved");if(!e.user.is_logged)throw Error("not logged")}var c=n(this),l=e.page;if("string"==typeof o){var p=o.split("#");o={page:e.getCategory(p[0])||{path:o,title:o},path:o}}r&&(o.is_expanded=!0),t.extend(c,o),t.extend(c,{app:e,replies:[],reply_count:c.reply_count||0,time:c.time||+new Date,has_replied:!!o.has_replied,is_watched:!!o.is_watched,is_expanded:!!o.is_expanded}),c.page=c.page||{},c.page.path=o.path.split("#")[0],r||i.user||!e.is_forum||(c.is_commenting=!0,i.user={}),c.seed=i=new w(c,i,a,r),c.is_own=r||i.user&&i.user.path==e.user.path,t.extend(c,{is_loaded:c.is_expanded,reply:function(n,o){if(s(),!t.trim(n))throw Error("no content");var i=m.parse(n),r=e.conf(),u=c.seed.is_stub;i.key=d(i.body[0]);var p=new w(c,i,a,!0);return c.emit("before:reply",p),t.extend(i,{path:u?l.path:c.path,mootTitle:r.mootTitle||r.pageTitle,pageTitle:r.pageTitle,pageLocation:r.pageUrl}),a.call("reply",i,function(e){p.emit("key",e),c.one("reply",o).emit("reply",p)})},posts:function(){return t.grep([c.seed].concat(c.replies||[]),function(e){return!e.is_gap})},find:function(e){if(c.seed.key==e)return c.seed;e.split("#")[1]||(e=c.path+"/"+e);for(var t=0,n=c.posts(),o=n.length;o>t;t++)if(n[t].path==e)return n[t]},expand:function(e){return c.toggle(!0,e)},collapse:function(e){return c.toggle(!1,e)},load:function(t){var n=c.path+("search"==e.page.type?"?"+e.page.title:"user"==e.page.type?"@"+e.page.username:"");return c.is_loaded?u(t,c):a.call("moot",n,function(e){c.one("load",t).emit("load",e).emit("expand")})},toggle:function(n,o){function i(){return c.one(r,o).emit(r)}if(t.isFunction(n)&&(o=n,n=void 0),"boolean"!=typeof n&&(n=!c.is_expanded),n==c.is_expanded)return u(o,c);if(n&&!c.is_loaded)return c.load(o);var r=n?"expand":"collapse";return e.user.is_logged?a.call(r+"Moot",c.path,i):i()}}).on("key",function(e){r=!1,c.path=c.page.path+"#"+e}).on("load",function(e){c.is_loaded=c.is_expanded=!0,c.reply_count=e.reply_count,c.seed=new w(c,e.seed,a)}).on("load",o,function(e){var n=0;c.match_count=e.match_count,t.each(e.replies||[],function(e,t){var o=t.reply_count;c.replies.push(o?new g(c,o,a):new w(c,t,a)),n+=o||1}),c.is_expanded&&c.reply_count>n&&c.replies.unshift(new g(c,c.reply_count-n,a,!0))}).on("reply",function(e){c.lastReply=+new Date,c.reply_count++,e.is_own&&(c.has_replied=!0),c.is_loaded&&c.replies.push(e)}).on("remove",function(e){return e.is_seed?l.emit("remove",c):(c.replies=t.grep(c.replies,function(t){return t.path!=e.path}),c.reply_count--,void 0)}).on("more",function(e,t){[].splice.apply(c.replies,[t>=0?t+1:0,0].concat(e))}).on("expand",function(){c.is_expanded=!0}).on("collapse",function(){c.is_expanded=!1})}function y(e,o,i){var a=n(this);o=o.replace(e.path,""),e.path&&(o=e.path+"/"+o),o=o.replace("//","/"),"/"==o.slice(-1)&&(o=o.slice(0,-1)),a.type=/\?/.test(o)?"search":/feed/.test(o)?"feed":o==e.path+"/spam"?"spam":/@/.test(o)?"user":2==o.split("/").length?"all":/#/.test(o)?"moot":"page","user"==a.type&&(a.username=o.split("@")[1]),t.extend(a,{app:e,path:o,find:function(e){for(var t,n=0;a.length>n;n++){if(t=a[n],t.path==e)return t;if(t=t.find(e))return t}},more:function(e){return a.available?(a.emit("before:more"),i.call("moots",{path:a.path,start:a.length},function(t){a.one("more",e).emit("more",t)})):void 0},lift:function(t,n){var o=a.find(t);o&&a.emit("remove",o),i.call("moot",t,function(t){var o=new v(e,t,t.seed,i);a.one("moot",n).emit("moot",o,!0)})},reply:function(e,n,o){var i=a.find(n);return i&&i.is_expanded?(i.reply(e,o),i.replies.slice(-1)):(a.lift(n,function(n){setTimeout(function(){n.reply(e,o)},t.browser.msie?1e3:0)}),i)},like:function(e){var t=a.find(e);return t?(t.seed&&(t=t.seed),t.like()):i.call("like",e),t},collapse:function(e){var n=t.grep(a,function(e){return e.is_expanded}),o=t.map(n,function(e){return e.path});return i.call("collapseMoot",o,function(){t.each(n,function(){this.emit("collapse",!0)}),u(e,a,n)})}}).on("load",function(n){return e.is_stub?!1:(t.extend(a,n),a.available=n.size,delete a.entries,e.is_commenting&&(n.entries[0]||n.entries.push({seed:{user:e.user},is_expanded:!0,path:o}),n.entries[0].seed.is_stub=!0),void 0)}).on("load more",function(n,o){t.each(o.entries,function(t,n){var o=new v(e,n,n.seed,i);a.emit("moot",o)}),a.available-=o.entries.length}).on("moot",function(e,t){a[t?"unshift":"push"](e)}).on("remove",function(e){var n;t.each(a,function(t,o){return o.path!=e.path?(n=t,!1):void 0}),n&&(a.splice(n,1),a.size--)})}function w(e,o,i,a){function r(){if(!l.is_logged)throw Error("not logged");if(a)throw Error("not saved")}var s=n(this),c=e.app,l=c.user,p=e.path+(o.title||o.is_stub?"":"/"+o.key);a&&(o=t.extend({},o,{user:l})),o.body=o.body||[],t.extend(s,o,{app:c,moot:e,path:p,key:o.key||p.split("#")[1],is_own:a||o.user&&o.user.path==l.path,likes:0,is_expanded:!!o.body[1],is_loaded:!o.has_more||!!o.body[1],is_seed:!!o.title,is_new:!!o.is_new||!!o.from_channel,is_liked:!!o.is_liked,like_count:o.like_count||0,meta:o.meta||{},time:o.time||+new Date,likeToggle:function(n,o){if(r(),t.isFunction(n)&&(o=n,n=void 0),void 0===n&&(n=!s.is_liked),n==s.is_liked)return u(o,s,l);var a=s.is_liked?"unlike":"like",d=c.conf(),m=p;return e.seed.is_stub&&n&&(m={pageLocation:d.pageUrl,mootTitle:d.mootTitle||d.pageTitle,pageTitle:d.pageTitle,path:p}),i.call(a,m,function(){s.one(a,o).emit(a,l)})},like:function(e){return s.likeToggle(!0,e)},unlike:function(e){return s.likeToggle(!1,e)},setMeta:function(e,t){return r()&&i.call("setMeta",p,e,function(){s.one("meta",t).emit("meta",e)})},remove:function(e){if(!s.removable())throw Error("No permission");var t=l.is_admin?{path:p,force:1}:p;return i.call("delete",t,function(){s.one("remove",e).emit("remove")})},removable:function(){return l.is_admin||a||s.is_own&&!s.like_count&&(!e.replies.length||e.replies.slice(-1)[0]==s)&&2.718*60>(+new Date-s.time)/1e3},whoLikes:function(e){return s.likes?e.call(s,s.likes):i.call("whoLikes",p,function(t){s.likes=t||[],u(e,s,t)})},more:function(e){return s.is_loaded?u(e,s):i.call("more",p,function(t){s.one("more",e).emit("more",t)})},toggle:function(e,n){function o(){return s.one(a,n).emit(a)}if(t.isFunction(e)&&(n=e,e=void 0),void 0===e&&(e=!s.is_expanded),e===s.is_expanded)return u(n,s);if(e&&!s.is_loaded)return s.more(n);var a=e?"expand":"collapse";return l.is_logged?i.call(a+"Post",p,o):o()},expand:function(e){return s.toggle(!0,e)},collapse:function(e){return s.toggle(!1,e)}}).on("key",function(t){s.key=t,s.path=p=s.is_seed?e.path:e.path+"/"+t,a=!1}).on("like",function(e){(e.is_logged||e.path==l.path)&&(s.is_liked=!0),s.likes&&s.likes.push(e),s.like_count++}).on("unlike",function(e){(e.is_logged||e.path==l.path)&&(s.is_liked=!1),s.likes&&(s.likes=t.grep(s.likes,function(e){return e.path!=l.path})),s.like_count--}).on("more",function(e){s.is_loaded=s.is_expanded=!0,s.body.push(e)}).on("expand collapse",function(e){s.is_expanded="expand"==e}).on("remove",function(){e.emit("remove",s)}).on("meta",function(e){t.extend(s.meta,e)}).on("spam unspam",s.spam_level,function(e,t){if(s.spam_level=t,"inline"!=e&&(s.flag=e),-1==t)s.emit("remove");else if(t>=1){var n=20*E;s.body[0]=s.body[0].replace(/\n/g," "),s.body[0].length>n&&(s.body[1]=s.body[0].slice(n)+(s.body[1]||""),s.body[0]=s.body[0].slice(0,n)),s.is_expanded=!1}}),t.each(["spam","unspam"],function(e,t){s[t]=function(e){return r(),i.call(t,p,function(n){s.one(t,e).emit(t,n)})}})}function b(e,o,i){function a(){if(!s.is_logged)throw Error("must be logged")}function r(e){return e[0].toUpperCase()+e.slice(1)}var s=n(this);e.path+"/feed",o.new_count=o.new_count||{all:0,feed:0},e.is_stub&&o.path&&(o.is_admin=!0),o.img=o.img||"//cloudinary-a.akamaihd.net/moot/image/upload/t_default-avatar/v1364433583/moot-default-avatar.jpg",o.email||delete o.email,t.extend(s,o,{app:e,is_logged:!!o.path,logout:function(t){return a(),i.call("logout",e.page.path,function(n){e.reload(n),u(t,s)})},join:function(t,n){if(s.is_logged)throw Error("already logged");return i.call("join",t,function(t){e.reload(t),u(n,s)})},update:function(e,t){return i.call("userUpdate",e,function(){e.url||s.emit("update",e),u(t,s)})},isAvailable:function(e,t){return i.call("isAvailable",e,t)},unwatch:function(){return i.call("forumUnwatch",e.path,function(){t.each(e.page,function(){this.is_watched=!1,this.emit("unwatch")})})}}),t.each(["email_confirm","account_confirm","password_reset","validationCode_send","resetCode_check"],function(t,n){var o=n.split("_");s[o[1]+r(o[0])]=function(t,n){return i.call(o[0]+r(o[1]),t,function(t){t&&t.moots&&e.reload(t),u(n,s,t)})}}),s.on("update",function(e){delete e.email,t.extend(s,e),s.is_logged=!0}),e.on("load",function(e){e.is_init||(s.new_count[e.type]=0),s.emit("newcount",s.new_count)})}!function(e){if(!e.browser){var t=e.browser={},n=navigator.userAgent.toLowerCase(),o=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||0>n.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[];o[1]&&(t[o[1]]=!0,t.version=o[2]||"0")}}(jQuery);var k="jsonrpc.session",_={},x=[];e||(window.RPC=o),_.ajax=function(e,n,o){var i=this,a={};t.extend(i,{send:function(n){t.post(e,n,o,"json")},poll:function(e,r){i.destroy(),a=t.post(e,r,0,"json").done(function(t){o(t),t.error||i.poll(e,r)}).fail(function(e,t){n.is_destroyed||"abort"==t||n.close()})},destroy:function(){1==a.readyState&&a.abort()},ping:function(n){return t.ajax({url:e+"/ping",dataType:"text"}).done(n)}})},_.ajax.supported=t.support.cors,t.cookie2=function(e,t,n){var o=window.localStorage,i=null===t,a=void 0===t;if("file:"==location.protocol){if(o)return i?o.removeItem(e):a?o[e]:o[e]=t;throw"moot: localStorage support needed under file:// protocol"}if(i&&(n=-1),a){var r,s,c=document.cookie;if(c&&(r=c.indexOf(e+"="),r>-1))return s=c.indexOf(";",r),c.slice(r+e.length+1,s>-1?s:c.length)}else document.cookie=e+"="+escape(t)+"; path=/"+(n?";expires="+new Date(+new Date+864e5*n).toUTCString():"")},_.upgrade=function(e,n,o){var i,a=this,r=new _.ajax(e,n,o),s=_.websocket.supported;s&&(s=new _.websocket(e,n,o),n.one("receive",function(e){e.result&&s.ping(function(){if(!e.session||!e.session.sessionId)throw Error("Empty sessionId");s.send(JSON.stringify({method:"rpc.upgrade",session:e.session})),i=!0,r.destroy(),n.emit("upgrade",s)})})),t.each(["send","close","poll","ping","destroy"],function(e,t){a[t]=function(){var e=(i?s:r)[t];return e?e.apply(null,arguments):a}})},_.upgrade.supported=t.support.cors||e;var T=e?require("ws"):window.WebSocket||window.MozWebSocket;if(_.websocket=function(e,n,o){function i(){n.is_destroyed||n.close(),s={}}e=e.replace(/^http/,"ws");var a={fail:t.noop,abort:t.noop},r=this,s={};t.extend(r,{ping:function(t){var n=s.readyState;return 0===n?a:1==n?(t(),a):(s=new T(e),s.onopen=function(){s.onmessage=function(e){o(e.data)},s.onclose=i,s.onerror=i,t()},a)},destroy:function(){1==s.readyState&&s.close()},send:function(e){r.ping(function(){s.send(e)})}})},_.websocket.supported=!!T,!e&&T){var $=navigator.userAgent.toLowerCase(),j=navigator.appVersion.split("Version/")[1];T&&t.browser.webkit&&!/chrome/.test($)&&j&&"5.1.14">j.split(" ")[0]&&(_.websocket.supported=!1),t.browser.mozilla&&t(document).keydown(function(e){27==e.which&&e.preventDefault()})}_.xdomain=function(e,n,o){function i(e,n,o,i){var a=c[e];return a||(a=c[e]=new XDomainRequest,a.onerror=t.noop,a.ontimeout=t.noop,a.onprogress=t.noop),a.open(i||"post",e),a.onload=function(){var e=a.responseText;try{e=JSON.parse(e)}catch(t){}o(e)},a.send(n),a}var a,r=this,s={},c={};r.send=function(t){i(e,t,o)},r.destroy=function(){a&&(a=!1,s.abort())},r.poll=function(e,c){n.is_destroyed||(r.destroy(),a=!0,s=i(e,t.param(c),function(t){a=!1,o(t),setTimeout(function(){t.error||r.poll(e,c)},200)}),s.onerror=function(){console.error("xdomain",JSON.stringify(arguments[0])),n.is_destroyed||n.close()})},r.ping=function(t){var n=i(e+"/ping?"+Math.random(),"",t,"get");return{fail:function(e){n.onerror=e},abort:function(){n.abort()}}}},_.xdomain.supported=window.XDomainRequest,o(function(e){var t,n,o=3e4,i=this;i.conf,i.on("receive heartbeat",function(){t=+new Date}).on("close reconnect",function(e){i.is_closed="close"==e}).ready(function(){if("file:"!=location.protocol&&"localhost"!=location.hostname||navigator.onLine){var a;n=n||setInterval(function(){navigator.onLine!==!1||i.is_closed?i.is_closed===!0&&navigator.onLine!==!1?(a&&a.abort(),a=e.ping(i.reconnect)):i.is_closed||(t=t||+new Date,+new Date-t>o&&e.ping(function(){t=+new Date,i.poll()}).fail(i.close)):i.close()},1e3)}}).destroy(function(){clearInterval(n)})});var C=1,q=26,D=36,O=38,S=700,F=128,I=72,E=2.718,A=e?require("url").parse:function(e){var t=document.createElement("a");t.href=e;var n=t.pathname;return"/"!=n[0]&&(n="/"+n),{href:e,pathname:n,port:1*t.port||"",hostname:t.hostname,hash:t.hash,search:t.search,protocol:t.protocol}},U=[],W={};e?module.exports=m:window.moot=m,y.prototype=[],m(function(e){function t(e){for(var t=0;n.length>t;t++)if(n[t].path==e)return t;return-1}if(e.users){var n=e.users.online;e.users.find=function(e){var o=t(e);return n[o]},e.channel.on("enter",function(e){e&&n.push(e)}).on("leave",function(e){if(e){var o=t(e.path);o>=0&&n.splice(o,1)}}).on("away return",function(t,n){n&&(n=e.users.find(n.path)),n&&(n.is_active="return"==t)}).on("enter leave away return",function(t,n,o){e.users.anon_count=o})}});var M=30*E,z=100*E,L=40*E,P=30*E,R=10,N=/\[#(.+)\/#\]/g,H=/-{3,} *(\w*)/g;m.parse=function(e,n,o){e=t.trim(e).replace(/\n{2,}/g,"\n\n").replace(N,"$1");var i,a=e.split("\n"),r={body:e},s=a[0];if(t.each(e.split(/\s+/g),function(t,n){n.length>P&&!/^https?:/.test(n)&&(e=e.replace(n,n.slice(0,P)+" "+n.slice(P,2*P)))}),n&&(s.length>M&&(s=s.slice(0,M),s=s.slice(0,s.lastIndexOf(" "))),r.title=s,r.body=e=t.trim(e.slice(r.title.length)),a=e.split("\n")),!o){r.body=e.slice(0,z),i=e.slice(r.body.length),e.length>z&&L>i.length&&(r.body=e.slice(0,z-L));var c=R+r.body.split(H).length/2;a.length>c&&(r.body=a.slice(0,c).join("\n").slice(0,z)),i=e.slice(r.body.length)}return r.body=[r.body],i&&r.body.push(i),r}}(!this.top,jQuery),!function(e,t){"use strict";function n(e){return e&&e.replace(w,function(e,t,n){return""+t+y[n]+""})}function o(e,t){return e&&(e=e.replace(g,"<$1$2$3"),t&&(e=e.replace(v,"$1"))),e}function i(e){return e.replace(/<(\w{1,2})"([\w\- ]+)"([^>]*)>/g,function(e,t,n,o){return n="m-"+n.split(" ").join(" m-"),"<"+(k[t]||t)+' class="'+n+'"'+o+">"}).replace(/<(\/?)(\w)>/g,function(e,t,n){return"<"+t+k[n]+">"})}function a(e,t){var n=(+new Date-e)/1e3,o=Math.floor(n/86400),i=Math.ceil(o/7);return 0>=o&&(60>n&&t.now||120>n&&t.minute||3600>n&&Math.floor(n/60)+" "+t.minutes||7200>n&&t.hour||86400>n&&Math.floor(n/3600)+t.hours)||1==o&&t.yesterday||7>o&&o+t.days||7==o&&"a week ago"||10>i&&i+t.weeks||Math.ceil(i/4)+" months ago"}function r(e,t){var n=x[e]||Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){ p.push('"+e.replace(/[\r\t\n]/g," ").split("{").join(" ").replace(/((^|\})[^\t]*)'/g,"$1\r").replace(/\t(.*?)\}/g,"',$1,'").split(" ").join("');").split("}").join("p.push('").split("\r").join("\\'")+"');} return p.join('');");return x[e]=n,t?n(t):n}function s(e,n,o){var i=t.extend({},n||{},{l:o}),s=d[e];i.time&&(i.prettyTime=a(i.time,o.time));try{return r(s,i)}catch(c){console.error(e,s,c,i)}}function c(e){e&&e.length&&(t("html, body").animate({scrollTop:e.offset().top-200}),e.mootboost())}function l(e){function n(){return i.text(e.match_count||e.available)}var o=t(s("more")),i=t("button",o),a=t("a",o),r=o.eq(1);return a.click(function(){r.slideUp($),a.hide(),i.text(e.size).show()}),n().tc("has-match",e.match_count>0),i.click(function(){var t=e.available;return t&&r.is(":visible")?(i.ac("loading"),r.animate({paddingTop:60*Math.min(t,5)},$),a.show(),e.more(function(t){i.rc("loading").text(e.available).tc("has-match",e.match_count>0),r.stop().css({paddingTop:0});for(var n=t.length-1;n>=0;n--)(function(){var e=t[n],o=e.is_gap?l(e):p(e);r.prepend(o),e.is_gap||o.mootboost()})();e.available||i.text(e.size).hide()}),void 0):r.slideDown($,function(){n().toggle(t>0),a.show()})}),o}function u(e,i){function r(){var e;t(".m-seed, .m-reply:not(.m-preview)",f).each(function(){var n=t(this);if(!n.closest(".m-more-replies").is(":hidden")){var o=t(".m-facelink img",this).attr("title");e&&o&&n.tc("followup",e===o),e=o}})}function c(n){var o=t(".m-replies, .m-seed .m-body, .m-form",f),i=t(".m-seed .m-body",f).css({display:"block"});n?(f.ac("animating expanded").rc("collapsed"),o.mootslide(200,function(){f.rc("animating"),i.css({display:"inline"})})):o.slideUp(100,function(){f.rc("expanded").ac("collapsed"),t(this).css("display","")}),e.is_expanded=n}var u=e.app,d=u.language,m=e.seed,f=t(s("moot",t.extend({},e,m),d)),h=t(".m-replies",f),g="search"==i.type;f.data("moot",e),e.root=f.mousemoved("moot-hover").tc("flat",!!e.is_commenting),f.prepend(p(m,!0));var v=t(".m-seed",f);return e.is_expanded||f.ac("collapsed"),e.on("load",e.is_expanded,function(n){var o="load"==n||n.seed;if(f.ac("expanded").rc("loading collapsed"),o){var i=p(e.seed,!0);v.replaceWith(i),m.root=v=i}t.each(e.replies,function(e,t){h.append(t.is_gap?l(t):p(t))}),o&&(c(!0),r())}).on("collapse",function(e){e&&c(!1),t(".m-new_count",v).hide()}).on("remove",function(e){if(e.is_seed&&f.fadeOut(f.remove),e.is_own){var n=e.is_seed?t(".m-create textarea",u.root):t("textarea",f);e.is_seed&&e.body.unshift(e.title),n.val(e.body.join("\n")).trigger("keyup").trigger("keydown"),n[0].focus(),n[0].select()}}).on("before:reply",function(e){u.user.is_admin||t(".m-remove",f).remove(),p(e).appendTo(h),e.root.ac("boosted"),e.on("key",function(){setTimeout(function(){e.root.rc("boosted")},500)})}).on("reply",function(n){n.from_channel&&e.is_loaded&&(u.user.is_admin||t(".m-remove",f).remove(),p(n).appendTo(h).mootslide()),n.is_own&&t(".m-is-new",f).rc("is-new")}).on("*",!0,function(){var s=e.reply_count,c=(e.new_count,(e.is_expanded?m.time:e.lastReply)||m.time);t(".m-reply_count",v).toggle(s>0).text(s).tc("has_replied",!!e.has_replied),u.is_commenting&&(s&&t(".m-comment-title",v).text("comment"+(s>1?"s":"")),f.tc("first-comment",!s),m.like_count||m.is_liked||t(".m-like",v).text("Be the first to like this"));var l=t(".m-time",v).attr("data-time",c).text(a(c,d.time));t(".m-title",v).html(n(o(m.title,g))),"moot"!=i.type&&t(".m-permlink",f).add(l).off("click").click(function(){u.load(e.path)}),e.page&&"page"!=i.type&&t(".m-cat",v).html("in "+e.page.title+"").find("a").click(function(){return e.is_expanded?(u.load(e.page.path),!1):void 0}),r()}),u.is_commenting||"moot"==i.type||f.click(function(n){if(!f.hc("loading")){var o=e.is_loaded,i=t(n.target);e.is_expanded?i.closest("h2").length&&(e.collapse(),o&&c(!1)):i.closest("a").length||(e.expand(),o&&c(!0)),o||f.ac("loading")}}),f}function p(e,n){var o=e.app,i=o.language,a=t(s(e.is_stub?"commenting":n?"seed":"reply",e,i)),r=o.user.is_admin,c=e.moot.match_count>=0,l=t(".m-unspam",a);return t(".m-post",a).data("post",e),e.root=a.mousemoved(),a.tc("is-new",!!e.is_new),t(".m-body",a).on("render",function(){function n(t){o.html(moot.format(e.body,t,c)),i.tc("closed",!t).tc("opened",t),a.html(t?"less…":"…")}var o=t(this),i=o.parent(),a=t(".m-show-all",i),r=e.is_expanded;o.html(moot.format(e.body,r,c)),(e.has_more||e.body[1])&&(i.ac("expandable "+(r?"opened":"closed")),a.html(r?"less…":"…").click(function(){e.is_loaded?n(!e.is_expanded):a.ac("loading"),e.toggle(!e.is_expanded)})),e.on("more",function(){a.rc("loading"),n(!0)})}).trigger("render"),t(".m-heart",a).each(function(){function n(t,n){arguments.length||(t=e.like_count,n=!!e.is_liked);var o=t;n&&(t--,o=t?"+"+t:""),c.text(n?i.unlike:i.like),r.tc("has-likes",!n&&t>0).text(t?o:"").tc("is-liked",n).toggle(!!t||n)}var r=t(this),c=t(".m-like",a),l=t(".m-like_list",a).active2("m-");o.user.is_logged&&c.click(function(){var t=!e.is_liked;n(e.like_count+(t?1:-1),t),e.likeToggle()}),e.on("like unlike spam",!0,function(o){n(),"spam"==e.flag&&c.remove(),("inline"!=o||e.is_liked)&&t(".m-remove",a).remove()}),r.click(function(){return e.moot.is_expanded?(r.ac("loading"),l.empty(),e.whoLikes(function(e){r.rc("loading"),t.each(e,function(e){l.append(s(o.is_forum?"face":"img",{user:this})),0==(e+1)%5&&l.append("
")}),l.trigger("open").css({top:-l.outerHeight()-13,left:r.position().left-5})}),void 0):!1})}),t(".m-remove",a).each(function(){var n=t(this),i=t("Thanks!").ac("thanks"),s=e.removable();return o.user.is_logged?(e.on("spam unspam",e.spam_level,function(n,o){var i=o>=1;a.tc("is-spam",i),e.is_seed&&e.moot.root.tc("is-spam",i),i&&!a.hc("is-spam")&&t(".m-body",a).trigger("render")}),s||((e.flag||e.is_own)&&n.hide(),t("strong",n).text("Offensive or spam"),t("span",n).text("!")),n.click(function(){if(!a.hc("removing")){a.ac("removing");var o,r=3,c=n.next(),u=t("strong",c).text(r);o=setInterval(function(){r--,u.text(r),r||(clearInterval(o),a.rc("removing"),i.appendTo(n.parent()),n.add(c).add(l).remove(),s?e.remove(function(){a.remove()}):e.spam(function(){setTimeout(function(){i.remove()},2e3)}))},1e3),t("a",c).off("click").click(function(){clearInterval(o),a.rc("removing")})}}),!r&&s&&setTimeout(function(){s=!1,t("strong",n).text("Offensive / Spam")},6e4*T-(+new Date-e.time)),e.on("remove",function(){a.fadeOut(function(){a.remove()})}),r||o.user.is_logged&&!e.is_own&&!e.flag||l.remove(),l.click(function(){e.unspam(function(e){e>0&&(l.replaceWith(i),setTimeout(function(){i.remove()},2e3),n.remove())})}),void 0):n.remove()}),a}var d={logo:'M',header:'{l.feed}{l.all}{l.forums}{l.online}
Please upgrade your browser to use Moot. You need WebSockets or CORS support for cross domain communication. All modern browsers except Opera 11 and IE7 work.
',unverified:'Unverified account Please click the verification link on your by email.
',img:'',face:'@img;',growl:'ctrl+↵ post
Your real name, so people will recognize you
We have sent you a confirmation email. Your email is not updated before you complete this step!
Your email is never shared
Please check your email to complete the registration. If you dont receive email within a minute or two, check your spam folder.
Later …OK
",confirm_account:"OK
",expired:"We just sent you a new one. Please check your email.
OK
",confirm_error:"OK
"}; !function(){function e(){n&&n.trigger("close")}var n;t(document).on("mousedown.a2",function(o){n&&!t(o.target).closest(n).length&&e()}).on("keydown.a2",function(t){27==t.which&&e()}),t.fn.active2=function(o){o=o||"";var i=(o||"is-")+"active";return t("."+o+"close").click(function(){e()}),this.on("open",function(){n=t(this).addClass(i)}).on("close",function(e){setTimeout(function(){e.isDefaultPrevented()||(n&&n.removeClass(i),n=0)},1)})}}(),t.fn.autogrow=function(e){var n="maxHeight,fontSize,fontFamily,lineHeight,border".split(",");return this.each(function(){var o,i=t(this),a=i.next(".jqt-shadow"),r=i.is("textarea");a.length||(a=t("<"+(r?"div":"span")+"/>").attr("class","jqt-shadow").insertAfter(i),t.each(n,function(e,t){a.css(t,i.css(t))}),a.css({position:"fixed",top:"-9999em",whiteSpace:"nowrap"})),r&&i.one("keyup",function(){a.width(i.width())}),i.bind("keydown.size",function(){o=r?i.outerHeight():i.outerWidth(),o&&i.unbind("keydown.size")}),i.keydown(function(){setTimeout(function(){var t=i.val();a.html(t.replace(//g,">").replace(/&/g,"&").replace(/\n$/,""),n=t.trim(n.slice(1)),s=!0):s&&(u+="",s=!1),u+=n?t.browser.msie&&9>t.browser.version?n:"
"+n+"
":""})}}),u};var k={a:"a",b:"button",c:"code",d:"div",f:"form",i:"img",j:"iframe",l:"label",p:"p",r:"strong",s:"span"};t.each(d,function(e,t){d[e]=i(t)});for(var _=0;2>_;_++)t.each(d,function(e,t){d[e]=t.replace(/@(\w+);/g,function(e,t){return d[t]})});var x={};t.each({ac:"addClass",rc:"removeClass",tc:"toggleClass",hc:"hasClass"},function(e,n){t.fn[e]=function(e,t){return this[n]("m-"+e.split(" ").join(" m-"),t)}}),t.fn.mootslide=function(e,n){return e=e||100*T,this.each(function(){var o=t(this),i=o.css({opacity:0}).height();o.height(0).animate({height:i},e).animate({opacity:1,queue:!0},e,function(){o.css({height:"",opacity:"",overflow:""}),(n||t.noop)()})})},t.fn.mootboost=function(e){return this.each(function(){var n=t(this);n.ac("boosted"),setTimeout(function(){n.rc("boosted")},e||500*T)})};var T=2.718;moot(function(e){function n(){+new Date-i>250&&(jQuery.fx.off=!0)}function o(e){r.tc("has-message","string"==typeof e),t(".m-message",r).text(e),e&&e.stack&&console.error(e.stack)}var i=+new Date;e.on("load",n),setTimeout(function(){e.off("load",n)},10);var r=e.root,c=e.language,l=e.user.is_logged;return e.is_stub&&!/moot.it/.test(location.host)?(r.html('Forum does not exist. Setup "'+e.name+'" »'),!1):(r.html(s("page",{},c)),e.is_commenting&&t(".m-create",r).remove(),e.is_forum||r.on("click.face","a[href^='#!']",function(e){e.preventDefault()}),r.rc("app-loading loading").tc("logged",l).tc("no-logged",!l).tc("ie8",!!t.browser.msie&&9>t.browser.version).tc("webkit",!!t.browser.webkit||!!t.browser.chrome),e.user.unverified&&(r.ac("is-unverified"),t(".m-page",r).prepend(s("unverified"))),t.each(["forum","page","commenting"],function(t,n){e["is_"+n]&&r.addClass("is-"+n)}),setInterval(function(){t("[data-time]",r).each(function(){var e=t(this).data("time");e&&t(this).text(a(e,c.time))})},1e4*T),e.on("error",o).on("waiting",function(e,t){t.on("progress",function(e){3>e?o(["loading","still working","and working"][e]+"..."):(o("giving up"),setTimeout(o,1e3))}).done(function(){o()})}).on("destroy",function(){r.ac("destroyed")}),e.channel.on("close reconnect",function(e){o("close"==e?"Reconnecting ...":0)}),void 0)}),moot(function(e){function n(){e.is_forum&&setTimeout(function(){var n=t.grep(e.page,function(e){return e.is_expanded});a.tc("shown",n.length>1)},1)}var o=e.root,i=t(".m-list",o),a=t(".m-collapse",o).click(function(){e.page.collapse()}),r=t(".m-more-moots",o).click(function(){e.page.more()});e.is_commenting&&a.remove(),e.on("before:load",function(e){r.hide(),e.on("load more",function(t){r.text(e.available).css("display",e.available>0?"block":"none"),n(t)}).on("before:more more",function(e){r.tc("loading","more"!=e)}).on("before:moot",function(t){u(t,e).prependTo(i),t.root.ac("boosted")}).on("moot",function(t,o){if(t.root&&t.root.hc("boosted"))setTimeout(function(){t.root.rc("boosted")},500*T);else if(o){var a=u(t,e).prependTo(i);t.from_channel&&a.mootslide()}else u(t,e).appendTo(i);t.on("expand collapse",n)}).on("remove",function(e){e.root.remove()})})});var $=200;moot(function(e){function n(e){var t=e.split("@"),n="#!/"+(t[1]?"@"+t[1]:e.split("/").slice(2).join("/"));return n}if(e.is_forum){var o=e.root,i=e.user,a=t(s("header",{user:e.user},e.language)).prependTo(o),r=t(".m-page",o),c=t(s("sidebar",{},e.language)).insertAfter(r),l=t(".m-navi",o),u=t(".m-nav-feed",o),p=t(".m-forums",c).active2("m-"),d=t(".m-users",c).active2("m-"),m=t(".m-nav-all",o),f=t(".m-list",o),h=t(".m-pagetitle",o);o.off("click.face").on("click.face","a[href^='#!']",function(n){n.preventDefault();var o=t(this),a=o.attr("href").slice(3);("feed"!=a||i.is_logged)&&(o.ac("loading"),e.load(a))}),t(".m-nav-forums",a).click(function(){var e=t(this),n=e.position();p.trigger("open").css({top:n.top+e.outerHeight()+l.outerHeight(),left:n.left-e.outerWidth()/2})}),t(".m-nav-online",a).click(function(){var e=t(this),n=e.position();d.trigger("open").css({top:n.top+e.outerHeight()+l.outerHeight(),left:n.left-d.outerWidth()/2}).on("close",function(){d.removeAttr("style")})}),i.on("login logout",!i.is_logged,function(){u.attr("title",i.is_logged?"":"Log in to use your personal feed")});var g=t(s("navi",{href:"#!/spam",title:"Spam"})).ac("nav-spam");if(e.on("categories",!0,function(){p.empty(),t.each(e.categories||[],function(e,o){o=t.extend({},o,{href:n(o.path)});var i=t(s("navi",o)).appendTo(p);t("a",i).tc("has-new",!!o.has_new).click(function(){p.trigger("close")})}),i.is_admin&&p.append(g)}),i.is_admin){var v=t("edit").ac("edit-cats").appendTo(t("h3",p.parent()));v.click(function(){return g.remove(),t.isFunction(moot.admin)?moot.admin(e,o):(v.ac("loading"),t.getScript("//cdn.moot.it/1.0.7/admin.min.js",function(){v.rc("loading"),moot.admin(e,o)}),void 0)})}e.on("before:load",function(i){f.empty().ac("loading"),o.attr("class",t.trim(o.attr("class").replace(/m-\w+page/,""))),o.rc(e.page.type+"page"),h.html("loading …").css("display",""),t(".m-selected",o).rc("selected"),t("[href='"+n(i.path)+"']",o).add(r).ac("loading")}).on("load",function(e){if(f.rc("loading"),o.ac(e.type+"page"),h.text(e.title),t(".m-loading",o).rc("loading has-new"),t("[href='"+n(e.path)+"']",o).ac("selected"),"search"==e.type){e.length?(e.old_query&&h.show().html("Showing “"+e.title+"”"+"No results for “"+e.old_query+"”"),e.suggestion&&h.show().html("Did you mean "+e.suggestion+"?")):h.show().html("No results for “"+e.title+"”");var i=t(".m-search input",o),a=e.title;i.val()!=a&&i.val(a).keyup()}e.size||"spam"!=e.type||h.append("No spam on your forum!")}),i.on("newcount",function(e){function n(e,n){t(".m-newcount",e).toggle(n>0).text(n)}n(u,e.feed),n(m,e.all),e.all||t(".m-has-new",c).rc("has-new")}),t(".m-search",a).each(function(){var n=t(this);n.submit(function(n){n.preventDefault();var o=t.trim(this.q.value);o&&e.search(o)});var o=t(":input",n).placeholder2("m-");t(".m-placeholder",n).click(function(){o.focus()})}),d.each(function(){function n(e){return t("[href*='"+e.path+"']",a)}function o(e){return n(e)[0]?void 0:t(s("face",{user:e})).appendTo(a)}var i=t(this),a=t(".m-logged-users",i),r=t("h3 em",i).add(t(".m-nav-online em",e.root)),c=t(".m-anon-count",i),l=e.users&&e.users.online;return l?(a.on("click","a",function(){d.trigger("close")}),e.channel.on("enter",function(e){e&&o(e).mootboost(500)}).on("leave",function(e){e&&n(e).fadeOut(function(){t(this).remove()})}).on("away return",function(e,t){n(t).tc("inactive","away"==e)}).on("enter leave away return",!0,function(){var t=l.length,n=e.users.anon_count;r.text(t).add(a).toggle(t>0),c.toggle(n>0).html((t>0?"+":"")+""+n+" anonymous"),i.toggle(t+n>0)}),t.each(l,function(e,t){o(t)}),void 0):i.hide()}),history.pushState&&(e.on("load",function(e){var t=e.path,o=n(t),i=location.hash;e.is_init||"/"!=t[0]||o==i||history.pushState(null,null,o)}),t(window).on("popstate",function(){var t=location.hash.split("#!/")[1]||"";(t||e.page.path!=e.path)&&(e.page.is_init||e.load(t))}))}});var j;moot(function(e){j||(j=document.title);var t=e.is_forum,n=(e.user,1e3*T);e.channel.on("moot reply",function(e,t){t.seed&&(t=t.seed),t.path&&(document.title=t.user.displayname+": "+(t.title||t.body[0]).slice(0,32),setTimeout(function(){document.title=j},n))}),t&&e.on("load",function(e){e.title&&(document.title=e.title+" | "+j)})});var C={};moot(function(e){t(".m-create",e.root).mootform(e).mootpreview(e).mousemoved(),t(document).bind("click.moot",function(n){var o=t(n.target);o.closest("form").length||t("form",e.root).rc("focus")}),e.on("before:load",function(n){n.on("moot",function(n){t(".m-form",n.root).mootform(e,n).mootpreview(e).mousemoved()})}),e.channel.on("close",function(){t("textarea",e.root).each(function(){var e=t(this),n=e.val(),o=e.closest(".m-moot").data("moot");n&&(C[o?o.path:"@"]=n)})}),e.one("load",function(){t.each(C,function(n,o){var i=t("textarea:first",e.root),a=e.page.find(n);a&&(i=t("textarea",a.root)),i.val(o).trigger("keyup").trigger("keydown")}),C={}})}),t.fn.mootform=function(e,n){return this.each(function(){function o(){var e=c.val(),n=!!t.trim(e);return u.is(":visible")&&!u.data("value")&&(n=!1),l.prop("disabled",!n),n}function i(){c.val("").trigger("keyup").trigger("keydown"),r.rc("loading"),a=0}var a,r=t(this),s=!n,c=t("textarea",r),l=t(":submit",r),u=t(".m-select",r),p=e.user.is_logged,d=e.conf().label;p||l.text("Login and "+l.text().toLowerCase()),!n&&d&&c.attr("placeholder",d),n&&n.seed.is_stub&&c.attr("placeholder","Comment..."),c.placeholder2("m-"),r.submit(function(o){o.preventDefault();var d=t.trim(c.val());!a&&d&&p&&(d=d.replace(/\?\?/g,"??"),a=1,l.attr("disabled",!0),i(),(s?e.create(d,u.data("value")):n.reply(d)).fail(function(n){var o=s?t(".m-moot:first",e.root):r.closest(".m-moot").find(".m-reply:last");o.rc("boosted").ac("error").prepend("