var requirejs,require,define;(function(e){var h,a,m,n,d={},c={},u={},q={},l=Object.prototype.hasOwnProperty,i=[].slice,k=/\.js$/;function v(w,x){return l.call(w,x)}function o(z,x){var H,D,B,E,I,A,K,M,G,F,C,L,J=x&&x.split("/"),y=u.map,w=(y&&y["*"])||{};if(z){z=z.split("/");I=z.length-1;if(u.nodeIdCompat&&k.test(z[I])){z[I]=z[I].replace(k,"")}if(z[0].charAt(0)==="."&&J){L=J.slice(0,J.length-1);z=L.concat(z)}for(G=0;G0){z.splice(G-1,2);G-=2}}}}}z=z.join("/")}if((J||w)&&y){H=z.split("/");for(G=H.length;G>0;G-=1){D=H.slice(0,G).join("/");if(J){for(F=J.length;F>0;F-=1){B=y[J.slice(0,F).join("/")];if(B){B=B[D];if(B){E=B;A=G;break}}}}if(E){break}if(!K&&w&&w[D]){K=w[D];M=G}}if(!E&&K){E=K;A=M}if(E){H.splice(0,A,E);z=H.join("/")}}return z}function t(w,x){return function(){var y=i.call(arguments,0);if(typeof y[0]!=="string"&&y.length===1){y.push(null)}return a.apply(e,y.concat([w,x]))}}function p(w){return function(x){return o(x,w) }}function f(w){return function(x){d[w]=x}}function g(x){if(v(c,x)){var w=c[x];delete c[x];q[x]=true;h.apply(e,w)}if(!v(d,x)&&!v(q,x)){throw new Error("No "+x)}return d[x]}function r(x){var y,w=x?x.indexOf("!"):-1;if(w>-1){y=x.substring(0,w);x=x.substring(w+1,x.length)}return[y,x]}function j(w){return w?r(w):[]}m=function(w,z){var x,A=r(w),y=A[0],B=z[1];w=A[1];if(y){y=o(y,B);x=g(y)}if(y){if(x&&x.normalize){w=x.normalize(w,p(B))}else{w=o(w,B)}}else{w=o(w,B);A=r(w);y=A[0];w=A[1];if(y){x=g(y)}}return{f:y?y+"!"+w:w,n:w,pr:y,p:x} };function b(w){return function(){return(u&&u.config&&u.config[w])||{}}}n={require:function(w){return t(w)},exports:function(w){var x=d[w];if(typeof x!=="undefined"){return x}else{return(d[w]={})}},module:function(w){return{id:w,uri:"",exports:d[w],config:b(w)}}};h=function(x,I,H,G){var B,F,C,w,z,A,D=[],y=typeof H,E;G=G||x;A=j(G);if(y==="undefined"||y==="function"){I=!I.length&&H.length?["require","exports","module"]:I;for(z=0;z0&&window.location.hash===(g.hashString))||(b.get(g.cookieName)===g.hashString)};h.handleWindowError=function(){window.onerror=function(p,o,n,m,l){h.error("Error message: "+p+"\nURL: "+o+(n?":"+n+":"+m:"")+"\nLine Number: "+n+":"+m+"\nError: "+l);return true}};h.handleJqueryError=function(){j(document).ajaxError(function(n,o,m,l){if(l==="timeout"){h.error(l+": "+m.url)}else{h.error(l)}});j(document).error(function(l){h.error(l)}) };function k(){var m,n,l=["log","debug","info","warn","error"];for(m in l){if(l.hasOwnProperty(m)){n=l[m];h[n]=function(o){a.subscribe("logger."+o,function(p){d(p,o)});return function(p){d(p,o)}}(n)}}g.log=h.isEnabled();if(g.handleWindowError===true){h.handleWindowError();a.subscribe("window.load",function(){h.handleWindowError()})}if(g.handleJqueryError===true){h.handleJqueryError()}}h.getLogs=function(){return c.slice(0)};k();return h});define("is",[],function(){var a={};a.number=function(b){return typeof b==="number" };a.string=function(b){return typeof b==="string"};a.funct=a.method=function(b){return typeof b==="function"};a.object=function(b){return b!==null&&typeof b==="object"};a.array=Array&&Array.isArray?Array.isArray:function(b){return b instanceof Array};a.undefined=function(b){return typeof b==="undefined"};a.defined=function(b){return typeof b!=="undefined"};a.exists=function(b){return a.defined(b)||b===""};a.empty=function(c){if(!a.defined(c)){return true}else{if(a.string(c)||a.array(c)){return c.length===0 }else{if(a.object(c)){var b=0,d;for(d in c){if(c.hasOwnProperty(d)){b++}}return b===0}else{if(a.number(c)){return false}else{return true}}}}};a.alphaOnly=function(b){return/^[A-z\s]+$/.test(b)};a.numberOnly=function(b){return/^[0-9]+$/.test(b)};a.mobile=function(){return(function(b){return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(b)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(b.substr(0,4)) })(navigator.userAgent||navigator.vendor||window.opera)};a.tablet=function(){return(function(b){return/(?:ipad|tab)/i.test(b)})(navigator.userAgent||navigator.vendor||window.opera)};a.desktop=function(){return !a.mobile()&&!a.tablet()};a.touch=function(){return(("ontouchstart" in window)||("DocumentTouch" in window))};a.IE=function(){var c=window.navigator.userAgent;var b=c.indexOf("MSIE ");if(b>0||!!navigator.userAgent.match(/Trident.*rv\:11\./)){return true}else{return false}};a.IE11=function(){return(!!navigator.userAgent.match(/Trident\/7\./)) };a.visible=function(b){return b&&b.is(":visible")};a.iframe=function(b){return b.tagName==="IFRAME"};a.dateStr=function(c){try{new Date(c);return true}catch(b){return false}};a.email=function(b){var c=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return c.test(b)};a.url=function(c){var b=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-]*)?\??(?:[\-\+=&;%@\.\w]*)#?(?:[\.\!\/\\\w]*))?)/g; return b.test(c)};return a});define("string",[],function(){var a={};a.camelCase=function(b){return b.replace(/(?:^|\s)\w/g,function(c){return c.toUpperCase()}).replace(/(\s|-|_)/g,"")};a.splice=function(d,b,e,c){return(d.slice(0,b)+c+d.slice(b+Math.abs(e)))};a.startsWith=function(b,c){return b.indexOf(c)===0};return a});define("util",["logger","jquery","is","string","json"],function(b,g,e,a,c){b.log("util loaded");var h={};h.extend=g.extend;h.deepextend=function(){return g.extend.apply(this,arguments) };h.xor=function(l,j){var i={},k;for(k in j){if(!l.hasOwnProperty(k)){i[k]=j[k]}}return i};h.convertObj=function(i,k){var j={};util.each(i,function(m,l){j[m]=k(m,l)});return j};h.each=function(k,m){var j,l;if(!m){return null}if(k instanceof Array){for(j=0;j=1000000000){return(i/1000000000).toFixed(1)+"G" }if(i>=1000000){return(i/1000000).toFixed(1)+"M"}if(i>=1000){return(i/1000).toFixed(1)+"K"}return i};h.getJsonFromString=function(m,j,k){j=j||"&";k=k||"=";var i={};var l=m.split(j);h.each(l,function(o,n){var p=n.split(k);i[p[0]]=p[1]});return i};h.val=function(j,i){if(e.funct(j)){return j(i)}return j};h.throttle=function(j,m){var k;var l=0;return function i(){var n=+new Date()-l;var p=this;var o=arguments;function q(){l=+new Date();m.apply(p,o)}k&&clearTimeout(k);if(n>j){q()}else{k=setTimeout(q,j-n) }}};h.getDate=function(j){try{if(e.number(j)){return new Date(j)}else{j=j.replace(/(\d)(A|P)M/,"$1 $2M")}return new Date(j)}catch(i){b.error(i);return null}};var d=0;h.uuid=function(){var j=new Date().getTime();var i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){var k=(j+Math.random()*16)%16|0;j=Math.floor(j/16);return(l=="x"?k:(k&7|8)).toString(16)});return i};h.mapObj=function(j,k){if(!e.object(j)&&!e.object(k)){throw new Error("Invalid Parameters")}var i={};h.each(j,function(m,l){if(e.funct(l)){i[m]=l(k) }else{i[m]=k[l]}});return i};h.getDomainOnly=function(i){return"."+(i||document.location.host).split(":")[0].split(".").reverse().slice(0,2).reverse().join(".")};h.format=function(k,j){var i=k;h.each(j,function(m,l){i=i.replace("{{:"+m+"}}",j[m])});i=i.replace(/{{:[a-zA_Z0-9]+}}/,"");return i};h.stringify=JSON?JSON.stringify:null;h.checkNoScript=function(i){};h.getClick=function(){return e.touch()?"touchstart":"click"};h.getParam=function(j){var i=window.location.search.replace("?","");if(e.defined(j)){return h.deparam(i)[j] }else{return h.deparam(i)}};h.deparam=function(j){var i={};h.each(j.replace(/\+/g," ").split("&"),function(k,m){var l=m.split("=");i[decodeURIComponent(l[0])]=decodeURIComponent(l[1]||"")});return i};h.data=function(j){var k={};var i=g(j)[0].attributes;g.each(i,function(l,n){var m=n.nodeName.substr(0,5);if(m==="data-"){k[n.nodeName.replace(m,"")]=n.nodeValue}});return k};var f=function(i){Error.prototype.constructor.apply(this,arguments);this.message=i};f.prototype=new Error();h.wrapCallback=function(i){return function(){try{return i.apply(this,arguments) }catch(j){if(j instanceof f){throw j}b.error(j);throw j}}};h.md5=function(av){function ag(i,j){return(i<>>(32-j))}function ah(n,j){var l,p,o,m,i;o=(n&2147483648);m=(j&2147483648);l=(n&1073741824);p=(j&1073741824);i=(n&1073741823)+(j&1073741823);if(l&p){return(i^2147483648^o^m)}if(l|p){if(i&1073741824){return(i^3221225472^o^m)}else{return(i^1073741824^o^m)}}else{return(i^o^m)}}function aw(l,j,i){return(l&j)|((~l)&i)}function ax(l,j,i){return(l&i)|(j&(~i))}function ay(l,j,i){return(l^j^i)}function aA(l,j,i){return(j^(l|(~i))) }function at(m,n,p,o,i,l,j){m=ah(m,ah(ah(aw(n,p,o),i),j));return ah(ag(m,l),n)}function aH(m,n,p,o,i,l,j){m=ah(m,ah(ah(ax(n,p,o),i),j));return ah(ag(m,l),n)}function ak(m,n,p,o,i,l,j){m=ah(m,ah(ah(ay(n,p,o),i),j));return ah(ag(m,l),n)}function au(m,n,p,o,i,l,j){m=ah(m,ah(ah(aA(n,p,o),i),j));return ah(ag(m,l),n)}function aI(q){var j;var r=q.length;var n=r+8;var l=(n-(n%64))/64;var o=(l+1)*16;var i=Array(o-1);var m=0;var p=0;while(p>>29;return i}function am(i){var j="",m="",l,n;for(n=0;n<=3;n++){l=(i>>>(n*8))&255;m="0"+l.toString(16);j=j+m.substr(m.length-2,2)}return j}function ai(j){j=j.replace(/rn/g,"n");var m="";for(var l=0;l127)&&(i<2048)){m+=String.fromCharCode((i>>6)|192);m+=String.fromCharCode((i&63)|128)}else{m+=String.fromCharCode((i>>12)|224);m+=String.fromCharCode(((i>>6)&63)|128); m+=String.fromCharCode((i&63)|128)}}}return m}var al=Array();var ac,aF,aj,ar,aG,k,x,F,G;var Z=7,ab=12,ae=17,af=22;var an=5,ao=9,ap=14,aq=20;var az=4,aB=11,aC=16,aD=23;var H=6,I=10,aa=15,ad=21;av=ai(av);al=aI(av);k=1732584193;x=4023233417;F=2562383102;G=271733878;for(ac=0;ac").text(i).html()};h.decodeHTML=function(i){return g("
").html(i).text()};h.reloadIframe=function(i){if(g(i).length>0){g(i).attr("src",g(i).attr("src"));return true}return false};return h});define("timer",["util","is"],function(a,c){var b={};b.every=function(d,e){return setInterval(e,d) };b.after=b.delay=function(d,e){return setTimeout(e,d)};b.available=function(d,g,f,e){if(e==0){g(null)}if(window[d]){if(g){g(window[d])}}else{f=f||2000;setTimeout(function(){b.available(d,g,f,--e)},f)}};b.cancel=function(f){try{clearTimeout(f)}catch(d){}try{clearInterval(f)}catch(d){}};b.elapsedTime=function(o,g,d){if(!c.number(o)){try{o=parseInt(o,10);return b.elapsedTime(o,g,d)}catch(n){return""}}var r={year:"year",day:"day",hour:"hour",minute:"minute",second:"second",ago:"ago"};var m=a.extend(true,{},r,g); var q=[{name:m.year,div:31536000000,mod:10000},{name:m.day,div:86400000,mod:365},{name:m.hour,div:3600000,mod:24},{name:m.minute,div:60000,mod:60},{name:m.second,div:1000,mod:60}];var k=0,h=q.length,j,p=[],f=new Date().getTime()-o;while(k=0){p.push(j+" "+q[k].name+(j>1?"s":""))}k+=1}if(p.length===0){p.push("1 "+m.second)}if(d===true){return p[0]+" "+m.ago}else{return p.join(", ")+" "+m.ago}};return b});define("ajax",["timer","util","jquery","is","module"],function(h,a,g,e,d){var f={timeout:60000},c=a.extend(true,{},f,d.config()),b={}; g.ajaxSetup({timeout:c.timeout});b.getAll=function(l,j,r,o){var p=this,t=[],m=[],n,q;function k(i){m.push(i);if(m.length===l.length){r.apply(p,m)}}for(n=0;nn?j[n]:{};t.push(g.get(l[n],q,k,o))}return t};b.param=g.param;b.ajax=g.ajax;b.get=function(i,k,l,j){if(e.funct(i)){return i(k,l)}else{return g.get(i,k,l,j)}};b.post=function(i,k,l,j){return g.post(i,k,l,j)};b.postCrossDomain=function(j,m){var i="postFrame"+new Date().getTime()+Math.floor((Math.random()*1000)),k=g("").attr("name",i),l=g("
"); a.each(m,function(o,n){l.append(g("").attr("value",n))});k.appendTo("body");l.appendTo("body").submit().remove();h.after(10000,function(){k.remove()})};b.getJSONP=function(i,j,k){return b.get(i,j,k,"jsonp")};b.getJSON=function(i,j,k){return b.get(i,j,k,"json")};return b});define("user",["util","ajax","cookie","event","jquery","is","logger","string"],function(f,i,b,a,d,e,j,g){var c={},h=function(k,l){var n={},m=this;if(l&&e.object(l)){k=f.mapObj(l,k)}f.each(k,function(p,o){n[p]=o; var q=g.camelCase(p);m["get"+q]=function(){return n[p]}});this.getMappedUser=function(){return n};this.getOriginalUser=function(){return k};this.toString=this.toJson=function(){return f.stringify(n,true,"\t")}};c.getNewUser=function(l,k){if(l instanceof h){return l}else{if(e.object(l)){return new h(l,k)}else{return null}}};c.isUser=function(k){return k instanceof h};return c});var TimesApps=window.TimesApps||{};TimesApps.checkGdprAndCall=function(f,c,a){var d="geo_continent";if(window.TimesGDPR&&TimesGDPR.common.consentModule.gdprCallback){TimesGDPR.common.consentModule.gdprCallback(function(g){if(g&&g.isEUuser&&typeof c=="function"){c() }else{if(!g.isEUuser&&typeof f=="function"){f()}}})}else{if(window.self!=window.parent){var e=(toiprops&&toiprops.cookie&&toiprops.cookie.get(d))||"";var b=e.toUpperCase()==="EU";if(b&&typeof c=="function"){c()}}else{if(typeof c=="function"){c()}}}};define("login",["util","ajax","cookie","event","jquery","module","user","string","logger"],function(j,l,b,a,i,c,h,k,m){var g,e,d,f,n;g={autoinit:false,multiuser:false,login:"",logout:"",check_user_status:"",mapping:null,renderer:true};e=j.extend(true,{},g,c.config()); d={};f={};n="SINGLE_USER";d.login=function(q,o,p){if(!q){p(null,"Username is required for login.")}if(!o){p(null,"Password is required for login.")}l.get(e.login,{username:q,password:o},function(t,u){var r=h.getNewUser(t,e.mapping);if(r){d.setUser(r)}else{d.removeUser()}if(u){a.publish("login.error",u)}if(p){p(r,u)}})};d.logout=function(o){l.get(e.logout,{},function(p){d.removeUser();if(o){o(p)}})};d.register=function(){m.info("Register event called.")};d.isLoggedIn=function(o){l.get(e.check_user_status,{},function(q){var p=h.getNewUser(q,e.mapping); if(p){p.loginType=b.get("LoginType");p.facebook={name:b.get("fbookname"),location:b.get("fbooklocation"),image:b.get("Fbimage"),email:b.get("FaceBookEmail"),oauth:b.get("Fboauthid")};p.twitter={name:b.get("TwitterUserName"),image:b.get("Twimage"),oauth:b.get("Twoauthid")};d.setUser(p)}else{d.removeUser()}if(o){o(p)}})};d.removeUser=function(o){if(e.multiuser){if(o){delete f[o]}else{throw new Error("'userId' is required to remove a user.")}}else{delete f[n]}d.statusChange(null)};d.setUser=d.addUser=function(o){if(typeof o!=="undefined"&&!h.isUser(o)){throw new Error("Object is not an instance of User, use 'user.getNewUser()' to get a User object.") }if(e.multiuser){f[o.id](o)}else{f[n]=o}d.statusChange(o)};d.getUser=function(o){if(e.multiuser){return j.extend(true,{},f[o])}else{return f[n]}};d.statusChange=function(o){m.info("User Status:"+(o?o.toString():null));a.publish("user.status",o)};d.onStatusChange=function(o){a.subscribe("user.status",o)};d.updateConfig=function(o){if(o){e=j.extend(true,{},e,o)}};d.init=function(o){d.updateConfig(o);if(e.renderer===true){d.onStatusChange(function(p){d.renderPlugins(p)})}d.isLoggedIn(function(){});d.initActions() };d.initActions=function(){i("[data-plugin='user-isloggedin']").on("click","[data-plugin='user-logout']",function(){d.logout()});i("[data-plugin='user-notloggedin']").on("click","[data-plugin='user-login']",function(){d.login()}).on("click","[data-plugin='user-register']",function(){d.register()}).on("click","[data-plugin='user-login-facebook']",function(){d.loginWithFacebook()}).on("click","[data-plugin='user-login-twitter']",function(){d.loginWithTwitter()}).on("click","[data-plugin='user-login-google']",function(){d.loginWithGoogle() })};d.renderPlugins=function(o){var q=i("[data-plugin='user-isloggedin']"),p=i("[data-plugin='user-notloggedin']");if(p.length===0){m.warn("Cannot render plugins. data-plugin='user-isloggedin' not found")}if(o){q.show();p.hide();i("[data-plugin='user-info']").each(function(){var r=i(this),t=r.attr("data-info");try{r.text(o["get"+k.camelCase(t)]());m.info("user-info="+t+":"+o["get"+k.camelCase(t)]())}catch(u){m.error("user-info="+t+":"+u.message)}})}else{q.hide();p.show()}};if(e.autoinit===true){d.init() }return d});define("page",["module","util","jquery"],function(d,a,f){var e={msid:window.msid,channel:"",siteId:"",domain:""};var c=a.extend(true,{},e,d.config());var b={};b.getMsid=function(g){try{if(!g||g.length===0||g==="#"){g=location.href;return/(\d*)\.cms/.exec(g)[1]}else{return c.msid}}catch(h){return c.msid}};b.getSiteId=function(){return c.siteId};b.getDomain=function(){return c.domain};b.getChannel=function(){return c.channel};b.getMeta=function(g){if(g){return f("meta[property='"+g+"']").attr("content") }else{var h={};f("meta[property]").each(function(l,j){var i=f(j);h[i.attr("property")]=i.attr("content")});return h}};return b});define("analytics/mytimes",["module","ajax","util"],function(c,e,a){var f={};var d={url:"http://myt.jeetwin-gaming.com/mytimes/",appKey:""};var b=a.extend(true,{},d,c.config());f.log=function(g,i){var h=new Image();h.src=g+"?"+e.param(i)};f.logActivity=function(g){var h=b.url+"addActivity";var i=a.extend(true,{},g);f.log(h,i)};f.logCommentActivity=function(g){var h=a.extend(true,{appKey:b.appKey,parentCommentId:0,activityType:"",baseEntityType:"ARTICLE",objectType:"A",url:document.location.href},g); f.logActivity(h)};f.agreeComment=function(g){var h={parentCommentId:g,activityType:"Agreed"};f.logCommentActivity(h)};f.disagreeComment=function(g){var h={parentCommentId:g,activityType:"Disagreed"};f.logCommentActivity(h)};f.recommendComment=function(g){var h={parentCommentId:g,activityType:"Reccomended"};f.logCommentActivity(h)};f.logShareCount=function(i,h){var g=b.url+"entityCount";var j={appKey:b.appKey,via:h,entityId:i};f.log(g,j)};f.getShareCount=function(h,j){var g=b.url+"sharedEntity";var i={appKey:b.appKey,msids:h}; e.ajax({type:"GET",url:g,jsonpCallback:"getShareCount"+Math.random()*1000000000000000000,dataType:"jsonp",data:i,success:function(l){var k=l&&l.length>0?l[0]:null;if(k&&j){if(j){j(k)}else{j(null)}}},error:j})};f.getNotifications=function(i){var g=b.url+"notification";var h={appKey:b.appKey,openNetworkId:"sso",size:100,lastSeenId:0,after:true};e.ajax({type:"GET",url:g,jsonpCallback:"getNotifications"+Math.random()*1000000000000000000,dataType:"jsonp",data:h,success:i,error:i})};f.followUser=function(g,h){e.getJSONP(b.url+"followuser",{userId:g,fromMyTimes:true},h) };f.unfollowUser=function(g,h){e.getJSONP(b.url+"unfollowuser",{userId:g,fromMyTimes:true},h)};f.getFollowers=function(g){e.getJSONP(b.url+"activity/myfriends",{openNetworkId:"sso",size:-1,lastSeenId:0,after:true,type:"follower"},g)};f.getFollowee=function(g){e.getJSONP(b.url+"activity/myfriends",{openNetworkId:"sso",size:-1,lastSeenId:0,after:true,type:"followee"},g)};f.followUser=function(g,h){e.getJSONP(b.url+"followuser",{userId:g,fromMyTimes:true},h)};f.updateUserCity=function(g,h){e.getJSONP(b.url+"/profile/update?city="+g,{openNetworkId:"sso",size:-1,lastSeenId:0,after:true},h) };return f});define("times/api",["util","ajax","cookie","event","string","page","module","analytics/mytimes"],function(h,k,b,a,i,j,c,f){var e={};var g={ticket:{url:"http://jsso.jeetwin-gaming.com/sso/crossdomain/getTicket"},usersInfo:{url:"http://myt.jeetwin-gaming.com/mytimes/getUsersInfo",params:{ssoids:""}},badges:{url:"http://rewards.jeetwin-gaming.com/bp/api/urs/mubhtry",params:{format:"json",pcode:j.getChannel(),uid:""}},rewards:{url:"http://rewards.jeetwin-gaming.com/bp/api/urs/ups",params:{format:"json",pcode:j.getChannel(),uid:""}},comments:{url:document.location.host=="test.jeetwin-gaming.com"||document.location.host=="test.happytrips.com"?"lib/getComments.php":"/json/new_cmtofart2_nit_v1.cms",type:"json",params:{msid:"",curpg:1,pcode:j.getChannel()}}}; g.comments_newest=g.comments;g.comments_oldest={url:g.comments.url,type:g.comments.type,params:{msid:"",curpg:1,ordertype:"asc",pcode:j.getChannel()}};g.comments_recommended={url:g.comments.url,type:g.comments.type,params:{msid:"",curpg:1,commenttype:"mostrecommended",pcode:j.getChannel()}};g.comments_discussed={url:g.comments.url,type:g.comments.type,params:{msid:"",curpg:1,commenttype:"mostdiscussed",pcode:j.getChannel()}};g.comments_agree={url:g.comments.url,type:g.comments.type,params:{msid:"",curpg:1,commenttype:"agree",pcode:j.getChannel()}}; g.comments_disagree={url:g.comments.url,type:g.comments.type,params:{msid:"",curpg:1,commenttype:"disagree",pcode:j.getChannel()}};g.validate_comment={url:"/validatecomment.cms",type:"html",params:{fromname:null,fromaddress:null,userid:null,location:null,imageurl:null,loggedstatus:null,message:null,roaltdetails:null,ArticleID:null,msid:null,parentid:null,rootid:null}};g.post_comment={url:"/postro.cms",type:"html",params:{fromname:null,fromaddress:null,userid:null,location:null,imageurl:null,loggedstatus:null,message:null,roaltdetails:null,ArticleID:null,msid:null,parentid:null,rootid:null}}; g.post_comment_withoutverification={url:"/postro_nover.cms",type:"html",params:{fromname:null,fromaddress:null,userid:null,location:null,imageurl:null,loggedstatus:null,message:null,roaltdetails:null,ArticleID:null,msid:null,parentid:null,rootid:null}};g.post_comment_withverification={url:"/postroemailverification.cms",type:"html",params:{fromname:null,fromaddress:null,userid:null,location:null,imageurl:null,loggedstatus:null,message:null,roaltdetails:null,ArticleID:null,msid:null,parentid:null,rootid:null}}; g.rate={url:"/rate_techreview.cms",type:"html",params:{msid:null,getuserrating:null,vote:null,criticrating:null}};g.rate_comment={url:"/ratecomment_new.cms",type:"html",params:{opinionid:null,typeid:null,rateid:null}};g.rate_comment_offensive={url:"/offensive/mark",type:"html",params:{ofusername:null,ofreason:"NONE",ofcommenteroid:null,ofcommenthostid:83,ofcommentchannelid:-2128958273,ofcommentid:null,ofuserisloggedin:null,ofuserssoid:null,ofuseremail:null}};var d=h.extend(true,{},g,c.config());e.updateConfig=function(l){d=h.extend(true,d,l) };e.getConfig=function(l){return d};e.getTicket=function(l,m){return e.api("ticket",l,m)};e.getUsersInfo=function(l,m){return e.api("usersInfo",l,m)};e.getBadges=function(l,m){return e.api("badges",l,m)};e.getRewards=function(l,m){return e.api("rewards",l,m)};e.getComments=e.getComments_newest=function(l,m){return e.api("comments",l,m)};e.getComments_oldest=function(l,m){return e.api("comments_oldest",l,m)};e.getComments_recommended=function(l,m){return e.api("comments_recommended",l,m)};e.getComments_discussed=function(l,m){return e.api("comments_discussed",l,m) };e.getComments_agree=function(l,m){return e.api("comments_agree",l,m)};e.getComments_disagree=function(l,m){return e.api("comments_disagree",l,m)};e.validateComment=function(l,m){return e.post("validate_comment",l,m)};e.postComment=function(l,m){return e.post("post_comment",l,m)};e.postCommentWithoutVerification=function(l,m){return e.post("post_comment_withoutverification",l,m)};e.postCommentWithVerification=function(l,m){return e.post("post_comment_withverification",l,m)};e.rate=function(n,o,m){var l={msid:n.msid,getuserrating:n.user_rating,vote:n.rating,criticrating:n.critic_rating}; return e.api("rate",l,o)};e.rateComment=function(m,n,l){if(l){switch(m.typeid){case 100:f.agreeComment(m.opinionid);break;case 101:f.disagreeComment(m.opinionid);break;case 102:f.recommendComment(m.opinionid);break;case 103:e.rateCommentOffensive(m,l);break}}return e.api("rate_comment",m,n)};e.rateCommentOffensive=function(m,l,o){if(l){var n={};n.ofcommenteroid=m.opinionid;n.ofcommentid=window.msid;n.ofuserisloggedin=1;n.ofuserssoid=n.ofuseremail=l.getEmail();n.ofusername=l.getFullName();return e.api("rate_comment_offensive",n,o) }else{a.publish("logger.error","Cannot rate comment offensive, user not available.")}};e.api=function(m,l,o){var n=d[m];return k.get(h.val(n.url,n.params),h.extend(true,{},n.params,l),function(p){if(o){try{o(p)}catch(q){a.publish("logger.error",q.stack)}}},n.type||"jsonp").error(function(){if(o){try{o()}catch(p){a.publish("logger.error",p.stack)}}})};e.post=function(m,l,o){var n=d[m];return k.post(h.val(n.url,n.params),h.extend(true,{},n.params,l),function(p){if(o){try{o(p)}catch(q){a.publish("logger.error",q.stack) }}}).error(function(p,r,q){p.publish("comment.post.error",q)})};e.get=function(m,o){if(o){var n=d[m];var l=h.extend(true,{},n.params,o);return{url:h.val(n.url,l),params:l}}else{return d[m]}};e.init=function(){h.each(d,function(l,m){var n=i.camelCase("get "+l);e[n]=function(o,p){k.getJSONP(h.val(m.url,m.params),h.extend(true,{},m.params,o),function(q){if(p){p(q)}})}})};return e});define("ui",["util","logger","event","jquery","is","timer"],function(h,i,b,f,g,c){i.log("ui loaded");var a={},d={},j,e; a.window=function(k,t){i.log("ui.window called");var o,m,r,q,n,l;o={width:300,height:300,name:"Window",mask:true,resizable:false,disableScroll:false,closeCallback:function(){i.log("Empty ui.window callback function.")}};m=h.extend(true,{},o,t);r=window.screen.width/2-m.width/2;q=window.screen.height/2-m.height/2;n=["width="+m.width,"height="+m.height,"left="+(g.defined(m.left)?m.left:r),"top="+(g.defined(m.top)?m.top:(q-20)),"scrollbars="+m.scrollbars,"resizable="+m.resizable];if(m.mask===true&&g.desktop()){a.mask(null,{},false) }if(m.disableScroll===true){a.disableScroll()}l=window.open(k,m.name,n.join(","));if(l){l.focus();i.log("Popup opened: "+k);i.log(l)}try{l.reposition=function(){var u=window.screen.width/2-m.width/2,v=(window.screen.height/2-m.height/2);l.moveTo(u,v)}}catch(p){i.warn("Handled Exception in IE10.");i.error(p)}if(!l){i.error("Popups are blocked. Please enable them.");a.unmask();return l}(function(u,w,x){var v=window.setInterval(function(){try{i.log("Checking if popup is closed:"+w+":"+u.closed);if(u===null||u.closed!==false){a.window.close(x.name) }}catch(y){i.warn("Handled exception while closing popup.");i.error(y.stack);window.clearInterval(v);v=null}},500);d[x.name]={opt:x,popup:u,interval:v,url:w}}(l,k,m));return l};a.window.close=function(l,m){if(!l){i.error("Window name is required to close it.");return}var k=d[l];if(m===true){h.each(d,function(n){a.window.close(n)})}else{if(k){i.log("Closing popup is closed:"+k.opt.name+":"+k.url);if(k.opt.mask===true){a.unmask()}if(k.opt.disableScroll===true){a.enableScroll()}window.clearInterval(k.interval); k.interval=null;k.popup.close();d[k.opt.name]=null;k.opt.closeCallback(k.popup)}else{i.warn("Popup '"+l+"' not found.")}}};if(window.closeWindow){i.warn("window.closeWindow is already defined, open windows may not close properly.")}else{window.closeWindow=a.window.close}a.iframe=function(m,l){var q={width:300,height:300,name:"Window",disablePopup:true,closeCallback:function(){i.log("Empty ui.iframe callback function.")}},n=h.extend(true,{},q,l),o=f(""),p,k;o.attr("src",m);o.css({width:"100%",height:"100%",border:"4px solid #cccccc",backgroundColor:"#FFF"}); p=o[0];k=a.popup(o,n);p.close=function(){o.remove();k.remove();a.unmask()};p.resizeTo=function(t,r){if(t&&r){k.width(t);k.height(r)}};p.reposition=k.reposition;return p};a.closeButton=function(l){var k=f("");k.on("click",l);return k};a.popup=function(p,n){var q,m,l,o,k;q={width:300,height:300,name:"Window",closeCallback:function(){i.log("Empty ui.popup callback function.")},disableScroll:false};o=h.extend(true,{},q,n);k=f("
");k.width(o.width);k.height(o.height);k.css({position:"absolute",zIndex:e.zIndex+1}); k.append(p);if(o.disableScroll===true){a.disableScroll()}if(o.closeCallback){if(window.closePopup){i.warn("'window.closePopup' is already defined.")}if(window.disablePopup){i.warn("'window.disablePopup' is already defined.")}window.closePopup=window.disablePopup=function(){k.remove();a.unmask();if(o.disableScroll===true){a.enableScroll()}if(o.closeCallback){o.closeCallback()}window.closePopup=null;window.disablePopup=null};m=a.closeButton(window.closePopup);m.addClass("popup_close_button");m.css({position:"absolute",top:"0px",right:"0px",cursor:"pointer",background:"url('/photo/25494620.cms') no-repeat scroll -160px -20px rgba(0, 0, 0, 0)",width:"18px",height:"18px"}); k.append(m)}f("body").append(k);l=a.mask(k,{},false);k.reposition=function(){var u=f(window),r=u.width(),w=u.height(),t=((r/2)-(k.width()/2)),v=((w/2)-(k.height()/2));if(t<0){t=0}if(v<0){v=0}k.css({left:t,top:v+f(window).scrollTop()})};k.reposition();k.close=function(){k.remove();a.unmask()};b.subscribe("window.resize",function(){k.reposition()});return k};a.img=function(m,k){var l=f("");l.attr("src",m);h.each(k,function(o,n){l.attr(o,n)});return l};a.anchor=function(m,n,k){var l=f("");l.attr("href",m); l.text(n);h.each(k,function(p,o){l.attr(p,o)});return l};a.inView=function(o,t,u){u=u||0;var q=f(window),n=f(o),l,m,r,p,k;if(n.is(":hidden")){return false}l=q.scrollTop()-u;m=l+q.height()+u;r=n.offset().top;p=r+n.height();k=false;if(t===true){k=((p>l)&&(r<=m))}else{k=((p<=m)&&(r>=l))}return k};a.init=function(){var l=h.throttle(500,function(n){b.publish("window.scroll",n)}),k=function(n){b.publish("window.load",n)},m=h.throttle(500,function(n){b.publish("window.resize",n)});if(window.addEventListener){window.addEventListener("scroll",l,false); window.addEventListener("load",k,false);window.addEventListener("resize",m,false)}else{if(window.attachEvent){window.attachEvent("onscroll",l);window.attachEvent("onload",k);window.attachEvent("onresize",m)}}f(function(n){b.publish("document.ready",n)})};a.getGravatar=function(k,l){if(!k||k.length===0){return null}l=l||80;return"http://www.gravatar.com/avatar/"+h.md5(k.trim().toLowerCase())+".jpg?s="+l};a.maxlength=function(l,k,o,n,m){f(n||"body").off("keyup change",l);f(n||"body").on("keyup change",l,function(){var q=f(this).val(),p=q.length; k=parseInt(k,10);o.call(this,k-p,p);if(p>k){f(this).val(q.substr(0,k));if(m){window.alert(m)}return false}})};a.getActionReferences=function(l,k){var m={current:f(l)};m.parent=k?m.current.parents(k):m.current;m.parent.find("[data-plugin]").each(function(o,n){m[f(n).attr("data-plugin")]=f(this)});return m};j=null;e={position:"fixed",left:0,top:0,width:"100%",height:"100%",backgroundColor:"#000",opacity:0.5,zIndex:99999};a.mask=function(l,k,m){if(!j){j=f("
");j.popup=l;j.css(h.extend(e,k)); if(j.popup){j.popup.show()}if(typeof m==="undefined"||m===true){j.on("click",function(){if(j.popup){j.popup.hide()}a.unmask()})}f(document).one("keyup",function(n){if(n.keyCode===27){if(j){if(j.popup){j.popup.hide()}a.unmask()}}});f("body").append(j)}else{i.warn("Already masked. Use ui.unmask() before masking again.")}return j};a.isMasked=function(){return j?true:false};a.unmask=function(){if(j){if(j.popup){j.popup.hide()}j.remove();j=null}else{i.warn("No mask available. Use ui.mask() before unmasking.") }};a.tooltip=function(l,k){k=k||5;var m=f("
");if(k>0){c.after(function(){m.fadeOut(function(){})})}return m};a.dialog=function(l){var k=f("
");k.css({backgroundColor:"#FFF"});k.html(l.html());return k};a.customScrollbar=function(k){if(window.$&&window.$&&window.$.fn&&window.$.fn.mCustomScrollbar){k=window.$(k);k.mCustomScrollbar("destroy");k.mCustomScrollbar({scrollButtons:{enable:true},advanced:{updateOnContentResize:true,updateOnBrowserResize:true}})}else{i.warn("mCustomScrollbar not found.") }};a.disableScroll=function(k){f("html,body").css({overflow:"hidden",height:"100%",padding:"0",margin:"0"});f(k||"#container").css({overflowY:"scroll",height:"100%"})};a.enableScroll=function(k){f("html,body").css({overflow:"",height:"",padding:"",margin:""});f(k||"#container").css({overflowY:"",height:""})};a.init();return a});define("load",["event","logger","util","is"],function(e,c,a,d){c.log("load loaded");var b={};b.js=function(h,l,k,j){var i=document.getElementsByTagName("head")?document.getElementsByTagName("head")[0]:null; if(i){var g=document.createElement("script");var f=false;if(k){g.id=k}if(j){g.async=j}if(!h){throw new Error("Param 'url' not defined.")}g.src=h;g.onload=g.onreadystatechange=function(){if(!g.loaded&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){g.loaded=true;var m=new Date().getTime();var n=m-g.startTime;e.publish("load.js",["_trackTiming","js",h,n,h]);if(l){try{l()}catch(o){e.publish("logger.error",o.stack)}}g.onload=g.onreadystatechange=null}};g.startTime=new Date().getTime(); i.appendChild(g);return g}else{c.info("Head Element not found. JS '"+h+"' not loaded. ");return null}};b.css=function(g,i){var h=document.getElementsByTagName("head")?document.getElementsByTagName("head")[0]:null;if(h){var f=document.createElement("link");f.setAttribute("rel","stylesheet");f.setAttribute("type","text/css");f.setAttribute("href",g);h.appendChild(f);if(i){setTimeout(i,0)}}else{c.info("Head Element not found. CSS '"+g+"' not loaded. ")}return f};b.iframe=function(l,k,f,h){var g=document.getElementById(h)||document.body; if(g){var j=document.createElement("iframe");j.src=l;j.scrolling="no";j.frameBorder="0";j.width=k||0;j.height=f||0;g.appendChild(j);return j}else{c.info("Container with id '"+h+"' not found. iframe '"+l+"' not loaded. ")}};b.image=function(g){if(d.array(g)){a.each(ajaxLogout,function(j,h){b.image(h)})}else{var f=new Image();f.src=g}};b._content=function(g,f){};b.isLoaded=function(f){return $('script[src="'+f+'"]').length>0||$('link[href="'+f+'"]').length>0};return b});define("localstorage",["module","util","json","is","logger"],function(a,e,g,d,h){var f={}; var c={};var b=e.extend(true,{},c,a.config());var i=window.localStorage;if(!i){h.warn("'localStorage' is not available.");i={getItem:function(){},removeItem:function(){},setItem:function(){}}}f.get=function(k){var l=i.getItem(k);if(l!=null){var j=g.parse(l);if(!j){return null}return(new Date().getTime()
Re-Generate OTP
  • Forgot Password?
    '; $("#user-sign-in").html(e)};b.showRegisterScreen=function(V){var T=$('#toi-login input[name="emailId"]').val();var U=b.getLoginType();var e="";e+='
    '; $("#user-sign-in").html(e);b.setRecaptchaCode("");if(typeof grecaptcha==="object"&&b.showCaptcha()){a=grecaptcha.render("recaptcha-container",{sitekey:"6LcXeh0TAAAAAO1DsEX1iEF8n8-E_hQB67bIpxIw",theme:"light",callback:b.recaptchaResponse,"error-callback":b.recaptchaErrorCallback,"expired-callback":b.recaptchaExpiredCallback})}};b.showForgotPasswordScreen=function(V){var T=$('#toi-login input[name="emailId"]').val();var U=b.getLoginType();var e="";e+='
    '; $("#user-sign-in").html(e)};b.showSignUpOtpScreen=function(V,T,U,ab){var W=U&&U.length>0?U.split("#"):[];var e=W[0]||$("#register-inputVal").val();var Z="";var aa="";var X=b.getLoginType();if(X==="email"&&T&&T.length){aa="mobile"}else{if(W&&W.length>0){aa="email"}else{if(X==="email"){aa="email"}else{aa="mobile"}}}b.setPageName(aa);if(T&&T.length){X="mobile";Z=e;e=T}var Y="";Y+='
    '; $("#user-sign-in").html(Y)};b.showSuccessMsgScreen=function(e,T){var U="";U+='
    ";$("#user-sign-in").html(U);setTimeout(function(){var V=$("#login-popup");if(V.hasClass("active")){b.closeBtnHandler()}},5000)};b.recaptchaResponse=function(T){var e=$("li.recaptcha-wrapper");b.handleError(e);b.setRecaptchaCode(T)};b.recaptchaErrorCallback=function(T){var e=$("li.recaptcha-wrapper");b.handleError(e,v.serverError)};b.recaptchaExpiredCallback=function(e){};b.setRecaptchaCode=function(e){N=e};b.getRecaptchaCode=function(){return N};b.logout=function(X){p=function(){R.publish("user.logout"); if(X){X()}};L();var U="http://jsso.jeetwin-gaming.com/sso/identity/profile/logout/external?channel="+c.getChannel().toLowerCase();var W=M.iframe(U);$(W).load(function(){$(W).remove();b.removeUser();if(window.__sso){window.__sso()}});D.remove("sso_user");var V=c.getDomain();var T=[{name:"ssoid",path:"/",domain:V},{name:"Fbsecuritykey",path:"/",domain:V},{name:"fbookname",path:"/",domain:V},{name:"CommLogP",path:"/",domain:V},{name:"CommLogU",path:"/",domain:V},{name:"FaceBookEmail",path:"/",domain:V},{name:"Fbimage",path:"/",domain:V},{name:"fbooklocation",path:"/",domain:V},{name:"Fboauthid",path:"/",domain:V},{name:"fbname",path:"/",domain:V},{name:"fbLocation",path:"/",domain:V},{name:"fbimage",path:"/",domain:V},{name:"fbOAuthId",path:"/",domain:V},{name:"MSCSAuth",path:"/",domain:V},{name:"MSCSAuthDetail",path:"/",domain:V},{name:"MSCSAuthDetails",path:"/",domain:V},{name:"Twimage",path:"/",domain:V},{name:"TwitterUserName",path:"/",domain:V},{name:"Twoauthid",path:"/",domain:V},{name:"Twsecuritykey",path:"/",domain:V},{name:"ssosigninsuccess",path:"/",domain:V},{name:"prc",path:"/",domain:V},{name:"ssoid"},{name:"MSCSAuthDetail"},{name:"articleid"},{name:"txtmsg"},{name:"tflocation"},{name:"tfemail"},{name:"setfocus"},{name:"fbookname"},{name:"CommLogP"},{name:"CommLogU"},{name:"FaceBookEmail"},{name:"Fbimage"},{name:"fbooklocation"},{name:"Fboauthid"},{name:"Fbsecuritykey"},{name:"fbname"},{name:"fbLocation"},{name:"fbimage"},{name:"fbOAuthId"},{name:"MSCSAuth"},{name:"MSCSAuthDetails"},{name:"ssosigninsuccess"},{name:"Twimage"},{name:"TwitterUserName"},{name:"Twoauthid"},{name:"Twsecuritykey"},{name:"prc"}]; var e=0;for(;e0){var T=b.getUser();if(T){if(W){W(T)}}else{if(e){f.getUsersInfo({ssoids:V},function(X){if(W){W(X[0]||X)}})}else{B.getJSONP("http://jsso.jeetwin-gaming.com/sso/crossdomain/getTicket?version=v1",function(Y){if(Y.ticketId!=null&&Y.ticketId!=undefined&&Y.ticketId.length>0){var X="http://socialappsintegrator.jeetwin-gaming.com/socialsite/v1validateTicket?ticketId="+Y.ticketId+"&channel="+c.getChannel().toLowerCase(); B.getJSONP(X,function(Z){if(location.hostname.indexOf(".jeetwin-gaming.com")>-1){f.getUsersInfo({ssoids:V},function(ab){if(W){W(ab[0]||ab)}})}else{var aa="http://"+location.hostname+"/v1validateTicket?ticketId="+Y.ticketId+"&channel="+c.getChannel().toLowerCase();B.getJSONP(aa,function(ab){f.getUsersInfo({ssoids:V},function(ac){if(W){W(ac[0]||ac)}})})}})}else{if(W){W(null)}}})}}}else{if(W){W(null)}}},mapping:{uid:"uid",email:"EMAIL",id:"_id",name:"FL_N",username:"D_N_U",fullName:"FL_N",firstName:"F_N",lastName:"L_N",icon:"tiny",link:"profile",CITY:"CITY",thumb:"thumb",followersCount:"F_C",FE_C:"FE_C",I_U_A:"I_U_A",I_I_L:"I_I_L",badges:"badges",rewards:"rewards",whatsonid:"W_ID",ps:"SUB_U_J"}}; b.renderPlugins=function(e){e=e||b.getUser();$(function(){if(e){$("[data-plugin='user-isloggedin']").show();$("[data-plugin='user-notloggedin']").hide();$("[data-plugin='user-name']").text(e.getFirstName());$("[data-plugin='user-icon']").attr("src",e.getIcon());$("[data-plugin='user-thumb']").attr("src",e.getThumb());f.getRewards({uid:e.getUid()},function(T){if(T&&T.output&&T.output.user&&T.output.user.levelName){$("[data-plugin='user-points']").text((T.output.user.statusPoints));$("[data-plugin='user-level']").text((T.output.user.levelName)); $("[data-plugin='user-points-wrapper']").show().addClass("points_"+T.output.user.levelName.toLowerCase())}else{$("[data-plugin='user-points-wrapper']").hide()}})}else{$("[data-plugin='user-icon']").attr("src",F.default_user_icon);$("[data-plugin='user-thumb']").attr("src",F.default_user_icon);$("[data-plugin='user-isloggedin']").hide();$("[data-plugin='user-notloggedin']").show()}$("body").toggleClass("loggedin",!!e);$("body").toggleClass("notloggedin",!e)})};b.register=function(){z.info("Register event called.") };b.isLoggedIn=function(e){B.get(F.check_user_status,{},function(U){var T=y.getNewUser(U,F.mapping);if(T){T.loginType=A.get("LoginType");T.facebook={name:A.get("fbookname"),location:A.get("fbooklocation"),image:A.get("Fbimage"),email:A.get("FaceBookEmail"),oauth:A.get("Fboauthid")};T.twitter={name:A.get("TwitterUserName"),image:A.get("Twimage"),oauth:A.get("Twoauthid")};b.setUser(T)}else{b.removeUser()}if(e){e(T)}})};b.removeUser=function(e){if(F.multiuser){if(e){delete C[e]}else{throw new Error("'userId' is required to remove a user.") }}else{delete C[g]}b.statusChange(null)};b.setUser=b.addUser=function(e){if(typeof e!=="undefined"&&!y.isUser(e)){throw new Error("Object is not an instance of User, use 'user.getNewUser()' to get a User object.")}if(F.multiuser){C[e.id](e)}else{C[g]=e}b.statusChange(e)};b.getUser=function(e){if(F.multiuser){return k.extend(true,{},C[e])}else{return C[g]}};b.statusChange=function(e){z.info("User Status:"+(e?e.toString():null));R.publish("user.status",e);b.refreshIframes()};b.refreshIframes=function(){$(window.parent.document).find("iframe[data-refreshstate]").each(function(e,T){$(T).attr("src",$(T).attr("src")) })};b.onStatusChange=function(e){R.subscribe("user.status",e)};b.updateConfig=function(e){if(e){F=k.extend(true,{},F,e)}};b.forgotPasswordBtnHandler=function(Y){Y.preventDefault();var aa=b.setAndGetJssoCrosswalkObj(),Z=b.getLoginType(),W=$("#fp-inputVal").val(),T=$("#toi-forgot-password"),X=T.find('input[name="otpfp"]').val(),V=T.find('input[name="registerPwd"]').val(),U;U=(Z==="email"?aa.loginEmailForgotPassword:aa.loginMobileForgotPassword);if(typeof U==="function"){b.showLoader();U.call(aa,W,X,V,V,b.handleForgotPasswordVerifyCallback); b.fireGAEvent(b.getPageName()+"_PW_Verify")}};b.handleForgotPasswordVerifyCallback=function(e){b.hideLoader();var T=$('#toi-forgot-password input[name="otpfp"]').closest("li");var U=$('#toi-forgot-password input[name="registerPwd"]').closest("li");var V=b.getLoginType();if(e.code===200){b.fireGAEvent("Login_Success_"+b.getPageName());b.showSuccessMsgScreen(true);b.isLoggedIn(p)}else{b.handleError(T);b.handleError(U);$(".successMsg").hide();switch(e.code){case 414:b.handleError(T,(V==="email"?v.wrongOtpEmail:v.wrongOtp)); break;case 415:b.handleError(T,v.expiredOTP);break;case 416:b.handleError(T,v.limitExceeded);break;case 418:b.handleError(U,v.matchLastThree);break;case 503:b.handleError(U,v.connectionError);break;default:b.handleError(U,v.serverError)}b.fireGAEvent("API_Error_"+e.code)}};b.forgotPasswordHandler=function(X){if($("#sso-forgot-pass").hasClass("disabled")){return}var V=$('#toi-login input[name="emailId"]');var Z=b.setAndGetJssoCrosswalkObj(),Y=b.getLoginType(),W=$('#toi-login input[name="emailId"]').val(),U=$("#toi-login li.email"),T; if(W.length===0){b.handleError(U,v.fpNoEmailOrMobile);return}else{if(!Y){b.handleError(U,v.fpInvalidEmail);return}}b.handleError(U);W=(Y==="email"?b.getValidEmailId(W):b.getValidMobileNumber(W));T=(Y==="email"?Z.getEmailForgotPasswordOtp:Z.getMobileForgotPasswordOtp);if(typeof T==="function"){b.showLoader();T.call(Z,W,b.handleForgotPasswordOTPCallback)}b.setPageName(b.getLoginType());b.fireGAEvent(b.getPageName()+"_Forgot_PW")};b.handleError=function(e,T){if(T){e.find("p").addClass("error");e.find(".errorMsg").html(T).show() }else{e.find("p").removeClass("error");e.find(".errorMsg").html("").hide()}};b.handleForgotPasswordOTPCallback=function(T){b.hideLoader();var e=$("#toi-login li.email");if(T&&T.code===200){b.showForgotPasswordScreen();var U=b.getLoginType();b.setScreenName("Forgot_PW")}else{if([405,406,407,408].indexOf(T.code)!==-1){b.handleError(e,v.accountUnregistered)}else{if(T.code===503){b.handleError(e,v.connectionError)}else{if(T.code===416){b.handleError(e,v.limitExceeded);$("#sso-regenerate-otp, #sso-generate-otp, #sso-forgot-pass").addClass("disabled") }else{b.handleError(e,v.serverError)}}}b.fireGAEvent("API_Error_"+T.code)}};b.fpInputKeyupHandler=function(U){var T=$(this);setTimeout(function(){var e=$("#toi-forgot-password");var W=e.find('input[name="otpfp"]').val();var V=e.find('input[name="registerPwd"]').val();var X=$("#sso-fp-btn");var Y=true;if(!(!isNaN(W)&&W.length===6)||!b.isPasswordValid(V)){Y=false}X.prop("disabled",!Y);if(Y){X.removeClass("disabled")}else{X.addClass("disabled")}if(T.attr("name")==="registerPwd"){b.passwordErrors.call(T,U) }},0)};b.changeEmailIdHandler=function(T){$("#sso-pwdDiv, #changeEmailIdDiv, #sso-otpLoginDiv, #sso-login-otp-msg").hide();$('#toi-login input[name="emailId"]').prop("disabled",false).val("");$('#sso-signInButtonDiv input[type="submit"]').prop("disabled",true).addClass("disabled");$(".errorMsg, .successMsg").hide();$(".error").removeClass("error");$("#sso-signInButtonDiv > input").val("Continue");$('#sso-pwdDiv input[name="password"]').val("");$('#sso-otpLoginDiv input[type="password"]').val(""); $("#sso-regenerate-otp, #sso-fp-regenerate-otp, #sso-verify-regenerate-otp, #sso-generate-otp, #sso-forgot-pass").removeClass("disabled");b.fireGAEvent(b.getPageName()+"_Change");b.setScreenName("Login_Screen")};b.changeRegisterEmailIdHandler=function(T){b.showLoginScreen();b.fireGAEvent(b.getPageName()+"_Change")};b.handleEmailIdKeyUp=function(U){var T=$(this);setTimeout(function(Z){var ab=T.val(),X=ab.indexOf("@"),aa=!isNaN(ab)&&ab.length>=10,W=false,V=$("#toi-login li.email"),Y=$('#sso-signInButtonDiv > input[type="submit"]'); if(X&&b.getValidEmailId(ab).length>0){b.setLoginType("email");W=true}else{if(aa&&b.getValidMobileNumber(ab).length>0){b.setLoginType("mobile");W=true}else{b.setLoginType("")}}Y.prop("disabled",!W);b.handleError(V);if(W){Y.removeClass("disabled")}else{Y.addClass("disabled")}},0)};b.checkUserExists=function(U){b.hideLoader();var T=$("#toi-login li.email");var e=$('#toi-login input[name="emailId"]');var V="";var W=b.getLoginType();b.handleError(T);if(U&&U.code===200&&U.data){if(U.data.statusCode===212||U.data.statusCode===213){$("#sso-pwdDiv, #changeEmailIdDiv").show(); $("#sso-signInButtonDiv > input").val("Sign In")}else{if(U.data.statusCode===205||U.data.statusCode===206||U.data.statusCode===214||U.data.statusCode===215){b.registerUser();b.setScreenName("Register_New_User")}else{e.prop("disabled",false);V=U.data.statusCode===216?v.fpInvalidEmailOnly:v.fpInvalidEmail;b.handleError(T,V)}}}else{e.prop("disabled",false);if(U.code===410){b.handleError(T,(W==="email"?v.fpInvalidEmailOnly:v.fpInvalidMobileOnly))}else{if(U.code===503){b.handleError(T,v.connectionError) }else{b.handleError(T,v.serverError)}}b.fireGAEvent("API_Error_"+U.code)}};b.registerUser=function(){b.showRegisterScreen()};b.registerButtonHandler=function(az){az.preventDefault();b.registerFormSubmitted(true);var ak=$("#toi-register");var ae=ak.find('input[name="emailId"]');var X=ak.find('input[name="fullname"]');var aj=ak.find('input[name="registerPwd"]');var ay=ak.find('input[name="registerCnfrmPwd"]');var ag=ak.find('input[name="mobile"]');var ab=b.getRecaptchaCode();var Y=ak.find('input[name="agree"]'); var ao=Y.is(":checked");var V=ak.find('input[name="promotions"]').is(":checked");var aA=ak.find('input[name="sharedDataAllowed"]').is(":checked")?"1":"0";var at=ae.val();var ax=X.val();var W=aj.val().trim();var ad=ay.val().trim();var Z=ag.val()||"";var ac={};var ar=true;var ai=b.getLoginType();var aq=b.setAndGetJssoCrosswalkObj(),am;var av=X.closest("li");var aa=aj.closest("li");var U=ay.closest("li");var af=ag.closest("li");var ap=ae.closest("li");var an=Y.closest("li");var al=$("#recaptcha-container").closest("li"); var ah=b.checkAndSetFullNameError(X,av);var T=b.checkAndSetConfirmPasswordError(ay,U);var aw=true;var au=b.checkAndSetAgreeTnCError(Y,an);if(ai==="email"){aw=b.checkAndSetEmailOrMobileToRegisterError(ag,af,"mobile")}else{aw=b.checkAndSetEmailOrMobileToRegisterError(ae,ap,"email")}if(!ah||!T||!aw||!au){ar=false}if(!b.isPasswordValid(W)){ar=false}if(b.showCaptcha()){if(!ab){ar=false;b.handleError(al,v.captchaUnselected)}else{b.handleError(al)}}$(".password-conditions").show();if(ar){ac=b.getFirstAndLastName(ax); am=b.showCaptcha()?aq.registerUserRecaptcha:aq.registerUser;if(typeof am==="function"){b.showLoader();if(b.showCaptcha()){am.call(aq,ac.firstName,ac.lastName,"","",at,Z,W,V,ab,"1",aA,b.registerUserCallback)}else{am.call(aq,ac.firstName,ac.lastName,"","",at,Z,W,V,"1",aA,b.registerUserCallback)}}}b.fireGAEvent(b.getPageName()+"_Verify")};b.registerFormErrorHandler=function(W){if(!H){return}var T=$(W.target);var V=T.attr("name");var U=T.closest("li");if(V==="fullname"){b.checkAndSetFullNameError(T,U) }else{if(V==="registerCnfrmPwd"){b.checkAndSetConfirmPasswordError(T,U)}else{if(V==="emailId"){b.checkAndSetEmailOrMobileToRegisterError(T,U,"email")}else{if(V==="mobile"){b.checkAndSetEmailOrMobileToRegisterError(T,U,"mobile")}else{if(V==="agree"){b.checkAndSetAgreeTnCError(T,U)}}}}}};b.checkAndSetFullNameError=function(V,U){var W=/^[a-zA-Z\s]*$/;var e=V.val();var T=true;if(!(e&&e.length>0&&W.test(e))){T=false;if(e.length===0){b.handleError(U,v.emptyName)}else{b.handleError(U,v.wrongName)}}else{b.handleError(U) }return T};b.checkAndSetConfirmPasswordError=function(W,V){var U=$('#toi-register input[name="registerPwd"]').val().trim();var T=W.val().trim();var e=true;if(U!==T){e=false;b.handleError(V,v.passwordMismatch)}else{b.handleError(V)}return e};b.checkAndSetEmailOrMobileToRegisterError=function(V,U,W){var T=V.val();var e=true;if(T.length===0){b.handleError(U)}else{T=W==="email"?b.getValidEmailId(T):b.getValidMobileNumber(T,true);if(T.length===0){e=false;b.handleError(U,(W==="email"?v.wrongEmail:v.wrongMobile)) }else{b.handleError(U)}}return e};b.checkAndSetAgreeTnCError=function(V,U){var e=V.is(":checked");var T=true;if(!e){T=false;b.handleError(U,v.tncNotSelected)}else{b.handleError(U)}return T};b.verifyButtonHandler=function(ab){ab.preventDefault();var Z=$("#toi-verifyotp-password");var T=$("#verify-inputVal").val();var X=$("#verify-ssoid").val();var ac=Z.find('input[name="otpverify"]').val();var aa=b.getLoginType();var Y=$("#verify-logintype").val();var V=$("#verify-email").val()||"";var W=b.setAndGetJssoCrosswalkObj(); var U=(Y==="email"?W.verifyEmailSignUp:W.verifyMobileSignUp);if(typeof U==="function"){b.showLoader();U.call(W,T,X,ac,b.handleSignUpVerifyCallback((aa!==Y&&V?V:""),X));b.fireGAEvent(b.getPageName()+"_Verify")}};b.verifyEmailButtonHandler=function(T){T.preventDefault();b.verifyButtonHandler(T)};b.enableVerifyButton=function(U){var T=$(this);setTimeout(function(){var e=T.val();var V=$("#sso-verify-btn");if(!V.is(":visible")){V=$("#sso-verify-email-btn")}if(!isNaN(e)&&e.length===6){V.prop("disabled",false).removeClass("disabled") }else{V.prop("disabled",true).addClass("disabled")}},0)};b.handleSignUpVerifyCallback=function(T,U,e){return function(X){b.hideLoader();var Z=$('#toi-verifyotp-password input[name="otpverify"]').closest("li");var aa=$("#verify-logintype").val();var Y="";var V=$("#verify-inputVal");var W={};if(X&&X.code===200){b.fireGAEvent("Login_Success_"+b.getPageName());if(!T||!U){if(aa==="email"){W.email=V.val()}else{W.mobile=V.val()}b.showSuccessMsgScreen(false,W)}else{Y=V.val();b.showSignUpOtpScreen(U,"",T+"#"+Y) }b.isLoggedIn(p)}else{$(".successMsg").hide();switch(X.code){case 414:b.handleError(Z,(aa==="email"?v.wrongOtpEmail:v.wrongOtp));break;case 415:b.handleError(Z,v.expiredOTP);break;case 416:b.handleError(Z,v.limitExceeded);break;case 503:b.handleError(Z,v.connectionError);break;default:b.handleError(Z,(v.serverError))}b.fireGAEvent("API_Error_"+X.code)}}};b.registerUserCallback=function(T){b.hideLoader();var e=$("#sharedDataAllowed").closest("li");var U=$('#toi-register input[name="mobile"]').val(); if(T&&T.code===200){b.showSignUpOtpScreen(T.data.ssoid,U);b.setScreenName("Complete_Profile")}else{if(T.code===429){b.handleError(e,v.userAlreadyRegistered)}else{if(T.code===416){b.handleError(e,v.limitExceeded)}else{if(T.code===503){b.handleError(e,v.connectionError)}else{b.handleError(e,v.serverError)}}}if(typeof grecaptcha==="object"&&b.showCaptcha()){grecaptcha.reset(a)}b.setRecaptchaCode("");b.fireGAEvent("API_Error_"+T.code)}};b.getFirstAndLastName=function(T){var e=[];var U={firstName:"",lastName:""}; if(T&&T.length>0){T=T.replace(/ +/g," ");e=T.split(" ");U.firstName=e[0]||"";if(e.length>1){e.splice(0,1);U.lastName=e.join(" ")}}return U};b.loginWithOTP=function(X,V){if($("#sso-generate-otp").hasClass("disabled")){return}var U=$('#toi-login input[name="emailId"]');var Z=b.setAndGetJssoCrosswalkObj(),Y=b.getLoginType(),W=$('#toi-login input[name="emailId"]').val(),T;W=(Y==="email"?b.getValidEmailId(W):b.getValidMobileNumber(W));T=(Y==="email"?Z.getEmailLoginOtp:Z.getMobileLoginOtp);if(typeof T==="function"){b.showLoader(); T.call(Z,W,b.handleLoginOTPCallback(V));if(V){b.fireGAEvent(b.getPageName()+"_Re_OTP")}else{b.fireGAEvent(b.getPageName()+"_OTP_Submit")}}};b.regenerateLoginOTP=function(){if($("#sso-regenerate-otp").hasClass("disabled")){return}b.loginWithOTP({},true)};b.fpRegenerateOTP=function(){if($(this).hasClass("disabled")){return}var V=b.setAndGetJssoCrosswalkObj(),U=b.getLoginType(),T=$("#fp-inputVal").val(),e;e=(U==="email"?V.getEmailForgotPasswordOtp:V.getMobileForgotPasswordOtp);if(typeof e==="function"){b.showLoader(); e.call(V,T,b.handleForgotPasswordRegenerateOTPCallback);b.fireGAEvent(b.getPageName()+"_Re_OTP")}};b.handleForgotPasswordRegenerateOTPCallback=function(T){b.hideLoader();var e=$('input[name="otpfp"]').parent().parent();b.handleError(e);if(T&&T.code===200){$('#toi-forgot-password input[name="otpfp"]').val("");$(".successMsg").text("OTP has been successfully sent.").show()}else{$(".successMsg").hide();switch(T.code){case 416:b.handleError(e,v.limitExceeded);$("#sso-fp-regenerate-otp").addClass("disabled"); $("#forgot-password-sent").hide();break;case 503:b.handleError(e,v.connectionError);break;default:b.handleError(e,v.serverError)}b.fireGAEvent("API_Error_"+T.code)}};b.verifyPageRegenerateOTP=function(){if($("#sso-verify-regenerate-otp").hasClass("disabled")){return}var W=b.setAndGetJssoCrosswalkObj(),V=$("#verify-logintype").val(),U=$("#verify-inputVal").val(),T=$("#verify-ssoid").val(),e;e=(V==="email"?W.resendEmailSignUpOtp:W.resendMobileSignUpOtp);if(typeof e==="function"){b.showLoader();e.call(W,U,T,b.handleSignUpVerifyRegenerateOTPCallback); b.fireGAEvent(b.getPageName()+"_Re_OTP")}};b.handleSignUpVerifyRegenerateOTPCallback=function(T){b.hideLoader();var e=$("#toi-verifyotp-password li.password:visible");b.handleError(e);if(T&&T.code===200){$('#toi-verifyotp-password input[name="otpverify"]').val("");$(".successMsg").text("OTP has been successfully sent.").show()}else{$(".successMsg").hide();switch(T.code){case 416:b.handleError(e,v.limitExceeded);$("#sso-verify-regenerate-otp").addClass("disabled");break;case 503:b.handleError(e,v.connectionError); break;default:b.handleError(e,v.serverError)}b.fireGAEvent("API_Error_"+T.code)}};b.handleLoginOTPCallback=function(e){return function(U){b.hideLoader();var T=$("#toi-login li.password:visible");b.handleError(T);if(U&&U.code===200){var W=b.getLoginType();var V=$('#toi-login input[name="emailId"]').val();V=(W==="email"?b.getValidEmailId(V):b.getValidMobileNumber(V));$("#sso-pwdDiv").hide();$("#sso-otpLoginDiv, #sso-login-otp-msg").show();$("#sso-login-otp-msg > p").text("We have sent a 6 digit verification code "+(W==="email"?"to ":"on +91-")+V); if(e){$('#toi-login input[name="otplogin"]').val("");$("#sso-otpLoginDiv .successMsg").text("OTP has been successfully sent.").show()}}else{$("#sso-otpLoginDiv .successMsg").hide();switch(U.code){case 416:b.handleError(T,v.limitExceeded);$("#sso-regenerate-otp, #sso-generate-otp, #sso-forgot-pass").addClass("disabled");$("#sso-login-otp-msg > p").text("");break;case 503:b.handleError(T,v.connectionError);break;default:b.handleError(T,v.serverError)}b.fireGAEvent("API_Error_"+U.code)}}};b.fbLoginHandler=function(T){var U=function(){b.closeBtnHandler() };b.initiateFbLogin(U)};b.gplusLoginHandler=function(){var e=function(){b.closeBtnHandler()};b.initiateGplusLogin(e)};b.handleLoginCallback=function(T){b.hideLoader();var U=$("#sso-otpLoginDiv").is(":visible");var e=$("#toi-login li.password:visible");var V=b.getLoginType();if(T&&T.code===200){b.closeBtnHandler();b.isLoggedIn(p);b.fireGAEvent("Login_Success_"+b.getPageName())}else{$(".successMsg").hide();switch(T.code){case 415:b.handleError(e,(!U?v.wrongPassword:v.expiredOTP));break;case 416:b.handleError(e,v.limitExceeded); break;case 503:b.handleError(e,v.connectionError);break;default:b.handleError(e,(!U?v.wrongPassword:(V==="email"?v.wrongOtpEmail:v.wrongOtp)))}b.fireGAEvent("API_Error_"+T.code)}};b.handleEmailIdClick=function(aa){aa.preventDefault();var Z=$('#sso-pwdDiv input[name="password"]');var Y=$('#sso-otpLoginDiv input[type="password"]');var ab=$('#toi-login input[name="emailId"]');var ac="";var X=$("#toi-login li.password:visible .errorMsg");ab.prop("disabled",true);var V=b.setAndGetJssoCrosswalkObj(),W=b.getLoginType(),U=$('#toi-login input[name="emailId"]').val(),T; U=(W==="email"?b.getValidEmailId(U):b.getValidMobileNumber(U));if(Z.is(":visible")||Y.is(":visible")){T=(W==="email"?V.verifyEmailLogin:V.verifyMobileLogin);ac=Z.is(":visible")?Z.val():Y.val();b.fireGAEvent(b.getPageName()+(Z.is(":visible")?"_PW":"_OTP")+"_Entry");if(ac.length===0){X.html(v.emptyPassword).show();return}else{if(typeof T==="function"){$(".errorMsg").html("").hide();b.showLoader();T.call(V,U,ac,b.handleLoginCallback)}}}else{if(typeof V.checkUserExists==="function"){b.showLoader();V.checkUserExists(U,b.checkUserExists); b.setPageName(W);b.fireGAEvent(b.getPageName()+"_Continue")}else{ab.prop("disabled",false)}}};b.getValidEmailId=function(e){var U=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/;var T="";if(U.test(e)){T=e}return T};b.getValidMobileNumber=function(V,W){var e=(W?/^[789]\d{9}$/:/^(\+91)?[0]?[789]\d{9}$/);var U=["7777777777","8888888888","9999999999"];var T="";var X=V.length;if(e.test(V)){T=V.substring(V.length-10,V.length)}if(U.indexOf(T)!==-1){T=""}return T};b.closeModalOnEscapeKeyPress=function(U){if(!h.loginPopup.hasClass("active")){return }var T=U.keyCode||U.which;if(T===27){h.closeBtn.click()}};b.isPasswordValid=function(e){return e&&e.length>=6&&e.length<=14&&b.hasNumber(e)&&b.hasSpecialCharacters(e)&&b.hasLowerCase(e)};b.hasLowerCase=function(e){return(/[a-z]/.test(e))};b.hasNumber=function(e){return(/[0-9]/.test(e))};b.hasSpecialCharacters=function(e){return(/[!@#$%^&*()]/.test(e))};b.passwordErrors=function(U){var T=$(this);setTimeout(function(){var e=T.val();if(e.length<6||e.length>14){$("#charCnt").removeClass("success").addClass("error") }else{$("#charCnt").removeClass("error").addClass("success")}if(b.hasLowerCase(e)){$("#lwCnt").removeClass("error").addClass("success")}else{$("#lwCnt").removeClass("success").addClass("error")}if(b.hasNumber(e)){$("#numCnt").removeClass("error").addClass("success")}else{$("#numCnt").removeClass("success").addClass("error")}if(b.hasSpecialCharacters(e)){$("#spclCharCnt").removeClass("error").addClass("success")}else{$("#spclCharCnt").removeClass("success").addClass("error")}},0)};b.showPassword=function(U){var T=$(this); T.prev().attr("type","text");T.removeClass("view-password").addClass("hide-password")};b.hidePassword=function(U){var T=$(this);T.prev().attr("type","password");T.removeClass("hide-password").addClass("view-password")};b.showPasswordCondition=function(T){T.stopPropagation();$(".password-conditions").show()};b.stopEventProp=function(T){T.stopPropagation()};b.setLoginType=function(e){t=e};b.getLoginType=function(){return t};b.setPageName=function(e){E=(e==="email"?"Email":"MobNo")};b.getPageName=function(){return E };b.setScreenName=function(e){q=e};b.getScreenName=function(e){return q};b.setAndGetJssoCrosswalkObj=function(){var e={};if(typeof m==="object"){e=m}else{if(typeof JssoCrosswalk==="function"){m=new JssoCrosswalk("toi","web");e=m}}return e};b.showLoader=function(){$("#user-sign-in").addClass("loader")};b.hideLoader=function(){$("#user-sign-in").removeClass("loader")};b.closeBtnHandler=function(){h.loginPopup.removeClass("active");$("body").removeClass("disable-scroll");if(typeof grecaptcha==="object"&&$("#toi-register").is(":visible")&&b.showCaptcha()){grecaptcha.reset(a) }};b.init=function(e){var T=function(){h.loginPopup.show();b.updateConfig(e);if(F.renderer===true){b.onStatusChange(function(U){b.renderPlugins(U)})}b.isLoggedIn(function(){});b.initActions()};TimesApps.checkGdprAndCall(T,b.logout)};b.initActions=function(){h.closeBtn.on("click",function(){b.closeBtnHandler();b.fireGAEvent("Close")});$("[data-plugin='user-isloggedin']").on("click","[data-plugin='user-logout']",function(){b.logout()});$("[data-plugin='user-notloggedin']").on("click","[data-plugin='user-login']",function(){$("body").addClass("disable-scroll"); h.loginPopup.addClass("active");b.showLoginScreen();b.setScreenName("Login_Screen");b.fireGAEvent("Load")}).on("click","[data-plugin='user-register']",function(){b.register()}).on("click","[data-plugin='user-login-facebook']",function(){b.loginWithFacebook()}).on("click","[data-plugin='user-login-twitter']",function(){b.loginWithTwitter()}).on("click","[data-plugin='user-login-google']",function(){b.loginWithGoogle()});$(document).off("keyup").on("keyup",b.closeModalOnEscapeKeyPress);$("#user-sign-in").off("keyup paste",'#toi-login input[name="emailId"]').on("keyup paste",'#toi-login input[name="emailId"]',b.handleEmailIdKeyUp).off("click",'#sso-signInButtonDiv input[type="submit"]').on("click",'#sso-signInButtonDiv input[type="submit"]',b.handleEmailIdClick).off("submit","#toi-login form").on("submit","#toi-login form",b.handleEmailIdClick).off("click","#changeEmailIdDiv").on("click","#changeEmailIdDiv",b.changeEmailIdHandler).off("click","#changeRegisterEmailId").on("click","#changeRegisterEmailId",b.changeRegisterEmailIdHandler).off("click","#sso-forgot-pass").on("click","#sso-forgot-pass",b.forgotPasswordHandler).off("click","#sso-fb-login").on("click","#sso-fb-login",b.fbLoginHandler).off("click","#sso-gplus-login").on("click","#sso-gplus-login",b.gplusLoginHandler).off("click","#sso-generate-otp").on("click","#sso-generate-otp",b.loginWithOTP).off("click","#sso-regenerate-otp").on("click","#sso-regenerate-otp",b.regenerateLoginOTP).off("click","#sso-fp-regenerate-otp").on("click","#sso-fp-regenerate-otp",b.fpRegenerateOTP).off("click","#sso-verify-regenerate-otp").on("click","#sso-verify-regenerate-otp",b.verifyPageRegenerateOTP).off("click","#sso-registerBtn").on("click","#sso-registerBtn",b.registerButtonHandler).off("submit","#toi-register form").on("submit","#toi-register form",b.registerButtonHandler).off("click","#sso-verify-btn").on("click","#sso-verify-btn",b.verifyButtonHandler).off("click","#sso-verify-email-btn").on("click","#sso-verify-email-btn",b.verifyEmailButtonHandler).off("submit","#toi-verifyotp-password form").on("submit","#toi-verifyotp-password form",b.verifyButtonHandler).off("click","#sso-fp-btn").on("click","#sso-fp-btn",b.forgotPasswordBtnHandler).off("submit","#toi-forgot-password form").on("submit","#toi-forgot-password form",b.forgotPasswordBtnHandler).off("focus",'input[name="registerPwd"]').on("focus",'input[name="registerPwd"]',b.showPasswordCondition).off("keyup paste",'#toi-register input[name="registerPwd"]').on("keyup paste",'#toi-register input[name="registerPwd"]',b.passwordErrors).off("keyup paste",'#toi-register input[type="text"]').on("keyup paste",'#toi-register input[type="text"]',b.registerFormErrorHandler).off("keyup paste",'#toi-register input[name!="registerPwd"][type="password"]').on("keyup paste",'#toi-register input[name!="registerPwd"][type="password"]',b.registerFormErrorHandler).off("change",'#toi-register input[name="agree"]').on("change",'#toi-register input[name="agree"]',b.registerFormErrorHandler).off("focus blur","[placeholder]").on("focus blur","[placeholder]",b.stopEventProp).off("keyup paste","#toi-forgot-password input").on("keyup paste","#toi-forgot-password input",b.fpInputKeyupHandler).off("keyup paste",'#toi-verifyotp-password input[name="otpverify"]').on("keyup paste",'#toi-verifyotp-password input[name="otpverify"]',b.enableVerifyButton).off("click",".view-password").on("click",".view-password",b.showPassword).off("click",".hide-password").on("click",".hide-password",b.hidePassword) };h.loginPopup.off("click").on("click",function(T){if(T.srcElement&&T.srcElement.id==="login-popup"){h.closeBtn.click()}});b.updateConfig(u);return b});define("times/login",["times/usermanagement"],function(a){return a});define("localstoragec",["cookie"],function(a){var b={};b.isEnabled=function(){return typeof(Storage)!=="undefined"};b.checkExpiry=function(c){var d=localStorage.getItem(c);if(d&&!(d.hasOwnProperty("timestamp")&&d.hasOwnProperty("expires"))){return c}if(d&&(Number(new Date().getTime())-Number(d.timestamp)>Number(d.expires)*60*60*24*1000)){localStorage.removeItem(c); return}return c};b.set=function(f,h,c,k,g,j){try{var d={value:h,timestamp:new Date().getTime(),expires:c};localStorage.setItem(f,JSON.stringify(d))}catch(i){a.set(f,h,c,k,g,j)}};b.get=function(d){var e="";try{e=JSON.parse(localStorage.getItem(d))}catch(c){e=localStorage.getItem(d)}return(e&&e.value)?e.value:e};b.csget=function(c){return(b.isEnabled()&&b.get(c))?b.get(c):a.get(c)};b.remove=function(c){return localStorage.removeItem(c)};return b});define("toi/api",["times/api"],function(b){var a=b; return a});define("plugin/plugin",["load","util","event","ui","logger","is"],function(g,e,b,f,i,d){var c={init:true,root:"body",dependency:function(j){this.dep_data={};if(j){j()}}};var h=function(k,j){if(!k){throw new Error("'id' param is required.")}this.id=k;this.updateConfig(j)};h.prototype.updateConfig=function(j){this.config=e.extend(true,{},c,j)};h.prototype.find=function(){return $(this.config.root).find("[data-plugin='"+this.id+"']")};h.prototype.init=function(){b.publish(a("beforeinit")); if(d.funct(this.config.dependency)){var j=this;this.config.dependency(function(){j.render()})}else{this.render()}};h.prototype.render=function(){b.publish(a("beforerender"));var j=this;this.find().each(function(k,l){j.renderEach(l)});b.publish(a("afterrender"))};h.prototype.renderEach=function(j){};var a=function(j){return"plugin."+this.id+j};return h});define("plugin/dynamic",["timer","util","plugin/plugin"],function(d,a,c){var b=new c("dynamic-uptime");b.uptime=function(){var e=$("[data-plugin='dynamic-uptime']"); e.each(function(f,g){b.renderEach(g)})};b.renderEach=function(g){var f=$(g);var h=f.attr("data-time");var e=d.elapsedTime(h,{minute:"min",second:"sec"},true);f.html(e)};d.every(60000,function(){b.render()});b.init();return b});define("toicommonjs/rodate",[],function(){var a={};a.uptime=function(){var b=$("[rodate]");b.each(function(c,d){a.renderEach(d)})};a.renderEach=function(e){var d=$(e);var f=d.attr("rodate");var c=f.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);if(!c){f=f.replace(" hrs IST",""); f=f.splice(-2,0,":");rod=new Date(f);c=["",rod.getYear()+1900,rod.getMonth()+1,rod.getDate(),rod.getHours(),rod.getMinutes(),rod.getSeconds()]}var b=a.elapsedTime(new Date(c[1],c[2]-1,c[3],c[4],c[5],c[6]).getTime(),{minute:"min",second:"sec"},true);d.html(b)};a.elapsedTime=function(j,d,b){if(typeof j!=="number"){return""}var n={year:"year",day:"day",hour:"hour",minute:"minute",second:"second",ago:"ago"};var h=$.extend({},n,d);var m=[{name:h.year,div:31536000000,mod:10000},{name:h.day,div:86400000,mod:365},{name:h.hour,div:3600000,mod:24},{name:h.minute,div:60000,mod:60},{name:h.second,div:1000,mod:60}]; var g=0,e=m.length,f,k=[],c=new Date().getTime()-j;while(g=0){k.push(f+" "+m[g].name+(f>1?"s":""))}g+=1}if(k.length===0){k.push("1 "+h.second)}if(b===true){return k[0]+" "+h.ago}else{return k.join(", ")+" "+h.ago}};return a});define("plugin/lazy",["event","ui","module","util"],function(e,g,d,b){var a={};var f={skew:1000,error_image:null};var c=b.extend(true,{},f,d.config());a.init=function(){var h=this;h.load();e.subscribe("window.scroll",function(){h.load() })};a.load=function(){var i=this;var h=$("[data-src]");h.each(function(j,k){if(g.inView(k,true,c.skew)){i.loadEach(k)}})};a.loadEach=function(i){var h=$(i);var j=h.attr("data-err");if(j&&j.length>0){(function(k){h.error(function(){$(this).attr("src",k)})}(j))}else{if(c.error_image){h.error(function(){$(this).attr("src",c.error_image)})}}h.attr("src",h.attr("data-src"));h.removeAttr("data-src")};a.init();return a});define("comments",["util","ui","jquery","module","is","plugin/lazy","event"],function(h,j,f,b,g,c,a){var e={gravatar:false,wrapper:"#comment-section",main:"#comments",comment:"[data-plugin='comment']",tmpl:"comment_tmpl",count:"[data-plugin='comments-count']",post_button:"[data-plugin='comment-post']",comment_input:"[data-plugin='comment-input']",form:"[data-plugin='comment-form']",loadonscroll:true}; var d=function(k){this.config=h.extend(true,{},k)};d.config=h.extend(true,{},e,b.config());var i=[{text:"Hello World",name:"Del Sanic",image:"http://www.gravatar.com/avatar/?d=identicon",uid:"123456",badge:[{name:"Silver"},{name:"Gold"}]},{text:"Test Comment",name:"John",image:"http://www.gravatar.com/avatar/?d=identicon",uid:"123457",badge:[{name:"Silver"},{name:"Gold"}]}];d.getConfig=function(){return this.config};d.prototype.getConfig=function(){return this.config};d.prototype.initialize=function(){var k=this; this.comments=[];this.getData(function(m,l){k.renderCommentCount(l||(m?m.length:0));if(m&&m.length>0){k.renderNoComment(false);k.render(m)}else{k.renderNoComment(true)}});if(k.config.loadonscroll===true){(function(l){a.subscribe("window.scroll",function(){l.loadNextPg()})})(k)}};d.prototype.getData=function(k){k(i)};d.prototype.renderCommentCount=function(l,k){f("[data-plugin='comment-count']").text(l)};d.prototype.renderNoComment=function(k){if(k){f("[data-plugin='comment-none']").show()}else{f("[data-plugin='comment-none']").hide() }};d.prototype.render=function(n,o,k){var m=this;if(n){var l=f(m.config.main);if(k==false||typeof k==="undefined"){l.empty()}h.each(n,function(q,p){l.append(m.renderEach(q,p));if(o){o(n)}});c.load()}};d.prototype.renderEach=function(k,l){if(this.config.tmpl&&f.fn.render){return this.renderUsingTemplate(k,l,this.config.tmpl)}else{return this.renderUsingjQuery(k,l)}};d.prototype.renderUsingTemplate=function(m,n,l,k){return f("#"+l).render(n)};d.prototype.renderUsingjQuery=function(l,m){var k=f("
  • "); k.text(m.name+": "+m.text);return k};d.prototype.loadingDiv=function(k){f("[data-plugin='comment-loading']").text(k)};d.prototype.loadNextPg=function(){var k=this;if(k.isLoading===0&&j.inView(k.config.main+" .comment:last-child",true,1000)){k.loadComment(k.config.commentType,function(l){},true,++k.config.curpg)}};d.prototype.loading=function(k){this.loadingDiv("Loading...");this.isLoading=1};d.prototype.loaded=function(){this.loadingDiv("");this.isLoading=0;a.publish("comments.loaded",this);if(this.config.loadonscroll==false){f(this.config.main).append("
    View 25 more
    ") }};d.prototype.loadedAll=function(){this.loadingDiv("Loaded all comments");f(this.config.main+" .loadmore").hide();if(this.comments.length==0){a.publish("comments.loaded.none",this)}else{if(this.comments.length>=0){a.publish("comments.loaded.all",this)}}this.isLoading=2};return d});define("compatibility",["jquery"],function(b){var a={};if(!Array.prototype.indexOf){Array.prototype.indexOf=a.Array_indexOf=function(c,d){if(this===undefined||this===null){throw new TypeError('"this" is null or not defined') }var e=this.length>>>0;d=+d||0;if(Math.abs(d)===Infinity){d=0}if(d<0){d+=e;if(d<0){d=0}}for(;d0||k.parse===true){if(h.beforeloadjs){h.beforeloadjs()}if(h.js&&(h.isJSdependent(j)||k.parse===true)){g.js(h.js,function(m,l){return function(){if(h.afterloadjs){h.afterloadjs()}h.initPlugins(l)}}(h,j),h.js_id)}else{h.initPlugins(j)}}};this.find=function(){return f("[data-plugin^='"+this.id+"-']")};this.isJSdependent=function(j){for(var k=0;k0&&j!=="#")?j:document.location.href;k=k.split("#")[0];if(k&&k.length>2&&k[0]==="/"&&k[1]!=="/"){k=location.protocol+"//"+location.host+k}return k};this._share=function(n,q,m,p){d.publish("social.onBeforeShare",{params:q,element:p,network:this.id});var o=this.getAbsoluteUrl(n);var l="social_share_"+new Date().getTime();var j=f.extend({name:l,width:700,height:400},m);var k=e.window(o+"?"+f.param(q),j);if(k){k.moveTo(275,275) }}};a.onBeforeShare=function(h){d.subscribe("social.onBeforeShare",h)};return a});define("social/facebook",["social/social","ui","logger","event","util","module","jquery","ajax","is"],function(b,m,o,a,k,c,i,n,j){var g={parse:false,init:true,appid:null,js:"//connect.facebook.net/en_US/sdk.js",js_id:"facebook-jssdk",load_js:false,share_url:"http://www.facebook.com/sharer.php",oauth:false,status:false,xfbml:false,fb_version:"v2.0",share_params:function(q,t,p,r){return{"url[url]":q}}};var e=k.extend(true,{},g,c.config()); var l=new b("facebook","facebook");l.setJS(e.js,e.js_id);var d=l.isJSdependent;l.isJSdependent=function(p){return e.load_js||d(p)};l.addPlugin({id:"like",js:true,init:function(u,r){var q=i(u);var t=k.data(u);var p={href:location.href,layout:"button_count","show-faces":"false",width:"100",action:"like",share:false};var w=k.extend(true,{},p,t);w.href=t.url||t.href||q.attr("href")||w.href;var v=i("
    ");i.each(w,function(x,y){v.attr("data-"+x,y)});q.empty();q.append(v);l.parse(u) }});l.addPlugin({id:"comments",js:true,init:function(v,t){var r=i(v);var u=k.data(v);var q={href:location.href,colorscheme:"light",numposts:10};var w=k.extend(true,{},q,u);w.href=u.url||u.href||r.attr("href")||w.href;var p=i("
    ");i.each(w,function(x,y){p.attr("data-"+x,y)});r.empty();r.append(p);l.parse(r[0])}});l.addPlugin({id:"share",alias:["button"],events:{click:function(q){var p=k.data(this);l.share(p.url||i(this).attr("href"),p.title,p.summary,p.image,this)}}}); l.share=function(q,v,p,u,r){if(false&&window.FB&&e.appid){FB.ui({method:"feed",display:"popup",link:l.getAbsoluteUrl(q),picture:l.getAbsoluteUrl(u),name:v,description:p},function(w){})}else{var t={u:l.getAbsoluteUrl(q),display:"popup",sdk:"joey"};if(!j.empty(e.appid)){t.app_id=e.appid}l._share(e.share_url,t,{name:"facebook_share_dialog",width:626,height:436},r)}};l.addPlugin({id:"follow",events:{click:function(p){l.follow(i(this).attr("data-url")||i(this).attr("href"))}},init:function(q,p){}});l.follow=function(q,p){var r=l.getAbsoluteUrl(q); var t=window.open(q,"_blank");t.focus()};l.addPlugin({id:"login",js:true,events:{click:function(p){l.login()}}});var h=null;l.parse=function(p){if(typeof FB!=="undefined"){FB.XFBML.parse(p)}else{o.warn("'FB' is required in parse")}};l.getGrantedPermissions=function(p){if(typeof FB!=="undefined"){l.api("/me/permissions",function(q){if(p){p(q)}})}else{o.warn("'FB' is required in login")}};l.hasPermissions=function(p,q){if(typeof FB!=="undefined"){l.api("/me/permissions",function(v){if(v&&v.data&&v.data.length>0){var t=typeof p==="string"?p.split(","):(p instanceof Array?p:[]); for(var r=0;r");p.attr("id",q);p.css("display","none");i("body").append(p)}return p};l.beforeinit=function(){if(!e.appid){o.warn("'config.appid' is Required") }};l.beforeloadjs=function(){l._createFBroot()};l.afterloadjs=function(){if(typeof FB!=="undefined"){o.log("FB js loaded");if(e.init===true){FB.init({appId:e.appid,oauth:e.oauth,status:e.status,cookie:true,xfbml:e.xfbml,version:e.fb_version})}a.publish("FB.onload",FB);FB.Event.subscribe("comment.create",function(p){a.publish("FB.comment.create",p)});FB.Event.subscribe("auth.authResponseChange",function(p){a.publish("FB.auth.authResponseChange",p);if(p.status==="connected"){var r=p.authResponse.userID; var q=p.authResponse.accessToken;a.publish("FB.auth.authResponseChange.connected",p);a.publish("FB.connected",FB)}else{if(p.status==="not_authorized"){a.publish("FB.auth.authResponseChange.not_authorised",p)}else{a.publish("FB.auth.authResponseChange.failed",p)}}})}else{o.warn("'FB' is required in afterloadjs")}};var f=null;l.getUser=function(p){if(typeof FB!=="undefined"&&!f){FB.api("/me",function(q){if(p){f=q;p(q)}})}else{if(p){p(f)}}};l.onlogin=function(p){a.subscribe("FB.auth.authResponseChange.connected",function(q){l.getUser(function(r){if(p){p(r,q) }})})};l.oncomment=function(p){a.subscribe("FB.comment.create",function(q){l.getUser(function(r){if(p){p(r,q)}})})};l.onlogout=function(p){a.subscribe(["FB.auth.authResponseChange.not_authorised","FB.auth.authResponseChange.failed"],function(q){if(p){f=null;p(q)}})};l.fql=function(p,q){if(typeof FB!=="undefined"){o.log(p);FB.api({method:"fql.query",query:p},q)}else{o.warn("'FB' is required in fql")}};l.getLikes=function(p){if(typeof FB!=="undefined"){FB.api("/me/likes",function(q){if(p){f=q;p(q)}}) }};l.getLikesByCategory=function(q,t){if(q.length>0&&j.string(q)){q=q.split(",")}var p=[];if(q.length>0){k.each(q,function(w,u){p.push("type='"+u+"'")})}var r=p.length>0?"AND ("+p.join(" OR ")+")":"";l.getUser(function(u){if(u){l.fql("select name from page where page_id in (SELECT page_id FROM page WHERE page_id IN (SELECT uid, page_id, type FROM page_fan WHERE uid=me()) "+r+")",function(v){if(t){t(v)}})}else{o.warn("User is not logged in. Cannot run facebook.getLikesByCategory.")}})};l.paging=l.pageNext=function(p,q){if(p&&p.paging&&p.paging.next){return n.getJSONP(p.paging.next,q) }else{q(null)}};l.pagePrev=function(p,q){if(p&&p.paging&&p.paging.previous){return n.getJSONP(p.paging.previous,q)}else{q(null)}};l.getRegisteredUsersTxt=function(p){l.getRegisteredUsers(function(q){if(p){if(q.length==1){p(q[0].name+" has planned his/her trips on HappyTrips.com.",q)}else{if(q.length>1){p(q.length+" of your friends have planned their trips on HappyTrips.com",q)}else{p("None of your friends have planned their trips on HappyTrips.com.",q)}}}})};l.getRegisteredUsers=function(p){l.fql("SELECT uid,name,pic_square_with_logo FROM user WHERE is_app_user AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())",p) };l.api=function(){var p=arguments[0];var t=typeof arguments[1]==="string"?arguments[1]:"GET";var q=typeof arguments[2]==="object"?arguments[2]:{};var r=typeof arguments[1]==="function"?arguments[1]:(typeof arguments[2]==="function"?arguments[2]:(typeof arguments[3]==="function"?arguments[3]:null));if(typeof FB!=="undefined"){o.debug(p);FB.api(p,t,q,function(u){if(r){r(u)}})}else{o.warn("'FB' is required in api")}};l.getCheckins=function(p){l.api("/me/locations",p)};l.post=function(q,r){var p=typeof arguments[0]==="string"?{message:arguments[0]}:arguments[0]; l.login("publish_stream",function(){l.api("/me/feed","POST",p,r)})};l.checkin=function(q,p,r){l.post({message:q,place:p},r)};l.init(e);return l});define("ext/date",[],function(){!function(b,g){var f=/(["'])((?:[^\\]|\\.)*?)\1|YYYY|([MD])\3\3(\3?)|SS|([YMDHhmsW])(\5?)|[uUAZSwo]/g,a=/(\d{4})[-.\/](\d\d?)[-.\/](\d\d?)/,h=/(\d\d?)[-.\/](\d\d?)[-.\/](\d{4})/,d=/(\d\d?):(\d\d):?(\d\d)?\.?(\d{3})?(?:\s*(?:(a)|(p))\.?m\.?)?(\s*(?:Z|GMT|UTC)?(?:([-+]\d\d):?(\d\d)?)?)?/i,c=/.[a-z]+/g,e=/\\(.)/g;b[g].format=function(i){i=b.masks[i]||i||b.masks["default"]; var j=this,k="get"+(i.slice(0,4)=="UTC:"?(i=i.slice(4),"UTC"):"");return i.replace(f,function(m,l,q,p,n,r,o){q=r=="Y"?j[k+"FullYear"]()%100:m=="YYYY"?j[k+"FullYear"]():r=="M"?j[k+"Month"]()+1:p=="M"?b.monthNames[j[k+"Month"]()+(n?12:0)]:r=="D"?j[k+"Date"]():p=="D"?b.dayNames[j[k+"Day"]()+(n?7:0)]:r=="H"?j[k+"Hours"]()%12||12:r=="h"?j[k+"Hours"]():r=="m"?j[k+"Minutes"]():r=="s"?j[k+"Seconds"]():m=="S"?j[k+"Milliseconds"]():m=="SS"?(l=j[k+"Milliseconds"](),l>99?l:(l>9?"0":"00")+l):m=="u"?(j/1000)>>>0:m=="U"?+j:m=="A"?b[j[k+"Hours"]()>11?"pm":"am"]:m=="Z"?"GMT "+(-j.getTimezoneOffset()/60):m=="w"?j[k+"Day"]()||7:r=="W"?(l=new b(+j+((4-(j[k+"Day"]()||7))*86400000)),Math.ceil(((l.getTime()-l["s"+k.slice(1)+"Month"](0,1))/86400000+1)/7)):m=="o"?new b(+j+((4-(j[k+"Day"]()||7))*86400000))[k+"FullYear"]():l?q.replace(e,"$1"):m; return o&&q<10?"0"+q:q})};b.am="AM";b.pm="PM";b.masks={"default":"DDD MMM DD YYYY hh:mm:ss",isoUtcDateTime:'UTC:YYYY-MM-DD"T"hh:mm:ss"Z"'};b.monthNames="JanFebMarAprMayJunJulAugSepOctNovDecJanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember".match(c);b.dayNames="SunMonTueWedThuFriSatSundayMondayTuesdayWednesdayThursdayFridaySaturday".match(c);String[g].date=Number[g].date=function(k){var i,j,l=new b,o=+this||""+this;if(isNaN(o)){if(i=o.match(a)){l.setFullYear(i[1],i[2]-1,i[3]) }else{if(i=o.match(h)){j=b.middle_endian?1:2;l.setFullYear(i[3],i[j]-1,i[3-j])}}i=o.match(d)||[0,0,0];l.setHours(i[6]&&i[1]<12?+i[1]+12:i[5]&&i[1]==12?0:i[1],i[2],i[3]|0,i[4]|0);if(i[7]){l.setTime(l-((l.getTimezoneOffset()+(i[8]|0)*60+((i[8]<0?-1:1)*(i[9]|0)))*60000))}}else{l.setTime(o<4294967296?o*1000:o)}return k?l.format(k):l}}(Date,"prototype");return{}});define("times/comments",["comments","ajax","plugin/dynamic","util","login","times/api","event","ui","jquery","is","string","plugin/lazy","cookie","json","logger","module","timer","analytics/mytimes","compatibility","social/facebook","page","user","ext/date"],function(comments,ajax,dynamic,util,login,api,event,ui,$,is,string,lazy,cookie,json,logger,module,timer,mytimes,compatibility,facebook,page,userClass,ext_date){var CONSTANT={RATE_TYPE:{AGREE:100,DISAGREE:101,RECOMMEND:102,OFFENSIVE:103}}; var default_config={validation:{minlength:1},loadCommentFromMytimes:false,loadonscroll:true,sendCommentLiveEmail:true,loginRequiredForRating:true,maxchar:3000,share_url:"/share.cms",verify_comment_url:"/json/cmtverified.cms",messages:{name_required:"Please enter your name.",location_required:"Please enter your location.",captcha_required:"Please enter captcha value.",name_toolong:"Name cannot be longer than 30 chars.",name_not_string:"Name can only contain alphabets.",location_toolong:"Location cannot be longer than 30 chars.",location_not_string:"Location can only contain alphabets.",captcha_toolong:"Captcha cannot be longer than 4 chars.",captcha_number_only:"Captcha value can only be a number.",email_required:"Please enter your email address.",email_invalid:"Please enter a valid email address.",captcha_invalid:"Please enter a valid captcha value.",minlength:"You can't post this comment as the length it is too short. ",blank:"You can't post this comment as it is blank.",maxlength:"You have entered more than 3000 characters.",popup_blocked:"Popup is blocked.",has_url:"You can't post this comment as it contains URL.",duplicate:"You can't post this comment as it is identical to the previous one.",abusive:"You can't post this comment as it contains inappropriate content.",self_agree:"You can't Agree with your own comment",self_disagree:"You can't Disagree with your own comment",self_recommend:"You can't Recommend your own comment",self_offensive:"You can't mark your own comment as Offensive",already_agree:"You have already Agreed with this comment",already_disagree:"You have already Disagreed with this comment",already_recommended:"You have already Recommended this comment",already_offensive:"You have already marked this comment Offensive",cant_agree_disagree:"You can't Agree and Disagree with the same comment",cant_agree_offensive:"You can't Agree and mark the same comment Offensive",cant_disagree_recommend:"You can't Disagree and Recommend the same comment",cant_recommend_offensive:"You can't Recommend and mark the same comment Offensive",permission_facebook:"You can't post to facebook. Post permission is required.",offensive_reason:"Please select a reason.",offensive_reason_text:"Please enter a reason.",offensive_reason_text_limit:"Please enter less than 200 chars."}}; var times_comments=comments;comments.config=util.extend(true,{},comments.config,default_config,module.config());times_comments.prototype.updateConfig=function(update_config){};var commentType="comments";times_comments.prototype.initialize=function(){var tthis=this;this.config=util.extend(true,{},comments.config,this.config);tthis.comments=[];tthis.commentCount=0;tthis.countPresent=false;tthis.pageCount=1;tthis.config.comment_block_count=25;tthis.config.commentType=tthis.config.commentType||commentType; tthis.config.attachReplyAction=tthis.config.attachReplyAction!==false;tthis.config.attachOpinionAction=tthis.config.attachOpinionAction!==false;tthis.config.opinions=[{name:"Agree",id:"agree"},{name:"Disagree",id:"disagree"},{name:"Recommend",id:"recommended"},{name:"Offensive",id:"offensive"}];if(tthis.config.attachOpinionAction===true){tthis.attachOpinionAction()}if(tthis.config.attachReplyAction===true){tthis.attachReplyAction()}this.getData(function(data,commentCount){tthis.renderCommentCount(commentCount||(data?data.length:0)); if(data&&data.length>0){tthis.renderNoComment(false);tthis.render(data)}else{tthis.renderNoComment(true)}tthis.verifyEmailComment()});(function(tthis){event.subscribe("window.scroll",function(){var config=tthis.getConfig();if(tthis.config.loadonscroll===true&&tthis.isLoading===0&&ui.inView(tthis.config.main+" [data-plugin='comment']:last-child",true,200)){tthis.loadComment(tthis.config.commentType,function(data){},true,++tthis.pageCount)}})})(tthis)};times_comments.run=function(){var msid=window.msid; var toi_comment={};toi_comment.comments=new comments({main:"#comments",msid:msid});toi_comment.comments.initialize();$("#comment_sort").change(function(){var rootid=$(this).val();var id="comments"+(rootid&&rootid.length>0?"_"+rootid:"");$(".comments-list").hide();$("#"+id).show();$(".comment-section .noComment").hide();if(toi_comment[id]){toi_comment[id].updateAfterCommentsLoaded();toi_comment[id].attachReplyAction();toi_comment[id].attachOpinionAction();toi_comment[id].updateCachedRating()}else{toi_comment[id]=new comments({main:"#"+id,msid:msid,commentType:id}); toi_comment[id].initialize()}$("[data-plugin='comment-error-outer']").text("");$("[data-plugin='comment-error']").text("")});event.subscribe("user.status",function(user){if(!user){$("[data-plugin='comment-error-outer']").text("");$("[data-plugin='comment-error']").text("")}toi_comment.comments.markFollowingAll()});event.subscribe("comments.loaded",function(commentObj){logger.log("comments.loaded:"+commentObj.config.commentType);commentObj.updateAfterCommentsLoaded()});event.subscribe("comments.loaded.none",function(commentObj){logger.log("comments.loaded.none:"+commentObj.config.commentType); commentObj.updateAfterCommentsLoaded()});event.subscribe("login.error",function(err){if(err&&err.error){logger.error(err.error)}else{logger.error(err)}});return toi_comment};times_comments.prototype.attachUserToComment=function(commentObj,user){logger.log("Attaching user to comment");commentObj.user={id:user.getId(),name:user.getFullName(),username:user.getUsername(),location:user.getCITY(),image:user.getThumb(),email:user.getEmail()}};times_comments.prototype.updateAfterCommentsLoaded=function(){var commentObj=this; if(commentObj.config.commentType==="comments"){if(commentObj.comments.length>0){logger.log("updateAfterCommentsLoaded : comments.loaded:"+commentObj.config.commentType);$(".comment-section .sortby").show()}else{logger.log("updateAfterCommentsLoaded : comments.loaded.none:"+commentObj.config.commentType);$(".comment-section .sortby").hide();$(".comment-section .noComment").text("Be the first one to review.").show()}}if(commentObj.countPresent!==true){logger.log("updateAfterCommentsLoaded : countPresent:false:"+commentObj.config.commentType); if(commentObj.config.commentType==="comments_discussed"){$(".comment-section .noComment").text("None of the comments have been discussed.").show()}else{if(commentObj.config.commentType==="comments_agree"){$(".comment-section .noComment").text("None of the comments have been up voted.").show()}else{if(commentObj.config.commentType==="comments_disagree"){$(".comment-section .noComment").text("None of the comments have been down voted.").show()}}}}};times_comments.prototype.renderCommentCount=function(count){function displayCount(type,cnt){$("[data-plugin='comment-count"+(type?"-"+type:"")+"']").text(cnt?cnt:"0") }if(is.object(count)){displayCount("",count.newest);displayCount("oldest",count.oldest);displayCount("recommended",count.recommended);displayCount("discussed",count.discussed);displayCount("agree",count.agree);displayCount("disagree",count.disagree)}else{displayCount("",count)}};times_comments.prototype.loadComment=function(commentType,callback,append,curpg){var tthis=this;if(tthis.config.loadCommentFromMytimes==true){tthis._loadCommentMytimes(commentType,function(data){tthis.render(data,callback,append) },curpg)}else{tthis._loadComment(commentType,function(data){tthis.render(data,callback,append)},curpg)}};times_comments.prototype.getData=function(callback){var tthis=this;if(tthis.config.loadCommentFromMytimes==true){this._loadCommentMytimes(this.config.commentType,callback)}else{this._loadComment(this.config.commentType,callback)}};times_comments.prototype._loadComment=function(commentType,callback,curpg){var tthis=this;var config=tthis.config;tthis.loading();logger.log("loading comments: "+config.msid); api.api(commentType,{msid:config.msid,curpg:curpg||1},function(comments_data){logger.log("loaded comments: "+config.msid);var commentsD=comments_data.articlecomment||comments_data.new_cmtofart2_nit||comments_data.new_cmtofart2_nit_v1||comments_data.articleshow_othcmtofart||comments_data.new_cmtofart2_nit_sub_dev||(comments_data.mytuserdata?comments_data:null);var userData=commentsD.mytuserdata&&commentsD.mytuserdata.array?(is.array(commentsD.mytuserdata.array)?commentsD.mytuserdata.array:[commentsD.mytuserdata.array]):null; var commentsData=commentsD.rothrd&&commentsD.rothrd.op?(is.array(commentsD.rothrd.op)?commentsD.rothrd.op:[commentsD.rothrd.op]):null;if(!commentsData||commentsData.length==0){tthis.loadedAll();callback([]);return null}var commentCount={total:commentsD.rothrd.opctr,newest:commentsD.rothrd.opctr,oldest:commentsD.rothrd.opctr,recommended:commentsD.rothrd.recommendcount,discussed:commentsD.rothrd.opctrtopcnt,disagree:commentsD.rothrd.disagreecount,agree:commentsD.rothrd.agreecount};var commentPageCount={comments:Math.ceil(commentsD.rothrd.opctrtopcnt/config.comment_block_count),comments_oldest:Math.ceil(commentsD.rothrd.opctrtopcnt/config.comment_block_count),comments_recommended:Math.ceil(commentsD.rothrd.recommendcount/config.comment_block_count),comments_discussed:Math.ceil(commentsD.rothrd.opctrtopcnt/config.comment_block_count),comments_disagree:Math.ceil(commentsD.rothrd.disagreecount/config.comment_block_count),comments_agree:Math.ceil(commentsD.rothrd.agreecount/config.comment_block_count)}; var users=[];var i=0;if(userData){for(i=0;i").text(cmt.optext).html():"",level:cmt.level,parentuid:cmt.parentuid,parentusername:cmt.parentusername,time:cmt.rodate?util.getDate(cmt.rodate).getTime():"",abstime:cmt.rodate,opinion:(function(cmt){var opinions=[]; if(tthis.config.opinions){for(var o=0;o0?opinions:null}(cmt)),user:{id:user&&user._id?user._id:cmt.roaltdetails.fromname,username:user?user.D_N_U:null,name:cmt.roaltdetails.fromname||(user&&user.FL_N?user.FL_N:""),location:user&&user.CITY&&!is.object(user.CITY)&&!is.empty(user.CITY)?user.CITY:(!is.empty(cmt.roaltdetails.location)&&!is.object(cmt.roaltdetails.location)?cmt.roaltdetails.location:null),image:user&&user.thumb?user.thumb:cmt.roaltdetails.imageurl,email:user?user.sso:"",followers:user?user.F_C:0,follower_text:(user?user.F_C:0)>1?("("+user.F_C+" followers)"):((user?user.F_C:"")>0?"("+user.F_C+" follower)":""),points:user&&user.reward&&user.reward.user&&user.reward.user.statusPoints?user.reward.user.statusPoints:null,pointslevel:user&&user.reward&&user.reward.user&&user.reward.user.levelName?user.reward.user.levelName:null,pointsNeeded:(function(user){var points_needed=""; var user_points=user&&user.reward&&user.reward.user&&user.reward.user.statusPoints?user.reward.user.statusPoints:null;if(user_points==null||user_points<250){points_needed=250-user_points}else{if(user_points>249&&user_points<5000){points_needed=5000-user_points}else{if(user_points>4999&&user_points<25000){points_needed=25000-user_points}else{if(user_points>24999&&user_points<250000){points_needed=250000-user_points}}}}return points_needed}(user)),badge:(function(user){var badges=[];if(user&&user.rewardpoint&&user.rewardpoint.userbadges&&user.rewardpoint.userbadges.activityBadge){var activityBadge=user.rewardpoint.userbadges.activityBadge; if(!is.array(activityBadge)){activityBadge=[activityBadge]}for(var d=0;d0?badges:null}(user))}};commentsResult.push(comment);logger.log("Parsed comment "+c)}tthis.comments=tthis.comments.concat(commentsResult);logger.log("rendering "+commentsResult.length+" comments");callback(commentsResult,commentCount); logger.log("rendered "+commentsResult.length+" comments");tthis.loaded();var curpgn=curpg||1;if(tthis.config.loadonscroll==false&&!commentsResult||!(curpgn").html(cmt.C_T).text():"",level:level,parentuid:cmt.O_ID,parentusername:cmt.O_D_N,time:(cmt.A_DT?util.getDate(parseInt(cmt.A_DT,10)).getTime():""),abstime:cmt.A_DT?util.getDate(parseInt(cmt.A_DT,10)).format("DD MMM, YYYY HH:mm A"):"",opinion:(function(cmt){var opinions=[];opinions.push({name:"Agree",id:"AC_A_C",count:cmt.AC_A_C});opinions.push({name:"Disagree",id:"AC_D_C",count:cmt.AC_D_C}); opinions.push({name:"Recommend",id:"AC_R_C",count:cmt.AC_R_C});opinions.push({name:"Offensive",id:"AC_O_C",count:cmt.AC_O_C});return opinions.length>0?opinions:null}(cmt)),user:{id:user&&user._id?user._id:null,username:user&&user.D_N_U?user.D_N_U:null,name:user&&user.FL_N?user.FL_N:"",location:user&&user.CITY&&!is.object(user.CITY)&&!is.empty(user.CITY)?user.CITY:null,image:user&&user.thumb?user.thumb:"",email:user&&user.sso?user.sso:"",followers:user&&user.F_C?user.F_C:0,follower_text:(user?user.F_C:0)>1?("("+user.F_C+" followers)"):((user?user.F_C:"")>0?"("+user.F_C+" follower)":""),points:user&&user.reward&&user.reward.user&&user.reward.user.statusPoints?user.reward.user.statusPoints:null,pointslevel:user&&user.reward&&user.reward.user&&user.reward.user.levelName?user.reward.user.levelName:null,pointsNeeded:(function(user){var points_needed=""; var user_points=user&&user.reward&&user.reward.user&&user.reward.user.statusPoints?user.reward.user.statusPoints:null;if(user_points==null||user_points<250){points_needed=250-user_points}else{if(user_points>249&&user_points<5000){points_needed=5000-user_points}else{if(user_points>4999&&user_points<25000){points_needed=25000-user_points}else{if(user_points>24999&&user_points<250000){points_needed=250000-user_points}}}}return points_needed}(user)),badge:(function(user){var badges=[];if(user&&user.rewardpoint&&user.rewardpoint.userbadges&&user.rewardpoint.userbadges.activityBadge){var activityBadge=user.rewardpoint.userbadges.activityBadge; if(!is.array(activityBadge)){activityBadge=[activityBadge]}for(var d=0;d0?badges:null}(user))}};commentsResult.push(comment);if(cmt.CHILD){for(var cmtChild in cmt.CHILD){tthis.parseComment(cmt.CHILD[cmtChild],commentsResult,level+1)}}};times_comments.prototype._loadCommentMytimes=function(commentType,callback,curpg){var tthis=this; var config=tthis.config;tthis.loading();logger.log("loading comments: "+config.msid);api.api(commentType,{msid:config.msid,pagenum:curpg||1},function(comments_data){logger.log("loaded comments: "+config.msid);var commentsData=comments_data;if(!commentsData||commentsData.length==0){tthis.loadedAll();callback([]);return null}var commentCount={total:commentsData[0].totalcount,newest:commentsData[0].totalcount,oldest:commentsData[0].totalcount,recommended:commentsData[0].totalcount,discussed:commentsData[0].totalcount,disagree:commentsData[0].totalcount,agree:commentsData[0].totalcount}; var commentPageCount={comments:Math.ceil(commentCount.newest/config.comment_block_count),comments_oldest:Math.ceil(commentCount.oldest/config.comment_block_count),comments_recommended:Math.ceil(commentCount.recommended/config.comment_block_count),comments_discussed:Math.ceil(commentCount.discussed/config.comment_block_count),comments_disagree:Math.ceil(commentCount.disagree/config.comment_block_count),comments_agree:Math.ceil(commentCount.agree/config.comment_block_count)};var commentsResult=[];for(var c=1; c100){message=message.substring(0,99)+"..."}window.log=window.log||function(){}; window.popupblocked=0;cookie.remove("fbcheck","/",domainOnly);cookie.remove("twtcheck","/",domainOnly);cookie.set("twtcheck","1",1,"/",domainOnly);cookie.set("usercomt",message,1,"/",domainOnly);var url="/stgredirectpagetest.cms";var twitterPost=ui.window(url,{width:600,height:230,name:"twitterPost",closeCallback:closeCallback});if(twitterPost){twitterPost.moveTo(250,240)}else{window.popupblocked=1;if(is.desktop()){twitterPost=ui.iframe(url,{width:575,height:314,name:"twitterPost",closeCallback:closeCallback}) }else{alert("Popups are blocked. Please enable them.")}}};times_comments.prototype.postToFacebook=function(message,closeCallback){var domainOnly=util.getDomainOnly();var tthis=this;if(window.localStorage){localStorage.setItem("usercomt",message)}window.log=window.log||function(){};window.popupblocked=0;cookie.remove("fbcheck","/",domainOnly);cookie.remove("twtcheck","/",domainOnly);cookie.set("fbcheck","1",1,"/",domainOnly);cookie.set("usercomt",message,1,"/",domainOnly);var url="/stgredirectpagetest.cms"; var facebookPost=ui.window(url,{width:600,height:230,name:"facebookPost",closeCallback:closeCallback});if(facebookPost){facebookPost.moveTo(250,240)}else{window.popupblocked=1;if(is.desktop()){facebookPost=ui.iframe(url,{width:575,height:314,name:"facebookPost",closeCallback:closeCallback})}else{alert("Popups are blocked. Please enable them.")}}};times_comments.prototype.attachOpinionAction=function(){logger.log("Attaching Opinion Action");var tthis=this;var opinions=this.config.opinions;for(var o=0; o200){tthis.error(tthis.config.messages.offensive_reason_text_limit,ref["comment-offensive-error"]);reason=null}else{reason="Others: "+reasonVal}}}}if(reason){tthis.rate(opinionid,CONSTANT.RATE_TYPE.OFFENSIVE,0,function(error,resp){if(error){tthis.error(error,ref["comment-offensive-error"])}else{if(!error&&ref.parent){ref.offensive_popup.addClass("submitted") }}},ref,reason)}});$(tthis.config.wrapper).off("click","[data-action='offensive_popup_close']");$(tthis.config.wrapper).on("click","[data-action='offensive_popup_close']",function(){var ref=ui.getActionReferences(this,tthis.config.comment);if(ref.offensive_popup&&ref.offensive_popup.hasClass("submitted")){ref.parent.find("[data-action='comment-offensive-already']").show();ref.parent.find("[data-action='comment-offensive']").hide()}ref.offensive_popup.hide();return false})};times_comments.prototype.attachReplyAction=function(){logger.log("Attaching Reply Action"); var tthis=this;$(tthis.config.wrapper).off("click","[data-action='comment-reply']");$(tthis.config.wrapper).on("click","[data-action='comment-reply']",function(){var ref=ui.getActionReferences(this,tthis.config.comment);var parent=ref.parent;if(ref["comment-reply"]){ref["comment-reply"].show()}else{var commentForm=$("[data-plugin='comment-form']");var tmpl=$.templates("
    "+commentForm.html()+"
    ");parent.append(tmpl.render([{}])) }ref=ui.getActionReferences(this,tthis.config.comment);tthis.error("",ref["comment-error"]);$("[placeholder]").blur();return false});$(tthis.config.main).off("click",".loadmore");$(tthis.config.main).on("click",".loadmore",function(){$(this).remove();if(tthis.config.loadonscroll==false){tthis.loadComment(tthis.config.commentType,function(data){},true,++tthis.pageCount)}});$(tthis.config.wrapper).off("keyup","[data-plugin='comment-input']");$(tthis.config.wrapper).on("keyup","[data-plugin='comment-input']",function(e){if(e.keyCode===27){var ref=ui.getActionReferences(this,tthis.config.comment); ref["comment-input"].val("");ref["comment-reply"].hide()}});ui.maxlength("[data-plugin='comment-input']",tthis.config.maxchar,function(remainingChar,messageLength){var ref=ui.getActionReferences(this,tthis.config.comment);var parent=ref.parent;var charsrem=ref["comment-input-remaining"];charsrem.text(remainingChar>=0?remainingChar:0);if(tthis.config.messages.maxlength&&messageLength>tthis.config.maxchar){tthis.error(tthis.config.messages.maxlength,ref["comment-error"])}else{tthis.error("",ref["comment-error"]) }},tthis.config.wrapper);$(tthis.config.wrapper).off("click","[data-action='comment-close']");$(tthis.config.wrapper).on("click","[data-action='comment-close']",function(){var ref=ui.getActionReferences(this,tthis.config.comment);var reply=ref["comment-reply"];var input=ref["comment-input"];input.val("");reply.hide();tthis.error("",ref["comment-error"]);return false});tthis.onLoaded(function(tthis){tthis.updateCachedRating();if(tthis.followee){tthis.markFollowingAll()}else{mytimes.getFollowee(function(data){tthis.followee=data; tthis.markFollowingAll()})}lazy.load();dynamic.uptime()});$(tthis.config.wrapper).off("click","[data-plugin='comment-user-follow']");$(tthis.config.wrapper).on("click","[data-plugin='comment-user-follow']",function(){var currentEle=$(this);var currentUser=login.getUser();var ref=ui.getActionReferences(this,tthis.config.comment);var userId=ref.parent.attr("data-userid");var userName=ref.parent.attr("data-user");if(currentUser&¤tUser.getId()!=userId){(function(userId,userName){mytimes.followUser(userId,function(dataa){tthis.followee=tthis.followee||[]; var currFollowee={_id:userId,F_N:userName};tthis.followee.push(currFollowee);tthis.markFollowingId(currFollowee)})}(userId,userName))}else{logger.warn("Cannot follow self.")}});$(tthis.config.wrapper).off("click","[data-plugin='comment-post'],[data-plugin='comment-facebook-post'],[data-plugin='comment-twitter-post'],[data-plugin='comment-google-post'],[data-plugin='comment-email-post']");$(tthis.config.wrapper).on("click","[data-plugin='comment-post'],[data-plugin='comment-facebook-post'],[data-plugin='comment-twitter-post'],[data-plugin='comment-google-post'],[data-plugin='comment-email-post']",function(){event.publish("comment.post.start"); var ref=ui.getActionReferences(this,tthis.config.comment);var parent=ref.parent;var reply=ref["comment-reply"];var errorElement=ref["comment-error"];var reply_input=ref["comment-input"];var parentid=parent.attr("data-id");var parentlevel=parent.attr("data-level");var rootid=parent.attr("data-id");var rootlevel=parent.attr("data-level");var preventInfinite=10;var prevParent=parent;while(rootlevel>1&&--preventInfinite>0){prevParent=prevParent.prev();if(prevParent.attr("data-plugin")==="comment"){rootid=prevParent.attr("data-id"); rootlevel=prevParent.attr("data-level")}else{break}}tthis.error("",errorElement);var val=(reply_input.val()===reply_input.attr("placeholder"))?"":reply_input.val().trim();tthis.add(val,parentid,rootid,rootlevel,function(commentObj,errMsg){tthis.renderComment(commentObj,errMsg);event.publish("comment.post.end")},false,this);return false})};times_comments.prototype.markFollowingAll=function(){var tthis=this;var followees=tthis.followee;var comments=$(tthis.config.wrapper);var user=login.getUser();if(user){logger.info("Showing follow links"); comments.find("[data-plugin='comment-user-follow_wrapper']").show();comments.find("[data-plugin='comment'][data-userid ='"+user.getId()+"'] [data-plugin='comment-user-follow_wrapper']").hide();util.each(followees,function(i,followee){tthis.markFollowingId(followee)})}else{comments.find("[data-plugin='comment-user-follow_wrapper']").hide();logger.info("Follow links : Not logged in.")}};times_comments.prototype.markFollowingId=function(followee){var tthis=this;var user=login.getUser();var comments=$(tthis.config.wrapper); if(user){var foloweeEle=comments.find("[data-userid='"+followee._id+"'] .follow");if(foloweeEle&&foloweeEle.length>0){logger.info("Mark Following : "+user.getFullName()+"("+user.getId()+") >> "+followee.F_N+"("+followee._id+")");tthis.markFollowing(foloweeEle)}else{logger.info("Mark Following : "+user.getFullName()+"("+user.getId()+") >> "+followee.F_N+"("+followee._id+") - NA")}}else{logger.info("Follow link : Not logged in.")}};times_comments.prototype.markFollowing=function(currentEle){if(currentEle&¤tEle.length>0){currentEle.html("Following"); currentEle.removeClass("follow");currentEle.addClass("following");currentEle.removeAttr("data-plugin");currentEle.attr("title",currentEle.attr("title").replace("Follow","Following"))}};times_comments.prototype.onLoaded=function(callback){event.subscribe("comments.loaded",callback)};var savedComment=null;times_comments.prototype.saveComment=function(comment){savedComment=comment;cookie.set("comment"+window.msid,json.stringify(comment),1,document.location.pathname)};times_comments.prototype.getSavedComment=function(){var commentCookie=cookie.get("comment"+window.msid); if(is.defined(commentCookie)){return json.parse(commentCookie)}else{if(savedComment){return savedComment}else{return null}}};times_comments.prototype.removeSavedComment=function(){savedComment=null;return cookie.remove("comment"+window.msid,document.location.pathname)};times_comments.prototype.loadSavedComment=function(){var tthis=this;var user=login.getUser();var savedComment=tthis.getSavedComment();if(savedComment){if(user){logger.log("Has saved comment and user is logged in.");logger.log(savedComment); tthis.attachUserToComment(savedComment,user);tthis.removeSavedComment();tthis.post(savedComment,function(savedComment,errMsg){tthis.renderComment(savedComment,errMsg)})}else{logger.log("Saved comment but user not logged in")}}else{logger.log("No Saved comment.")}};times_comments.prototype.verifyEmailComment=function(){var url_params=util.getParam();var tthis=this;tthis.verify(function(commentObj,errMsg){if(is.object(commentObj)){tthis.renderComment(commentObj,errMsg,true);$("[data-plugin='comment-verified-msg']").show(); tthis.removeSavedComment()}})};times_comments.prototype.saveRatingValidation=function(opinionid,typeid,rateid,val,ref){logger.log("Save Rating: "+this.config.commentType+":"+opinionid);var user=login.getUser();var userId=user?user.getId():0;var rating=["rateV",opinionid,typeid,rateid];cookie.set(rating.join(":"),val||"1",1,document.location.pathname)};times_comments.prototype.getSavedRatingValidation=function(opinionid,typeid,rateid,ref){var user=login.getUser();var userId=user?user.getId():0;var rating=["rateV",opinionid,typeid,rateid]; var commentCookie=cookie.get(rating.join(":"));if(is.defined(commentCookie)){return commentCookie}else{return null}};times_comments.prototype.updateCachedRating=function(){var tthis=this;var cookies=cookie.getAll();var comments=$(tthis.config.wrapper+" #"+this.config.commentType);util.each(cookies,function(key,value){if(key.indexOf("rateV")===0){logger.log("Updating Rating from cookie: "+key);var keyArr=key.split(":");var rating={opinionid:parseInt(keyArr[1],10),typeid:parseInt(keyArr[2],10),rateid:parseInt(keyArr[3],10),commentType:tthis.config.commentType}; var eleType="";switch(rating.typeid){case CONSTANT.RATE_TYPE.AGREE:eleType="comment-agree-count";break;case CONSTANT.RATE_TYPE.DISAGREE:eleType="comment-disagree-count";break}if(eleType!=""){var commentRateCount=comments.find("[data-id='"+rating.opinionid+"'] [data-plugin='"+eleType+"']");var val=parseInt(commentRateCount.text(),10);var cookieVal=parseInt(cookie.get(key),10);if(cookieVal>val){commentRateCount.text(cookieVal);logger.log("Updated Rating from cookie: "+key+" : "+val+" updated to "+cookieVal) }else{logger.log(key+" Already Updated")}}}})};times_comments.prototype.validateRating=function(opinionid,typeid,rateid,ref,callback){logger.log("Validate Rating: "+opinionid);var config=this.config;var user=login.getUser();var savedRating=this.getSavedRatingValidation(opinionid,typeid,rateid,ref);if(ref){if(user&&ref.parent&&ref.parent.attr("data-userid")==user.getId()){switch(typeid){case CONSTANT.RATE_TYPE.AGREE:callback(config.messages.self_agree);break;case CONSTANT.RATE_TYPE.DISAGREE:callback(config.messages.self_disagree); break;case CONSTANT.RATE_TYPE.RECOMMEND:callback(config.messages.self_recommend);break;case CONSTANT.RATE_TYPE.OFFENSIVE:callback(config.messages.self_offensive);break}}else{if(savedRating&&savedRating.length>0){switch(typeid){case CONSTANT.RATE_TYPE.AGREE:callback(config.messages.already_agree);break;case CONSTANT.RATE_TYPE.DISAGREE:callback(config.messages.already_disagree);break;case CONSTANT.RATE_TYPE.RECOMMEND:callback(config.messages.already_recommended);break;case CONSTANT.RATE_TYPE.OFFENSIVE:callback(config.messages.already_offensive); break}}else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.AGREE,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.DISAGREE){callback(config.messages.cant_agree_disagree)}else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.DISAGREE,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.AGREE){callback(config.messages.cant_agree_disagree)}else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.AGREE,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.OFFENSIVE){callback(config.messages.cant_agree_offensive) }else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.OFFENSIVE,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.AGREE){callback(config.messages.cant_agree_offensive)}else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.DISAGREE,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.RECOMMEND){callback(config.messages.cant_disagree_recommend)}else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.RECOMMEND,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.DISAGREE){callback(config.messages.cant_disagree_recommend) }else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.OFFENSIVE,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.RECOMMEND){callback(config.messages.cant_recommend_offensive)}else{if(this.getSavedRatingValidation(opinionid,CONSTANT.RATE_TYPE.RECOMMEND,rateid,ref)&&typeid==CONSTANT.RATE_TYPE.OFFENSIVE){callback(config.messages.cant_recommend_offensive)}else{callback()}}}}}}}}}}}else{logger.error("Cannot validate rating. 'ref' is undefined.")}};times_comments.prototype.validateComment=function(commentObj,callback,ref){event.publish("comment.post.validating"); var comment=commentObj.comment;var config=this.config;logger.info("Validating Comment: "+comment);if(is.empty(comment)){callback(config.messages.blank)}else{if(is.url(comment)){callback(config.messages.has_url)}else{if(comment.length0&&$get_user_email.length>0){var user={};user.name=$get_user_name.val().trim();user.email=$get_user_email.val().trim();if($get_user_location&&$get_user_location.length>0){user.location=$get_user_location.val().trim()}if(user.name.length==0||user.name==$get_user_name.attr("placeholder")){this.error(config.messages.name_required,ref["comment-error"]);return true}if(user.name.length>30){this.error(config.messages.name_toolong,ref["comment-error"]); return true}if(!is.alphaOnly(user.name)){this.error(config.messages.name_not_string,ref["comment-error"]);return true}if($get_user_location&&$get_user_location.length>0){if(user.location.length==0||user.location==$get_user_location.attr("placeholder")){this.error(config.messages.location_required,ref["comment-error"]);return true}if(user.location.length>30){this.error(config.messages.location_toolong,ref["comment-error"]);return true}if(!is.alphaOnly(user.location)){this.error(config.messages.location_not_string,ref["comment-error"]); return true}}if(user.email.trim().length==0||user.email==$get_user_email.attr("placeholder")){this.error(config.messages.email_required,ref["comment-error"]);return true}if(!is.email(user.email.trim())){this.error(config.messages.email_invalid,ref["comment-error"]);return true}if($get_user_captcha&&$get_user_captcha.val().trim().length==0){this.error(config.messages.captcha_required,ref["comment-error"]);return true}if($get_user_captcha&&$get_user_captcha.val().trim().length>4){this.error(config.messages.captcha_toolong,ref["comment-error"]); return true}if($get_user_captcha&&!is.numberOnly($get_user_captcha.val().trim())){this.error(config.messages.captcha_number_only,ref["comment-error"]);return true}if($set_user_captcha&&$get_user_captcha&&!eval($set_user_captcha.text()+"="+$get_user_captcha.val())){this.error(config.messages.captcha_invalid,ref["comment-error"]);return true}return userClass.getNewUser(user,{id:"id",username:"username",thumb:"thumb",email:"email",name:"name",fullName:"name",CITY:"location"})}};times_comments.prototype.commentOnFacebook=function(commentObj,ref){var tthis=this; var domainOnly=util.getDomainOnly();tthis.saveComment(commentObj);cookie.set("clickkepfbtart","1",1,"/",domainOnly);cookie.set("clickkepfbtart"+window.msid,window.msid,1,"/",domainOnly);login.loginWithFacebook(function(){tthis.loadSavedComment()})};times_comments.prototype.commentOnGoogle=function(commentObj,ref){var tthis=this;tthis.saveComment(commentObj);login.loginWithGoogle(function(){tthis.loadSavedComment()})};times_comments.prototype.commentOnTwitter=function(commentObj,ref){var tthis=this; var domainOnly=util.getDomainOnly();tthis.saveComment(commentObj);cookie.set("clickkeptwtart","1",1,"/",domainOnly);cookie.set("clickkeptwtart"+window.msid,window.msid,1,"/",domainOnly);login.loginWithTwitter(function(){tthis.loadSavedComment()})};times_comments.prototype.commentUsingEmail=function(commentObj,ref){var tthis=this;var domainOnly=util.getDomainOnly();tthis.saveComment(commentObj);cookie.set("clickkepssoart","1",1,"/",domainOnly);cookie.set("clickkepssoart"+window.msid,window.msid,1,"/",domainOnly); login.login(function(){tthis.loadSavedComment()})};times_comments.prototype.commentWithoutLogin=function(commentObj,ref){var tthis=this;var domainOnly=util.getDomainOnly();tthis.saveComment(commentObj);cookie.set("clickkepssoart","1",1,"/",domainOnly);cookie.set("clickkepssoart"+window.msid,window.msid,1,"/",domainOnly);login.login(function(){tthis.loadSavedComment()})};times_comments.prototype.verify=function(callback,ref){var tthis=this;var url=tthis.config.verify_comment_url;var msgObj={msid:window.msid,cmtid:null,r:null}; var url_params=util.getParam();msgObj.cmtid=url_params.messageid;msgObj.r=url_params.r;if(msgObj.msid&&msgObj.cmtid&&msgObj.r){logger.info("Verifying Comment.");ajax.get(url,msgObj,function(response){if(response.cmtverified.commentbyid&&response.cmtverified.commentbyid.roaltdetails){var cmt=response.cmtverified.commentbyid;cmt.roaltdetails=cmt.roaltdetails.roaltdetails;var commentObj={index:-1,id:-1,comment:is.string(cmt.message)?$("
    ").text(cmt.message).html():"",level:1,parentuid:cmt.parentuid,parentusername:cmt.parentusername,abstime:msgObj.r?util.getDate(msgObj.r).getTime():"",time:msgObj.r,type:"comment-post",user:{name:cmt.roaltdetails.fromname,location:cmt.roaltdetails.location}}; if(callback){callback(commentObj)}}else{if(callback){callback(null,{})}}})}if(url_params.register==="1"){logger.info("Display register window.");if(!login.getUser()){login.register()}}};times_comments.prototype.post=function(commentObj,callback,ref){var tthis=this;if(!is.empty(commentObj.social)){tthis.postToSocial(commentObj.comment,commentObj.social.join(","))}tthis.validateComment(commentObj,function(error){if(!is.empty(error)){if(callback){callback(commentObj,error)}return}event.publish("comment.post.posting"); logger.info("Posting Comment:"+commentObj.comment);var msgObj=tthis.commentObjToMsgObj(commentObj);msgObj.pcode=page.getChannel();if(tthis.config.sendCommentLiveEmail===false){msgObj.verifyuser=1;api.postCommentWithoutVerification(msgObj,function(response){event.publish("comment.post.posted");if(callback){callback(commentObj)}})}else{api.postComment(msgObj,function(response){event.publish("comment.post.posted");if(callback){callback(commentObj)}})}},ref)};times_comments.prototype.commentObjToMsgObj=function(commentObj){var config=this.config; var msgObj={fromname:commentObj.user?commentObj.user.name:null,fromaddress:commentObj.user?commentObj.user.email:null,userid:commentObj.user?(commentObj.user.id?commentObj.user.email:"qrst"):"qrst",location:commentObj.user?commentObj.user.location:null,imageurl:commentObj.user?commentObj.user.image:null,loggedstatus:commentObj.user&&commentObj.user.id?1:0,message:commentObj.comment,roaltdetails:1,ArticleID:config.msid,msid:config.msid,parentid:commentObj.parentId,rootid:commentObj.rootId,url:commentObj.url,configid:commentObj.configid}; if(!commentObj.user.id){msgObj.verifyuser=1}return msgObj};times_comments.prototype.error=function(errMsg,wrapper){if(is.visible(wrapper)){wrapper.text(errMsg)}else{if(!is.empty(errMsg)){alert(errMsg)}}};times_comments.prototype.rateAgree=times_comments.prototype.rateUpVote=function(opinionid,callback,ref){logger.log("Agree Comment: "+opinionid);this.rate(opinionid,CONSTANT.RATE_TYPE.AGREE,0,callback,ref)};times_comments.prototype.rateDisagree=times_comments.prototype.rateDownVote=function(opinionid,callback,ref){logger.log("Disagree Comment: "+opinionid); this.rate(opinionid,CONSTANT.RATE_TYPE.DISAGREE,0,callback,ref)};times_comments.prototype.rateRecommend=function(opinionid,callback,ref){logger.log("Recommend Comment: "+opinionid);this.rate(opinionid,CONSTANT.RATE_TYPE.RECOMMEND,0,callback,ref)};times_comments.prototype.flag=times_comments.prototype.rateOffensive=function(opinionid,callback,ref,reason){var tthis=this;logger.log("Flag/Offensive Comment: "+opinionid);$(ref.offensive_popup).off("click");$(ref.offensive_popup).on("click",function(){var ref=ui.getActionReferences(this,tthis.config.comment); var valReason=ref.offensive_popup.find("input:checked").val();if(valReason&&valReason.length>0&&valReason=="Others"){ref.offensive_popup_reason.show()}else{ref.offensive_popup_reason.hide()}tthis.error("",ref["comment-offensive-error"])});ref.offensive_popup.show();return};times_comments.prototype.showRateOffensiveBox=function(opinionid,callback,ref){};times_comments.prototype.rate=function(opinionid,typeid,rateid,callback,ref,reason){logger.log("Rate Comment: "+opinionid+":"+typeid);var tthis=this; var rating={opinionid:opinionid,typeid:typeid,rateid:rateid||0};if(reason){rating.ofreason=reason}var user=login.getUser();if(user){logger.log("Rate Comment user is logged in");this.validateRating(opinionid,typeid,rateid,ref,function(error){if(!is.empty(error)){if(callback){callback(error)}return}var val=parseInt(ref["comment-agree-count"].text(),10);tthis.saveRatingValidation(opinionid,typeid,rateid,val+1,ref);api.rateComment(rating,function(resp){if(callback){callback(null,resp)}},user)})}else{logger.log("Rate Comment user is NOT logged in, login prompted."); (function(rating,callback,ref){if(tthis.config.loginRequiredForRating===true){login.login(function(){logger.log("Rate Comment user logged in, continue rating.");tthis.rate(rating.opinionid,rating.typeid,rating.rateid,callback,ref,rating.reason)},true)}else{logger.log("Rate Comment user NOT logged in, continue rating.");tthis.validateRating(rating.opinionid,rating.typeid,rating.rateid,ref,function(error){if(!is.empty(error)){if(callback){callback(error)}return}var val=parseInt(ref["comment-agree-count"].text(),10); tthis.saveRatingValidation(rating.opinionid,rating.typeid,rating.rateid,val+1,ref);api.rateComment(rating,function(resp){if(callback){callback(null,resp)}})})}}(rating,callback,ref))}};times_comments.prototype.renderComment=function(commentObj,errMsg,verified){if(commentObj){var ref=ui.getActionReferences("[data-id='"+commentObj.parentId+"']");var parent=ref.parent;var input=ref["comment-input"];var facebookCheckbox=ref["comment-facebook"];var twitterCheckbox=ref["comment-twitter"];if(errMsg){event.publish("comment.post.error",errMsg); this.error(errMsg,ref["comment-error"])}else{event.publish("comment.post.rendering");commentObj.comment=$("
    ").text(commentObj.comment).html();if(this.isReply(commentObj)){var reply=ref["comment-reply"];if(!is.number(commentObj.level)){commentObj.level=parseInt(commentObj.level,10)}++commentObj.level;if((commentObj&&commentObj.user&&commentObj.user.id)||!ref["set-user-captcha"]){parent.after(this.renderEach(-1,commentObj,true));reply.hide()}else{parent.after("
    "+$("[data-plugin='comment-verification-msg']").html()+"
    "); reply.hide()}}else{if((commentObj&&commentObj.user&&commentObj.user.id)||verified==true||!ref["set-user-captcha"]){$(this.config.main).prepend(this.renderEach(-1,commentObj,true))}else{$(this.config.main).prepend("
    "+$("[data-plugin='comment-verification-msg']").html()+"
    ")}}if(input){input.val("");input.keyup();input.focus();if(facebookCheckbox){facebookCheckbox.prop("checked",false)}if(twitterCheckbox){twitterCheckbox.prop("checked",false)}var $get_user_captcha=ref["get-user-captcha"]; var $set_user_captcha=ref["set-user-captcha"];if($get_user_captcha){$get_user_captcha.val("")}if($set_user_captcha){$set_user_captcha.text(Math.floor((Math.random()*10))+"+"+Math.floor((Math.random()*10))+"=")}}this.error("",ref["comment-error"])}lazy.load()}else{this.error(errMsg)}};times_comments.prototype.renderUsingTemplate=function(index,dataOne,tmpl,prepend){return $("#"+tmpl).render(dataOne,{formatNumber:function(val){return util.formatNumber(val)},timeToDate:function(time){return new Date(time) },parseDate:function(time){if(jsonDate!=null){var date=new Date(time);var newDate=$.fullCalendar.formatDate(date,"MMM dd, yyyy");return newDate}}})};times_comments.prototype.isReply=function(cmt){return cmt.parentuid&&cmt.parentusername};times_comments.prototype.loadingDiv=function(text){if(text==="Loading..."){$("[data-plugin='comment-loading']").show()}else{$("[data-plugin='comment-loading']").hide()}};return times_comments});define("toi/comments",["times/comments","login","logger","event","jquery","util","module","cookie","ui"],function(h,j,k,a,f,g,c,b,i){var d=h; var e={validation:{minlength:1},messages:{name_required:"Please enter your name.",name_toolong:"Name cannot be longer than 30 chars.",email_required:"Please enter your email address.",email_invalid:"Please enter a valid email address.",minlength:"Whoops! Your review is too short. Please write a review which is at least 140 characters long so that it is helpful for others as well :)",maxlength:"You have entered more than 3000 characters.",blank:"You can't post this review as it is blank.",popup_blocked:"Popup is blocked.",has_url:"You can't post this review as it contains URL.",duplicate:"You can't post this review as it is identical to the previous one.",abusive:"You can't post this review as it contains inappropriate content.",self_agree:"You can't Agree with your own review",self_disagree:"You can't Disagree with your own review",self_recommend:"You can't Recommend your own review",self_offensive:"You can't mark your own review as Offensive",already_agree:"You have already Agreed with this review",already_disagree:"You have already Disagreed with this review",already_recommended:"You have already Recommended this review",already_offensive:"You have already marked this review Offensive",cant_agree_disagree:"You can't Agree and Disagree with the same review",cant_agree_offensive:"You can't Agree and mark the same review Offensive",cant_disagree_recommend:"You can't Disagree and Recommend the same review",cant_recommend_offensive:"You can't Recommend and mark the same review Offensive",permission_facebook:"You can't post to facebook. Post permission is required."}}; d.config=g.extend(true,{},h.config,e,c.config());return d});define("toicommonjs/homepage",["cookie","load"],function(a,b){var c={};c.init=function(){};return c});define("social/twitter",["social/social","ui","logger","event","util","jquery","module"],function(b,k,l,a,i,h,c){var j=new b("twitter","twitter");var f={parse:false,js:"//platform.twitter.com/widgets.js",js_id:"twitter-wjs",share_url:"http://twitter.com/share",via:null,format:"{{:title}}",sharePageTitle:false};var d=i.extend(true,{},f,c.config()); j.setJS(d.js,d.js_id);j.addPlugin({id:"button",js:true,init:function(r,p){var o=h(r);var q=i.data(r);var m={count:"vertical",url:location.href};var t=i.extend(true,{},m,q);t.url=q.url||q.href||o.attr("href")||t.href;var n=h("");h.each(t,function(u,v){n.attr("data-"+u,v)});o.empty();o.append(n);j.parse(r)}});j.addPlugin({id:"share",alias:["tweet"],events:{click:function(n){var m=i.data(this);j.tweet(m.url||h(this).attr("href"),i.format(m.format||d.format,m),m.via||d.via,this) }},init:function(n,m){}});j.tweet=j.share=function(n,q,m,p){var o={url:j.getAbsoluteUrl(n),text:q||(d.sharePageTitle===true?document.title.split("|")[0]:"")};if(m){o.via=m}j._share(d.share_url,o,{name:"twitter_tweet_dialog",width:500,height:400},p)};j.addPlugin({id:"follow",events:{click:function(m){j.follow(h(this).attr("data-url")||h(this).attr("href"))}},init:function(n,m){}});j.follow=function(n,m){var o=j.getAbsoluteUrl(n);var p=window.open(n,"_blank");p.focus()};j.addPlugin({id:"login",init:function(n,m){}}); var g=null;j.login=function(m,n){};j.addPlugin({id:"logout",init:function(n,m){}});j.parse=function(m){if(typeof twttr!=="undefined"){twttr.widgets.load(m)}else{l.warn("'twttr' is required in parse")}};j.logout=function(m){};j.beforeinit=function(){};j.beforeloadjs=function(){};j.afterloadjs=function(){if(typeof twttr!=="undefined"){l.log("twttr js loaded");var m=["click","tweet","retweet","follow","favorite"];i.each(m,function(n,o){if(m.hasOwnProperty(o)){twttr.events.bind(o,function(p){return function(q){a.publish("twttr."+p,{intent_event:q}) }}(o))}})}else{l.warn("'twttr' is required in afterloadjs")}};var e=null;j.getUser=function(m){};j.onlogin=function(m){};j.onlogout=function(m){};j.init(d);return j});define("social/pinterest",["social/social","ui","logger","event","util","load","jquery","module"],function(b,i,k,a,g,j,f,c){var h=new b("pinterest","pinterest");var e={parse:false,js:"//assets.pinterest.com/js/pinit.js",js_id:"pinterest-js",share_url:"//www.pinterest.com/pin/create/button/"};var d=g.extend(true,{},e,c.config());h.setJS(d.js,d.js_id); h.addPlugin({id:"button",init:function(q,o){var n=f(q);var p=g.data(q);var m={"pin-do":"buttonPin","pin-config":"above"};var t=g.extend(true,{},m,p);t.href=p.url||p.href||n.attr("href")||t.href;var r=f("");var l={url:h.getAbsoluteUrl(t.href),media:h.getAbsoluteUrl(t.image),description:t.summary};r.attr("href","http://www.pinterest.com/pin/create/button/?"+f.param(l));f.each(t,function(u,v){r.attr("data-"+u,v)});n.empty();n.append(r);h.parse(q)}});h.addPlugin({id:"share",alias:["pin"],events:{click:function(m){var l=g.data(this); h.share(l.url||f(this).attr("href"),l.title,l.summary,l.image,this)}},init:function(m,l){}});h.pin=h.share=function(m,p,l,o,n){h._share(d.share_url,{url:h.getAbsoluteUrl(m),description:p,summary:l,media:h.getAbsoluteUrl(o)},{name:"pinterest_pin_dialog",width:700,height:400},n)};h.addPlugin({id:"follow",events:{click:function(l){h.follow(f(this).attr("data-url")||f(this).attr("href"))}},init:function(m,l){}});h.follow=function(m,l){var n=h.getAbsoluteUrl(m);var o=window.open(m,"_blank");o.focus()}; h.parse=function(m){var l=f("#"+d.js_id);l.remove();j.js(d.js,null,d.js_id)};h.init(d);return h});define("social/linkedin",["social/social","ui","logger","event","util","jquery","module"],function(b,h,j,a,g,f,c){var i=new b("linkedin","linkedin");var e={parse:false,js:"//platform.linkedin.com/in.js",js_id:"linkedin-js",share_url:"http://www.linkedin.com/shareArticle"};var d=g.extend(true,{},e,c.config());i.setJS(d.js,d.js_id);i.addPlugin({id:"button",js:true,init:function(o,m){var l=f(o);var n=g.data(o); var k={url:location.href,counter:"top"};var q=g.extend(true,{},k,n);q.url=n.url||n.href||l.attr("href")||q.href;var p=f("