").addClass("jPlaylist playlist").attr("data-plugin","videos_section_slider").html(y);if(!r.find("ul li").length){return}if(!r.find("ul [data-msid='"+g+"']").length){var t=r.find("ul li").eq(0).clone();var q=t.data("msid");var v=new RegExp(q,"g");var x=t.find("img").attr("data-src").replace(v,g);
var w=m.find(".w_tle a").eq(0).text();t.attr("data-msid",g).find("img").attr("data-src",x);t.find(".w_tle a").eq(0).text(w);r.find("ul").prepend(t)}else{var u=r.find("ul [data-msid='"+g+"']");var o=u.clone();u.remove();r.find("ul").prepend(o)}r.attr("data-ga-source",j||"").find("[data-msid='"+g+"']").addClass("active");if(typeof k=="function"){p.append(r);k(p)}})},_addPlaylist:function(i){var k=$(".video-content");var f=function(p){if(d._getPlayerType()=="VIDOVERLAY"){k.find(".jPlaylist").remove();
k.append(p)}else{if(d._getPlayerType()=="VIDPLAY"){k.find(".jPlaylist").remove();k.append(p)}}var o=k.find(".jPlaylist");o.off().on("click","[data-plugin='vidOverlay']",d._changeVideo);videos_section_slider.init(o);setTimeout(function(){require("tiljs/plugin/lazy").load()},1000)};var m=$(i.target).closest("[data-plugin='vidOverlay']");var h=m.data("msid");var l=m.closest(".video-category").find("[data-secid]").data("secid")||"";var n=TimesApps.GA.getGACategory();n=n.indexOf("/")>=0?n.replace("/","$slash$"):n;
var j=n+"_overlay_playlist";var g=m.closest("[data-source-url]").data("source-url")||"";if(!l){l=m.closest("[data-secid]").data("secid")||""}d._fetchPlaylist(i,m,h,l,f,g,j)},_changeVideo:function(h){h.preventDefault();var g=this;e.currentVideo=g;var j=d._getVideoSrc(g,true);$(".jOverlay").find("iframe").attr("src",j);var i=$(g).find("a").attr("title");var f=$(g).find("a").attr("href");require("tiljs/event").publish("onVideoOverlayOpen",{title:i,url:f})},_onOverlayClose:function(f){d._updatePageUrl({url:e.pageUrl});
e.isOverlayOpen=false},_onOverlayOpen:function(i){var h=$(e.currentVideo);var j=$(h).find("a").attr("title");var g=$(h).find("a").attr("href");e.isOverlayOpen=true;e.isDocked=false;var f={title:j,url:g,isOverlay:true,vidSource:e.vidSource};require("tiljs/event").publish("onVideoOverlayOpen",f)},_onOverlayDock:function(){var i=$(e.currentVideo);var h=$(i).data("msid");var g=$(i).find("a").attr("href");e.isOverlayOpen=false;e.isDocked=true;var f={vidSource:e.vidSource,vidUrl:g,msid:h,isDocked:true};
require("tiljs/event").publish("onVideoDock",f)},_handleClick:function(i){i.preventDefault();var h=$(".jOverlay");h.find(".jToggleOverlay").trigger("click");TimesApps.dockVideo&&TimesApps.dockVideo.close();var f=this;var g=$(this).data("plugin")||"";e.playerType=g.toUpperCase();d._loadVideoInOverlay(f,true);if(d._getPlayerType()=="VIDOVERLAY"||d._getPlayerType()=="VIDPLAY"){d._addPlaylist(i)}},_handlePlayerEvents:function(g,h,f){g.preventDefault();var i=h.source||"";i=i.toUpperCase();switch(f.toUpperCase()){case"ONNEXTVIDEOPLAY":if(d._getPlayerType()=="VIDPLAY"){d._playNext(h.userInitiated)
}break;case"VIDEOREADY":if(d._getPlayerType()=="VIDOVERLAY"){d._updateUi(h)}break;case"PLAYING":if(i=="ABOVEARTICLE"&&!TimesApps.dockVideo.getStatus("isOverlayOpen")){TimesApps.dockVideo.setStatus("overlayClosedByUser",false)}}},_getNextVideo:function(g){var g=$(g);var f=g.next();if(f.length==0){f=g.siblings().eq(0)}return f},_playNext:function(h){if(!e.currentVideo){return}var g=$(e.currentVideo);e.currentVideo=g;var f=d._getNextVideo(g);d._updatePageUrl({url:$(f).find("a").attr("href")});d._loadVideoInOverlay(f,h)
},_updateUi:function(f){var j=$(".jOverlay").find(".jPlaylist");var i=$("ul [data-msid='"+f.id+"']").eq(0);e.currentVideo=i;var k=i.find(".w_tle a").eq(0).text()||"";var h=$(".jOverlay");h.find(".jTitle").text(k);var g=i.find("a").attr("href")||"";require("tiljs/event").publish("onVideoOverlayUpdate",{url:g,obj:f,playlistDom:j,title:k})},_markPlaying:function(g){if(!(g&&g.playlistDom&&g.obj)){return}var i=g.playlistDom;var h=g.obj;var f;if(h&&h.id){f=h.id}else{if(g.currentVideo){f=g.currentVideo.attr("msid")
}}i.find("li").removeClass("active");i.find("ul [data-msid='"+f+"']").addClass("active")},_getPlayerType:function(){return(e.playerType||"").toUpperCase()},_init:function(){if(!(a.videoList.find("[data-plugin='vidPlay']").length||a.videoList.find("[data-plugin='vidOverlay']").length)){return}bindEvents();d._savePageUrl()}};c={init:function(){return d._init()},savePageUrl:function(){d._savePageUrl()},getVideoSrc:function(f,g){return d._getVideoSrc(f,g)},fetchPlaylist:function(h,l,j,g,i,f,k){return d._fetchPlaylist(h,l,j,g,i,f,k)
}};d._init();return c})();TimesApps.dockVideo=(function(e){var c,b,a,d,f;a={validSourceList:["ABOVEARTICLE"]};d={isDocked:false,isDragged:false,isOverlayOpen:false,overlayClosedByUser:false,msid:undefined,vidContainer:undefined,vidSource:undefined};data={vidUrl:""};f=function(){require(["tiljs/event"],function(g){g.subscribe("VOD_EVENTS",function(j){if(!j instanceof Array){return}var l=j[1]||{};var k=(l.source||"").toUpperCase();var i=(j[2]&&typeof j[2]=="string")?j[2].toUpperCase():"";if((a.validSourceList.indexOf(k)>-1||k.indexOf("ABOVEARTICLE")>-1)&&i=="VIDEOREADY"){if(!d.vidContainer){d.vidSource=k;
var h=e("[data-msid="+l.id+'][data-plugin="vodIframe"]');if(h.length){d.vidContainer=h}else{d.vidContainer=e(".articlevideo[data-msid='"+l.id+"']").find(".vidContainer")}d.vidScrollContainer=d.vidContainer.closest(".articlevideo");require("tiljs/event").subscribe("window.scroll",c._handleVideoPosition)}else{if(d.vidSource!=k){c._close(true);d.vidSource=k;d.vidContainer=e(".articlevideo[data-msid='"+l.id+"']").find(".vidContainer");d.vidScrollContainer=d.vidContainer.closest(".articlevideo")}else{if(!c._getStatus("isOverlayOpen")){d.overlayClosedByUser=false;
d.vidContainer=e(".articlevideo[data-msid='"+l.id+"']").find(".vidContainer")}}}if(c._getStatus("isOverlayOpen")){c._updateOverlay(l)}else{if(d.isDocked){c._updateDock(l)}}d.vidContainer.off().on("click",".jToggleOverlay",c._expandCollapseOverlay);d.vidContainer.on("click",".jClose",c._close)}else{if(k.indexOf("ABOVEARTICLE")>-1&&i=="PLAYING"){d.overlayClosedByUser=false}}e(document).on("keyup",function(m){if(m.keyCode==27){c._close()}})})})};c={_makePlayerDraggable:function(){},_handleVideoPosition:function(){if(d.isOverlayOpen){return
}var h=d.vidScrollContainer;var g=e("#skew").val()||50;var j=require("tiljs/ui").inView(e("#header .sub-header"),true,100);var i=require("tiljs/ui").inView(h,true,-280);if(i&&d.isDocked){c._closeDock();d.isDragged=false}else{if(!i&&!d.isDragged&&!d.isDocked&&!j){c._dockPlayer()}}},_dockPlayer:function(k){var i=d.vidContainer;if(!d.isDocked&&!d.overlayClosedByUser){if(!i.find(".buttonContainer").length){var h='
';
i.prepend(h)}else{i.find(".buttonContainer").removeClass("hidden")}d.isDocked=true;d.msid=i.find("iframe").data("videomsid");var m=i.closest("#container.articleshow #content").find(".title_section .heading1").text();var n=TimesApps.overlayModule.getSidebarPosition();if(!i.find(".jTitle").length){var j=e("
").addClass("jTitle title").text(m);i.addClass("dockedVideo fixed animateDock dockedVideoSize belowHeader").css({"margin-left":n.leftOffset,width:n.width}).append(j)}else{i.addClass("dockedVideo fixed animateDock dockedVideoSize belowHeader").css({"margin-left":n.leftOffset,width:n.width}).find(".jTitle").text(m).removeClass("hidden")
}e("#gaanaplayer").addClass("shifttoleft");TimesApps.overlayModule.close();i.one("animationend webkitTransitionEnd transitionend webkitAnimationEnd oAnimationEnd MSAnimationEnd",function(p){p.stopPropagation();p.stopImmediatePropagation();i.addClass("animationEnd")});i.removeClass("animationEnd");var l=e(".articlevideo").attr("data-msid")||window.msid;var o="/photo/"+l+".cms";e(".vidbox").css("background-image","url("+o+")");var g={vidSource:d.vidSource,vidUrl:data.vidUrl,msid:d.msid,isDocked:true};
require("tiljs/event").publish("onVideoDock",g)}},_expandToOverlay:function(){d.isOverlayOpen=true;d.isDocked=false;var h=e(".vidContainer");h.addClass("expand-overlay").removeClass("dockedVideo fixed animateDock dockedVideoSize belowHeader").css({"margin-left":"",width:""}).off("mousedown");if(h.parent().find(".expand-overlay-box").length){e("
").addClass("expand-overlay-box").insertBefore(h)}e("body").addClass("overflowHidden");TimesApps.VideoListPlayer.savePageUrl();var g={vidSource:d.vidSource,vidUrl:data.vidUrl,msid:d.msid,isOverlay:true};
require("tiljs/event").publish("onVideoOverlayOpen",g)},_collapseToDock:function(){d.isOverlayOpen=false;d.isDocked=true;var h=e(".vidContainer");e("body").removeClass("overflowHidden");var i=TimesApps.overlayModule.getSidebarPosition();h.removeClass("expand-overlay").addClass("dockedVideo fixed animateDock dockedVideoSize belowHeader").css({"margin-left":i.leftOffset,width:i.width}).off("mousedown");var g={vidSource:d.vidSource,vidUrl:data.vidUrl,msid:d.msid,isDocked:true};require("tiljs/event").publish("onVideoDock",g)
},_expandCollapseOverlay:function(j){if(d.isDocked){d.isDocked=false;c._expandToOverlay();var i=function(o){var n=e(".vidContainer");n.find(".jPlaylist").remove();n.append(o);n.find(".jPlaylist").off().on("click","[data-plugin='vidOverlay']",c._changeVideoInOverlay);videos_section_slider.init(n.find(".jPlaylist"));setTimeout(require("tiljs/plugin/lazy").load(),1000)};var m=d.vidScrollContainer;var l=d.vidScrollContainer.find("iframe").contents().find("#msid").val()||"";var g=d.vidScrollContainer.find("iframe").contents().find("#sectionId").val()||"";
var h=TimesApps.GA.getGACategory();h=h.indexOf("/")>=0?h.replace("/","$slash$"):h;var k=h+"_overlay_playlist";TimesApps.VideoListPlayer.fetchPlaylist(j,m,l,g,i,null,k)}else{c._collapseToDock()}},_changeVideoInOverlay:function(j){j.preventDefault();var i=e(this);var l=TimesApps.VideoListPlayer.getVideoSrc(i,true);d.vidContainer.find("iframe").attr("src",l);var k=i.find("a").attr("title");var h=i.find("a").attr("href");d.vidContainer.find(".jPlaylist li").removeClass("active");i.addClass("active");
d.vidContainer.find(".jTitle").text(k);data.vidUrl=h;var g={url:h,obj:undefined,playlistDom:d.vidContainer,title:k,vidSource:d.vidSource,vidUrl:data.vidUrl,isOverlay:true};require("tiljs/event").publish("onVideoOverlayUpdate",g)},_removePlaylist:function(){e(".jPlaylist").remove()},_closeDock:function(){e(".vidbox").css("background-image","").css("background-color","black");e(".vidContainer").removeClass("dockedVideo animateDock dockedVideoSize fixed belowHeader").css({"margin-left":"",width:""}).find(".jTitle").addClass("hidden");
d.isDocked=false;c._removeButtons()},_closeOverlay:function(){d.isOverlayOpen=false;c._removePlaylist();e(".vidContainer").removeClass("expand-overlay").find(".jTitle").addClass("hidden");e("expand-overlay-box").addClass("hidden");c._removeButtons();e("body").removeClass("overflowHidden");require(["tiljs/event"],function(g){g.publish("overlayClosed",{})})},_close:function(h){if(!d.vidScrollContainer){return}if(h===true){d.overlayClosedByUser=false}else{d.overlayClosedByUser=true}if(d.isDocked){c._closeDock()
}else{c._closeOverlay()}var g=d.vidScrollContainer.find("iframe");if(g&&g[0]&&g[0].contentWindow&&g[0].contentWindow.TimesApps.VideoPlayer2.getPlayer("VOD")&&g[0].contentWindow.TimesApps.VideoPlayer2.getPlayer("VOD").pause){g[0].contentWindow.TimesApps.VideoPlayer2.getPlayer("VOD").pause()}},_removeButtons:function(){e(".vidContainer").find(".buttonContainer").addClass("hidden")},_getStatus:function(g){return d[g]},_setStatus:function(g,h){d[g]=h},_isVideoDocked:function(){var g={status:false,id:undefined};
if(d.isDocked){g={status:true,id:d.msid}}return g},_updateTitle:function(g){var h=g.title||"";d.vidContainer.find(".jTitle").text(h)},_updateOverlay:function(j){c._updateTitle(j);var k=d.vidContainer.find(".jPlaylist");var h=d.vidContainer.find(".jPlaylist ul [data-msid="+j.id+"]");if(!(h&&h.length)){return}var g=h.eq(0).find("a").attr("href")||"";var i={url:g,obj:j,playlistDom:k,title:title,isOverlay:true};require("tiljs/event").publish("onVideoOverlayUpdate",i)},_updateDock:function(g){c._updateTitle(g)
},_init:function(){f()}};b={getStatus:function(g){return c._getStatus(g)},setStatus:function(g,h){c._setStatus(g,h)},isVideoDocked:function(){return c._isVideoDocked()},close:function(g){return c._close()}};c._init();return b}(jQuery));define("gaanaplayer",["jquery","tiljs/logger","tiljs/is"],function(e,c,d){var b={};var a=false;b.api={init:function(){TimesApps.checkGdprAndCall&&TimesApps.checkGdprAndCall(b.fn._init,null)}};b.utils={checkIfIE:function(){var g=window.navigator.userAgent;var f=g.indexOf("MSIE ");
if(f>0||!!navigator.userAgent.match(/Trident.*rv\:11\./)){return true}else{return false}}};b.fn={_bindEvents:function(){e("#gaanaplayer .box_head").on("click",function(f){f.preventDefault();f.stopImmediatePropagation();if(e(this).closest("#gaanaplayer").hasClass("active")){b.fn._analyticsFire("Gaana widget","Minimize",window.location.href);b.fn._removeCloseBtn();e("#gaanaplayer").removeClass("active")}else{b.fn._analyticsFire("Gaana widget","Open",window.location.href);e("#gaanaplayer").addClass("active");
b.fn._addCloseBtn();b.fn._setIframeLink()}});e(document).on("videodash.userAction videodash.videoEvents LIVE_TV_EVENTS MINI_TV_EVENTS",function(g,h,f){b.fn._handleVideodashEvents(g,h,f)});e(window).on("beforeunload",function(f){a=true;if(document.getElementById("gaanatvplayer")&&document.getElementById("gaanatvplayer").contentWindow){var g=document.getElementById("gaanatvplayer");g.contentWindow.postMessage("close_browser","*")}});e(window).unload(function(){if(!a){var f=document.getElementById("gaanatvplayer");
f.contentWindow.postMessage("close_browser","*")}});e(".gaanaplayer_box .box_head").on("click",".close_gaanaplayer",function(f){f.preventDefault();var g=document.getElementById("gaanatvplayer");g.contentWindow.postMessage("close_gaanawidget","*");b.fn._analyticsFire("Gaana widget","Close",window.location.href);b.fn._closeGaanaplayer()});window.addEventListener("message",b.fn._messageHandler,false)},_createUI:function(){var h=e('
');var f=e('
of the Day');
var g=e('
');h.append(f).append(g);e("#gaanaplayer").append(h)},_analyticsFire:function(g,h,f){if(window.ga){ga("send","event",g,h,f,{nonInteraction:1})}else{setTimeout(function(){ga("send","event",g,h,f,{nonInteraction:1})},5000)}return true},_init:function(){e("#gaanatvplayer").attr("src","");if(typeof d.IE=="function"&&d.IE()){e("#gaanaplayer").hide()}else{if(e("#minitv #streaming_box")&&e("#minitv #streaming_box").is(":visible")){e("#gaanaplayer").addClass("shifttoleft")
}b.fn._createUI();e("#gaanaplayer").show();b.fn._bindEvents()}},_addCloseBtn:function(){var f=e('
');e(".gaanaplayer_box .box_head").append(f)},_removeCloseBtn:function(){e(".gaanaplayer_box .box_head .close_gaanaplayer").remove()},_messageHandler:function(h){var g="http://gaana.com";if(h.origin==g){var f=h.data.status.replace(/\s/g,"").toLowerCase();if(f=="play"){b.fn._analyticsFire("Gaana widget","Play",h.data.title);b.fn._gaanaplayed()}else{if(f=="pause"){b.fn._analyticsFire("Gaana widget","Pause",h.data.title);
b.fn._gaanapaused()}else{if(f=="languagedropdownopen"){b.fn._analyticsFire("Gaana widget","Drop down open",window.location.href)}else{if(f=="languagechange"){b.fn._analyticsFire("Gaana widget","Language",h.data.value)}else{if(f=="loading"){b.fn._analyticsFire("Gaana widget","Loading",h.data.title);b.fn._gaanaplayed()}else{if(f=="seekbackward"){b.fn._analyticsFire("Gaana widget","Seek backward",h.data.title)}else{if(f=="seekforward"){b.fn._analyticsFire("Gaana widget","Seek forward",h.data.title)}}}}}}}}},_pauseGaanaplayer:function(){document.getElementById("gaanatvplayer").contentWindow&&document.getElementById("gaanatvplayer").contentWindow.postMessage("pause","*")
},_closeGaanaplayer:function(){e("#gaanaplayer").remove()},_pauseAndMinimizePlayer:function(){b.fn._pauseGaanaplayer();e("#gaanaplayer").removeClass("active");b.fn._removeCloseBtn()},_gaanaplayed:function(){e(document).trigger("GAANA_PLAYER_EVENTS",[{source:"GAANA_PLAYER"},"playing"])},_gaanapaused:function(){e(document).trigger("GAANA_PLAYER_EVENTS",[{source:"GAANA_PLAYER"},"paused"])},_triggerPlayerLoaded:function(){e(document).trigger("GAANA_PLAYER_LOADED",[{source:"GAANA_PLAYER"},"GAANA_PLAYER_LOADED",b.fn._pauseAndMinimizePlayer])
},_playGaanaplayer:function(){document.getElementById("gaanatvplayer").contentWindow&&document.getElementById("gaanatvplayer").contentWindow.postMessage("play","*")},_setIframeLink:function(){if(!e("#gaanatvplayer").attr("isloadedfirsttime")){b.fn._triggerPlayerLoaded();var f=b.data.iframeurl;e("#gaanatvplayer").attr("src",f).attr("isloadedfirsttime","true");e("#gaanatvplayer").on("load",function(){document.getElementById("gaanatvplayer").contentWindow&&document.getElementById("gaanatvplayer").contentWindow.postMessage("open_gaanawidget","*")
})}},_handleVideodashEvents:function(i,h,f,g){if(f.toUpperCase()=="START"){b.fn._pauseGaanaplayer()}}};b.data={iframeurl:e("#gaanatvplayer").attr("data_src")||"http://gaana.com/gaanawidget-v7"};return b.api});define("tiljs/login",["tiljs/apps/times/usermanagement"],function(a){mod_login=a;return mod_login});define("tiljs/apps/times/tpwidget",["../../event","../../cookie"],function(c,a){var b={};b.init=function(){b.subscribeLoggedInStatus();b.bindEvents()},b.data={widgettypes:["widget-head","widget-two"],"widget-head":"tpwidget-one","widget-two":"tpwidget-two",widgetsArray:[],isUserLoggedIn:false,isInitialised:false,userInfo:[],uemail:"",url:escape(document.location.href),pcode:"TOI",scode:"News",oid:"",uid:"",aname:"",txnId:"",firsttime:true},b.handlePostLoginActivity=function(f,e){var d="?uid="+b.data.uid;
d+="&pcode="+b.data.pcode;d+="&scode="+b.data.scode;d+="&aname="+f;d+="&pfm=web";d+="&txnId="+e;if(f=="mv_rt"){d+="&oid="+e}b.sendActivityRequest(d)},b.sendActivityRequest=function(d){$.get("http://tpapi.timespoints.com/v1/activity/logact"+d,function(f,e){if(f.status=='"FAILURE"'){console.log(f.message)}else{console.log("TPActivity Post Login Activity URL -http://tpapi.timespoints.com/v1/activity/logact"+d)}})},b.bindEvents=function(){$(document).on("VOD_EVENTS",function(f,g,e){var d=g.id?g.id:Math.round((new Date()).getTime());
if(typeof e!="undefined"&&e.toUpperCase()=="VIDEOVIEW"){b.fireActivity("watch_video",d)}});$(document).on("article_read",function(e,f,d){b.fireActivity("read",f.msid)});$(document).on("view_photo",function(e,f,d){b.fireActivity("view_photo",f.msid)});$(document).on("rate_movie",function(e,f,d){b.fireActivity("mv_rt",f.msid)})},b.fireActivity=function(d,e){if(!b.data.isUserLoggedIn){console.log("TPActivity Activity- "+d+", Transcation ID-"+e);TPWidget.addPreLoginActivity(d)}else{b.handlePostLoginActivity(d,e)
}},b.initialisewidget=function(e){if(typeof TPWidget!="undefined"&&typeof TPWidget.init=="function"){var d=[];$.each(b.data.widgettypes,function(f,g){if($("#"+g).length){d.push({ele:g,widgetType:b.data[g]})}});if(e!=null&&typeof(e)!="undefined"){TPWidget.init({widgets:d,userLoginInfo:{host:b.data.pcode,channel:b.data.scode,URL:escape(document.location.href),userId:b.data.uid,oid:"",email:b.data.email}})}else{TPWidget.init({widgets:d})}}c.publish("tpinitated")},b.PostLoginActions=function(){TPWidget.PostLoginActions({host:"TOI",channel:"News",URL:escape(document.location.href),userId:b.data.uid,oid:"",email:b.data.email})
},b.subscribeLoggedInStatus=function(){c.subscribe("user.status",function(d){b.data.isUserLoggedIn=typeof d!=="undefined"&&d!==null?true:false;if(!b.data.isInitialised){b.updateUserDetails();b.initialisewidget(d);b.data.isInitialised=true;b.fireActivity("visit",Math.round((new Date()).getTime()));b.fireActivity("register",Math.round((new Date()).getTime()))}b.data.firsttime=false});c.subscribe("user.login",function(d){if(d){b.data.isUserLoggedIn=true;b.updateUserDetails(d.getEmail());b.PostLoginActions();
typeof ga=="function"&&ga("send","event","TPRedeem","login_success",window.location.href)}});c.subscribe("user.logout",function(d){b.data.isUserLoggedIn=false;if(!b.data.firsttime){if(typeof TPWidget!="undefined"&&typeof TPWidget.logoutAction=="function"){TPWidget.logoutAction()}}b.data.isUserLoggedIn=false})},b.updateUserDetails=function(d){b.data.email=d?d:a&&a.get("MSCSAuthDetails")&&a.get("MSCSAuthDetails").split("=")[1];b.data.uid=a&&a.get("ssoid")};b.handleLoginCallback_andPrcFPrime=function(d){$.ajax({url:"http://pauth.jeetwin-gaming.com/prime-auth/prime/status/setCookies",type:"GET",xhrFields:{withCredentials:true},success:function(e){console.log(e)
},error:function(g,e,f){console.log(f)}})};return b});define("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 g=d.attr("rodate");var c=g.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);if(!c){g=!isNaN(g)?parseInt(g):g;var f=new Date(g);if(!isNaN(f.getTime())){rod=f}else{if(g.indexOf("hrs IST")!=-1){g=g.replace(" hrs IST","");g=g.splice(-2,0,":")}g=g.replace("IST","");g=g.replace("hrs","");g=g.replace("AM"," AM");
g=g.replace("PM"," PM");rod=new Date(g);if(isNaN(rod.getTime())){if(g.indexOf(":")>-1){g=g.split(" ").join("T");g=g.concat("+05:30");rod=new Date(g)}}}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("localstoragec",["tiljs/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("tiljs/apps/times/comments",["module","jquery","json","jsrender","localstoragec","../times/api","../../comments","../../ajax","../../plugin/dynamic","../../util","../../login","../../event","../../ui","../../is","../../string","../../plugin/lazy","../../cookie","../../logger","../../timer","../../analytics/mytimes","../../compatibility","../../social/facebook","../../page","../../user","../../ext/date"],function(module,$,json,jsrender,localstoragec,api,comments,ajax,dynamic,util,login,event,ui,is,string,lazy,cookie,logger,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,commentType:"comments",loadonscroll:true,sendCommentLiveEmail:true,loginRequiredForRating:true,nonloggedinComment:true,disabledirectcomment:false,maxchar:3000,maxCommentWrapLength:500,maxResponseCount:3,hideResponses:false,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.config.commentType;times_comments.prototype.initialize=function(){var tthis=this;this.config=util.extend(true,{},comments.config,module.config(),this.config);tthis.comments=[];tthis.commentCount=0;tthis.countPresent=false;tthis.pageCount=1;tthis.config.comment_block_count=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;if(tthis.config.disabledirectcomment){$(tthis.config.wrapper+' [data-plugin="comment-form"]').hide()}if(login.getUser()){$(tthis.config.wrapper+" [data-plugin='user-isloggedin']").show();$(tthis.config.wrapper+" [data-plugin='user-notloggedin']").hide()}else{$(tthis.config.wrapper+" [data-plugin='user-isloggedin']").hide();
$(tthis.config.wrapper+" [data-plugin='user-notloggedin']").show()}if(!tthis.config.nonloggedinComment&&tthis.pageCount===1){$(tthis.config.wrapper+' [data-plugin="user-notloggedin"]').remove()}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.wrapper+" #"+tthis.config.commentType+" [data-plugin='comment']:visible:last",true,200)){tthis.loadComment(tthis.config.commentType,function(data){},true,++tthis.pageCount)}})})(tthis)};times_comments.run=function(config){this.config=util.extend(true,{},comments.config,module.config());
var msid=config&&config.msid?config.msid:window.msid;var main=config&&config.main?config.main:"#"+this.config.commentType;var wrapper=config&&config.wrapper?config.wrapper:this.config.wrapper;var toi_comment={};toi_comment[this.config.commentType]=new comments({main:main,msid:msid,wrapper:wrapper});toi_comment[this.config.commentType].initialize();$(wrapper+" #comment_sort").change(function(){var rootid=$(this).val(),id="comments"+(rootid&&rootid.length>0?"_"+rootid:""),sortLbl=rootid.length?rootid:"newest";
$(wrapper+" .comments-list").hide();$(wrapper+" #"+id).show();$(wrapper+".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,wrapper:wrapper});toi_comment[id].initialize()}event.publish("comment.sort",sortLbl);$(wrapper+" [data-plugin='comment-error-outer']").text("");
$(wrapper+" [data-plugin='comment-error']").text("");event.publish("comment_error")});function processRated(user){var commenttype="comments"+($("#comment_sort")&&$("#comment_sort").val()!==""?"_"+$("#comment_sort").val():"");if(user&&toi_comment[commenttype].config.msid){var tthis=toi_comment[commenttype];var savedComment=tthis.getSavedComment();var usr_data={};usr_data.userId=user.getId();usr_data.baseEntityId=0;usr_data.uniqueAppKey=tthis.config.msid;usr_data.appKey="TFOOD";$.ajax({url:"/already_rated.cms",dataType:"jsonp",crossDomain:true,async:false,jsonp:"callback",data:usr_data,type:"GET"}).done(function(data){alreadyratedvar=data/2;
if(data==undefined){userInfo.userRating=""}event.publish("comments.user_has_rated",data);if(window.msid==tthis.config.msid){data=(data&&data!="")?data:" ";if(data==" "&&ratevalue!=undefined&&ratetype!=undefined){movreview.rateMovie(ratevalue,ratetype,tthis.config.msid)}else{if(data==" "&&ratevalue!=undefined&&ratetype!=undefined){movreview.rateMovie(ratevalue,ratetype,tthis.config.msid);savedComment.urs=ratevalue;tthis.saveComment(savedComment);tthis.loadSavedComment()}else{if(!isNaN(alreadyratedvar)){savedComment.urs=data;
tthis.saveComment(savedComment);tthis.loadSavedComment()}}}}})}if(user){toi_comment[commenttype].markFollowingAll()}}var user=login.getUser();if(tempname!="videoshow"&&tempname!="articleshow"){processRated(user);event.subscribe("user.status",processRated)}event.subscribe("comments.loaded",function(commentObj){logger.log("comments.loaded:"+commentObj.config.commentType);commentObj.updateAfterCommentsLoaded();if(commentObj.config.hideResponses===true){commentObj.hideExtraResponses()}});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.runsec=function(config){this.config=util.extend(true,{},comments.config,module.config());var msid=config&&config.msid?config.msid:window.msid;var main=config&&config.main?config.main:"#"+this.config.commentType;var wrapper=config&&config.wrapper?config.wrapper:this.config.wrapper;var toi_comment={};toi_comment[this.config.commentType]=new comments({main:main,msid:msid,wrapper:wrapper});
toi_comment[this.config.commentType].initializesec();$(wrapper+" #comment_sort").change(function(){var rootid=$(this).val(),id="comments"+(rootid&&rootid.length>0?"_"+rootid:""),sortLbl=rootid.length?rootid:"newest";$(wrapper+" .comments-list").hide();$(wrapper+" #"+id).show();$(wrapper+".comment-section .noComment").hide();if(toi_comment[id]){toi_comment[id].attachReplyAction();toi_comment[id].attachOpinionAction();toi_comment[id].updateCachedRating()}else{toi_comment[id]=new comments({main:"#"+id,msid:msid,commentType:id,wrapper:wrapper});
toi_comment[id].initialize()}event.publish("comment.sort",sortLbl);$(wrapper+" [data-plugin='comment-error-outer']").text("");$(wrapper+" [data-plugin='comment-error']").text("");event.publish("comment_error")});function processRated(user){var commenttype="comments"+($("#comment_sort")&&$("#comment_sort").val()!==""?"_"+$("#comment_sort").val():"");if(user&&typeof toi_comment!="undefined"&&typeof toi_comment[commenttype]!="undefined"&&typeof toi_comment[commenttype].config!="undefined"&&toi_comment[commenttype].config.msid){var tthis=toi_comment[commenttype];
var savedComment=tthis.getSavedComment();var usr_data={};usr_data.userId=user.getId();usr_data.baseEntityId=0;usr_data.uniqueAppKey=tthis.config.msid;usr_data.appKey="TFOOD";$.ajax({url:"/already_rated.cms",dataType:"jsonp",crossDomain:true,async:false,jsonp:"callback",data:usr_data,type:"GET"}).done(function(data){alreadyratedvar=data/2;if(data==undefined){userInfo.userRating=""}event.publish("comments.user_has_rated",data);if(window.msid==tthis.config.msid){data=(data&&data!="")?data:" ";if(data==" "&&ratevalue!=undefined&&ratetype!=undefined){movreview.rateMovie(ratevalue,ratetype,tthis.config.msid)
}else{if(data==" "&&ratevalue!=undefined&&ratetype!=undefined){movreview.rateMovie(ratevalue,ratetype,tthis.config.msid);savedComment.urs=ratevalue;tthis.saveComment(savedComment);tthis.loadSavedComment()}else{if(!isNaN(alreadyratedvar)){savedComment.urs=data;tthis.saveComment(savedComment);tthis.loadSavedComment()}}}}})}if(user&&typeof toi_comment!="undefined"&&typeof toi_comment[commenttype]!="undefined"&&typeof toi_comment[commenttype].markFollowingAll=="function"){toi_comment[commenttype].markFollowingAll()
}}var user=login.getUser();if(tempname!="videoshow"&&tempname!="articleshow"){processRated(user);event.subscribe("user.status",processRated)}event.subscribe("comments.loaded",function(commentObj){logger.log("comments.loaded:"+commentObj.config.commentType);commentObj.updateAfterCommentsLoaded();if(commentObj.config.hideResponses===true){commentObj.hideExtraResponses()}});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)}});dynamic.uptime();return toi_comment};times_comments.prototype.initializesec=function(){var tthis=this;this.config=util.extend(true,{},comments.config,module.config(),this.config);tthis.comments=[];tthis.commentCount=0;tthis.countPresent=false;tthis.pageCount=1;tthis.config.comment_block_count=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;if(tthis.config.disabledirectcomment){$(tthis.config.wrapper+' [data-plugin="comment-form"]').hide()}if(login.getUser()){$(tthis.config.wrapper+" [data-plugin='user-isloggedin']").show();$(tthis.config.wrapper+" [data-plugin='user-notloggedin']").hide()}else{$(tthis.config.wrapper+" [data-plugin='user-isloggedin']").hide();$(tthis.config.wrapper+" [data-plugin='user-notloggedin']").show()
}if(!tthis.config.nonloggedinComment&&tthis.pageCount===1){$(tthis.config.wrapper+' [data-plugin="user-notloggedin"]').remove()}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()}(function(tthis){event.subscribe("window.scroll",function(){var config=tthis.getConfig();
if(tthis.config.loadonscroll===true&&tthis.isLoading===0&&ui.inView(tthis.config.wrapper+" #"+tthis.config.commentType+" [data-plugin='comment']:visible:last",true,200)){tthis.loadComment(tthis.config.commentType,function(data){},true,++tthis.pageCount)}})})(tthis)};times_comments.prototype.attachUserToComment=function(commentObj,user){logger.log("Attaching user to comment");commentObj.user={id:user.getId(),uid:user.getId()?user.getUid():"",name:user.getFullName(),username:user.getUsername(),location:user.getCITY(),image:user.getThumb(),email:user.getEmail()}
};times_comments.prototype.hideExtraResponses=function(){var ttthis=this;$($(this.config.wrapper+" #"+this.config.commentType+" .comment-box.level1").get().reverse()).each(function(i,v){var tc=$(this);var tc_level=tc.data("level");var tc_next=tc.next();if(is.numberOnly(tc_next.data("level"))){var response_cnt=0;while((tc_next.data("level")!=tc_level)&&(tc_next.is(":hidden"))&&(i');
break}else{tc_next.slideDown();tc_next=tc_next.next();if(!is.numberOnly(tc_next.data("level"))){break}}response_cnt++}}})};times_comments.prototype.updateAfterCommentsLoaded=function(){var commentObj=this;if(this.pageCount===1){if(commentObj.config.commentType===this.config.commentType){if(commentObj.comments.length>0){logger.log("updateAfterCommentsLoaded : comments.loaded:"+commentObj.config.commentType);$(commentObj.config.wrapper+".comment-section .sortby").show()}else{logger.log("updateAfterCommentsLoaded : comments.loaded.none:"+commentObj.config.commentType);
$(commentObj.config.wrapper+".comment-section .sortby").hide();$(commentObj.config.wrapper+".comment-section .noComment").text("Be the first one to comment.").show()}}if(commentObj.countPresent!==true){logger.log("updateAfterCommentsLoaded : countPresent:false:"+commentObj.config.commentType);if(commentObj.comments.length===0){$("#morebt-"+commentObj.config.msid).show();$(commentObj.config.wrapper+".comment-section .noComment").text("Be the first one to comment.").show()}else{if(commentObj.config.commentType==="comments_discussed"){$(commentObj.config.wrapper+".comment-section .noComment").text("None of the comments have been discussed.").show()
}else{if(commentObj.config.commentType==="comments_agree"){}else{if(commentObj.config.commentType==="comments_disagree"){$(commentObj.config.wrapper+".comment-section .noComment").text("None of the comments have been down voted.").show()}}}}}}};times_comments.prototype.renderCommentCount=function(count){var tthis=this;function displayCount(type,cnt){$(tthis.config.wrapper+" [data-plugin='comment-count"+(type?"-"+type:"")+"']").text(cnt?cnt:"0");if(tempname=="videoshow"){$("[data-plugin='comment-count']").text(" "+(cnt?cnt:"0")+" ")
}else{$("[data-commentmsid='"+msidnew+"'] [data-plugin='comment-count']").text(" "+(cnt?cnt:"0")+" ")}event.publish("comment.count",(cnt?cnt:"0"));if(cnt==0){$(".cmtname").hide();$("#write").css("border","0 none")}}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}tthis.flagData=commentsData[0];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,childcount:cmt.CHILD?cmt.CHILD.length:0,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;o