????
Current Path : /home2/morganrand/backup.morganrand.com/coupon/Professor Cloud_files/a_data/ |
Current File : /home2/morganrand/backup.morganrand.com/coupon/Professor Cloud_files/a_data/client.js |
var DISQUS=function(b){var f=b.DISQUS||{};f.AssertionError=function(f){this.message=f};f.AssertionError.prototype.toString=function(){return"Assertion Error: "+(this.message||"[no message]")};f.assert=function(g,a,c){if(!g)if(c)b.console&&b.console.log("DISQUS assertion failed: "+a);else throw new f.AssertionError(a);};var g=[];f.define=function(h,a){typeof h==="function"&&(a=h,h="");for(var c=h.split("."),o=c.shift(),d=f,i=(a||function(){return{}}).call({overwrites:function(d){d.__overwrites__=!0; return d}},b);o;)d=d[o]?d[o]:d[o]={},o=c.shift();for(var m in i)i.hasOwnProperty(m)&&(!i.__overwrites__&&d[m]!==null&&f.assert(!d.hasOwnProperty(m),"Unsafe attempt to redefine existing module: "+m,!0),d[m]=i[m],g.push(function(d,a){return function(){delete d[a]}}(d,m)));return d};f.use=function(b){return f.define(b)};f.cleanup=function(){for(var f=0;f<g.length;f++)g[f]()};return f}(window); DISQUS.define(function(b,f){var g=b.DISQUS,h=b.document,a=h.getElementsByTagName("head")[0]||h.body,c={running:!1,timer:null,queue:[]};g.defer=function(a,d){function i(){var d=c.queue;if(d.length===0)c.running=!1,clearInterval(c.timer);for(var a=0,i;i=d[a];a++)i[0]()&&(d.splice(a--,1),i[1]())}c.queue.push([a,d]);i();if(!c.running)c.running=!0,c.timer=setInterval(i,100)};g.each=function(a,d){var i=a.length,c=Array.prototype.forEach;if(isNaN(i))for(var j in a)a.hasOwnProperty(j)&&d(a[j],j,a);else if(c)c.call(a, d);else for(c=0;c<i;c++)d(a[c],c,a)};g.extend=function(a){g.each(Array.prototype.slice.call(arguments,1),function(d){for(var c in d)a[c]=d[c]});return a};g.serializeArgs=function(a){var d=[];g.each(a,function(a,c){a!==f&&d.push(c+(a!==null?"="+encodeURIComponent(a):""))});return d.join("&")};g.isString=function(a){return Object.prototype.toString.call(a)==="[object String]"};g.serialize=function(a,d,c){d&&(a+=~a.indexOf("?")?a.charAt(a.length-1)=="&"?"":"&":"?",a+=g.serializeArgs(d));if(c)return d= {},d[(new Date).getTime()]=null,g.serialize(a,d);d=a.length;return a.charAt(d-1)=="&"?a.slice(0,d-1):a};g.require=function(c,d,i,f,j){function b(a){if(a.type=="load"||/^(complete|loaded)$/.test(a.target.readyState))f&&f(),k&&clearTimeout(k),g.bean.remove(a.target,l,b)}var n=h.createElement("script"),l=n.addEventListener?"load":"readystatechange",k=null;n.src=g.serialize(c,d,i);n.async=!0;n.charset="UTF-8";(f||j)&&g.bean.add(n,l,b);j&&(k=setTimeout(function(){j()},2E4));a.appendChild(n);return g}; g.requireStylesheet=function(c,d,i){var f=h.createElement("link");f.rel="stylesheet";f.type="text/css";f.href=g.serialize(c,d,i);a.appendChild(f);return g};g.requireSet=function(a,d,c){var f=a.length;g.each(a,function(a){g.require(a,{},d,function(){--f===0&&c()})})};g.injectCss=function(c){var d=h.createElement("style");d.setAttribute("type","text/css");c=c.replace(/\}/g,"}\n");b.location.href.match(/^https/)&&(c=c.replace(/http:\/\//g,"https://"));d.styleSheet?d.styleSheet.cssText=c:d.appendChild(h.createTextNode(c)); a.appendChild(d)}}); DISQUS.define("JSON",function(){function b(a){return a<10?"0"+a:a}function f(a){o.lastIndex=0;return o.test(a)?'"'+a.replace(o,function(a){var d=m[a];return typeof d==="string"?d:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function g(c,b){var m,h,o,l,p=d,n,q=b[c];q&&typeof q==="object"&&typeof q.toJSON==="function"&&!a&&(q=q.toJSON(c));typeof j==="function"&&(q=j.call(b,c,q));switch(typeof q){case "string":return f(q);case "number":return isFinite(q)?String(q):"null";case "boolean":case "null":return String(q); case "object":if(!q)return"null";d+=i;n=[];if(Object.prototype.toString.apply(q)==="[object Array]"){l=q.length;for(m=0;m<l;m+=1)n[m]=g(m,q)||"null";o=n.length===0?"[]":d?"[\n"+d+n.join(",\n"+d)+"\n"+p+"]":"["+n.join(",")+"]";d=p;return o}if(j&&typeof j==="object"){l=j.length;for(m=0;m<l;m+=1)h=j[m],typeof h==="string"&&(o=g(h,q))&&n.push(f(h)+(d?": ":":")+o)}else for(h in q)Object.hasOwnProperty.call(q,h)&&(o=g(h,q))&&n.push(f(h)+(d?": ":":")+o);o=n.length===0?"{}":d?"{\n"+d+n.join(",\n"+d)+"\n"+ p+"}":"{"+n.join(",")+"}";d=p;return o}}var h={},a=!1;if(typeof Date.prototype.toJSON!=="function")Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()};var c=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d,i,m={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;h.stringify=function(a,c,f){var b;i=d="";if(typeof f==="number")for(b=0;b<f;b+=1)i+=" ";else typeof f==="string"&&(i=f);if((j=c)&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw Error("JSON.stringify");return g("",{"":a})};h.parse=function(a,d){function f(a, c){var i,j,b=a[c];if(b&&typeof b==="object")for(i in b)Object.hasOwnProperty.call(b,i)&&(j=f(b,i),j!==void 0?b[i]=j:delete b[i]);return d.call(a,c,b)}var i,a=String(a);c.lastIndex=0;c.test(a)&&(a=a.replace(c,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return i=eval("("+a+")"), typeof d==="function"?f({"":i},""):i;throw new SyntaxError("JSON.parse");};var p={a:[1,2,3]},n,l;if(Object.toJSON&&Object.toJSON(p).replace(/\s/g,"")==='{"a":[1,2,3]}')n=Object.toJSON;typeof String.prototype.evalJSON==="function"&&(p='{"a":[1,2,3]}'.evalJSON(),p.a&&p.a.length===3&&p.a[2]===3&&(l=function(a){return a.evalJSON()}));(function(){var c=[1,2,3];typeof c.toJSON==="function"&&(c=c.toJSON(),a=!(c&&c.length===3&&c[2]===3))})();if(a||!n||!l)return{stringify:h.stringify,parse:h.parse};return{stringify:n, parse:l}}); DISQUS.define("Bus",function(){function b(a){a=a.split("/");return a[0]+"//"+a[2]}var f=DISQUS.use("JSON"),g=window.location.hash.slice(1),h=window.parent,a=document.referrer,c={};c.client=b(document.location.href);c.host=a?b(a):c.client;return{origins:c,messageHandler:function(a){var d=a.origin;if(!(d!==c.client&&d!==c.host)){var f;try{f=DISQUS.JSON.parse(a.data)}catch(b){return}a=f.data;if(!(a.eventName[0]==="!"&&d!==c.client))switch(f.scope){case "client":DISQUS.Bus.trigger(a.eventName,a.data)}}}, postMessage:function(a){a.sender=g;a=f.stringify(a);h.postMessage(a,c.host)},sendHostMessage:function(a,c){c=c||[];DISQUS.Bus.postMessage({scope:"host",name:a,data:c})},sendGlobalMessage:function(a,c){c=c||[];DISQUS.Bus.postMessage({scope:"global",name:a,data:c})}}});_.extend(DISQUS.Bus,Backbone.Events); $(document).ready(function(){var b=window.addEventListener?window.addEventListener:window.attachEvent,f=window.addEventListener?"message":"onmessage";if(!b)throw Error("No event support.");b(f,DISQUS.Bus.messageHandler,!1)}); DISQUS.define(function(b,f){var g={blocks:{},ISO_8601:"YYYY-MM-DDTHH:mm:ssZ",apiKey:"E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F",bean:require("bean"),debug:!1,browser:{mobile:navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i)},modules:{},strings:{translations:{}}};g.strings.get=_.bind(function(a){var c=this.translations[a];return c!==f?c:a},g.strings);g.interpolate=function(a,c){return a.replace(/%\(\w+\)s/g,function(b){var b=b.slice(2,-2),d="";b in c?d= c[b]!==f&&c[b]!==null?c[b].toString():"":DISQUS.logError&&DISQUS.logError("Key `"+b+"` not found in context for: ",a);return d})};g.addBlocks=function(){return function(a){a(DISQUS)}};g.templateGlobals={urls:DISQUS.use("urls"),sso:null,gettext:g.strings.get};g.renderBlock=function(a,c){return DISQUS.blocks[a](g.templateGlobals,c)};g.assureOffset=function(a){return a.indexOf("+")>=0?a:a+"+00:00"};var h=g.Builder=function(){this.accum=[]};_.extend(h.prototype,{put:function(a){this.accum.push(a)},esc:function(a){return String(a).replace(/&/g, "&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},compile:function(){return this.accum.join("")}});return g}); DISQUS.define("urls",function(){var b=DISQUS.debug?"/js/src/embed/next/vglnk.js":"/build/next/alfie.js",f=encodeURIComponent(document.referrer),g={root:"http://disqus.com",media:"http://mediacdn.disqus.com/1363738576",translations:"http://mediacdn.disqus.com/1363738576/build/lang",loading:"http://mediacdn.disqus.com/1363738576/html/simple-loading.html",realertime:"//realtime.services.disqus.com",login:"https://disqus.com/next/login/",api:"http://disqus.com/api/3.0/",apiSecure:"https://disqus.com/api/3.0/", logout:"http://disqus.com/logout/?redirect="+f,editProfile:"http://disqus.com/account/",verifyEmail:"https://disqus.com/next/verify/",authorize:"https://disqus.com/api/oauth/2.0/authorize/",moderate:"http://disqus.com/admin/moderate/",oauth:{twitter:"http://disqus.com/_ax/twitter/begin/",google:"http://disqus.com/_ax/google/begin/",facebook:"http://disqus.com/_ax/facebook/begin/"},avatar:{generic:"http://mediacdn.disqus.com/1363738576/img/next/noavatar92.png"},linkAffiliatorClient:"http://mediacdn.disqus.com/1363738576"+ b};window.location.protocol==="https:"&&(g=_.extend(g,{root:"https://disqus.com",media:"https://securecdn.disqus.com/1363738576",translations:"https://securecdn.disqus.com/1363738576/build/lang",loading:"https://securecdn.disqus.com/1363738576/html/simple-loading.html",api:g.apiSecure,logout:"https://disqus.com/logout/?redirect="+f,editProfile:"https://disqus.com/account/",moderate:"https://disqus.com/admin/moderate/",oauth:{twitter:"https://disqus.com/_ax/twitter/begin/",google:"https://disqus.com/_ax/google/begin/", facebook:"http://disqus.com/_ax/facebook/begin/"},avatar:{generic:"https://securecdn.disqus.com/1363738576/img/next/noavatar92.png"},linkAffiliatorClient:"https://securecdn.disqus.com/1363738576"+b}));return g}); DISQUS.define("api",function(){function b(f){function a(b){var i=b.originalEvent.origin;DISQUS.urls.apiSecure.slice(0,i.length)===i&&(b=DISQUS.JSON.parse(b.originalEvent.data),b.requestId===c&&(i=b.code===0?f.success:f.error,delete b.requestId,(i||function(){})(b),document.body.removeChild(g),document.body.removeChild(d),$(window).unbind("message",a)))}var c=_.uniqueId("ft_"),b=document.createElement("div"),d=document.createElement("form"),i="frame_"+c,g;b.innerHTML='<iframe name="'+i+'"></iframe>'; g=b.childNodes[0];d.target=i;d.action=f.url.replace(".json",".pm");d.method=f.method||"GET";f.data=_.extend(f.data,{callback:c,referrer:document.referrer});_.each(f.data,function(a,c){a===!0?a=[1]:a===!1?a=[0]:a===null?a=[""]:_.isArray(a)||(a=[a]);_.each(a,function(a){var b=document.createElement("input");b.type="hidden";b.name=c;b.value=a;d.appendChild(b)})});$(window).bind("message",a);document.body.appendChild(g);document.body.appendChild(d);d.submit()}function f(b){b=_.defaults(b,g);b.data=b.data|| {};b.data.api_key=DISQUS.apiKey;return $.ajax(b)}var g={};return{defaults:function(b){var a,c,f;for(a in b)c=b[a],f=g[a],_.isObject(c)&&_.isObject(f)?_.extend(f,c):g[a]=c},headers:function(b){b=_.extend({},g.headers,b);return g.headers=_.pick(b,_.map(b,function(a,c){if(a)return c}))},getURL:function(b,a){a=a||{};if(a.secure||window.location.protocol==="https:")return DISQUS.urls.apiSecure+b;return DISQUS.urls.api+b},ajax:f,call:function(g,a){a=a||{};a.url=DISQUS.api.getURL(g,{secure:a.secure});a.data= _.extend(a.data||{},{api_key:DISQUS.apiKey});return(a.secure?b:f)(a)}}});(function(b){b.ajax=function(b){b.method=b.type;b.type=b.dataType;delete b.dataType;return DISQUS.api.ajax(b)};b.Collection.prototype.parse=function(b){return b.response}})(Backbone); DISQUS.define("ga",function(b){var f,g=function(a){f?f(a):b._gaq.push(a)},h={component:1,"package":2,forum:3,version:4,userType:5};return{setCaller:function(a){f=a},setAccount:function(a){g(["_setAccount",a])},setCustomVar:function(a,c){g(["_setCustomVar",h[a],a,c])},trackPageview:function(){g(["_trackPageview"])},trackEvent:function(a,c,b){g(["_trackEvent",c,a,b,1])},setDomainName:function(a){g(["_setDomainName",a])}}}); DISQUS.define("juggler",function(b){var f=(new Date).getTime().toString(10)+Math.floor(Math.random()*1E6).toString(10),g={},h=function(a){g[a]=this;this._emit=null;this.meta={};this.allowedOverwrites=["thread","forum","forum_id","user_id"];this.reservedKeys=this.allowedOverwrites.slice().concat(["imp","event","prev_imp"]);this.preloadBuffer=[]};DISQUS.extend(h.prototype,{disable:function(){this._emit=function(){};this.preloadBuffer=[]},copySettings:function(){return DISQUS.extend({},this.settings, this.meta)},overwrite:function(a){for(var c=0,b=this.allowedOverwrites.length;c<b;c++){var d=this.allowedOverwrites[c];a.hasOwnProperty(d)&&(this.meta[d]=a[d])}},load:function(a){var c=this;c.settings=a;c.url=a.url;if(a.disable)return void c.disable();if(b.location.protocol==="https:"){if(a.disableSSL)return void c.disable();c.url=c.url.replace("http:","https:")}DISQUS.each(c.allowedOverwrites,function(b){c.meta[b]=a[b]});c.meta.imp=f;c.meta.prev_imp=DISQUS.cookies.read("__jid");DISQUS.cookies.create("__jid", f,{expiresIn:18E5});c._emit=function(a){DISQUS.each(c.meta,function(b,f){a[f]=c.meta[f]});DISQUS.require(c.url,a,!1)};DISQUS.each(c.preloadBuffer,function(a){c._emit(a)})},emit:function(a,b){b=DISQUS.extend({},b);DISQUS.each(this.reservedKeys,function(a){if(b[a]!=null)throw"Error: cannot overwrite event context '"+a+"'";});b.event=a;this._emit==null?this.preloadBuffer.push(b):this._emit(b)}});return{client:function(a,b){return g[a]||b&&new h(a)},impId:f}}); DISQUS.define("next.intelligence",function(b){function f(b,a){function c(a){if(!(a instanceof DISQUS.next.models.User)&&!(a instanceof DISQUS.next.models.AnonUser))throw Error("determineUserType(user) needs an instance of User/Anonuser");return a.has("remote")?a.get("remote").domain:a.id?"disqus":k?"guest":"not_logged_in"}function f(b){if(a.switches.length>0)b(a.switches);else a.switches.on("reset",function t(){a.switches.off("reset",t);b(a.switches)})}var d=a.initialData;if(_.isObject(d)&&!_.isEmpty(d)){var i= DISQUS.ga.setCustomVar,m=DISQUS.ga.trackPageview,j=function(a){DISQUS.ga.trackEvent(a,p,n)},p="next",n=d.forum.id,l="not_logged_in",k=!1,s=d.features.support_preferred?"plus":d.features.support_priority?"pro":d.features.support_vip?"vip":"free";a.session.on("identify",function z(){var k=this;k.off("identify",z);var v=k.user.id;v&&g.overwrite({user_id:v});f(function(a){if(a.enabled("juggler_thread_onReady")){var c={thread_slug:d.thread.slug,user_type:k.user.get("user_type")||"anon",referrer:b.document.referrer, theme:"next"};g.emit("init_embed",c);a.enabled("dark_jester")&&(a=DISQUS.juggler.client("jester",!0),a.load(_.extend(g.copySettings(),{url:"http://referrer.disqus.com/juggler/event.js"})),a.emit("init_embed",c))}});l=c(k.user);i("component","embed");i("package",s);i("forum",n);i("version",p);i("userType",l);m();a.session.on("change:id",function(a){var b=l;l=c(a);b!=l&&(i("userType",l),j(l=="not_logged_in"||l=="guest"?"logout":"login"))})});f(function(a){g.load({disable:!a.enabled("juggler_enabled"), url:"http://juggler.services.disqus.com/event.js",disableSSL:a.enabled("next_disable_ssl_juggler"),thread:d.thread.id,forum:d.forum.id,forum_id:d.forum.pk})});DISQUS.each({inViewport:function(){j("view_embed");a.off("inViewport")},"uiAction:createPost":function(a){l=="not_logged_in"&&(l="guest",i("userType",l));k=!0;a.get("parent")!=null?j("post_comment_reply"):j("post_comment")},"uiAction:postUpvote":function(){j("like_comment")},"uiAction:postDownvote":function(){j("dislike_comment")},"uiAction:threadUpvote":function(){j("like_thread")}, "uiAction:postShare":function(a){j("share_comment_"+a)},"uiAction:threadShare":function(a){j("share_thread_"+a)},"uiAction:navigate":function(a){(a={community:"community",dashboard:"mydisqus",profile:"profile",reactions:"reactions"}[a])&&j("open_"+a)},"uiAction:followUser":function(){j("follow_user")}},function(b,c){a.on(c,b)})}}var g=DISQUS.juggler.client("juggler",!0);return{init:function(g){f(b,g)}}}); DISQUS.define("cookies",function(){return{create:function(b,f,g){b=b+"="+f+"; path=/";g.domain&&(b+="; domain=."+g.domain);g.expiresIn&&(f=new Date,f.setTime(f.getTime()+g.expiresIn),b+="; expires="+f.toGMTString());document.cookie=b},read:function(b){b+="=";for(var f=document.cookie.split(";"),g,h=0;h<f.length;h++){for(g=f[h];g.charAt(0)==" ";)g=g.substring(1,g.length);if(g.indexOf(b)===0)return g.substring(b.length,g.length)}return null},erase:function(b,f){var g=new Date;g.setTime(g.getTime()+ -864E5);g=b+"=; path=/;expires="+g.toGMTString();f.domain&&(g+="; domain=."+f.domain);document.cookie=g}}}); DISQUS.define("next.utils",function(){function b(a){function b(a){a=Number(a).toString(16);return a.length==1?"0"+a:a}if(a.substr(0,1)==="#")return a;var c=/.*?rgb\((\d+),\s*(\d+),\s*(\d+)\)/.exec(a);if(!c||c.length!==4)return"";var a=b(c[1]),d=b(c[2]),c=b(c[3]);return"#"+a+d+c}var f={handler:function(a,b,c){a&&c>=200&&c<300?a():b&&(c<200||c>=300)&&b()},XHR2:function(a,b,c,d){var g=f.handler,h=new XMLHttpRequest;h.open(a,b,!0);h.onreadystatechange=function(){h.readyState===XMLHttpRequest.DONE&&g(c, d,h.status)};return h},XDR:function(a,b,c,d){if(a!=="GET"&&a!=="POST")return null;var g=f.handler,h=new XDomainRequest;h.open(a,b);h.onload=_.bind(g,window,c,d,200);h.ontimeout=h.onerror=_.bind(g,window,c,d,500);return h}};f.request=function(){return"withCredentials"in new XMLHttpRequest?f.XHR2:window.XDomainRequest?f.XDR:function(){return null}}();var g=RegExp("[\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E\\u00A1-\\u00BF\\u2010-\\u2027\\u2030-\\u205E\\u2300-\\u23FF\\u2E00-\\u2E7F\\u3001-\\u303F\\uFE10-\\uFE19\\uFE30-\\uFE4F\\uFE50-\\uFE6B\\uFF01-\\uFF0F\\uFF1A-\\uFF20\\uFF3B-\\uFF40\\uFF5B-\\uFF60\\uFF5F-\\uFF64]+$"), h={domain:DISQUS.urls.root.split("/")[2],create:function(a,b){DISQUS.cookies.create(a,b,{domain:h.domain,expiresIn:31536E6})},read:DISQUS.cookies.read,erase:function(a){DISQUS.cookies.erase(a,{domain:h.domain})}},a=function(){var a={};return{getItem:function(b){return a.hasOwnProperty(b)?a[b]:null},setItem:function(b,c){a[b]=String(c)},removeItem:function(b){delete a[b]}}}(),c=/^[a-z0-9_.%+\-]+@[0-9a-z.\-]+\.[a-z.]{2,6}$/i,o=function(){function a(){this.state=null;this.queue=[]}_.extend(a.prototype, {highlight:function(a){this.state===null&&this._load();this.queue.push(a);this.state===2&&this._flush()},_load:function(){var a=this;a.state=1;DISQUS.require("http://mediacdn.disqus.com/1363738576/build/js/highlight.js",{},!1,function(){a.state=2;a._flush()})},_flush:function(){_.chainedDefer(this.queue,function(a){var b=$(a).html();$(a).html(b.replace(/^<br>/,""));hljs.highlightBlock(a)},this)}});return new a}(),d=function(){var a=document.createElement("fakeelement"),b={transition:"transitionend", OTransition:"otransitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},c;for(c in b)if(a.style[c]!==void 0)return b[c];return null}();return{attempt:function(a,b){try{_.bind(a,b||{})()}catch(c){return c}return null},extract:function(a,b){for(var c=b.split("."),d=c.shift();d;){if(c.length===0)return a[d];if(!_.isObject(a[d]))return;a=a[d];d=c.shift()}return a},addStylesheetRules:function(a){function b(){var d=_.find(document.styleSheets,function(a){return(a.ownerNode||a.owningElement).id=== c});if(!d)return void setTimeout(b,50);for(var f=0,g=a.length;f<g;f++){var s=1,h=a[f],o=h[0],t="";Object.prototype.toString.call(h[1][0])==="[object Array]"&&(h=h[1],s=0);for(var p=h.length;s<p;s++){var w=h[s];t+=w[0]+":"+w[1]+(w[2]?" !important":"")+";\n"}d.insertRule?d.insertRule(o+"{"+t+"}",d.cssRules.length):d.addRule(o,t,-1)}}var c="css_"+(new Date).getTime(),d=document.createElement("style");d.id=c;document.getElementsByTagName("head")[0].appendChild(d);window.createPopup||d.appendChild(document.createTextNode("")); b()},escapeColor:function(a){return b(a).replace(/[^#A-Fa-f0-9]/g,"")},CORS:f,hashStorage:a,cookies:h,niceTruncate:function(a,b){if(a.length<=b)return a;var c=a=a.slice(0,b-1),d=/(^.*\S)\s/.exec(a);d&&(a=d[1]);(d=g.exec(a))&&(a=a.slice(0,a.length-d[0].length));a.length<0.5*c.length&&(a=c);return a+"\u2026"},htmlDecode:function(a){var b=document.createElement("div");b.innerHTML=a;return b.childNodes.length===0?"":b.childNodes[0].nodeValue},isWindowClosed:function(a){if(!a)return!0;try{return a.closed|| a.closed===void 0}catch(b){return!0}},validateEmail:function(a){return c.test(a)},updateURL:function(a,b){var c=document.createElement("a"),b=b||{};c.href=a;b.hostname&&b.hostname.match(/\.$/)&&(b.hostname+=c.hostname);c=_.extend({protocol:c.protocol,hostname:c.hostname,pathname:c.pathname,search:c.search},b);if(!c.pathname.match(/^\//))c.pathname="/"+c.pathname;return c.protocol+"//"+c.hostname+c.pathname+c.search},injectBaseElement:function(a,b){var b=b||document,c=b.createElement("base");c.target= "_parent";c.href=a;b.getElementsByTagName("head")[0].appendChild(c)},syntaxHighlighter:o,transitionEndEvent:d}}); DISQUS.define("next.realtime",function(){function b(a,b,f){h.apply(this,arguments);this.name=b||"hose";this.url=DISQUS.urls.realertime+"/api/2/thread/"+a+"?"+this.name+"_";this.xhr=null;this.marker=this.reqCounter=0;if(this.continuous=f!==!1)this.interval=1;this._boundOnError=_.bind(this.onError,this);this._boundOnLoad=_.bind(this.onLoad,this);this._boundOnProgress=_.bind(this.onProgress,this)}function f(a){h.apply(this,arguments);this.handshakeSuccess=this.socket=null;this.interval=1;this.url=(window.location.protocol=== "https:"?"wss:":"ws:")+DISQUS.urls.realertime+"/ws/2/thread/"+a;this._boundOnOpen=_.bind(this.onOpen,this);this._boundError=_.bind(this.onError,this);this._boundClose=_.bind(this.onClose,this);this._boundMessage=_.compose(_.bind(this.onMessage,this),function(a){return JSON.parse(a.data)})}var g=DISQUS.use("next.utils"),h=function(a){this.thread=a;this.url=null;this._boundRun=_.bind(this.run,this)};_.extend(h.prototype,Backbone.Events,{onMessage:function(a){var b=a.message_type,f=a.firehose_id;this.lastEventId= f;DISQUS.log("RT: new message:",b,f);this.trigger(b,{type:b,data:a.message_body,lastEventId:f})}});_.extend(b.prototype,h.prototype,{onError:function(){this.trigger("error",this);this.continuous&&(this.interval<=120&&(this.interval*=2),DISQUS.logError("RT: Connection error, backing off %s secs",this.interval),_.delay(this._boundRun,this.interval*1E3))},onLoad:function(){this.trigger("success",this);this.continuous&&_.defer(this._boundRun)},onProgress:function(){var a=this.xhr.responseText,b=0;if(a&& !(this.marker>=a.length)){for(var a=a.slice(this.marker).split("\n"),f,d,g,h=a.length,j=0;j<h;j++)if(f=a[j],b+=f.length+1,d=f.replace(/^\s+|\s+$/g,"")){try{g=JSON.parse(d)}catch(p){if(j===h-1){b-=f.length+1;break}else{DISQUS.log("RT: unable to parse: ",d,f);continue}}this.onMessage(g)}else DISQUS.log("RT: ignoring empty row...");b>0&&(this.marker+=b-1)}},run:function(){var a=this.xhr=g.CORS.request("GET",this.url+ ++this.reqCounter,this._boundOnLoad,this._boundOnError);if(!a)return void DISQUS.log("RT: Cannot use any cross-domain request tool with StreamPipe. Bailing out."); a.onprogress=this._boundOnProgress;this.xhr=a;this.marker=0;try{a.send()}catch(b){this.xhr=null,DISQUS.log("RT: Attempt to send a CORS request failed.")}}});_.extend(f.prototype,h.prototype,{onOpen:function(){DISQUS.log("RT: [Socket] Connection established.");this.handshakeSuccess=!0},onError:function(){this.handshakeSuccess?(this.trigger("error"),this.interval<=120&&(this.interval*=2),DISQUS.logError("RT: Connection error, backing off %s secs",this.interval),_.delay(this._boundRun,this.interval* 1E3)):(DISQUS.log("RT: [Socket] Error before open, bailing out."),this.trigger("fail"))},onClose:function(a){a.wasClean&&(DISQUS.log("RT: [Socket] Connection closed. Restarting..."),this.trigger("close",this),this.run())},run:function(){var a=this.socket=new WebSocket(this.url);a.onopen=this._boundOnOpen;a.onerror=this._boundError;a.onmessage=this._boundMessage;a.onclose=this._boundClose}});return{StreamPipe:b,SocketPipe:f,Manager:{_wsSupported:window.WebSocket&&WebSocket.CLOSING===2,initialize:function(a, c,g){this._initArgs=[a,c,g];var d=this._wsSupported,h=this._pipe=new (d?f:b)(a);_.chain(c).pairs().each(function(a){h.on(a[0],a[1],g)});if(d)h.on("fail",function(){this._wsSupported=!1;h.off();this.initialize.apply(this,this._initArgs)},this);h.run()}}}}); DISQUS.define("next.models",function(){function b(a,c,d){var f=b.pool(a),g=c&&c[a.prototype.idAttribute];if(!g)return new a(c,d);b.get(a,g)?f[g].set(c):f[g]=new a(c,d);return f[g]}var f=DISQUS.use("next.collections"),g=DISQUS.use("next.utils"),h=DISQUS.use("Bus"),a=DISQUS.strings.get;b.pool={};b.pool=function(a){a=b.pool[a.__type__];if(!a)throw Error("Model not registered. Use UniqueModel.addType");return a};b.get=function(a,c){return b.pool(a)[c]};b.addType=function(a,c){if(!c.__type__||!b.pool[a])c.__type__= a,b.pool[a]={}};var c=Backbone.Model.extend({defaults:{settings:{}}}),o={getRelativeCreatedAt:function(){var a=this.get("createdAt");if(a)return a=DISQUS.assureOffset(a),moment(a,DISQUS.ISO_8601).fromNow()}},d=Backbone.Model.extend({defaults:{author:null,category:null,createdAt:null,forum:null,identifiers:[],ipAddress:null,isClosed:!1,isDeleted:!1,hasStreaming:!1,link:null,message:null,slug:null,title:null,userSubscription:!1,posts:0,reactions:0,likes:0,dislikes:0,userScore:0},initialize:function(a, b){var c=this,b=b||{};c.moderators=b.moderators;c.forum=b.forum;c.users=new f.UserCollection(b.users,{thread:c});c.posts=new f.PostCollection(b.posts,{thread:c,cursor:b.postCursor});c.reactions=new f.ReactionsCollection(null,{thread:c});c.votes=new f.ThreadVoteCollection;c.posts.bind("add reset",function(a){a=a.models?a.models:[a];_.each(a,function(a){c.users.get(a.author.id)||c.users.add(a.author)})});c.posts.bind("destroy",function(){c.set("posts",c.get("posts")-1)});c.bind("change:posts",c.broadcastPostCount, c);c.queue=new f.QueuedPostCollection(null,{thread:c})},_vote:function(a,b){var c=a-b;if(c===0)return c;this.set("likes",this.get("likes")+c);return c},vote:function(a){var b=this;b._vote(a,b.get("userScore"))!==0&&(this.set("userScore",a),DISQUS.api.call("threads/vote.json",{data:{thread:this.id,vote:a},method:"POST",success:function(c){c.response.id&&(b.votes.get(c.response.id)||b.votes.add({id:c.response.id,score:a}))}}))},broadcastPostCount:function(){h.sendGlobalMessage("lounge.updateCounter", {count:this.get("posts")})},fetch:function(a){var b=this,c=b.attributes,a=a||{};DISQUS.api.call("threads/details.json",{data:{thread:c.identifier?"ident:"+c.identifier:"link:"+c.url,forum:c.forum},success:function(c){b.set(c.response);a.success&&a.success()},error:function(){DISQUS.debug?b.save({},{success:a.success}):console.log("Couldn't find thread; not creating in production.")}})},_toggleState:function(a,b){b||(b={});var c=a?"open.json":"close.json";this.set("isClosed",!a);DISQUS.api.call("threads/"+ c,{method:"POST",data:{thread:this.id},success:b.success,error:b.error})},open:function(a){this._toggleState(!0,a)},close:function(a){this._toggleState(!1,a)},sync:function(){var a=this,b=a.attributes;DISQUS.api.call("threads/create.json",{data:{title:b.title,forum:b.forum,identifier:b.identifier,url:b.url},method:"POST",success:function(b){a.set(b.response)}})},incrementPostCount:function(a){this.set("posts",this.get("posts")+a)},isModerator:function(a){if(this.moderators)return a=a instanceof k|| _.isObject(a)?a.id:a,a=parseInt(a,10),_(this.moderators).contains(a)},subscribe:function(a,b){var a=a!==!1,c=this.get("userSubscription");if(c!=a){a?this.set("userSubscription",b||!0):this.set("userSubscription",!1);var d={thread:this.id};if(b)d.email=b;else if(!a&&typeof c==="string")d.email=c;DISQUS.api.call("threads/"+(a?"subscribe.json":"unsubscribe.json"),{data:d,method:"POST"})}},relatedIds:function(){var a=this.get("forum");_.isObject(a);return{forum:this.get("forum"),thread:this.id}},twitterText:function(a){var a= 140-(a.length+1),b=DISQUS.next.utils.htmlDecode(this.get("title"));return b=DISQUS.next.utils.niceTruncate(b,a)},url:function(){var a=this.get("url")||this.get("link");if(!a&&this.currentUrl)a=this.currentUrl;return a}}),i=d.extend({defaults:_.extend({postsInInterval:0,topPost:null},d.prototype.defaults)}),m=Backbone.Model.extend({defaults:function(){return{createdAt:moment().format(DISQUS.ISO_8601),dislikes:0,isApproved:!0,isDeleted:!1,isEdited:!1,isFlagged:!1,isHighlighted:!1,isRealtime:!1,isImmediateReply:!1, isMinimized:null,hasMedia:!1,message:null,raw_message:null,likes:0,media:[],parent:null,points:0,depth:0,userScore:0}},initialize:function(){this.votes=new f.VoteCollection;this.usersTyping=new f.TypingUserCollection},set:function(a,c,d){if(a&&typeof a!=="string"&&a.author)this.author=new b(k,a.author),delete a.author;return Backbone.Model.prototype.set.call(this,a,c,d)},messageText:function(){var a=this.get("message");return _.strip(a)},relatedIds:function(){var a=this.get("forum");if(_.isObject(a))a= a.id;var b=this.get("thread");if(_.isObject(b))b=b.id;return{forum:a,thread:b,post:this.id}},twitterText:function(a){var b=140,c;c=this.author.get("name")||this.author.get("username");b-=c.length+3;b-=a.length+1;b-=2;a=this.messageText();a=DISQUS.next.utils.niceTruncate(a,b);return'"'+a+'" \u2014 '+c},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);a.isMinimized=this.get("isMinimized")===!1?!1:!this.get("isApproved");if(this.author)a.author=this.author.toJSON();a.relativeCreatedAt= this.getRelativeCreatedAt();a.formattedCreatedAt=this.getFormattedCreatedAt();a.cid=this.cid;return a},getFormattedCreatedAt:function(){var a=this.get("createdAt");if(!a)return null;a=DISQUS.assureOffset(a);return moment.utc(a,DISQUS.ISO_8601).local().format("LLLL")},validate:function(b){if(!this.id&&!b.id){if(_.isString(b.raw_message)){if(b.raw_message==="")return a("Comments can't be blank.");if(b.raw_message.length<2)return a("Comments must have at least 2 characters.")}if(b.author_email===""&& b.author_name==="")return a("Please sign in or enter a name and email address.");else if(b.author_email===""||b.author_name==="")return a("Please enter both a name and email address.");if(_.isString(b.author_email)&&!g.validateEmail(b.author_email))return a("Invalid email address format.")}},report:function(){this.set("isFlagged",!0);DISQUS.api.call("posts/report.json",{data:{post:this.id},method:"POST"})},_vote:function(a,b){var c=a-b,d={likes:this.get("likes"),dislikes:this.get("dislikes"),points:this.get("points")}; if(c===0)return c;a>0?(d.likes+=a,d.dislikes+=b):a<0?(d.dislikes-=a,d.likes-=b):b>0?d.likes-=b:d.dislikes+=b;d.points+=c;this.set(d);return c},vote:function(a){var b=this;b._vote(a,b.get("userScore"))!==0&&(b.set("userScore",a),DISQUS.api.call("posts/vote.json",{data:{post:b.id,vote:a},method:"POST",success:function(a){b.votes.add({id:a.response.id})}}))},_delete:function(){this.set({isApproved:!1,isDeleted:!0});DISQUS.api.call("posts/remove.json",{data:{post:this.id},method:"POST"})},spam:function(){this.set({isApproved:!1, isDeleted:!0,isSpam:!0});this.trigger("spam");DISQUS.api.call("posts/spam.json",{data:{post:this.id},method:"POST"})},_create:function(a,b){var c=this,d=a.attributes,f={thread:d.thread,message:d.raw_message};if(d.recaptcha_challenge_field)f.recaptcha_challenge_field=d.recaptcha_challenge_field,f.recaptcha_response_field=d.recaptcha_response_field;if(d.parent)f.parent=d.parent;if(d.author_name)f.author_name=d.author_name,f.author_email=d.author_email;DISQUS.api.call("posts/create.json",{data:f,method:"POST", success:function(a){c.set(a.response);b.success&&b.success()},error:b.error})},_update:function(a,b){var c=this,d=a.attributes;DISQUS.api.call("posts/update.json",{data:{post:d.id,message:d.raw_message},method:"POST",success:function(a){c.set(a.response);b.success&&b.success()},error:b.error})},_read:function(a,b){var c=this,b=b||{};DISQUS.api.call("posts/details.json",{data:{post:c.id},method:"GET",success:function(a){c.set(a.response);b.success&&b.success()},error:b.error})},sync:function(a,b,c){var c= c||{},d=c.error;if(d)c.error=function(a){d(JSON.parse(a.responseText||"{}"))};switch(a){case "create":this._create(b,c);break;case "update":this._update(b,c);break;case "delete":this._delete();break;case "read":this._read(b,c)}}});_.extend(m.prototype,o);b.addType("Post",m);var j=Backbone.Model.extend({defaults:{userId:null,message:null,parentId:null,immedReply:!1},initialize:function(){this.set("createdAt",moment().format(DISQUS.ISO_8601))},getVisibleParent:function(a){for(var b=this,c;b.get("parentId");){if(c= a.posts.get(b.get("parentId")))return c;b=a.queue.get(b.get("parentId"));if(!b)break}return null},toPost:function(a){var c=a.posts.get(this.get("parentId")),c=c?c.get("depth")+1:0,c=new b(m,{id:this.id,thread:a.id,message:this.get("message"),parent:this.get("parentId"),depth:c,createdAt:this.get("createdAt"),isRealtime:!0,isImmediateReply:this.get("immedReply")});c.author=a.users.get(this.get("userId"));return c}}),p=Backbone.Model.extend({defaults:{typing:!0},initialize:function(){this.createdAt= moment()}}),n=Backbone.Model.extend({defaults:{about:null,avatar:{cache:DISQUS.urls.media+"/images/noavatar92.png",permalink:DISQUS.urls.media+"/images/noavatar92.png"},connections:{},email:null,emailHash:null,isAnonymous:!0,isFollowedBy:!1,isFollowing:!1,joinedAt:null,name:null,profileUrl:null,url:null,username:null,numPosts:null,numFollowing:null,numFollowers:null,numLikesReceived:null},hasValidAvatar:function(a){if(!a)a=this.attributes;return(a=a.avatar)&&a.cache},validate:function(a){if(!this.hasValidAvatar(a))return"None of the avatar related properties can be null, undefined or empty on User models."}, toJSON:function(){var a=Backbone.Model.prototype.toJSON.apply(this,arguments);a.thread={};if(!this.hasValidAvatar())a.avatar=this.defaults.avatar;return a}}),l=n.extend({idAttribute:"emailHash"});b.addType("AnonUser",l);var k=n.extend({fetch:function(a){var b=this,a=a||{},c={};if(b.id)c.user=b.id;else if(b.get("username"))c.user="username:"+b.get("username");return DISQUS.api.call("users/details.json",{data:c,success:function(c){c=c.response;b.set(c);a.success&&a.success(c);a.complete&&a.complete(c)}, error:function(b){a.error&&a.error(b);a.complete&&a.complete(b)}})},toJSON:function(){var a=n.prototype.toJSON.call(this),b=this.collection&&this.collection.thread;a.thread.canModerate=!!b&&b.isModerator(this);return a},_changeFollowState:function(a){var b=this;DISQUS.api.call("users/"+(a?"follow":"unfollow")+".json",{data:{target:b.id},method:"POST",success:function(){b.set("isFollowing",a)}})},follow:function(){this._changeFollowState(!0)},unfollow:function(){this._changeFollowState(!1)},toggleFollowState:function(){this._changeFollowState(!this.get("isFollowing"))}}); b.addType("User",k);var s=k.extend({defaults:_.extend({numPosts:0},k.prototype.defaults)}),B=Backbone.Model.extend({initialize:function(){this.user=new b(l)},_eventProxy:function(){this.trigger.apply(this,arguments)},_setProxy:function(){this.user.on("all",this._eventProxy,this)},_clearProxy:function(){this.user&&this.user.off("all",this._eventProxy,this)},_setUser:function(a){this._clearProxy();this.user=a;this._setProxy();this.notifications=new f.NotificationCollection(null,{user:this.user});this.notifications.on("markRead", function(a){this.set("notificationCount",this.get("notificationCount")-a.length)},this);this.trigger("change:id",a)},isRegistered:function(){return this.user instanceof k},isAnonymous:function(){return this.user instanceof l},fetch:function(a){var a=a||{},c={};c["_"+(new Date).getTime()]=1;return DISQUS.api.call("users/details.json",{data:c,success:_.bind(function(c){c=c.response;c.id&&this._setUser(new b(k,c));a.success&&a.success(c);a.complete&&a.complete(c)},this),error:_.bind(function(b){a.error&& a.error(b);a.complete&&a.complete(b)},this)})}}),z=function(){var a=B.extend({defaults:{canReply:!0,canModerate:!1,discoveryVariant:null,mustVerifyEmail:!1,isReadOnly:!1,audienceSyncVerified:!1,notificationCount:null},toJSON:function(){var a=this.user.toJSON.apply(this.user,arguments);a.thread.canReply=this.get("canReply");if(!a.thread.canModerate)a.thread.canModerate=this.get("canModerate");return a},needsAudienceSyncAuth:function(a){return a.get("settings").audienceSyncEnabled&&this.isRegistered()&& !this.get("audienceSyncVerified")},fetch:function(a){var c=this;if(c._request)c._request.abort(),c._request=null;var a=a||{thread:{}},d={thread:a.thread.id,post:a.thread.posts.pluck("id")};if(a.discovery)d.discovery=a.discovery;d["_"+(new Date).getTime()]=1;c._request=DISQUS.api.call("embed/threadDetails.json",{data:d,success:function(d){var d=d.response,f={};d.user&&_.extend(f,d.user,{votes:d.votes});c.set(d.session);c.set("discoveryVariant",d.discovery);f.id&&(c._setUser(new b(k,f)),a.thread.users.add(c.user), d.thread&&(a.thread.set("userScore",d.thread.userScore),a.thread.set("userSubscription",d.thread.userSubscription)));a.success&&a.success(d);c.trigger("identify",c)},error:function(b){a.error&&a.error(b)},complete:function(b){c._request=null;a.complete&&a.complete(b)}});return c._request},register:function(a,c){var d=this;DISQUS.api.call("internal/users/register.json",{secure:!0,data:{display_name:a.name,email:a.email},method:"POST",success:function(a){d._setUser(new b(k,a.response))},error:c.error|| function(){}})},logout:function(){var a=this;DISQUS.api.call("internal/users/logout.json",{method:"POST",success:function(){a._setUser(new b(l))}})}}),c;return{get:function(){return c=c||new a},setDefaults:function(b){if(c)throw Error("Session defaults cannot be changed after a session instance is created!");return a.defaults=_.extend(a.prototype.defaults,b)},forget:function(){c=null}}}(),t=Backbone.Model.extend({defaults:{score:0}}),v=Backbone.Model.extend({defaults:{score:0}}),w=Backbone.Model.extend({defaults:function(){return{object:{}, type:"",createdAt:moment().format(DISQUS.ISO_8601)}},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this),b=DISQUS.assureOffset(this.get("createdAt"));a.relativeCreatedAt=moment(b,DISQUS.ISO_8601).fromNow();return a}}),E=Backbone.Model.extend({defaults:function(){return{sender:"",timestamp:moment().valueOf(),type:0,formatted:"",theme:"",createdAt:null,post:null}},set:function(a,b){if(a&&typeof a!=="string"&&a.post)this.post=new m(a.post),delete a.post;return Backbone.Model.prototype.set.call(this, a,b)},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);if(this.post)a.post=this.post.toJSON();a.relativeCreatedAt=this.getRelativeCreatedAt();return a}});_.extend(E.prototype,o);var o=Backbone.Model.extend({defaults:{enabled:!1}}),q=Backbone.Model.extend({defaults:{thread:null,forum:null,body:null,service:{url:null,name:null},url:null,title:null},set:function(a,c){if(a&&typeof a!=="string"){if(a.author)this.author=new b(a.author.id?k:l,a.author),delete a.author;if(a.createdAt)a.relativeCreatedAt= moment(DISQUS.assureOffset(a.createdAt),DISQUS.ISO_8601).fromNow()}return Backbone.Model.prototype.set.call(this,a,c)},toJSON:function(){var a=Backbone.Model.prototype.toJSON.call(this);if(this.author)a.author=this.author.toJSON();return a},destroy:function(){DISQUS.api.call("reactions/remove.json",{data:{reaction:this.id,forum:this.get("forum")},method:"POST"})}});return{UniqueModel:b,Forum:c,Thread:d,TopThread:i,Post:m,QueuedPost:j,Reaction:q,TypingUser:p,User:k,AnonUser:l,Session:z,BaseSession:B, TopUser:s,Vote:t,ThreadVote:v,Notification:E,ActivityItem:w,Switch:o}}); DISQUS.define("next.collections",function(){var b=DISQUS.use("next.models"),f=DISQUS.use("next.utils"),g=Backbone.Collection.extend({model:b.ThreadVote}),h=Backbone.Collection.extend({model:_.bind(b.UniqueModel,{},b.User),initialize:function(a,b){Backbone.Collection.prototype.initialize.apply(this,arguments);this.thread=b&&b.thread}}),a=Backbone.Collection.extend({model:b.Vote}),c=Backbone.Collection.extend({PER_PAGE:10,initialize:function(a,b){b=b||{};this.cursor=b.cursor||{}},fetch:function(a){a= a||{};a.data=_.defaults(a.data||{},{cursor:a.cursor||"",limit:this.PER_PAGE});return Backbone.Collection.prototype.fetch.call(this,a)},more:function(a){function b(a){d.push(a)}var c=this,a=a||{};if(this.cursor.hasNext){var d=[];this.on("add",b);this.fetch(_.extend({},a,{add:!0,cursor:this.cursor.next,success:function(){c.trigger("add:many",d,c,a);c.off("add",b);a.success&&a.success()}}))}else a.error&&a.error()},parse:function(a){this.cursor=a.cursor;return Backbone.Collection.prototype.parse.call(this, a)}}),o=c.extend({model:b.Notification,url:DISQUS.api.getURL("messagesx/list"),initialize:function(a,b){this.user=b.user;c.prototype.initialize.apply(this,arguments)},markRead:function(){var a=this.getUnread();if(a.length){var b=_.pluck(a,"id");DISQUS.api.call("messagesx/markRead.json",{data:{messages:b},method:"POST"});_.invoke(a,"set","isRead",!0);this.trigger("markRead",b)}},getUnread:function(){return this.filter(function(a){return!a.get("isRead")})}}),d=c.extend({PER_PAGE:50,model:_.bind(b.UniqueModel, {},b.Post),url:DISQUS.api.getURL("threads/listPostsThreaded"),initialize:function(a,b){c.prototype.initialize.apply(this,arguments);this.thread=b.thread;this.order=f.cookies.read("disqus.order")||"popular"},fetch:function(a){a=a||{};this.order==="popular"?f.cookies.erase("disqus.order"):f.cookies.create("disqus.order",this.order);a=_.extend(a,{data:{limit:this.PER_PAGE,thread:this.thread.id,forum:this.thread.get("forum"),order:this.order}});return c.prototype.fetch.call(this,a)},add:function(a,b){_.isArray(a)|| (a=[a]);for(var c=[],d=0;d<a.length;d++)this.get(a[d].id)||c.push(a[d]);Backbone.Collection.prototype.add.call(this,c,b)}}),i=Backbone.Collection.extend({model:b.QueuedPost,initialize:function(a,b){var c=this;c.thread=b.thread;c.counters={comments:0,replies:{}};c.on("add",function(a){var b=a.getVisibleParent(c.thread),d=c.counters.replies;b?(d[b.id]=(d[b.id]||0)+1,b.id==a.get("parentId")&&a.set("immedReply",!0)):c.counters.comments+=1})},comparator:function(a){return parseInt(a.id,10)},isDescendant:function(a, b){var e;var c=a.get("parentId"),c=c?this.get(c):null,d={};for(_.each(b,function(a){d[a]=!0});c;){if(d[c.get("id")]===!0)return!0;e=(c=c.get("parentId"))?this.get(c):null,c=e}return!1},drain:function(a){function b(a){var c=[];d.each(function(a){a.get("parentId")===null&&c.push(a.get("id"))});d.reset(d.filter(function(b){if(b.get("parentId")!==null&&!d.isDescendant(b,c))return b;a(b)}));d.counters.comments=0}function c(b){var f=[],g;g=d.filter(function(b){var c=b.getVisibleParent(d.thread);if(!c|| c.get("id")!=a)return b;f.push(b)});f=_.sortBy(f,function(a){return parseInt(a.get("id"),10)});_.each(f,function(a){b(a)});d.reset(g);d.counters.replies[a]=0}var d=this;return(a?c:b)(function(a){d.thread.posts.add(a.toPost(d.thread))})}}),m=Backbone.Collection.extend({model:b.Switch,parse:function(a){return _.map(a,function(a,b){return{id:b,enabled:a}})},enabled:function(a){return(a=this.get(a))?a.get("enabled"):!1}}),j=Backbone.Collection.extend({models:b.TypingUser,initialize:function(){var a=this; a.gc=null;a.bind("add remove reset",function(){var b=a.count();if(b>0&&a.gc===null)a.gc=setInterval(_.bind(a.cleanup,a),6E4);else if(b<=0&&a.gc!==null)clearInterval(a.gc),a.gc=null},a)},count:function(){var a=0;this.each(function(b){a+=b.get("typing")?1:-1});return a},cleanup:function(){var a=moment();this.reset(this.filter(function(b){return b.createdAt.diff(a,"minutes")>5}))}}),p=Backbone.Collection.extend({model:b.ActivityItem,url:DISQUS.api.getURL("users/listActivity"),initialize:function(a,b){this.user= b.user;this.include=b.include||null},fetch:function(){var a={user:"username:"+this.user.get("username")};if(this.include)a.include=this.include;Backbone.Collection.prototype.fetch.call(this,{data:a})}}),n=c.extend({model:_.bind(b.UniqueModel,{},b.Post),url:DISQUS.api.getURL("users/listPostActivity")}),l=Backbone.Collection.extend({model:b.TopThread,url:DISQUS.api.getURL("threads/listPopular"),initialize:function(a,b){this.forum=b.forum;this.limit=b.limit},add:function(a,b){_.isArray(a)||(a=[a]);var c= [];_.each(a,function(a){a.title.match(/^http/i)||c.push(a)});Backbone.Collection.prototype.add.call(this,c,b)},fetch:function(){Backbone.Collection.prototype.fetch.call(this,{data:{forum:this.forum,limit:this.limit,interval:"7d",with_top_post:!0}})}}),k=Backbone.Collection.extend({model:b.TopUser,url:DISQUS.api.getURL("forums/listMostActiveUsers"),initialize:function(a,b){this.forum=b.forum;this.limit=b.limit;this.discardLowRep=b.discardLowRep},fetch:function(){Backbone.Collection.prototype.fetch.call(this, {data:{forum:this.forum,limit:this.limit}})},parse:function(a){if(!this.discardLowRep)return a.response;return _.filter(a.response,function(a){if(parseFloat(a.rep)>0.7)return a})}}),b=c.extend({PER_PAGE:20,model:b.Reaction,url:DISQUS.api.getURL("threads/listReactions"),initialize:function(a,b){this.thread=b.thread},fetch:function(a){a=a||{};a=_.extend(a,{data:{limit:this.PER_PAGE,thread:this.thread.id}});return c.prototype.fetch.call(this,a)}});return{PaginatedCollection:c,UserCollection:h,PostCollection:d, ReactionsCollection:b,TypingUserCollection:j,TopUserCollection:k,TopThreadCollection:l,VoteCollection:a,ThreadVoteCollection:g,ActivityCollection:p,PostActivityCollection:n,NotificationCollection:o,QueuedPostCollection:i,SwitchCollection:m}}); DISQUS.define("next.views",function(){function b(e){return(e=e&&e.match(/discovery\-([\w\-]+)/))&&e[1]}function f(e){return function(a){a&&a.preventDefault&&a.preventDefault();e.apply(this,arguments)}}function g(e,a){var b="[data-action^="+a+"]",c=$(e),c=c.is(b)&&c||c.closest(b);return(c.attr("data-action")||":").split(":")[1]}var h=DISQUS.use("next.models"),a=DISQUS.use("next.collections"),c=DISQUS.use("next.utils"),o=DISQUS.use("next.realtime"),d=DISQUS.use("Bus"),i=DISQUS.use("JSON"),m=DISQUS.strings.get, j,p={_getShortUrl:function(e){var a=this,b=this._shareUrl(),c=b,b=_.extend({url:b,source:"disqus_embed_next"},this.model.relatedIds());DISQUS.api.call("shortener/create.json",{method:"POST",data:b,timeout:5E3,success:function(e){if(e.code===0)c=e.response.url},complete:function(){e.call(a,c)}})},_shareWaitPopup:function(e){return window.open(DISQUS.urls.loading,"_blank",e||"width=550,height=520")},share:function(e){this.sharers[e].call(this)},sharers:{twitter:function(){var e=this._shareWaitPopup(); this._getShortUrl(function(a){e.location=DISQUS.serialize("https://twitter.com/intent/tweet",{url:a,text:this.model.twitterText(a)})})},facebook:function(){var e=this._shareWaitPopup("width=655,height=352");this._getShortUrl(function(a){e.location=DISQUS.serialize("https://www.facebook.com/sharer.php",{u:a})})}}},n={alert:function(e,a){a?_.isString(a)&&(a={type:a}):a={};this._alert&&this._alert.dismiss();var b=this._alert=new P(_.extend({message:e},a));this.updateDom(function(){b.render().$el.prependTo($("#form")[0])}); return b}},l=Backbone.View.extend({events:{"click [data-action^=auth:]":"handleAuth","click [data-action=verify-email]":"verifyEmail","click [data-action=audiencesync]":"audienceSync","click [data-action=profile]":"handleShowProfile","click [data-action=sort]":"handleSort","click [data-action=close-thread]":"closeThread","click [data-action=open-thread]":"openThread","click [data-action=debug]":"renderDebugInfo"},STREAMING_MAX_VISIBLE:250,MEDIA_PERSISTED_WIDTHS:[320,480,600,800],MAX_MEDIA_HEIGHT:480, initialize:function(e){j=this;e=e||{};e=e.jsonData||{};this.initialData=e.response||{};if(c.extract(e,"response.forum.id"))DISQUS.urls.moderate=c.updateURL(DISQUS.urls.moderate,{hostname:e.response.forum.id+"."});this.theme=c.extract(this.initialData,"theme.base")||{};h.Session.setDefaults(this.initialData.session);this.session=h.Session.get();this.bindSessionEvents();this.forum=new h.Forum;this.initialData&&this.initialData.forum&&this.forum.set(this.initialData.forum);this.thread=new h.Thread(null, {forum:this.forum,postCursor:e.cursor,moderators:(this.initialData.thread||{}).moderators});this.posts=this.thread.posts;this.switches=new a.SwitchCollection;this.states={templateReady:!1,realtimeIndicatorsCreated:!1,ravenConfigured:!1,inViewport:!1,streamingPaused:!1};this.forum.get("settings").backplaneEnabled&&this.enableBackplane();d.bind("window.inViewport",function(){this.states.inViewport=!0;this.trigger("inViewport")},this);d.bind("window.scrollOffViewport",function(){this.states.inViewport= !1},this);d.bind("switches.changed",function(e){this.switches.reset(this.switches.parse(e));if(!this.states.ravenConfigured&&this.switches.enabled("next_raven"))Raven.config({servers:["http://disqus.com/raven/api/store/"],logger:"javascript.next",ignoreErrors:["Script error."]}),window.onerror=Raven.process,DISQUS.api.defaults({error:function(e){Raven.captureMessage({name:"API call failed.",message:e})}}),this.states.ravenConfigured=!0;this.switches.enabled("next_comments_truncation_enabled")&&_.invoke(this.postViews, "manageMessageHeight");if(!this.switches.enabled("next_lazy_embed")||this.states.inViewport)this.fetchSession();else this.on("inViewport",this.fetchSession,this);this.initLinkAffiliator()},this);this.switches.on("reset",function(){DISQUS.defer(_.bind(function(){if(!this.states.templateReady)return!1;return this.thread&&this.thread.id},this),_.bind(this.initRealtime,this))},this);d.bind("init",function(e){j.bootstrap(e)});e={};if(typeof this.initialData==="object"&&!_.isEmpty(this.initialData))e.thread= {id:this.initialData.thread.id};d.sendHostMessage("ready",e)},_templateReady:function(){this.updateModeratorText();this.states.templateReady=!0;this.renderLayout();_.defer(_.bind(this.trigger,this,"templateReady"))},enableBackplane:function(){this.backplaneCredentialsReady=!1;this.events["click [data-action=logout]"]=function(e){if(this.backplaneCredentialsReady)e.preventDefault(),d.sendHostMessage("backplane.invalidate",{redirectUrl:DISQUS.urls.logout});else return!0};this.session.on("identify", function(){if(this.backplaneCredentialsReady&&!this.session.isRegistered())d.sendHostMessage("backplane.invalidate"),this.backplaneCredentialsReady=!1,DISQUS.api.headers({Authorization:null})},this);d.bind("login",function(e){e.backplane!==null&&(this.setBackplaneHeaders(e.backplane),this.fetchSession())},this);d.sendHostMessage("loadBackplane")},setBackplaneHeaders:function(e){e="Backplane "+i.stringify({provider:"janrain",message_id_url:e.messageUrl,channel_name:e.channel,forum_id:this.forum.id}); this.backplaneCredentialsReady=!0;DISQUS.api.headers({Authorization:e})},bootstrap:function(e){var a=this;a.config=e||{};var u={};this.discoveryOverride=b(e.parentWindowHash);if(e.apiKey)u["X-Disqus-Publisher-API-Key"]=e.apiKey;if(e.remoteAuthS3)u["X-Disqus-Remote-Auth"]=e.remoteAuthS3;_.isEmpty(u)||DISQUS.api.headers(u);e.anchorColor&&function(){var a=c.escapeColor(e.anchorColor);c.addStylesheetRules([[".publisher-anchor-color a",["color",a,!0]],["a.publisher-anchor-color",["color",a,!0]],[".publisher-anchor-hover a:hover", ["color",a,!0]],["a.publisher-anchor-hover:hover",["color",a,!0]],[".active .publisher-nav-color:after",["background",a,!0]],[".media-preview .active.publisher-border-color",["border-color",a,!0]]])}();c.injectBaseElement(e.referrer);if(e.referrer)a.thread.currentUrl=e.referrer;if(e.width)document.body.style.width=e.width+"px";if(e.permalink)a.on("postsRendered",_.once(function(){a.scrollToPost(e.permalink)}));if(e.sso)DISQUS.templateGlobals.sso=e.sso;this.loadTheme(e);a.bind("templateReady",a.findClosestThumbnailSize, a);a.bind("templateReady",a.renderForm,a);a.bind("templateReady",a.updatePostCount,a);a.bind("templateReady",a.initCommunity,a);a.bind("templateReady",a.initReactions,a);a.bind("templateReady",a.initUserMenu,a);a.bind("templateReady",a.initThreadVotes,a);a.bind("templateReady",a.initThreadShareMenu,a);a.bind("templateReady",a.initThreadSubscribe,a);a.bind("templateReady",a.renderStreamingToggle,a);a.bind("postsRendered",_.debounce(a.initRealtime,500),a);a.renderBindings([a.thread,"change:likes",a.updateThreadVotes], [a.thread,"change:userScore",a.updateThreadUserScore],[a.thread,"change:posts",a.updatePostCount],[a.thread.posts,"reset",a.redrawPosts],[a.thread.posts,"add",a.addPosts],[a.thread.posts,"remove",a.removePost],[a.thread.posts,"reset add",a.toggleLoadMorePosts],[a.thread.posts,"reset add",a.toggleNoPosts],[a.thread.reactions,"reset add",a.toggleLoadMoreReactions],[a.session,"change:id",a.updateThreadSessionData],[a.session,"change:id",a.initDashboard]);a.bind("scroll",function(e){a.position=e;if(a.currentSection=== "conversation")a.conversationPosition=e});a.bind("scrollOffViewport",function(){a.states.realtimeIndicatorsCreated&&a.currentSection==="conversation"&&(d.sendHostMessage("realtime.hideNorth"),d.sendHostMessage("realtime.hideSouth"))});a.on("scroll",a.processDeferredImages,a);a.on("domReflow",function(){a.deferredImages=null;d.sendHostMessage("fakeScroll")});d.on("window.resize",_.bind(d.sendHostMessage,d,"fakeScroll"));a.on("scroll",a.handleRealtimeScroll,a);d.bind("window.hashchange",function(e){a.discoveryOverride= b(e);if(a.discoveryOverride)return a.fetchSession();(e=e&&e.match(/comment\-([0-9]+)/))&&a.scrollToPost(e[1])});d.bind("window.scroll",function(e){a.trigger("scroll",e)});d.bind("window.scrollOffViewport",function(){a.trigger("scrollOffViewport")});d.bind("window.resize",a.resize,a);d.on("realtime.click",a.handleRealtimeClick,a);a.thread.queue.bind("add reset",a.toggleRealtimeNotifications,a);a.thread.set(this.initialData.thread);a.posts.reset(this.initialData.posts);var f=$("body");a.getTypeface()=== "serif"&&f.addClass("serif");a.getColorScheme()==="dark"&&f.addClass("dark");a.bindBusListeners();_.delay(function C(){a.postViews&&!(_.size(a.postViews)<1)&&(_.invoke(a.postViews,"updateRelativeTime"),_.delay(C,6E4))},6E4);a.currentSection="conversation";a.thread.on("create",function(e){d.sendHostMessage("posts.create",e.toJSON())});var u=$(window),g=f.width(),h=_.debounce(function(){var e=f.width();g!=e&&a.postViews&&(g=e,_.each(a.postViews,function(e){e.manageMessageHeight()}))},50);u.on("resize", h);a.initialized=!0},bindBusListeners:_.once(function(){d.bind("!auth:success",function(e){e&&e.sessionId&&DISQUS.api.headers({"X-Sessionid":e.sessionId});this.fetchSession()},this);d.bind("!audiencesync:grant",function(){this.session.set("audienceSyncVerified",!0)},this)}),initLinkAffiliator:function(){if(this.switches.enabled("enable_link_affiliation")&&c.extract(this,"initialData.forum.settings.linkAffiliationEnabled")&&!this.isHttps()&&!this.initLinkAffiliatorCalled){this.initLinkAffiliatorCalled= !0;var e=c.extract(this,"initialData.forum.pk");if(_.isNumber(e)){var a=new Q({el:document.body});d.on("affiliationOptions",function fa(e){d.off("affiliationOptions",fa);e&&_.isNumber(e.timeout)&&a.trigger("options.timeout",e.timeout)});d.sendHostMessage("loadLinkAffiliator",{clientUrl:DISQUS.urls.linkAffiliatorClient,apiUrl:"//links.services.disqus.com/api",key:"cfdfcf52dffd0a702a61bad27507376d",id:e})}}},loadTheme:function(e){var a=this.theme.js,b=this.theme.css,c=function(e,a){return DISQUS.serialize((a|| "js")+"!"+e,null,DISQUS.debug)};this.language=e=e.language||this.initialData.forum.language||"en";var a=curl([c(b,"css"),c(a)]),d=_.bind(this._templateReady,this);e!=="en"&&(a=a.next([c(DISQUS.urls.translations+"/"+e+".js")]));a.then(d,function(e){d();DISQUS.log(e)})},bindSessionEvents:_.once(function(){this.session.on("change:isReadOnly",function(){this.session.get("isReadOnly")&&this.alert(m("The Disqus comment system is temporarily in maintenance mode. You can still read comments during this time, however posting comments and other actions are temporarily delayed."))}, this);this.session.on("identify change:audienceSyncVerified",function(){this.session.get("audienceSyncVerified")&&d.sendHostMessage("session.identify",this.session.user.id)},this);this.session.on("change:discoveryVariant",this.initDiscovery,this)}),fetchSession:function(){var e={thread:this.thread};if(this.switches.enabled("discovery_next:override")&&this.discoveryOverride)e.discovery=this.discoveryOverride;return this.session.fetch(e)},initRealtimeIndicators:function(){var e=$("html").width()+"px", e={width:e,minWidth:e,maxWidth:e,position:"fixed"},a={contents:DISQUS.renderBlock("realtimeIndicator",{orientation:"north"}),styles:{top:"0"}},b={contents:DISQUS.renderBlock("realtimeIndicator",{orientation:"south"}),styles:{bottom:"0"}};_.defaults(a.styles,e);_.defaults(b.styles,e);d.sendHostMessage("realtime.init",{north:a,south:b});this.states.realtimeIndicatorsCreated=!0},insertStreamingComments:_.throttle(function(){var e=this.thread.queue;e.drain();_.each(e.counters.replies,function(a,b){e.drain(b)})}, 1E3),getTypeface:function(){var e=this.forum.get("settings");return e.typeface==="auto"?this.config.typeface:e.typeface},getColorScheme:function(){var e=this.forum.get("settings");return e.colorScheme==="auto"?this.config.colorScheme:e.colorScheme},updateModeratorText:function(){var e=this.forum.get("settings");if(e.moderatorText)DISQUS.strings.translations.Mod=e.moderatorText},handleRealtimeScroll:function(e){if(this.states.inViewport&&this.states.realtimeIndicatorsCreated&&this.currentSection=== "conversation"){var a=_.union([this.queueView],_.values(this.postViews)),b=0,c=0;_.each(a,function(a){if(a&&!a.getDirection)a=a.queueView;if(a&&!(a.options.count<=0)){var y=a.getDirection(e);y===1?b+=a.options.count:y===-1&&(c+=a.options.count)}});var a="realtime.hideNorth",f;b>0&&(a="realtime.showNorth",f=DISQUS.renderBlock("realtimeIndicatorText",{num:b,orientation:"north"}));d.sendHostMessage(a,f);a="realtime.hideSouth";f=void 0;c>0&&(f=DISQUS.renderBlock("realtimeIndicatorText",{num:c,orientation:"south"}), a="realtime.showSouth");d.sendHostMessage(a,f)}},handleRealtimeClick:function(e){var a=this;d.sendHostMessage("realtime.hide"+(e==="north"?"North":"South"));var b=_.union([a],_.toArray(a.postViews)),c,f,b=_.filter(b,function(b){b=b.queueView;if(!b||b.options.count<=0)return!1;var c=e==="north"?1:-1;if(b.getDirection(a.position)!==c)return!1;return!0}),b=_.sortBy(b,function(e){if(e===a)return 0;return e.offset.top}),b=e==="north"?_.last(b):_.first(b);c=b.queueView;b===a?(f=0,c.model.queue.drain(), c.setCount(c.model.queue.length)):(f=b.offset.top-100,c.options.thread.queue.drain(c.model.id),c.setCount(c.options.thread.queue.length));var g=function(){d.sendHostMessage("scrollTo",{top:f});l.getInstance().off("domReflow",g)};l.getInstance().on("domReflow",g)},toggleRealtimeNotifications:function(){var e=this,a=e.thread.queue;e.updateDom(function(){_.defer(function(){d.sendHostMessage("fakeScroll")});if(!a.length)return void $("[data-role=realtime-notification]").hide();if(e.thread.get("hasStreaming"))return void e.insertStreamingComments(); if(a.counters.comments){var b=e.queueView||new F({model:e.thread,el:e.$el.find("button[data-role=realtime-notification]")});e.queueView=b;b.setCount(a.counters.comments);b.render()}_.each(a.counters.replies,function(a,b){var y=e.thread.posts.get(b);if(y){var c=e.postViews[y.cid],d=c.queueView;if(!d)d=new O({thread:e.thread,postView:c,model:y,el:c.$el.find("[data-role=realtime-notification:"+b+"] a")}),c.queueView=d;d.setCount(a);d.render()}})})},renderDebugInfo:f(function(){if(this.session.user.get("isGlobalAdmin")){var e= new R({Shortname:this.thread.get("forum"),"Thread ID":this.thread.get("id"),"Thread slug":this.thread.get("slug"),"Anchor color":c.escapeColor(this.config.anchorColor)});e.render();this.updateDom(function(){var a=document.body;a.insertBefore(e.el,a.firstChild)})}}),scrollToPost:function(e,a,b){var c=this;c.currentSection!=="conversation"&&(b=!0);c.mainNav.navTo("conversation");var f=c.$el.find("#post-"+e);f.length?(a=a||0,_.delay(function(){d.sendHostMessage("scrollTo",{top:f.offset().top+a,force:b|| null})},100)):DISQUS.api.call("posts/getContext.json",{method:"GET",data:{post:e},success:function(d){d=_.filter(d.response,function(e){return e.thread==c.thread.get("id")});d.length!==0&&(_.each(d,function(e){c.thread.posts.add(new h.UniqueModel(h.Post,e))}),c.on("domReflow",function C(){c.off("domReflow",C);c.scrollToPost(e,a,b)}))}})},updateThreadSessionData:function(e){e&&(e.get("thread")&&this.thread.set(e.get("thread")),(e=e.get("votes"))&&typeof e==="object"&&_.each(e,function(e,a){var b=this.posts.get(a); b&&b.set("userScore",e)},this))},initDashboard:function(){var e=$("#main-nav [data-nav=dashboard]");if(this.session.isAnonymous())return e.hide();e.show();this.notificationCount=new I({el:e.find("[data-role=notification-count]")[0],session:this.session,max:99});this.notificationCount.render();this.session.on("change:notificationCount",function(){this.session.get("notificationCount")<=0&&this.notificationCount.remove()},this);this.dashboard=new S({el:"#dashboard",session:this.session,notifications:this.notifications}); this.dashboard.render()},initCommunity:function(){this.community=new T({el:document.getElementById("community"),forum:this.forum})},initReactions:function(){this.reactions=new ha({el:$("#reaction-list")[0],collection:this.thread.reactions,thread:this.thread,session:this.session});this.forum.get("settings").hasReactions&&$("#global-nav").length===0&&(this.thread.reactions.on("reset",function(){$("#reactions").show()}),this.thread.reactions.fetch())},_getLogoutUrl:function(){return this.config.sso&& this.session.user.get("user_type")==="sso"?this.config.sso.logout:DISQUS.urls.logout},initUserMenu:function(){var e=this.userMenu=new t({el:this.$el.find("[data-role=logout]")[0],session:this.session,thread:this.thread,logoutUrl:this._getLogoutUrl(),referrerUrl:this.config.referrer});this.session.on("change:id",function(){e.logoutUrl=this._getLogoutUrl();e.render()},this);this.thread.on("change:isClosed",this.render,this);e.render()},initThreadShareMenu:function(){this.threadShareMenu=new s({el:$("#thread-share-menu")[0], model:this.thread})},initDiscovery:function(e,a){function b(){if(!c.states.templateReady)return void c.on("templateReady",function J(){c.off("templateReady",J);b()});if(!DISQUS.discovery||c.ranThemeScript){if(!c.ranThemeScript)DISQUS.runThemeScript(),c.ranThemeScript=!0;if(!c.switches.length)return void c.switches.on("reset",function C(){c.switches.off("reset",C);b()});DISQUS.discovery.init(_.extend({},{isExperiment:!!a.isExperiment,variant:a.name,thread:c.initialData.thread,forum:c.initialData.forum, switches:c.switches,loungeId:c.el.id,containerId:"discovery",session:e}),function(e){e.on("allSubviewsRendered",c.updateDom,c);e.on("resize",c.updateDom,c);c.updateDom(function(){e.render()})})}else DISQUS.discovery.init(_.extend({},a,{sourceThread:c.initialData.thread,sourceForum:c.initialData.forum,containerId:"discovery",session:e})).on("resize",function(){c.updateDom()})}var c=this;if(!a)return void DISQUS.log("Discovery seems not enabled. Check Gargoyle switches or forum settings.");DISQUS.discovery= null;var d=window.define;window.define=null;curl(["css!"+a.css,"js!"+a.js]).then(function(){b();window.define=d},function(){window.define=d})},toggleLoadMorePosts:function(){var e=this.$el.find("#posts [data-role=more]");this.updateDom(function(){this.thread.posts.cursor.hasNext?e.show():e.hide()},this)},toggleLoadMoreReactions:function(){var e=this.$el.find("#reactions [data-role=more]");this.updateDom(function(){this.thread.reactions.cursor.hasNext?e.show():e.hide()},this)},isHttps:function(){return window.location.protocol=== "https:"},isRealtimeEnabled:function(){return!this.thread.get("isClosed")},realtimeHandlers:{Post:function(e){var e=e.data,a=this.thread;if(!this.thread.get("hasStreaming")||!this.states.streamingPaused){if(!e.id)return void DISQUS.logError("RT: no post ID");if(!e.author||!e.author.id)return void DISQUS.logError("RT: no author or author ID");if(!e.author.name||!e.author.email_md5)return void DISQUS.logError("RT: no author name or email hash");if(!e.post||!e.post.message)return void DISQUS.logError("RT: no post message"); if(a.posts.get(e.id)||a.queue.get(e.id))return void DISQUS.log("RT: duplicate: ",e.id);if(e.type!=="approved")return void DISQUS.log("RT: unnaproved: ",e.id);this.thread.incrementPostCount(1);var b=e.post.parent_post.id;if((b=b!=="0"?b:null)&&!a.posts.get(b)&&!a.queue.get(b))return void DISQUS.log("RT: parent is not on this page: ",e.id);var c=e.author.id,d=a.users.get(c);d||(d=new h.UniqueModel(h.User,{id:c,name:e.author.name,emailHash:e.author.email_md5,isAnonymous:e.author.id==="0"}),e.author.avatar&& d.set("avatar",{cache:e.author.avatar,permalink:e.author.avatar}),a.users.add(d));a.queue.add({id:e.id,userId:d.get("id"),parentId:b,message:e.post.message})}},Vote:function(e){var a=e.data;if(a.id&&a.vote){var b=this.thread.posts.get(a.vote.recipient_post_id);!(this.session.user.id&&a.vote.voter_id===this.session.user.id)&&b&&(DISQUS.log("RT: Vote for post ",b.id),e=b.votes.get(a.id),e||(DISQUS.log("RT: Creating new vote with id ",a.id),e=new h.Vote({id:a.id}),b.votes.add(e)),a=b._vote(a.vote.vote, e.get("score")),a!==0&&e.set("score",a))}},ThreadVote:function(e){var a=e.data,b=this.thread;a.id&&a.vote&&!(this.session.user.id&&a.vote.voter_id==this.session.user.id)&&(e=b.votes.get(a.id),e||(e=new h.ThreadVote({id:a.id}),b.votes.add(e)),a=b._vote(a.vote.vote,e.get("score")),a!==0&&e.set("score",a))},IsTyping:function(e){var a=e.data,b=this.thread;a.thread_id==b.id&&a.post.parent_post.id&&(b=b.posts.get(a.post.parent_post.id))&&(b.usersTyping.get(e.lastEventId)||(!(b.usersTyping.count()<=0)|| a.typing)&&b.usersTyping.add(new h.TypingUser({id:e.lastEventId,typing:a.typing})))}},initRealtime:_.once(function(){this.isRealtimeEnabled()&&(this.switches.enabled("next_realtime_indicators")&&!this.states.realtimeIndicatorsCreated&&this.initRealtimeIndicators(),o.Manager.initialize(this.thread.id,this.realtimeHandlers,this))}),renderBindings:function(){var e=this;_.each(arguments,function(a){var b=a[2];a[0].bind(a[1],function(){var a=arguments;e.states.templateReady?b.apply(e,a):e.bind("templateReady", function(){b.apply(e,a)})})})},updateDom:function(){var e=_.debounce(function(){this.resize();this.trigger("domReflow")},0);return function(a,b){a&&a.call(b);e.call(this)}}(),initThreadVotes:_.debounce(function(){var e;this.threadVotes&&this.threadVotes.remove();this.threadVotes=e=new B({thread:this.thread,session:this.session});e.on("vote:up",_.bind(this.trigger,this,"uiAction:threadUpvote"));e.on("vote:down",_.bind(this.trigger,this,"uiAction:threadDownvote"));e.render();this.updateDom(function(){$("#thread-votes").append(e.el)})}, 200),initThreadSubscribe:function(){this.threadSubscribeButton=new z({session:this.session,thread:this.thread,el:$("#thread-subscribe-button")[0]})},renderStreamingToggle:function(){var e=this;if(e.thread.get("hasStreaming")&&DISQUS.blocks.realtimeToggleButton){var a=$(DISQUS.renderBlock("realtimeToggleButton"));$(a).bind("click",f(function(){e.toggleStreamingRealtime()}));e.updateDom(function(){$("#realtime-toggle").empty();$("#realtime-toggle").append(a[0])})}},toggleStreamingRealtime:function(){var e= $("#realtime-toggle a.btn");this.states.streamingPaused?(this.states.streamingPaused=!1,e.addClass("pause")):(this.states.streamingPaused=!0,e.removeClass("pause"))},updateThreadVotes:function(){$("#thread-votes [data-role=like-count]").text(this.thread.get("likes"))},updateThreadUserScore:function(){var e=this.thread.get("userScore"),a=$("#thread-votes [data-role=vote-button]");a.removeClass("upvoted").removeClass("downvoted");e>0?a.addClass("upvoted"):e<0&&a.addClass("downvoted")},updatePostCount:function(){$("#post-count").html(DISQUS.renderBlock("postCount", {count:this.thread.get("posts")}))},swapMain:function(e){var a=this,b=this.$el.find("#main-nav [data-nav=conversation]").parent("li");e!=="conversation"?b.attr("data-dropdown","disabled"):_.defer(function(){b.attr("data-dropdown","enabled")});a.updateDom(function(){a.states.realtimeIndicatorsCreated&&e!="conversation"&&(d.sendHostMessage("realtime.hideNorth"),d.sendHostMessage("realtime.hideSouth"));var b=a[e];b&&!b.isRendered&&(a.freeze(!0),b.on("render:all",_.once(function(){a.freeze(!1)})),b.show()); a.$el.find("[data-role=main]").hide();a.$el.find("[data-role=main]#"+e).show();a.prevSection=a.currentSection;a.currentSection=e});a.trigger("uiAction:navigate",e)},returnToConversation:function(){this.mainNav.navTo("conversation");var e=this.conversationPosition,a=e&&e.pageOffset;a&&this.updateDom(function(){_.delay(function(){d.sendHostMessage("scrollTo",{top:a,relative:"window",force:!0})},100)},this)},setupNavigation:function(){var e=this;e.globalNav=new U({el:e.$el.find("#global-nav")[0]});e.mainNav= new U({el:e.$el.find("#main-nav")[0]});e.globalNav.on("nav",function(a){e.updateDom(function(){var b=e.$el.find("#form"),c=e.$el.find("#main-nav");switch(a){case "conversation":b.show();c.show();e.swapMain(e.prevSection||a);break;case "reactions":b.hide(),c.hide(),e.swapMain(a)}})});e.mainNav.on("nav",function(a){e.updateDom(function(){e.swapMain(a)})})},renderLayout:function(){function a(e){return function(a){a.preventDefault();var c=$(a.currentTarget);c.addClass("busy");b.thread[e].more({success:function(){c.removeClass("busy")}, error:function(){c.removeClass("busy")}});d.sendHostMessage([e,".paginate"].join(""))}}var b=this;b.setElement($(DISQUS.renderBlock("layout",{thread:_.extend(b.thread.toJSON(),{showReactions:b.forum.get("settings").hasReactions}),order:b.thread.posts.order})).appendTo("body"));var c=b.$el;b.setupNavigation();_.each(["posts","reactions"],function(b){c.delegate("[data-action=more-"+b+"]","click",a(b))});b.updateDom();d.sendHostMessage("mainViewRendered")},renderForm:function(){if(this.thread.get("isClosed"))return void this.alert(m("Comments for this thread are now closed.")); if(!this.session.get("canReply"))return void this.session.on("change:id",function u(){this.session.off("change:id",u);this.renderForm()},this);var a=new x({thread:this.thread,session:this.session});a.render();this.updateDom(function(){$("#form").prepend(a.el);a.resize()},this)},toggleNoPosts:function(){this.updateDom(function(){this.thread.posts.models.length?$("#no-posts").hide():$("#no-posts").show();$("#post-list").removeClass("loading")},this)},handleShowProfile:f(function(a){a=$(a.currentTarget).attr("data-user"); (a=h.UniqueModel.get(h.User,a))&&this.showProfile(a)}),handleSort:f(function(a){var b=$(a.currentTarget),a=b.closest("li"),b=b.attr("data-sort");a.siblings().removeClass("selected");a.addClass("selected");this.thread.posts.order=b;this.thread.posts.fetch();$("#conversation-menu").removeClass("open");$("#posts [data-role=more]").hide();$("#post-list").addClass("loading").empty()}),closeThread:f(function(){this.thread.close({success:_.bind(d.sendHostMessage,d,"reset"),error:_.bind(this.alert,this,"An error occurred while closing thread. Please try again.", "error")})}),openThread:f(function(){this.thread.open({success:_.bind(d.sendHostMessage,d,"reset"),error:_.bind(this.alert,this,"An error occurred while opening thread. Please try again.","error")})}),findClosestThumbnailSize:function(){var a=document.body.offsetWidth;if(this.loadedThumbnailWidth)return this.loadedThumbnailWidth;var b=this.MEDIA_PERSISTED_WIDTHS,c=b.length;this.loadedThumbnailWidth=_.find(b,function(d,f){return f+1===c||Math.abs(b[f+1]-a)>Math.abs(b[f]-a)})},redrawPosts:function(){var a= this;a.postViews={};a.addPosts(a.thread.posts,{clearDom:!0});_.each(x.open,function(b,c){var d=a.postViews[c];d&&(d=d.getReplyView(),d.textarea.set(b.textarea.get()),b.isOpen()?d.show():d.hide())})},addPosts:_.decorate(Backbone.collectionAddNormalizer(a.PostCollection,h.Post),function(a,b,c){var d=this;if(a.length){var f=[];_.each(a,function(a){var e,b=a.get("parent");b&&(e=(b=d.thread.posts.get(b))&&d.postViews[b.cid]);e=new H({parent:e,model:a,thread:d.thread,session:d.session,created:c.created}); d.postViews[a.cid]=e;e.render();a.get("isRealtime")&&d.removeOldPosts.call(d);b?d.postViews[b.cid].attachChild(e):f.push(e.el)});f.length&&d.updateDom(function(){var b=$("#post-list");c.clearDom&&b.empty();$("#post-list").removeClass("loading");c.created||!a[0].id||a[0].get("isRealtime")?b.prepend(f):b.append(f);d.trigger("postsRendered")})}}),calculateImageOffsets:function(){var a=[];$("img[data-src]").each(function(b){var b=$(b),c=b.offset();(c.top||c.left)&&a.push({offset:c.top,element:b,relatedPost:b.attr("data-post")})}); this.deferredImages=a},processDeferredImages:function(a){this.deferredImages||this.calculateImageOffsets();var b=this.deferredImages.length;if(b&&(a=a.pageOffset+a.height*2-a.frameOffset.top,!(a<0))){for(var c=0;c<b;++c){var d=this.deferredImages[c];if(d.offset<=a){var f=d.element,g=f.attr("data-src");g&&(d.relatedPost&&(d=_.bind(this.onPostImageReady,this,d),f.on("load",d,this),f.on("error",d,this)),f.attr("src",g),f.removeAttr("data-src"))}else break}this.deferredImages=this.deferredImages.slice(c)}}, onPostImageReady:function(a){var b=j.postViews,a=a.relatedPost;b.hasOwnProperty(a)&&b[a].manageMessageHeight();this.updateDom()},showProfile:function(a){this.switches.enabled("next_profile_modal")?this.showProfileModal(a):this.showProfileTab(a)},showProfileModal:function(a){Modernizr.sessionstorage&&(sessionStorage.setItem("profile.session",i.stringify(this.session.user.toJSON())),sessionStorage.setItem("profile.user",i.stringify(a.toJSON())));$(document).trigger("mouseout");d.sendHostMessage("profile.show", {username:a.get("username")})},showProfileTab:function(a){this.profile&&this.profile.remove();var b=this.profile=new K({user:a,session:this.session});this.freeze(!0);this.updateDom(function(){this.mainNav.clear();$("#profile").empty().append(b.el);this.swapMain("profile");b.show()},this);b.bind("close",function(){this.returnToConversation();this.updateDom(function(){b.remove()},this)},this);b.bind("render:all",_.once(function(){this.freeze(!1)}),this);d.sendHostMessage("scrollTo",{top:0})},removePost:function(a){var b= this.postViews[a.cid];b&&(b.remove(),delete this.postViews[a.cid])},removeOldPosts:_.debounce(function(){if(this.switches&&this.switches.enabled("next_realtime_cap")){var a=_.size(this.postViews)-this.STREAMING_MAX_VISIBLE;if(!(a<=0))for(var b=this.thread.posts.sortBy(function(a){return moment(a.get("createdAt")).valueOf()}),c,d=0,f=0;d<b.length&&f<=a;d++)if((c=this.postViews[b[d].cid])&&c.childrenNode.children().length===0)this.thread.posts.remove(b[d]),f+=1}},500),resize:function(){var a=$("body").height(); if(!this._frozen||!(this._lastHeight&&this._lastHeight>a))this._lastHeight=a,d.sendHostMessage("resize",{height:a})},freeze:function(a){this._frozen=!!a;this._frozen===!1&&this.resize()},getPostView:function(a){return this.postViews[a]},windowOpen:function(a,b,c){window.open(a,"_blank","width="+b+",height="+c)},authenticate:function(a){var b=this.authServices[a];if(!b)return void DISQUS.log("Unknown authentication service: "+a);if(_.isFunction(b))return b.call(this);this.windowOpen(b.url,b.width, b.height)},handleAuth:f(function(a){this.authenticate(g(a.target,"auth"))}),authServices:{disqus:{url:DISQUS.urls.login,width:460,height:355},twitter:{url:DISQUS.urls.oauth.twitter,width:650,height:680},facebook:{url:DISQUS.urls.oauth.facebook,width:550,height:300},google:{url:DISQUS.urls.oauth.google,width:650,height:440},sso:function(){var a=parseInt(this.config.sso.width||"800",10),b=parseInt(this.config.sso.height||"500",10),f=window.open(this.config.sso.url,"_blank","width="+a+",height="+b); (function ga(){c.isWindowClosed(f)?d.sendHostMessage("reload"):_.delay(ga,500)})()}},verifyEmail:f(function(){var a=DISQUS.serialize(DISQUS.urls.verifyEmail,{f:this.forum.id});window.open(a,"_blank","width=460,height=355")}),getAudienceSyncUrl:_.memoize(function(){var a={client_id:this.config.apiKey,scope:"read,write",response_type:"audiencesync",forum_id:this.forum.id};if(window.location.protocol==="https:")a.ssl=1;return DISQUS.serialize(DISQUS.urls.authorize,a)}),audienceSync:f(function(){this.windowOpen(this.getAudienceSyncUrl(), 460,355)})});l.getInstance=function(){return j};_.extend(l.prototype,p);_.extend(l.prototype,n);var k=Backbone.View.extend({updateDom:function(a,b){var c=l.getInstance();c&&c.initialized?c.updateDom(a,b):_.isFunction(a)&&a.call(b)},resize:function(){var a=l.getInstance();a&&a.initialized&&a.resize()}}),s=k.extend({events:{"click [data-action=share:twitter]":"_onShare","click [data-action=share:facebook]":"_onShare"},_onShare:f(function(a){if((a=g(a.target,"share"))&&this.sharers[a])j.trigger("uiAction:threadShare", a),this.share(a)}),_shareUrl:function(){return this.model.url()}});_.extend(s.prototype,p);var B=k.extend({initialize:function(a){_.extend(this,a)},events:{"click [data-action=upvote]":"upvote"},render:function(){this.setElement($(DISQUS.renderBlock("threadVotes",{thread:this.thread.toJSON(),user:this.session.toJSON()})))},upvote:f(function(){this.vote(1)}),vote:function(a){this.trigger(a===1?"vote:up":"vote:down");var b=this.thread.get("userScore")===a,c;this.thread.vote(b?0:a);b||(c=this.$el.find(".dropdown"), _.defer(function(){c.addClass("open")}))},remove:function(){this.off();Backbone.View.prototype.remove.call(this)}}),z=k.extend({events:{"click [data-action=subscribe]":"subscribe","keydown #thread-subscribe-email":"subscribeKeypress"},initialize:function(a){this.thread=a.thread;this.session=a.session;this.thread.on("change:userSubscription",this.updateStatus,this);this.updateStatus();this._boundDocumentClickHandler=_.bind(this._documentClickHandler,this)},updateStatus:function(){this.thread.get("userSubscription")? this.$el.addClass("subscribed"):this.$el.removeClass("subscribed")},subscribe:f(function(){var a=this.thread.get("userSubscription");this.session.isAnonymous()&&!a?this.showForm():this.thread.subscribe(!a)}),showForm:function(){var a=this;this._unbindDocumentClickHandler();_.defer(function(){$(document.body).bind("click",a._boundDocumentClickHandler)});a.$el.addClass("show-form").find("input")[0].focus()},_documentClickHandler:function(a){a.target.id!=="thread-subscribe-email"&&this.hideForm()},_unbindDocumentClickHandler:function(){$(document.body).unbind("click", this._boundDocumentClickHandler)},hideForm:function(){this._unbindDocumentClickHandler();this.$el.removeClass("show-form").find("input")[0].blur()},subscribeKeypress:function(a){var b=this.$el.find("input");b.removeClass("alert error");if(a.key==="Esc"||a.keyCode===27)return void this.hideForm();if(!(a.key!=="Enter"&&a.keyCode!==13))a=a.target.value,c.validateEmail(a)?(this.hideForm(),this.thread.subscribe(!0,a)):b.addClass("alert error")}}),t=k.extend({initialize:function(a){_.extend(this,a)},render:function(){var a= DISQUS.renderBlock("userMenu",{user:this.session.toJSON(),thread:this.thread.toJSON(),logoutUrl:this.logoutUrl,feedbackUrl:this.getSurveyMonkeyUrl()});this.updateDom(function(){this.$el.html(a)},this)},getSurveyMonkeyUrl:function(){var a=this.referrerUrl,b=this.session.user.id;return"https://www.surveymonkey.com/s/5RBPTTZ?c="+encodeURIComponent((b?[b,a]:[a]).join(";"))}}),v=new QueuedStorage(Modernizr.localstorage?window.localStorage:DISQUS.next.utils.hashStorage,5,"drafts.queue"),w=function(a){if(!a)throw Error("Cannot instantinate MediaStore without a valid storageKey!"); this._storageKey=a;this._store=Modernizr.localstorage?window.localStorage:DISQUS.next.utils.hashStorage};_.extend(w.prototype,{getItems:function(){var a=this._store.getItem(this._storageKey);return a&&i.parse(a)||{}},clear:function(){this._store.removeItem(this._storageKey)},getItem:function(a){return this.getItems()[a]},setItem:function(a,b){var c=this.getItems();c[a]=b;this._store.setItem(this._storageKey,i.stringify(c));return b},removeItem:function(a){var b=this.getItems();if(a in b)return delete b[a], this._store.setItem(this._storageKey,i.stringify(b)),!0;return!1}});var E=k.extend({events:function(){var a={"click [data-action=attach]":"_attachMedia"};window.FormData&&_.extend(a,{dragover:"_dragOn",dragenter:"_dragOn",dragleave:"_dragOff",dragexit:"_dragOff",drop:"_drop"});return a},initialize:function(a){this.owner=a.owner;this.parent=a.parent;this.url=a.url},setElement:function(){var a=k.prototype.setElement.apply(this,arguments);this.$dragPlaceholder=this.$el.find("[data-role=drag-drop-placeholder]"); this.$mediaSelector&&this.$mediaSelector.off();this.$mediaSelector=this.$el.find("input[type=file][data-role=media-upload]");this.$mediaSelector.on("change",_.bind(this._selectorChange,this));return a},_toggleDragPlaceholder:_.throttle(function(a){a?this.$dragPlaceholder.show():this.$dragPlaceholder.hide()},50),_selectorChange:function(a){this.uploadMedia(a.target.files);if(j.switches.enabled("next_dragdrop_nag")&&a.target.files&&Modernizr.localstorage&&!window.localStorage.getItem("usedDragDrop"))this.owner.alert(m("Did you know you can drag and drop images too? Try it now: drag images below.")).on("dismiss", function(){window.localStorage.setItem("usedDragDrop","1")})},_dragOn:function(a){a.stop();this._toggleDragPlaceholder(!0);this.owner.owner.$el.addClass("expanded")},_dragOff:function(a){a.stop();this._toggleDragPlaceholder(!1)},_drop:function(a){a.stop();window.localStorage.setItem("usedDragDrop","1");this._toggleDragPlaceholder(!1);this.uploadMedia(a.dataTransfer.files)},_attachMedia:function(a){a.stop();this.$mediaSelector[0].click()},_uploadMediaModern:function(a){for(var b=this,d=new FormData, f=0,g=a[f];g;g=a[++f])g.type.match(/^image\//)&&d.append("attachment",g);d.append("json","true");this.parent&&d.append("id",this.parent.id);var h=c.CORS.request("POST",this.url,function(){if(!(h.readyState!==void 0&&(h.readyState!==4||h.status!==200))){var a=i.parse(h.responseText);a.success?b.owner.addMedia(a.media):b.owner.alert(a.message,"error")}});h.withCredentials=!0;h.send(d)},_uploadMediaLegacy:function(){var a=this,b=document.createElement("iframe"),c=document.createElement("form"),d=this.$mediaSelector[0]; $(d).off();var f=$(d.cloneNode(!0));d.parentNode.replaceChild(f[0],d);f.on("change",_.bind(this._selectorChange,this));this.$mediaSelector=f;b.style.display="none";b.name="uploadFrame"+ +new Date;c.style.display="none";c.target=b.name;c.action=this.url;c.method="post";c.appendChild(b);c.appendChild(d);if(this.parent)b=document.createElement("input"),b.type="hidden",b.name="id",b.value=this.parent.id,c.appendChild(b);c.enctype="multipart/form-data";c.encoding="multipart/form-data";var g=function(b){b= i.parse(b.data);b.name==="upload"&&($(c).remove(),$(window).off("message",g),b.data.success?a.owner.addMedia(b.data.media):a.owner.alert(b.data.message,"error"))};$(window).on("message",g);this.updateDom(function(){this.$el.append(c);c.submit()},this)},uploadMedia:function(a){this.uploadMedia=this["_uploadMedia"+(window.FormData?"Modern":"Legacy")];return this.uploadMedia(a)}}),q=k.extend({events:{"click [data-action=detach]":"_detachMedia"},initialize:function(a){this.alert=_.bind(a.owner.alert, a.owner);this.owner=a.owner;this.parent=a.parent;this.urls=a.urls;this.uploader=new E({owner:this,parent:this.parent,url:this.urls.add})},setElement:function(){var a=k.prototype.setElement.apply(this,arguments);this.$list=this.$el.find("ul[data-role=media-preview-list]");return a},clear:function(){this.$el.addClass("empty");this.$list.empty();this.owner.mediaStore&&this.owner.mediaStore.clear()},_detachMedia:function(a){a.stop();this.updateDom(function(){this.removeMedia($(a.target).closest("li"))}, this)},addMedia:function(a){var b=$(DISQUS.renderBlock("mediaUpload",{media:a}));this.owner.mediaStore.setItem(a.location,a);b.attr("data-media-id",a.location);this.updateDom(function(){this.$list.append(b);this.$el.removeClass("empty")},this)},removeMedia:function(a){var b=this.owner.mediaStore.getItem(a.attr("data-media-id"));if(b){var c={media:i.stringify(b)};if(this.parent)c.id=this.parent.id;(new Image).src=DISQUS.serialize(this.urls.remove,c,!0);this.owner.mediaStore.removeItem(b.location); this.updateDom(function(){a.remove();this.$list.children().length||this.$el.addClass("empty")},this)}}}),x=k.extend({events:{"click [name=author-register]":"expandRegister"},initialize:function(a){this.session=a.session;this.parent=a.parent;this.thread=a.thread;this.parentView=a.parentView;this.thread.bind("change:id",function(){this.restoreDraft();if(this.thread.forum.get("settings").allowMedia)this.mediaStore=new w(this.storageKey("media"))},this);this.session.on("change:id change:audienceSyncVerified", this.redraw,this);this.parent&&(x.open[this.parent.cid]=this);this.textarea=Modernizr.contenteditable&&!DISQUS.browser.mobile&&(!window.opera||!window.opera.version)?new A({thread:this.thread}):new D;if(this.thread.forum.get("settings").allowMedia){if(a=this.storageKey("media"))this.mediaStore=new w(a);this.mediaUploads=new q({owner:this,parent:this.parent,urls:{add:this.thread.get("uploadAdd"),remove:this.thread.get("uploadRemove")}})}},storageKey:function(a){if(!this.thread.id)return null;return[a|| "drafts","thread",this.thread.id,"parent",this.parent?this.parent.id:0].join(":")},saveDraft:function(){this.storageKey()!==null&&v.setItem(this.storageKey(),i.stringify([this.textarea.get(),(new Date).getTime()]))},getDraft:function(){if(this.storageKey()===null)return null;var a=v.getItem(this.storageKey());if(!a)return null;a=i.parse(a);if(a[1]+86400>(new Date).getTime())return a[0];v.removeItem(this.storageKey());return null},restoreDraft:function(){this.textarea.set(this.getDraft())},updateAvatar:function(){this.$el.find("[data-role=user-avatar]").attr("src", this.session.user.get("avatar").cache)},expandGuestForm:function(){this.$el.find("[data-role=guest-details]").addClass("expanded")},expandRegister:function(){this.$el.toggleClass("register")},redraw:function(){var a=this.$el.hasClass("expanded"),b=this.el,c=this.$el.find("textarea").val();this.render();this.$el.find("textarea").val(c);a&&this.$el.addClass("expanded");$(b).parent().length!==0&&this.updateDom(function(){b.parentNode.replaceChild(this.el,b)},this)},render:function(){var a=this,b=a.getDraft()|| "";this.setElement($(DISQUS.renderBlock("form",{message:b,parent:a.parent?a.parent.toJSON():null,user:a.session.toJSON(),forumName:a.thread.forum.get("name"),audienceSyncRequired:a.session.needsAudienceSyncAuth(a.thread.forum),apiKey:j.config&&j.config.apiKey||"",mediaList:this.mediaStore?_.values(this.mediaStore.getItems()):[],allowAnonPost:a.thread.forum.get("settings").allowAnonPost,allowMedia:a.thread.forum.get("settings").allowMedia})));this.$el.find("form").bind("submit",_.bind(this.submitForm, this));var c=this.textarea;c.setElement(a.$el.find("textarea")[0]);c.render();c.bind("keychange",_.debounce(this.saveDraft,500),this);c.$el.bind("focus",function(){a.$el.addClass("expanded focus");_.delay(_.bind(a.resize,a),200)});c.$el.bind("blur",function(){c.get()||a.$el.removeClass("focus")});this.mediaUploads&&(this.mediaUploads.setElement(this.$el.find("[data-role=media-preview]")[0]),this.mediaUploads.uploader.setElement(this.$el.find("[data-role=textarea]")[0]));a.$el.find("input[name=author-name]").bind("focus", function(){a.expandGuestForm()});a.show();a.session.get("mustVerifyEmail")&&a._alertMustVerify()},resize:function(){this.textarea.resize()},focus:function(){this.textarea.focus()},clear:function(){var a=this;a.textarea.clear();a.$el.removeClass("expanded");a.mediaUploads&&a.mediaUploads.clear();_.delay(function(){a.resize()},200);a.parent?a.hide():a.$el.removeClass("expanded");this.storageKey()&&v.removeItem(this.storageKey())},restore:function(a){var b=this;b.textarea.set(a.get("raw_message"));_.delay(function(){b.resize()}, 200);b.parent&&b.show()},_alertMustVerify:function(a){this.alert(DISQUS.interpolate(m("%(forumName)s requires you to %(verifyEmail)s before posting"),{forumName:this.thread.forum.get("name"),verifyEmail:'<a href="#" data-action="verify-email">'+m("verify your email address")+"</a>"}),{safe:!0,type:a?"error":"warn"})},submitForm:function(a){function b(a){a=a.response;/Invalid email address/i.test(a)?c.alert(m("Invalid email address."),"error"):/Missing required argument\: \'email\'/i.test(a)?c.alert(m("Please enter an email address."), "error"):/Unable to create user/i.test(a)?c.alert(m("That email address is already registered with a Disqus account. Log in or enter another email."),"alert"):c.alert(a,"error")}var c=this;a&&a.preventDefault&&a.preventDefault();if(this._alert)this._alert.remove(),this._alert=null;a=c.$el.find("input[name=author-register]");a=a.length&&a[0].checked;if(c.session.isAnonymous()&&a)return c.session.register({name:c.$el.find("input[name=author-name]").val(),email:c.$el.find("input[name=author-email]").val()}, {error:b}),null;return c.createPost()},createPost:function(){var a=this,b={thread:a.thread.id,depth:a.parent?a.parent.get("depth")+1:0,parent:a.parent?a.parent.id:null,raw_message:a.textarea.get()};a.session.isRegistered()?b.author_id=a.session.user.id:_.extend(b,{author_name:a.$el.find("input[name=author-name]").val(),author_email:a.$el.find("input[name=author-email]").val()});var c=new DISQUS.next.models.UniqueModel(DISQUS.next.models.Post);if(c.set(b,{error:function(b,c){a.alert(c,"error")}})){var d= null,f=function(b,f){if(f.code===19){if(d)return d.reload();d=new N;d.render();var y=j.getPostView(c.cid);y.el.parentNode.insertBefore(d.el,y.el);d.start();d.bind("submitted",function(){c.save({recaptcha_challenge_field:d.getChallenge(),recaptcha_response_field:d.getResponse()},{success:function(){d.remove()}})})}else f.code===12&&/verify/.test(f.response)?a._alertMustVerify(!0):_.isString(f.response)&&a.alert(f.response,"error"),a.thread.posts.remove(c),a.restore(c),a.thread.incrementPostCount(-1)}; c.on("error",f);c.on("sync",function J(){a.thread.trigger("create",c);c.off("error",f);c.off("sync",J)});c.save(b);c.author=a.session.isRegistered()?a.session.user:new h.UniqueModel(h.User,{id:md5(b.author_email),name:b.author_name,email:b.author_email});a.thread.posts.add(c,{created:!0});a.clear();a.thread.incrementPostCount(1);j.trigger("uiAction:createPost",c);return c}},remove:function(){this.updateDom(function(){this.$el.remove()},this);this.parent&&(delete x.open[this.parent.cid],this.typingStop())}, toggle:function(){this.isOpen()?this.hide():this.show()},show:function(){var a=this;a.updateDom(function(){a.$el.removeClass("hidden")});a.typingStart()},hide:function(){var a=this;a.updateDom(function(){a.$el.addClass("hidden")});a.typingStop()},isOpen:function(){return!this.$el.hasClass("hidden")},typingStart:function(){var a=this;a.parent&&l.getInstance().isRealtimeEnabled()&&_.delay(function(){var b=DISQUS.urls.realertime+"/api/2/typing/",d;c.attempt(function(){d=c.CORS.request("POST",b)});if(d=== null)return void DISQUS.log("CORS is not supported by this browser.");var f=i.stringify({typing:!0,forum_url:a.thread.get("forum"),thread_id:a.thread.get("id"),user_id:a.session.user.id||0,parent_post_id:a.parent.get("id")});c.attempt(function(){d.send(f)})},500)},typingStop:function(){var a=this;a.parent&&l.getInstance().isRealtimeEnabled()&&_.delay(function(){var b=DISQUS.urls.realertime+"/api/2/typing/",d;c.attempt(function(){d=c.CORS.request("POST",b)});if(d===null)return void DISQUS.log("CORS is not supported by this browser."); var f=i.stringify({typing:!1,forum_url:a.thread.get("forum"),thread_id:a.thread.get("id"),user_id:a.session.user.id||0,parent_post_id:a.parent.get("id")});c.attempt(function(){d.send(f)})},500)}});_.extend(x.prototype,n);x.open=x.open||{};var M=k.extend({initialize:function(a){this.post=a.post;this.textarea=new D},render:function(){this.setElement($(DISQUS.renderBlock("edit",{post:this.post.toJSON()})));this.$el.find("form").bind("submit",_.bind(this.submitForm,this));var a=this.textarea;a.setElement(this.$el.find("textarea")[0]); a.render()},resize:function(){this.textarea.resize()},submitForm:function(a){a&&a.preventDefault()&&a.preventDefault();var a={raw_message:this.textarea.get()},b=this.post.validate(a);if(b!==void 0)return alert(b);this.trigger("submitted");this.post.save(a,{success:function(){}})},remove:function(){this.updateDom(function(){this.$el.remove()},this)}}),H=k.extend({initialize:function(a){this.MAX_POST_HEIGHT=374;this.thread=a.thread;this.session=a.session;this.created=!!a.created;this.model.bind("destroy", this.removeAsDeleted,this);this.model.bind("spam",this.removeAsDeleted,this);this.model.bind("change:message",this.stopLoading,this);this.model.bind("change:points",this.updatePoints,this);this.model.bind("change:userScore",this.updateVotes,this);this.model.usersTyping.bind("add remove reset",this.updateTypingCount,this);this.session.on("change:id",this.updateEditHide,this);this.session.on("change:id",this.updateFooter,this);this.session.on("change:id",this.updateMenu,this);this.session.on("change:id", this.updateVotes,this);this.model.bind("change",function(){var a=this.model.changedAttributes();(a.id||a.message)&&this.redraw()},this);this.edit=this.reply=null;this.parent=a.parent;this.trackPosition=!1;l.getInstance().on("domReflow",function(){if(this.trackPosition){var a=this.contentNode;this.offset=a.offset();this.dim=a.dim()}else this.offset={top:-1,height:-1},this.dim={height:-1,width:-1}},this);this.isCollapseAllowed=!0},updateTypingCount:function(){this.typingUserView&&this.typingUserView.render()}, stopLoading:function(){this.contentNode.find(".loading").removeClass("loading")},updateRelativeTime:function(){this.contentNode.find("[data-role=relative-time]").text(this.model.getRelativeCreatedAt())},updateVotes:function(){var a=this.model,b=this.contentNode.find("[data-role=voting]"),c=DISQUS.renderBlock("postVotes",{session:{id:this.session.user.id},post:{userScore:a.get("userScore"),points:a.get("points"),likes:a.get("likes"),dislikes:a.get("dislikes")}});this.updateDom(function(){b.html(c)})}, updateEditHide:function(){var a=this.contentNode.find("[data-role=edit-hide]"),b=DISQUS.renderBlock("postEditHide",{post:{author:{id:this.model.author.id}},session:{id:this.session.user.id}});this.updateDom(function(){a.html(b)})},updateFooter:function(){var a=this.contentNode.find("footer"),b=DISQUS.renderBlock("postFooter",{post:this.model.toJSON(),session:this.session.toJSON(),thread:this.thread.toJSON()});this.updateDom(function(){a.html(b)})},updateMenu:function(){var a=this.contentNode.find("[data-role=menu]"), b=DISQUS.renderBlock("postMenu",{session:this.session.toJSON(),post:this.model.toJSON()});this.updateDom(function(){a.html(b)})},updatePoints:function(a){var b=function(a){_.delay(function(){a.addClass("update");_.delay(function(){a.removeClass("update")},1E3)},500)};this.contentNode.find("[data-role=likes], [data-role=dislikes]").each(function(c){var c=$(c),d=c.html(),f=a.get(c.attr("data-role")).toString();d!==f&&(c.removeClass("count-"+f),c.removeClass("count-"+d),c.html(f),b(c))})},getMessageContainer:function(){if(!this.messageContainer|| !this.messageContainer.length)this.messageContainer=this.contentNode.find("[data-role=message-container]");return this.messageContainer},getMessageContent:function(){if(!this.messageContent||!this.messageContent.length)this.messageContent=this.contentNode.find("[data-role=message-content]");return this.messageContent},getMoreButton:function(){if(!this.seeMoreButton||!this.seeMoreButton.length)this.seeMoreButton=this.contentNode.find("[data-action=post-expand]");return this.seeMoreButton},getShadowEl:function(){if(!this.shadowNode|| !this.shadowNode.length)this.shadowNode=this.contentNode.find("[data-role=message-shadow]");return this.shadowNode},manageMessageHeight:function(){var a=this.getMessageContent(),b=this.MAX_POST_HEIGHT;l.getInstance().switches.enabled("next_comments_truncation_enabled")&&this.isCollapseAllowed&&(a&&a.length&&a.height()>b*1.5&&!this.$el.hasClass("collapsed")?this.collapseMessage():this.expandMessage(!0))},collapseMessage:function(){var a=this.getMessageContainer(),b=this.MAX_POST_HEIGHT;a&&a.length&& !a.hasClass("post-message-collapse")&&(this.updateDom(function(){a.addClass("post-message-collapse");a.height(b)}),this.addMoreButton())},expandMessage:function(a){if(this.messageContainer&&this.messageContainer.length){var b=this.getMessageContainer();this.updateDom(function(){b.removeClass("post-message-collapse");b.css("height",null)});this.removeMoreButton();if(a!==!0)this.isCollapseAllowed=!1}},addMoreButton:function(){var a=this.getMoreButton(),b=this.getShadowEl();this.updateDom(function(){b.removeClass("hidden"); a.removeClass("hidden")})},removeMoreButton:function(){var a=this.getMoreButton(),b=this.getShadowEl();this.updateDom(function(){a.addClass("hidden");b.addClass("hidden")})},markSeen:function(){function a(d){var f,g;if(!d)return!1;f=b.offset.top+d.frameOffset.top;g=(g=f>d.pageOffset)&&f+b.dim.height<=d.pageOffset+d.height;if(!g)return!1;b.contentNode.addClass("seen");_.delay(function(){b.contentNode.removeClass("seen");b.contentNode.removeClass("new")},1E4);b.trackPosition=!1;c.off("scroll",a);return!0} var b=this,c=l.getInstance();if(!a(c.position))c.on("scroll",a,b);c.off("domReflow",b.markSeen)},render:function(){var a=this,b=a.parent&&a.parent.model,c=j.loadedThumbnailWidth,d=j.MAX_MEDIA_HEIGHT,f=j.forum.get("settings").showNewMedia;f||(d=c=75);a.setElement($(DISQUS.renderBlock("post",{post:a.model.toJSON(),session:a.session.toJSON(),thread:a.thread.toJSON(),loading:!a.model.id,created:a.created,parentAuthorName:b?b.author.get("name"):null,thumbnailWidth:c,thumbnailHeight:d,showNewMedia:f}))); a.contentNode=a.$el.find("[data-role=post-content]");a.childrenNode=a.$el.find("[data-role=children]");a.messageNode=a.contentNode.find("[data-role=message]");this.highlightSyntax();if(a.model.get("isRealtime"))l.getInstance().switches.enabled("next_realtime_anim_disabled")?a.contentNode.removeClass("new"):(a.trackPosition=!0,j.on("domReflow",a.markSeen,a));j.on("domReflow",_.once(function(){var b=a.$el.find("[data-role=realtime-notification:"+a.model.id+"] .realtime-replies");a.manageMessageHeight(); a.typingUserView=new V({parentView:a,model:a.model,el:b})}));a.processMentions();a.bindDomEvents();if(b&&!b.get("isDeleted"))a.contextCard=L.create({post:this.parent.model,targetElement:this.$el.find("[data-role=parent-link]")})},highlightSyntax:function(){var a=this.contentNode.find("pre code");a.length&&a.each(function(a){c.syntaxHighlighter.highlight(a)})},redraw:function(){var a=this.$el;if(!a)throw Error("Old child not found on PostView.redraw");var b=this.childrenNode.children();this.render(); this.updateDom(function(){a[0].parentNode.replaceChild(this.el,a[0]);this.childrenNode.append(b)},this)},processMentions:function(){this.contentNode.find("[data-dsq-mention]").each(function(){$(this).addClass("mention")})},attachChild:function(a){var b=a.model;!b.id||b.get("isImmediateReply")?this.childrenNode.prepend(a.el):this.childrenNode.append(a.el)},drawReply:function(){this.reply&&(this.reply.render(),this.updateDom(function(){var a=this.childrenNode[0];a.insertBefore(this.reply.el,a.firstChild); this.reply.focus()},this))},toggleEdit:function(){this.edit?(this.edit.remove(),this.edit=null,this.messageNode.show()):(this.edit=new M({post:this.model}),this.edit.render(),this.edit.bind("submitted",this.toggleEdit,this),this.expandMessage(!0),this.updateDom(function(){var a=this.messageNode;a[0].parentNode.insertBefore(this.edit.el,a[0]);a.hide();this.edit.resize();(a=l.getInstance())&&a.scrollToPost(this.model.id)},this))},removeAsDeleted:function(){this.redraw()},bindDomEvents:function(){var a= this;a.delegateActions(a.contentNode,{upvote:function(){a.handleVote(1)},downvote:function(){a.handleVote(-1)},reply:"handleReply",flag:"handleFlag",edit:"handleEdit","delete":"handleDelete",spam:"handleSpam",blacklist:"handleBlacklist",collapse:"handleCollapse",reveal:"handleReveal","share:twitter":"_onShare","share:facebook":"_onShare","post-expand":f(a.expandMessage)});var b=a.$el.find(".hovercard");if(b.length)a.profileCard=G.create({session:a.session,user:a.model.author,targetElement:b})},_onShare:function(a){if(a= g(a.target,"share"))j.trigger("uiAction:postShare",a),this.share(a)},_shareUrl:function(){return this.thread.url()+"#comment-"+this.model.id},handleBlacklist:function(){if(!this.blacklist){var a=this.blacklist=new W({model:this.model});a.render();a.on("success cancel",function(){this.blacklist.remove();this.blacklist=null},this);this.updateDom(function(){this.contentNode.find("[data-role=blacklist-form]").first().append(a.el)},this)}},handleCollapse:function(){this.updateDom(function(){this.$el.toggleClass("collapsed"); this.manageMessageHeight()},this)},handleVote:function(a){a===1?j.trigger("uiAction:postUpvote"):a===-1&&j.trigger("uiAction:postDownvote");var b=this.model.get("userScore")===a;this.model.vote(b?0:a);var c=this.contentNode.find("[data-role=voting]");c.removeClass("upvoted").removeClass("downvoted");b||(a>0?c.addClass("upvoted"):a<0&&c.addClass("downvoted"))},remove:function(){this.model.off(null,null,this);this.session.off(null,null,this);Backbone.View.prototype.remove.call(this)},getReplyView:function(){if(this.reply)return this.reply; this.reply=new x({parentView:this,parent:this.model,thread:this.thread,session:this.options.session});this.drawReply();return this.reply},handleReply:function(){this.reply?this.getReplyView().toggle():this.getReplyView()},handleFlag:function(){window.confirm("Are you sure you want to flag this comment?")&&this.model.report()},handleEdit:function(){this.toggleEdit()},handleDelete:function(){this.model.destroy()},handleSpam:function(){this.model.spam()},handleReveal:function(){this.model.set("isMinimized", !1);this.redraw()}});_.extend(H.prototype,p);var N=k.extend({render:function(){var a=this;a.setElement($(DISQUS.renderBlock("captcha")));a.$el.bind("submit",function(b){b.preventDefault();a.trigger("submitted")})},start:function(){function a(){b.updateDom(function(){Recaptcha.create("6LdKMrwSAAAAAPPLVhQE9LPRW4LUSZb810_iaa8u",b.el,{theme:"custom",custom_theme_widget:"recaptcha_widget"});b.$el.show()})}var b=this;typeof Recaptcha==="undefined"?DISQUS.require("//www.google.com/recaptcha/api/js/recaptcha_ajax.js", {},!1,a):a()},getChallenge:function(){return Recaptcha.get_challenge()},getResponse:function(){return Recaptcha.get_response()},reload:function(){Recaptcha.reload()}}),I=k.extend({initialize:function(a){this.session=a.session;this.showZero=a.showZero||!1;this.max=a.max;this.session.on("change:notificationCount",this.render,this)},render:function(){var a=this.session.get("notificationCount")||0;this.max&&(a=Math.min(a,this.max));this.$el.html("<span>"+a+"</span>");a>0||this.showZero?this.$el.show(): this.$el.hide();return this}}),F=Backbone.View.extend({__type__:"QueuedPostView",getDirection:function(a){if(this.offset&&this.dim){var b=a.pageOffset,c=this.offset.top+a.frameOffset.top;if(c+this.dim.height<b)return 1;if(c>b+a.height)return-1;return 0}},setCount:function(a){this.options.count=a},bindDrain:function(){var a=_.bind(this.drainHandler,this);if(!this.clickEvent)this.$el.attr("data-action")=="load-queued-posts"?this.$el.bind("click",a):this.$el.delegate("[data-action=load-queued-posts]", "click",a),this.clickEvent=!0},render:function(){var a=this;if(a.options.count===0)return void a.$el.hide();a.$el.html(DISQUS.renderBlock("realtimeCommentNotification",{comments:a.options.count}));a.bindDrain();l.getInstance().on("domReflow",_.throttle(function(){if(a.options.count!==0)this.offset=a.$el.offset(),this.dim=a.$el.dim()},400),this);a.$el.show()},drainHandler:function(){this.model.queue.drain();this.setCount(this.model.queue.counters.comments);this.render()}}),O=F.extend({getDirection:function(a){this.offset= this.options.postView.offset;this.dim=this.options.postView.dim;a=F.prototype.getDirection.call(this,a);delete this.offset;delete this.dim;return a},render:function(){var a=this,b=a.options.postView;DISQUS.log("Model:",a.model.id);a.options.count===0?(a.$el.hide(),b.trackPosition=!1):(b.trackPosition=!0,a.$el.html(DISQUS.renderBlock("realtimeReplyNotification",{replies:a.options.count})),a.bindDrain(),a.$el.show(),_.delay(function(){a.$el.addClass("reveal")},13))},drainHandler:function(){var a=this.model.id, b=this.options.postView,c=this.options.thread.queue;c.drain(a);this.setCount(c.counters.replies[a]);b.trackPosition=!1;this.render()}}),V=Backbone.View.extend({render:function(){var a=this.model.usersTyping.count(),b=this.options.parentView.reply;b&&b.isOpen()&&(a-=1);if(a<=0)return void this.$el.hide();a==1?this.$el.html("One other user is typing…"):this.$el.html(a+" other users are typing…");this.$el.show()}}),X=k.extend({tagName:"ul",className:"loading",initialize:function(a){this.collection.bind("reset", this.render,this);this.session=a.session},render:function(){this.updateDom(function(){this.$el.removeClass("loading");this.$el.empty();this.collection.each(function(a){this.$el.append(DISQUS.renderBlock("activityItem",{activity:a.toJSON(),session:this.session?this.session.toJSON():null}))},this);this.trigger("render")},this);return this}}),S=k.extend({events:{"click [data-action=network]":"showNetwork","click [data-action=notifications]":"showNotifications"},initialize:function(a){this.network=new Y; this.notifications=new Z({notifications:a.session.notifications});this.notificationCount=new I({session:a.session,showZero:!0});this._views={network:this.network,notifications:this.notifications};this.network.on("render:activity",_.bind(this.trigger,this,"render:all"))},render:function(){this.updateDom(function(){this.$el.html(DISQUS.renderBlock("dashboard"))},this);this._tabs={network:this.$el.find("[data-role=network-tab]"),notifications:this.$el.find("[data-role=notifications-tab]")};this.network.setElement(this.$el.find("[data-role=network]")); this.notifications.setElement(this.$el.find("[data-role=notifications]"));this.notificationCount.setElement(this.$el.find("[data-role=notification-count]"));this.network.render();this.notifications.render();this.notificationCount.render()},show:function(){this.setActiveTab("network")},setActiveTab:function(a){var b=l.getInstance();b.freeze(!0);_.chain(this._tabs).invoke("removeClass","active");this._tabs[a].addClass("active");_.chain(this._views).pluck("$el").invoke("hide");var c=this._views[a];this.updateDom(function(){c.$el.show(); b.freeze(!1)},this);c.show&&c.show()},showNetwork:f(function(){this.setActiveTab("network")}),showNotifications:f(function(){this.setActiveTab("notifications")})}),aa=k.extend({events:{"click [data-action=more]":f(function(){this.trigger("fire")})},setBusy:function(){this.$el.find("[data-action=more]").addClass("busy").removeAttr("disabled")},setReady:function(){this.$el.find("[data-action=more]").removeClass("busy").removeAttr("disabled");this.updateDom(function(){var a=this.collection.cursor;a&& a.hasNext?this.$el.show():this.$el.hide()},this)}}),Z=k.extend({initialize:function(a){this.notifications=a.notifications;this.notifications.on("reset",this.resetNotifications,this);this.notifications.on("add:many",this.addNotifications,this);this.notifications.on("reset add:many",this.markNotificationsAsRead,this);this._fetched=!1;this.moreButton=new aa({collection:this.notifications});this.moreButton.on("fire",this.loadMore,this)},render:function(){return this.renderLayout()},renderLayout:function(){this.updateDom(function(){this.$el.html(DISQUS.renderBlock("notifications")); this.moreButton.setElement(this.$el.find("[data-role=more-notifications]"));this.$el.addClass("loading")},this);return this},resetNotifications:function(a){var b=this.$el.find("[data-role=no-notifications]");b.hide();this.$el.removeClass("loading");a.size()===0?b.show():(b.hide(),this.addNotifications.apply(this,arguments))},addNotifications:_.decorate(Backbone.collectionAddNormalizer(a.NotificationCollection,h.Notification),function(a){var b=_.map(a,function(a){return $(DISQUS.renderBlock("notification", {notification:a.toJSON()}))[0]});this.updateDom(function(){this.$el.find("[data-role=entries]").append(b)},this);this.moreButton.setReady();this.notifications.markRead();return this}),show:function(){if(!this._fetched)this.notifications.fetch(),this._fetched=!0},loadMore:function(){this.moreButton.setBusy();this.notifications.more()}}),Y=k.extend({initialize:function(){this.posts=new a.PostActivityCollection;this.posts.on("reset",this.resetActivity,this);this.posts.on("add:many",this.addActivity, this);this._fetched=!1;this.moreButton=new aa({collection:this.posts});this.moreButton.on("fire",this.loadMore,this)},render:function(){return this.renderLayout()},renderLayout:function(){this.updateDom(function(){this.$el.html(DISQUS.renderBlock("networkActivity"));this.moreButton.setElement(this.$el.find("[data-role=more-activity]"));this.$el.addClass("loading")},this);return this},resetActivity:function(a){var b=this.$el.find("[data-role=no-activity]");b.hide();this.$el.removeClass("loading"); a.size()===0?b.show():(b.hide(),this.addActivity.apply(this,arguments))},addActivity:_.decorate(Backbone.collectionAddNormalizer(a.PostActivityCollection,h.Post),function(a){var b=new Backbone.Collection;_.each(a,function(a){var c=b.get(a.get("thread").id)||new h.Thread(_.extend(a.get("thread"),{forum:a.get("forum")}));c.posts.add(a);b.add(c)});var c=b.map(function(a){var b=$(DISQUS.renderBlock("networkActivityThreadEntry",{thread:a.toJSON()})),a=a.posts.map(function(a){return $(DISQUS.renderBlock("networkActivityPostEntry", {post:a.toJSON()}))[0]});b.find("[data-role=posts]").append(a);return b[0]});this.updateDom(function(){this.$el.find("[data-role=entries]").append(c);this.trigger("render:activity")},this);this.moreButton.setReady();return this}),show:function(){if(!this._fetched)this.posts.fetch(),this._fetched=!0},loadMore:function(){this.moreButton.setBusy();this.posts.more()}}),ba=k.extend({tagName:"ol",className:"loading",initialize:function(){this.collection.bind("reset",function(){this.updateDom(this.render, this)},this)},render:function(){this.updateDom(function(){this.$el.removeClass("loading");this.$el.empty();this.collection.each(function(a){var b=DISQUS.assureOffset(a.get("createdAt"));this.$el.append(DISQUS.renderBlock("topThread",{id:a.id,title:a.get("title"),url:a.get("link"),numPosts:a.get("postsInInterval"),numLikes:a.get("likes"),timeAgo:moment(b,DISQUS.ISO_8601).fromNow()}))},this);this.trigger("render")},this);this.attachPosts();return this},attachPosts:function(){this.collection.each(function(a){this.renderPost(a)}, this)},renderPost:function(a){var b=a.get("topPost");if(b){var c=_.escape(_.strip(b.message)),c=_.truncate(c,160,"…"),d=DISQUS.renderBlock("topThreadPost",{message:c,author:b.author});this.updateDom(function(){this.$el.find("[data-role=thread-"+a.id+"] [data-role=top-thread-post]").html(d)},this)}}}),ca=k.extend({tagName:"ol",className:"loading",initialize:function(){this.collection.bind("reset",function(){j.thread.users.add(this.collection.models,{merge:!0});this.updateDom(this.render,this)}, this)},render:function(){this.updateDom(function(){this.$el.removeClass("loading");this.$el.empty();this.collection.each(function(a){this.$el.append(DISQUS.renderBlock("topUser",{user:a.toJSON()}))},this);this.trigger("render")},this);return this}}),T=Backbone.View.extend({initialize:function(b){var c=this;c.forum=b.forum;c.topThreads=new ba({id:"top-threads",collection:new a.TopThreadCollection(null,{forum:c.forum.id,limit:10})});c.topUsers=new ca({id:"top-users",collection:new a.TopUserCollection(null, {forum:c.forum.id,limit:20,discardLowRep:j.switches.enabled("next_discard_low_rep")})});Backbone.when([c.topUsers,"render"],[c.topThreads,"render"]).then(function(){c.isRendered=!0;c.trigger("render:all")});c.fetched=!1;c.render()},render:function(){this.$el.html(DISQUS.renderBlock("community",{forum:this.forum.toJSON()}));this.$el.find("[data-role=top-threads]").append(this.topThreads.el);this.$el.find("[data-role=top-users]").append(this.topUsers.el);return this},show:function(){if(!this.fetched)this.topThreads.collection.fetch(), this.topUsers.collection.fetch(),this.fetched=!0}}),ha=k.extend({initialize:function(a){this.$el.addClass("loading");this.thread=a.thread;this.session=a.session;this.collection.on("add reset",this.render,this)},render:function(a,b,c){var d=this,f=(c&&c.index!=null?[d.collection.at(c.index)]:d.collection).map(function(a){a=new da({model:a,thread:d.thread,session:d.session});a.render();return a.el});d.updateDom(function(){d.$el.removeClass("loading");d.$el.append(f);d.isRendered=!0;d.trigger("render:all")})}, show:function(){this.collection.length>0||this.collection.fetch()}}),p={toggleFollow:function(a){a.preventDefault();this.user.get("isFollowing")?(this.user.unfollow(),$(a.target).removeClass("active")):($(a.target).addClass("active"),this.user.follow(),j.trigger("uiAction:followUser"))}},K=Backbone.View.extend({events:{"click [data-action=close]":"close","click [data-action=toggleFollow]":"toggleFollow"},initialize:function(b){var c=this;c.user=b.user;c.session=b.session;c.user.get("numFollowers")=== null&&c.user.fetch({success:function(){c.updateStats()}});c.user.on("change",c.updateStats,c);c.user.on("change:connections",c.updateConnections,c);c.user.on("change:isFollowing",c.updateActions,c);c.activity=new X({id:"activity",collection:new a.ActivityCollection(null,{user:c.user,include:"user"}),session:c.session});c.activity.on("render",function(){c.isRendered=!0;c.trigger("render:all")});c.render()},updateStats:function(){this.$el.find("[data-role=profile-stats]").html(DISQUS.renderBlock("profileStats", {user:this.user.toJSON()}))},updateActions:function(){this.$el.find("[data-role=actions]").html(DISQUS.renderBlock("profileActions",{user:this.user.toJSON(),sessionId:this.session.user.id}))},updateConnections:function(){DISQUS.blocks.profileConnections&&this.$el.find("[data-role=connections]").html(DISQUS.renderBlock("profileConnections",{user:this.user.toJSON()}))},close:f(function(){this.trigger("close")}),render:function(){this.$el.empty();this.$el.append(DISQUS.renderBlock("profile",{user:this.user.toJSON(), sessionId:this.session.user.id}));this.$el.find("[data-role=user-activity]").append(this.activity.el)},show:function(){this.activity.collection.fetch()}});_.extend(K.prototype,p);var r=k.extend({initialize:function(){this._id=_.uniqueId();this._rendered=!1;this._hoverState="out";this._leaveTimeout=this._enterTimeout=null;r.open={}},bindEvents:function(){var a=this;a.$el.bind("mouseover",function(){a.enter()});a.$el.bind("mouseout",function(){a.leave()})},target:function(a){var b=this;a.bind("mouseover", function(){b.enter(a)});a.bind("mouseout",function(){b.leave()})},enter:function(a){var b=this;if(a)this.$target=a;b._leaveTimeout&&clearTimeout(b._leaveTimeout);if(b._hoverState!=="in")b._hoverState="in",b._enterTimeout=_.delay(function(){b._hoverState==="in"&&b.show();b._enterTimeout=null},r.DELAY_ENTER),r.open[this.uid]=this},leave:function(){var a=this;a._enterTimeout&&clearTimeout(a._enterTimeout);if(a._hoverState!=="out")a._hoverState="out",a._leaveTimeout=_.delay(function(){a._hoverState=== "out"&&a.hide();a._leaveTimeout=null},r.DELAY_LEAVE),r.open[this.uid]&&delete r.open[this.uid]},show:function(){if(!this._rendered)this._rendered=!0,this.render();this.$target.append(this.el)},hide:function(){this.$el.remove()}},{open:{},instances:{},DELAY_ENTER:350,DELAY_LEAVE:175,exitAll:function(){_.invoke(r.open,"leave")},create:function(a,b,c,d){var f=r.instances[c];f||(r.instances[c]=f={});c=f[a];c||(c=new d(b),f[a]=c);c.target(b.targetElement);return c}});(function(){$(document).bind("mouseout", _.debounce(function(a){a=a.relatedTarget||a.toElement;(!a||a.nodeName==="HTML")&&r.exitAll()}),10)})();var G=r.extend({events:{"click [data-action=toggleFollow]":"toggleFollow"},initialize:function(a){var b=this;r.prototype.initialize.call(b,a);b.session=a.session;b.user=a.user;b.user.on("change:numPosts change:numLikesReceived",_.debounce(function(){b.updateCounters()}));b.user.on("change:isFollowing",function(){b.updateActions()});b.session.on("change:id",function(){b._rendered&&b.render()})},render:function(){var a= this.user.toJSON();if(a.about)a.about=_.truncate(a.about,80,"...");this.setElement($(DISQUS.renderBlock("hovercard",{user:a,sessionId:this.session.user.id})));this.bindEvents()},updateCounters:function(){var a=this.$el.find("[data-role=counters]");this.updateDom(function(){a.html(DISQUS.renderBlock("hovercardCounters",{user:this.user.toJSON(),sessionId:this.session.user.id}))},this)},updateActions:function(){var a=this.$el.find("[data-role=actions]");this.updateDom(function(){a.html(DISQUS.renderBlock("hovercardActions", {user:this.user.toJSON(),sessionId:this.session.user.id}))},this)},show:function(){this.user.get("numLikesReceived")===null&&this.user.fetch();r.prototype.show.call(this)}},{create:function(a){return r.create(a.user.id,a,"ProfileCard",G)}});_.extend(G.prototype,p);var L=r.extend({initialize:function(a){r.prototype.initialize.call(this,a);this.post=a.post},render:function(){var a=this.post.toJSON();a.excerpt=_.truncate(_.escape(_.strip(a.message),40,"..."));this.setElement($(DISQUS.renderBlock("contextCard", {post:a})));this.bindEvents()}},{create:function(a){if(DISQUS.blocks.contextCard)return r.create(a.post.id,a,"ContextCard",L)}}),da=k.extend({events:{"click [data-action=remove]":"destroyReaction"},initialize:function(a){this.thread=a.thread;this.session=a.session;this.session.on("change:id",this.renderMenu,this)},render:function(){this.setElement($(DISQUS.renderBlock("reaction",{reaction:this.model.toJSON(),thread:this.thread.toJSON()})))},renderMenu:function(){var a=this.$el.find("[data-role=menu]"), b=DISQUS.renderBlock("reactionMenu",{thread:this.session.toJSON().thread});this.updateDom(function(){a.html(b)},this)},destroyReaction:function(a){a&&a.preventDefault&&a.preventDefault();this.model.destroy();this.updateDom(function(){this.remove()},this)}}),P=k.extend({events:{"click [data-action=dismiss]":"dismiss"},initialize:function(a){_.extend(this,a)},render:function(){this.setElement($(DISQUS.renderBlock("alert",{message:this.message,type:this.type,safe:this.safe})));return this},dismiss:function(a){a&& a.preventDefault&&a.preventDefault();this.remove();this.trigger("dismiss")}}),W=k.extend({events:{"click [data-action=cancel]":"cancel"},initialize:function(){var a=this;a.loading=!1;if(!a.model.get("ipAddress"))a.loading=!0,a.model.on("change:ipAddress",function u(){a.model.off("change:ipAddress",u);a.loading=!1;a.redraw()}),a.model.fetch()},render:function(){var a=this;a.setElement($(DISQUS.renderBlock("blacklist",{loading:this.loading,post:a.model.toJSON()})));a.$el.bind("submit",function(b){b&& b.preventDefault()&&b.preventDefault();a.submit()});return a},redraw:function(){var a=this.el.parentNode;a&&(this.render(),this.updateDom(function(){$(a).empty().append(this.el)},this))},cancel:function(a){a&&a.preventDefault()&&a.preventDefault();this.trigger("cancel")},submit:function(){var a={},b=this;b.$el.find("input").each(function(){if(this.checked)a[this.name]=this.value});if(!_.isEmpty(a))a.forum=b.model.get("forum"),DISQUS.api.call("blacklists/add.json",{method:"POST",data:a,success:function(){b.trigger("success")}})}}), D=k.extend({events:{keyup:"handleKeychange",paste:"handleKeychange"},render:function(){this.el.tagName==="TEXTAREA"&&this.$el.autoresize({maxHeight:350});this.$el.bind("resize",_.debounce(_.bind(this.updateDom,this,function(){}),300));return this},resize:function(){this.$el.trigger("paste")},get:function(){return this.$el.val()},set:function(a){this.$el.val(a)},clear:function(){this.set("")},focus:function(){this.el.focus()},handleKeychange:function(){this.trigger("keychange")}}),A=D.extend({events:{keyup:"handleKeychange", paste:"handleKeychange"},initialize:function(b){b=b||{};this.thread=b.thread;this.mentionsCache=new a.UserCollection;this.suggestions=new ea({thread:b.thread,mentions:this.mentionsCache});this.placeholder="";this.suggestions.on("select",this.insertMention,this);this.reset()},reset:function(){this.anchorOffset=this.anchorNode=null;this.suggestions.clear()},handleKeychange:function(){this.trigger("keychange");this.$el.trigger("resize")},render:function(){var a=this.el.getAttribute("placeholder"),b= this.el.value,c=document.createElement("div");_.extend(c,{className:"textarea",contentEditable:!0,tabIndex:this.el.tabIndex});c.setAttribute("role","textbox");c.setAttribute("aria-multiline","true");c.style.overflow="auto";c.style.maxHeight="350px";var d=this.el.parentNode;d.replaceChild(c,this.el);this.setElement(c);this.bindKeyEvents();d.appendChild(this.suggestions.el);this.content=new Editable(this.el,!0);b&&this.set(b);D.prototype.render.call(this);if(a)this.placeholder='<span class="placeholder">'+ a+"</span>",this.content.text()||this.$el.html(this.placeholder),this.$el.bind("focus focusin",_.debounce(_.bind(function(){this.isPlaceholder()&&this.set("");this.el.focus()},this)),50),this.$el.bind("blur",_.bind(function(){this.content.text()===""&&this.setPlaceholder()},this));return this},isPlaceholder:function(){return this.$el.find(".placeholder").length!==0},setPlaceholder:function(){this.$el.html(this.placeholder)},bindKeyEvents:function(){this.$el.bind("keydown",_.bind(function(a){switch(a.keyCode){case 9:this.suggestions.active&& (this.suggestions.select(),a.preventDefault(),a.stopPropagation());break;case 10:case 13:case 38:case 40:this.suggestions.active&&(a.preventDefault(),a.stopPropagation())}},this));var a=_.throttle(_.bind(this.suggest,this),500);this.$el.bind("keyup",_.bind(function(b){b.preventDefault();b.stopPropagation();this.checkExistingMentions();switch(b.keyCode){case 50:if(!b.shiftKey)break;this.start(b);break;case 10:case 13:this.suggestions.select();break;case 27:this.reset(b);break;case 38:this.suggestions.move("up"); break;case 40:this.suggestions.move("down");break;default:a(b)}},this))},start:function(){this.reset();this.suggest()},suggest:function(){this.suggestions.suggest(this.parseSearchTerms())},insertMention:function(a){var b=this.thread.users.getByCid(a);this.selectSearchString(b);this.mentionsCache.getByCid(a)||this.mentionsCache.add(b);this.content.insertHTML(A.getMentionHtml(b));a=this.$el.find("span[data-cid]");_.each(a,function(a){if(a.contentEditable!==!1)a.contentEditable=!1})},selectSearchString:function(){this.content.selectNodeText(this.anchorNode, this.anchorOffset-1,this.anchorOffset+Editable.normalizeSpace(this.anchorNode.nodeValue.slice(this.anchorOffset)).toLowerCase().length)},get:function(){var a=this,b=A.isMention;if(this.isPlaceholder())return"";return this.content.text(function(c){return b(c,!0)?a.mentionToText(c):null})},set:function(a){this.content.setText(a);this.resize()},clear:function(){D.prototype.clear.call(this);this.setPlaceholder();_.defer(function(a){a.updateDom(function(){a.el.blur();a.$el.trigger("blur")})},this)},parseSearchTerms:function(){var a= this.content.selectedTextNode(),b=a?a.nodeValue:"",c=Editable.normalizeSpace;if(b){var d=this.content.selectedTextNodeOffset(a),f=Editable.normalizeSpace(b.slice(0,d).split("").reverse().join("")).indexOf("@");if(f===-1)return null;this.anchorNode=a;this.anchorOffset=d-f;if(a=c(b.slice(this.anchorOffset-1,d)).match(A.MENTIONS_RE))return a[0].slice(1).split(" ");if(f===0)return[""]}},checkExistingMentions:function(){var a=Editable.normalizeSpace,b=this.$el.find("span"),b=_.filter(b,A.isMention),c= this.mentionsCache,d={};_.each(b,function(b){var f=$(b).attr("data-cid"),g=_.reduce(this.content.getTextNodes(b),function(b,c){return b+a(c.nodeValue)},""),h=c.getByCid(f);h.get("name")!==g?(this.mentionsCache.remove(h),this.content.removeNode(b),this.content.insertHTML(" "),this.reset()):d[f]=b},this);c.each(function(a){d[a.cid]||c.remove(a)})},mentionToText:function(a){a=this.mentionsCache.getByCid($(a).attr("data-cid"));return["@",a.get("username")||a.get("emailHash"),":disqus"].join("")}},{MENTIONS_RE:/@\w+\s?(?:\w+\s?){0,5}(?:\w+)?$/, isMention:function(a,b){var c;do{c=$(a);if(c.hasClass("mention")&&c.attr("data-cid"))return!0;a=a.parentElement}while(b&&a);return!1},getMentionHtml:function(a){return'<span contenteditable="true"><span contenteditable="false" data-cid="'+a.cid+'" class="mention">'+a.get("name")+"</span></span> "}}),ea=Backbone.View.extend({events:{"click li":"onclick"},initialize:function(a){this.active=!1;this.thread=a.thread;this.mentionsCache=a.mentions},suggest:function(a){a=this.findMatches(a);if(!a||!a.length)return void this.clear(); this.active=!0;this.el.innerHTML=DISQUS.renderBlock("suggestions",{users:_.map(a,function(a){return _.extend(a.toJSON(),{cid:a.cid})})});this.$el.find("li[data-cid]").first().addClass("active")},clear:function(){this.active=!1;this.el.innerHTML=""},onclick:function(a){this.select($(a.currentTarget).attr("data-cid"))},findMatches:function(a){if(a&&a.length){for(var b=RegExp(a.join(" ").replace(/[^\w\s]/,""),"i"),c=ea.MAX_SUGGESTIONS,d=this.thread.users,f=[],g=0,h,a=a.length===1&&a[0]===""?function(){return!0}: function(a){return b.test(a.get("name"))||b.test(h.get("username"))},g=0;g<d.models.length&&f.length<c;g++)h=d.models[g],this.mentionsCache.getByCid(h.cid)||a(h)&&f.push(h);return f}},select:function(a){this.active&&(a||(a=this.$el.find(".active").attr("data-cid")),this.trigger("select",a),this.clear())},move:function(a){if(this.active){var b=this.$el.find(".active"),a=b[a==="up"?"previous":"next"]();a.length&&a.attr("data-cid")&&(b.removeClass("active"),a.addClass("active"))}}},{MAX_SUGGESTIONS:5}), R=k.extend({tagName:"ul",className:"debug",initialize:function(a){this.values=a},render:function(){this.$el.empty();_.each(this.values,function(a,b){var c=document.createElement("li");c.innerHTML="<strong>"+b+"</strong>: "+a;this.$el.append(c)},this);return this}}),U=Backbone.View.extend({events:{"click [data-nav]":"_navTo"},initialize:function(){this.prevDestination=this.activeNav()},_navTo:function(a){a.preventDefault();a=$(a.target);a=a.is("[data-nav]")?a:a.closest("[data-nav]");a=a.attr("data-nav"); if(this.prevDestination==a)return!1;this.navTo(a)},navTo:function(a){this.prevDestination=a;var b=this.$el.find("[data-nav="+a+"]").parent();b.siblings("li").removeClass("active");b.addClass("active");this.trigger("nav",a)},activeNav:function(){if(this.prevDestination!=null)return this.prevDestination;return this.$el.find(".active [data-nav]").attr("data-nav")},clear:function(){this.$el.find("li").removeClass("active");this.prevDestination=null}}),Q=Backbone.View.extend({events:{"click [rel=nofollow]":"sendLinkForInspection"}, initialize:function(){this.link=null;this.busy=!1;this.timeoutId=null;this.timeout=1E3;this.token=1;this.on("option.timeout",function(a){this.timeout=a})},setLink:function(a){this.link=a;this.$link=$(this.link)},onAffiliatorResponse:function(a){a=a||{};if(a.token==this.token){d.off("affiliateLink",this.onAffilatorResponse);if(a.url)this.link.href=a.url;this.undelegateEvents();this.$link.click()}},sendLinkForInspection:function(a){if(a.currentTarget===this.link)return void a.preventDefault();var b= a.which&&a.which===1||a.button===0;if(a.ctrlKey||a.metaKey||a.altKey||a.shiftKey||!b)return!0;if(this.busy){d.off("affiliateLink");if(this.timeoutId&&window.clearTimeout)window.clearTimeout(this.timeoutId),this.timeoutId=null;this.token++}this.busy=!0;this.setLink(a.currentTarget);a.preventDefault();d.on("affiliateLink",this.onAffiliatorResponse,this);d.sendHostMessage("affiliateLink",{token:this.token,url:this.link.href});a=_.bind(function(a){this.onAffiliatorResponse({token:a})},this,this.token); this.timeoutId=_.delay(a,this.timeout)}});return{Lounge:l,LoungeSubView:k,PostView:H,PostReplyView:x,PostEditView:M,ReactionView:da,UserMenuView:t,ThreadVotesView:B,ThreadSubscribeButton:z,QueuedPostView:F,QueuedReplyView:O,TypingUserView:V,CommunityView:T,TopThreadCollectionView:ba,TopUserCollectionView:ca,DashboardView:S,NotificationCollectionView:Z,NotificationCountView:I,UserActivityCollectionView:X,NetworkActivityCollectionView:Y,ProfileView:K,HoverCard:r,ProfileCard:G,ContextCard:L,CaptchaView:N, OutboundLinkHandler:Q,AlertView:P,BlacklistView:W,ContentEditableView:A,DebugInfoView:R}});var _comscore,_gaq; (function(b){var f="",f="UA-1410476-6",g=b.getElementsByTagName("script")[0],h=g.parentNode,a=b.location.protocol=="https:";_comscore=_comscore||[];_comscore.push({c1:"7",c2:"10137436",c3:"1"});var c=document.createElement("script");c.async=!0;c.src=(a?"https://sb":"http://b")+".scorecardresearch.com/beacon.js";h.insertBefore(c,g);_gaq=_gaq||[];_gaq.push(["_setAccount",f]);_gaq.push(["_setDomainName",".disqus.com"]);b=b.createElement("script");b.type="text/javascript";b.async=!0;b.src=(a?"https://ssl": "http://www")+".google-analytics.com/ga.js";h.insertBefore(b,g)})(document); (function(){DISQUS.log=function(){var b=DISQUS.next.views.Lounge.getInstance();window.console&&b&&b.switches&&b.switches.enabled("next_logging")&&(window.console.log.apply?window.console.log.apply(window.console,arguments):window.console.log(Array.prototype.slice.call(arguments,0).join(" ")))};DISQUS.logError=function(){var b=DISQUS.next.views.Lounge.getInstance(),f=Array.prototype.slice.call(arguments,0);DISQUS.log.apply(DISQUS,f);b.switches&&b.switches.enabled("next_raven")&&b.states.ravenConfigured&& Raven.captureMessage({name:"DISQUS.logError",message:f.join(" ")})};$(document).ready(function(){function b(){$(".dropdown").removeClass("open")}$("html").bind("click",b);$("body").delegate("[data-toggle]","click",function(f){f.stopPropagation();f.preventDefault();var f=$(f.currentTarget),f=f.closest("."+f.attr("data-toggle")),g=f.attr("data-dropdown")!="disabled"&&!f.hasClass("open");f.attr("data-dropdown","enabled");b();g&&f.addClass("open")});DISQUS.Bus.bind("window.click",b)})})();