var gChats=new Array();var gRE_IMAGE_URL=/(^https?:\/\/([ \S]+\.(jpe?g|png|gif))(\?w=\d+&h=\d+)?$)/ig;(function(b){var a={init:function(c){this.each(function(){var g=b(this);var f=g.data("glchat");if(!f){var e=g.attr("gulu:glchat");if(!e){return}f={code:e,started:false,maxMessages:g.attr("gulu:maxmsg"),boxPerMessage:g.attr("gulu:boxpermsg"),direction:g.attr("gulu:dir")||"up",subscribe:g.attr("gulu:subscribe")?true:false,notify:g.attr("gulu:notify")?true:false,participants:{},lastMessageTime:0,firstSeq:-1,messages:g.find(".messages")};if(f.subscribe){f.started=true}g.data("glchat",f);var d="update-"+e+".glchat";b(window).bind(d,b.proxy(a.update,g));g.find(".send-message").submit(b.proxy(a.sendMessage,this)).find("input").val("");gChats.push([e,f.subscribe]);f.messages.html("")}});return this},destroy:function(){return this.each(function(){})},update:function(c,d){this.glchat("update_"+d.type,d.data);return this},htmlEncode:function(c){return b("<div/>").text(c).html()},update_init:function(h){var f=this.data("glchat");if(!f){return}if(f.started){return}var c=f.participants;for(d=0;d<h.participants.length;d++){var g=h.participants[d];c[g.uuid]=g}f.userUUID=h.userUUID;this.data("glchat",f);for(var d=h.messages.length-1;d>=0;d--){var e=h.messages[d];this.glchat("update_"+e.type,e)}b("body.public.event .nothing_data.comment").hide();b("body.public.event .comment_list").prop({scrollTop:b(".comment_list").prop("scrollHeight")});f.started=true},update_init_subscribe:function(d){var c=d.seq_diff;var e=this.find(".notify");if(!e){return}e.text(c);if(c>0){e.show()}else{e.hide()}this.glchat("_updateStar")},_updateStar:function(){var c=0;b("#right_chat_all .star-bubble").each(function(){var d=parseInt(b(this).text(),10);c+=d});if(c){b("#chat_notify_star").show()}else{b("#chat_notify_star").hide()}},_updateNotify:function(){var e=this.data("glchat");if(!e.started){return}if(b.inArray(e.code,b.fn.glchat.joins)>=0){return}var d=this.find(".notify");if(!d){return}var c=parseInt(d.text(),10);d.text(c+1).show();if(gSTAR_NOTIFY_CHATS[e.code]){this.glchat("_updateStar")}},update_message:function(d){if(d.type!="message"){return}var e=this.data("glchat");if(!e){return}var f=e.userUUID;var c=d.sender_uuid;if(e.started&&e.userUUID==d.sender_uuid&&!this.hasClass("has_lightbox")){return}this.glchat("_writeMessage",d);this.glchat("_ensureFlashHint",d);this.glchat("_updateHistory",d);this.glchat("_updateNotify");b("body.public.event .nothing_data.comment").hide();b("body.public.event .comment_list").prop({scrollTop:b(".comment_list").prop("scrollHeight")})},writeBlock:function(d){var e=this.data("glchat");var c=e.messages;if(e.direction=="up"){c.prepend(d)}else{c.append(d)}},trimMessages:function(){var d=this.data("glchat");if(d.maxMessages&&d.messages.children().size()>d.maxMessages){var e;if(d.direction=="up"){e=d.messages.children(":last").remove()}else{e=d.messages.children(":first").remove()}var c=e.find(".sequenced").first().attr("glchat:seq");if(c===undefined){d.firstSeq+=1}else{d.firstSeq=Math.max(parseInt(c,10)+1,1)}this.glchat("_updateHistory")}},update_participant:function(c){var e=c.uuid;this.data("glchat")["participants"][e]=c;var d=this;this.find(".p"+e).each(function(){d.glchat("_setMessageParticipant",b(this),c)})},update_broadcast:function(c){return true},update_simplebroadcast:function(c){if(c.action=="start_typing"){b("."+c.participant_id+" .icon_dot").addClass("typing")}else{if(c.action=="stop_typing"){b("."+c.participant_id+" .icon_dot").removeClass("typing")}else{if(c.action=="leave_event"){uuid=c.participant_id;b(".glparticipant."+uuid).fadeOut(200,function(){b("li .glparticipant."+uuid).remove()})}}}},getHistory:function(){var g=b(this);var f=g.data("glchat");var d=g.find(".history");d.html(b('<img src="/static/images/icon_loading_s.gif" >'));var c=f.firstSeq-1;var h=Math.max(c-49,1);var e=b.comet.call({method:"history",data:{c:g.data("glchat")["code"],start:h,stop:c},success:b.proxy(a._gotHistory,g),error:function(i){g.find(".history").hide();return}})},_gotHistory:function(j){var g=this.data("glchat");var d=this.find(".history");delete g.maxMessages;var e=g.currentBlock;delete g.currentBlock;var f=g.messages;var k=b("<div></div>");g.messages=k;g.started=false;for(var h=0;h<j.history.length;h++){var l=j.history[h];this.glchat("update_message",l)}var c=k.contents();if(g.direction=="up"){f.append(c)}else{f.prepend(c)}g.messages=f;g.currentBlock=e;g.started=true},_writeMessage:function(e){var f=this.data("glchat");if(f.messages.length==0){return}e.content=e.content.replace(/\?w=\d+&h=\d+/,"");e._isImage=e.content.match(gRE_IMAGE_URL);var c;var h;if(e._isImage){c=this.glchat("_buildImageMessage",e)}else{c=this.glchat("_buildTextMessage",e)}h=c.messageHolder;h.attr("glchat:seq",e.sequence);var g=this.glchat("_getMessageBlock",e);var d=g.block;d.find(".msg_box").append(h);if(e._isImage){d.find(".user_name").after("<br />")}this.glchat("writeBlock",d);if(e._isImage){g.line=gMAX_LINE}else{g.line+=1}g.uuid=e.sender_uuid;if(f.lastMessageTime<e.created){f.lastMessageTime=e.created}this.glchat("trimMessages");if(e._isImage){return{image:true,imgWidth:c.imgWidth,imgHeight:c.imgHeight}}else{return{image:false}}},_buildTextMessage:function(d){var e=b('<p class="sequenced user_comment"></p>');var c=this;b.each(d.content.split(/\n|<br\s*\/?>/),function(g,f){f=c.glchat("htmlEncode",f);e.append(f);e.append("<br />")});return{type:"text",messageHolder:e}},_buildImageMessage:function(g){var e=b('<span class="sequenced pic_frame"><img src="/static/images/icon_loading_s.gif" ></span>');var f=new Image();f.name=g.content;f.src=g.content;var c=0;var d=0;f.onload=function(){c=this.height;d=this.width;if(d>290){var h=b('<img src="'+g.content+'" alt="'+g.content+'" style="width:290px;"/>')}else{var h=b('<img src="'+g.content+'" alt="'+g.content+'"/>')}$message=b('<a href="'+g.content+'" target="blank" class="chatimg"></a>');e.html(h);e.css("display","block")};return{type:"image",imgHeight:c,imgWidth:d,messageHolder:e}},_getMessageBlock:function(c){var e=this.data("glchat");var d=e.currentBlock;if(!d||e.boxPerMessage||c._isImage||(d.uuid!=c.sender_uuid)||(Math.abs(c.created-d.time)>=30)||(d.line>=gMAX_LINE)){return this.glchat("_startNewBlock",c)}return d},_startNewBlock:function(f){var g=this.data("glchat");var e=gMESSAGE_TEMPLATE.clone();e.attr("id","");var c=g.participants[f.sender_uuid];if(!c){c={display_name:"Unknown",user_id:"none"}}if(guluglobal.ctlist&&guluglobal.ctlist[c.user_id]){c.display_name=guluglobal.ctlist[c.user_id]["nickname"]}this.glchat("_setMessageParticipant",e,c);var i=f.created;if(Math.abs(i-g.lastMessageTime)<60){e.find(".talk_time").remove();e.css("padding","6px 8px 5px 8px")}else{var d=new Date(i*1000);e.find(".talk_time").text(d.toString())}e.css("display","block");var h={block:e,uuid:c.uuid,display_name:c.display_name,time:i,line:0};g.currentBlock=h;return h},_ensureFlashHint:function(f){var g=this.data("glchat");if(g.subscribe){return}var e=new Date().getTime()/1000;if(e-(parseInt(f.created,10))<2){if(typeof(TTCRLR)!="undefined"){var h;if(f._isImage){h="..."}else{h=f.content}var c=g.participants[f.sender_uuid];var d;if(!c){d=f.display_name}else{d=c.display_name}if(guluglobal.ctlist&&c&&guluglobal.ctlist[c.user_id]){d=guluglobal.ctlist[c.user_id]["nickname"]}TTCRLR.start(origin_title,d+" says: "+h,2000)}}},_updateHistory:function(f){var d=this.find(".history");if(d.length==0){return}var g=this.data("glchat");if(f){if(g.firstSeq>=1&&f.sequence>=g.firstSeq){return}g.firstSeq=f.sequence}var e=g.firstSeq-1;if(!e||e<0){d.hide();return}var c=b("<span>");c.html(gettext(" more messages... "));c.css("cursor","pointer");c.click(b.proxy(a.getHistory,this));d.empty().append(c);d.show()},_setMessageParticipant:function(e,c){e.find(".user_name span").text(c.display_name);if(guluglobal.ctlist&&guluglobal.ctlist[c.user_id]){e.find(".pic img").attr("src",guluglobal.ctlist[c.user_id]["photo_url"])}else{e.find(".pic img").attr("src","/photos/user/"+c.user_id+"/50/50")}if(b("body.event.public").size()==0){e.find(".pic img").css({width:"50px",height:"50px"})}else{if(this.hasClass("has_lightbox")){e.find(".pic img").css({width:"50px",height:"50px"})}else{e.find(".pic img").css({width:"25px",height:"25px"})}}e.addClass("p"+c.uuid);var d=e.find("li");if(c.uuid==this.data("glchat")["userUUID"]||this.data("glchat")["userUUID"]==undefined){d.addClass("pic_align_right");d.removeClass("pic_align_left")}else{d.addClass("pic_align_left");d.removeClass("pic_align_right")}},sendMessage:function(i,f){i.preventDefault();var h=b(this);var k=h.find(".send-message input");var j=k.val().trim();if(j==""){return false}k.val("");message={content:j,sender_uuid:h.data("glchat")["userUUID"],created:(new Date().getTime()/1000)};var g=h.glchat("_writeMessage",message);if(message._isImage){var d=g.imgWidth;var c=g.imgHeight;j+="?w="+d+"&h="+c}b.comet.call({method:"message",data:{c:h.data("glchat")["code"],m:j}});h.glchat("trimMessages");b("body.public.event .nothing_data.comment").hide();b("body.public.event .comment_list").prop({scrollTop:b(".comment_list").prop("scrollHeight")});return true}};b.fn.glchat=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.glchat")}}return this};b.fn.glchat.startComet=function(){var j=new Array();var f=new Array();for(var e=0;e<gChats.length;e++){var h=gChats[e];var d=h[0];var c=h[1];if(c){f.push(d)}else{j.push(d)}}var g=new Array();b.each(b(".glchat_rt_object"),function(k,l){var m=b(l).attr("gulu:rtobject");if(m){g.push(m)}});b.unique(j);b.unique(f);b.unique(g);b.fn.glchat.joins=j;b.comet.init(gCometURL,{pid:gParticipantUUID,joins:j,subscribes:f,subscribe_notifies:g},b.fn.glchat.on_glchats,b.fn.glchat.on_glchats_error,[b.fn.glchat.on_update,b.fn.glnotify.on_update,b.fn.globjectnotify.on_update]);return this};b.fn.glchat.subscribe_chat=function(c){b.comet.call({method:"subscribe_chat",data:{chat:c},success:function(e){b.fn.glchat.joins.push(c);var d="update-"+c+".glchat";b(window).trigger(d,[{type:"init",data:e.chat}])},error:b.fn.glchat.on_glchats_error});return this};b.fn.glchat.on_glchats=function(g){if(!g.success){b.fn.glchat.output("Error: "+g.error);return}var h=g.chats;for(var f=0;f<h.length;f++){var c=h[f];var e="update-"+c.chat+".glchat";b(window).trigger(e,[{type:"init",data:c}])}var d=g.subscribes;for(f=0;f<d.length;f++){c=d[f];e="update-"+c.chat+".glchat";b(window).trigger(e,[{type:"init_subscribe",data:c}])}};b.fn.glchat.on_update=function(d){var c="update-"+d.key+".glchat";b(window).trigger(c,[{type:d.type,data:d}])};b.fn.glchat.on_glchats_error=function(c,e,d){if(c.responseText){b.fn.glchat.output("Init failed: "+c.responseText)}};b.fn.glchat.output=function(d){try{console.debug(d)}catch(c){}}})(jQuery);(function(b){var a={init:function(c){this.each(function(){var h=b(this);var g=h.data("glpresence");if(!g){var f=h.attr("gulu:glchat");var d=(h.attr("gulu:flags")||"").trim().split(/\s+/);if(!f){return}h.data("glpresence",{code:f,flags:d,participants:{}});var e="update-"+f+".glchat";b(window).bind(e,b.proxy(a.update,h))}});return this},destroy:function(){return this.each(function(){})},update:function(c,e){var d=this;if(e.type=="init"){b.each(e.data["participants"],function(g,f){d.glpresence("update_participant",f)})}else{if(e.type=="participant"){d.glpresence("update_participant",e.data)}}return this},update_participant:function(j){var f=this.data("glpresence");var g=f.participants;var e=j.uuid;var h=this.find("."+e);if(!h.length){if(j.type=="participant"&&e){Invite.add_friend_by_session_uuid(e)}return}for(var d=0;d<f.flags.length;d++){var c=f.flags[d];if(j[c]){if(c=="active"){h.find(".icon_dot").removeClass("off");h.find(".icon_dot").addClass("on")}h.addClass(c)}else{if(c=="active"){h.find(".icon_dot").removeClass("on");h.find(".icon_dot").addClass("off")}h.removeClass(c)}}}};b.fn.glpresence=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.glpresence")}}return this}})(jQuery);(function(b){var a={init:function(c){this.each(function(){var g=b(this);var f=g.data("rsvp");if(!f){var e=g.attr("gulu:glchat");if(!e){return}g.data("rsvp",{code:e});var d="update-"+e+".glchat";b(window).bind(d,b.proxy(a.update,g))}});return this},destroy:function(){return this.each(function(){})},update:function(c,e){var d=this;if(e.type=="broadcast"){if(e.data["action_type"]=="rsvp"){d.glbcast("update_rsvp",e.data)}else{if(e.data["action_type"]=="change_default"){d.glbcast("update_default",e.data)}else{if(e.data["action_type"]=="vote"){d.glbcast("update_vote",e.data)}else{if(e.data["action_type"]=="add_new"){d.glbcast("add_new",e.data)}else{if(e.data["action_type"]=="delete_item"){d.glbcast("delete_item",e.data)}else{if(e.data["action_type"]=="update_admin"){d.glbcast("update_admin",e.data)}else{if(e.data["action_type"]=="leave_event"){d.glbcast("leave_event",e.data)}else{if(e.data["action_type"]=="update_gallery"){d.glbcast("update_gallery",e.data)}}}}}}}}}return this},update_gallery:function(c){if(window.mediaSet){b(".no_content").hide();b(".public_page_gallery").show();window.mediaSet.fetch()}},delete_item:function(g){if(window.votePlaceCandidates){if(g.target_type=="place"){window.votePlaceCandidates.fetch()}else{if(g.target_type=="time"){window.voteTimeCandidates.fetch()}}}else{uuid=g.sender_uuid;if(b(".event_feed_"+g.key).length>0){return false}else{if(b("body").hasClass("event")){if(uuid!=b(".chat_group.glchat").data("glchat")["userUUID"]){var f=b("li."+g.object_id);for(var e=0,c=f.length;e<c;++e){del_target=b(f[e]);del_target.slideUp(EventVotePage.ANIMATION_DURATION,function(){del_target.remove()})}$part=b("body.profile.event");var d={place_list:$part.find("div.vote_place ul"),time_list:$part.find("div.vote_time ul"),info_location:$part.find("#info_location"),info_time:$part.find("#info_time"),info_photo_url:$part.find("#event_profile_photo_url")};EventVotePage.update_info_board_if_needed(d)}}}}},update_admin:function(c){uuid=c.target_session_uuid;if(b(".event_feed_"+c.key).length>0){if(c.state){b("#inv_btn_"+uuid).parent().css("display","inline")}else{b("#inv_btn_"+uuid).parent().css("display","none");b("#inv_friend_wrapper_"+uuid).css("display","none")}}else{if(b("body").hasClass("event")){if(uuid==b(".chat_group.glchat").data("glchat")["userUUID"]){if(c.state){b("#event_editting_btn").css("display","block");b("#event_invite_friend").css("display","block")}else{b("#done_setting").click();b("#event_editting_btn").css("display","none");b("#event_invite_friend").css("display","none")}}}}},add_new:function(e){if(window.votePlaceCandidates){if(e.new_type=="place"){window.votePlaceCandidates.fetch()}else{if(e.new_type=="time"){window.voteTimeCandidates.fetch()}}}else{uuid=e.sender_uuid;if(b(".event_feed_"+e.key).length>0){return false}else{if(b("body").hasClass("event")){if(uuid!=b(".chat_group.glchat").data("glchat")["userUUID"]){$part=b("body.profile.event");var c=new EventVotePage($part.find("div.place > ul"),$part.find("div.time > ul"));var d=new EventVotePage($part.find("div.vote_place > ul"),$part.find("div.vote_time > ul"));if(e.new_type=="place"){c.add_into_place_list(b(e.new_item_page_s));d.add_into_place_list(b(e.new_item_page_v))}else{c.add_into_time_list(b(e.new_item_page_s));d.add_into_time_list(b(e.new_item_page_v))}}}}}},update_rsvp:function(c){if(window.invitations){window.invitations.fetch()}uuid=c.sender_uuid;part=b("."+uuid);if(c.status==1){part.find(".rsvp_yes.yes").removeClass("on");part.find(".rsvp_no.no").removeClass("on");b(".yes_check").hide();b(".no_check").hide()}else{if(c.status==2){part.find(".rsvp_yes.yes").addClass("on");part.find(".rsvp_no.no").removeClass("on");part.find(".rsvp_yes.yes").removeClass("off");b(".yes_check").show();b(".no_check").hide()}else{if(c.status==3){part.find(".rsvp_yes.yes").removeClass("on");part.find(".rsvp_no.no").addClass("on");part.find(".rsvp_no.no").removeClass("off");b(".yes_check").hide();b(".no_check").show()}}}},leave_event:function(c){uuid=c.sender_uuid;b(".glparticipant."+uuid).fadeOut(200,function(){b("li .glparticipant."+uuid).remove()})},update_vote:function(f){if(window.votePlaceCandidates){if(f.vote_target_type=="place"){window.votePlaceCandidates.fetch()}else{if(f.vote_target_type=="time"){window.voteTimeCandidates.fetch()}}}else{uuid=f.sender_uuid;if(b(".event_feed_"+f.key).length>0){return false}else{if(b("body").hasClass("event")){if(uuid!=b(".chat_group.glchat").data("glchat")["userUUID"]){var e=b("li."+f.object_id);for(var d=0,c=e.length;d<c;++d){vote_count=b(e[d]).find(".vote_count");vote_count.text("( "+f.count+" )")}}}}}},update_default:function(e){if(window.votePlaceCandidates){}uuid=e.sender_uuid;var k=b(".event_feed_"+e.key);if(b(".event_feed_"+e.key).length>0){var c=k.find(".info_time");var h=k.find(".info_location");var l=k.find(".post_target_img.pic_frame > img");if(e.location){h.text(e.location);h.attr("href",e.location_url)}else{h.text("-");h.attr("href","")}if(e.time){c.text(e.time)}else{c.text("-")}l.attr("src",e.photo_url);l.attr("small_src",e.photo_url);l.attr("large_src",e.large_photo_url);l.attr("photo_id",e.photo_id)}else{if(b("body").hasClass("event")){if(uuid!=b(".glchat").data("glchat")["userUUID"]){target_id=e.target_id;var h=b("#info_location");var c=b("#info_time");var l=b("#event_profile_photo_url");var j=b("li."+target_id);var d=e.target_type;b("div.place > ul").find("li.on").removeClass("on");b("div.time > ul").find("li.on").removeClass("on");b("div.vote_place > ul").find("li.on").removeClass("on");b("div.vote_time > ul").find("li.on").removeClass("on");if(e.location){h.text(e.location);if(d==EventVotePage.TYPE_PLACE){for(var f=0,g=j.length;f<g;++f){b(j[f]).addClass("on")}}}else{h.text("-")}l.attr("src",e.photo_url);if(e.time){c.text(e.time);if(d==EventVotePage.TYPE_TIME){for(var f=0,g=j.length;f<g;++f){b(j[f]).addClass("on")}}}else{c.text("-")}}}}}};b.fn.glbcast=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.glbcast")}}return this}})(jQuery);(function(b){var a={init:function(c){this.each(function(){var f=b(this);var e=f.data("glnotify");if(!e){f.data("glnotify",{code:c.id});var d="update-"+c.id+".glnotify";b(window).bind(d,b.proxy(a.update,f))}});return this},destroy:function(){return this.each(function(){})},update:function(c,g){var e=b(this);if(g.data["notify_type"]=="like"||g.data["notify_type"]=="unlike"){var f=new Date();b.ajax({url:"/like/like_info/"+e.data("glnotify").code+"/"+g.data["content_type_id"]+"/"+g.data["object_id"]+"/?_="+f.getTime(),type:"GET",data:{is_metoo:g.data["is_metoo"]},success:function(d){b("#"+g.data["content_type_id"]+"_"+g.data["object_id"]+"_like_info").trigger("updateLikeInfo",{pk:g.data["object_id"],html:d.html})},error:function(){console.log("real time like error!")},dataType:"json"})}else{if(g.data["ntfcount"]>0){window.top.updateActivityBall({act_num:g.data["ntfcount"],selector:"#show_notification"})}}}};b.fn.glnotify=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.glnotify")}}return this};b.fn.glnotify.on_update=function(e){if(e.uids){for(var d=0;d<e.uids.length;d++){var c="update-"+e.uids[d]+".glnotify";b(window).trigger(c,[{data:e}])}}else{if(e.uid){var c="update-"+e.uid+".glnotify";b(window).trigger(c,[{data:e}])}}}})(jQuery);(function(b){var a={init:function(c){this.each(function(){var f=b(this);var e=f.data("globjectnotify");if(!e){f.data("globjectnotify",{code:f.attr("gulu:rtobject"),uuid:gParticipantUUID});var d="update-"+f.data("globjectnotify").code+".glnotify";b(window).bind(d,b.proxy(a.update,f))}});return this},destroy:function(){return this.each(function(){})},update:function(c,f){var n=b(this);if(f.data["action_type"]=="dare_vote"){if(gViewSessionID==f.data["view_session_id"]){return true}var h="";var e="";if(guluglobal.ctlist&&guluglobal.ctlist[f.data.eid]){h=guluglobal.ctlist[f.data.eid]["nickname"];e=guluglobal.ctlist[f.data.eid]["photo_url"]}else{h=f.data.voter_name;e=f.data.voter_photo_url}if(b("body").hasClass("dare")&&b("body").hasClass("public_base")){b(this).DarePublic("updateVote",f.data.object_id,viewer_uer_id);if(f.data.status=="after_dare"){var k=f.data.vote_type=="ef"?"EPIC FAIL":"TWO THUMBS UP"}else{var k=f.data.vote_type=="no"?"No":"Yes"}if(f.data.remove){var d="<b>"+h+"</b> has taken bake the vote <b>"+k+"</b>"}else{if(f.data.first_time){var d="<b>"+h+"</b> has voted <b>"+k+"</b>"}else{var d="<b>"+h+"</b> has switched side to <b>"+k+"</b>"}}d='<div class="text">'+d+"</div>";d='<div class="img"><img src="'+e+'" alt="" height="25" width="25"></div>'+d;b(this).DarePublic("showRoomMsg",d)}else{if(b(".dare_feed_"+f.data.object_id).size()>0){b(".dare_feed_"+f.data.object_id).DareFeed("update_feed",b(".dare_feed_"+f.data.object_id))}}}if(f.data["action_type"]=="like"){if(b(".dare_feed_"+f.data.object_id).size()>0){if(gViewSessionID==f.data["view_session_id"]){b(".dare_feed_"+f.data.object_id).DareFeed("update_feed",b(".dare_feed_"+f.data.object_id))}}}if(f.data["action_type"]=="upload_photo"||f.data["action_type"]=="upload_video"){if(gViewSessionID==f.data["view_session_id"]){return true}if(b("body").hasClass("dare")&&b("body").hasClass("public_base")){b(this).DarePublic("updateGallery",f.data.object_id,viewer_uer_id)}if(b(".dare_feed_"+f.data.object_id).size()>0){b(".dare_feed_"+f.data.object_id).DareFeed("update_feed",b(".dare_feed_"+f.data.object_id))}}if(f.data["action_type"]=="comment"){if(gViewSessionID==f.data["view_session_id"]){return true}var h="";var e="";var m="#";if(guluglobal.ctlist&&guluglobal.ctlist[f.data.eid]){h=guluglobal.ctlist[f.data.eid]["nickname"];e=guluglobal.ctlist[f.data.eid]["photo_url"];m=guluglobal.ctlist[f.data.eid]["user_url"]}if(f.data["html"]){var l=b(f.data["html"])}else{if(h!=""){var j=Gulu.comment_template.replace("[[comment_id]]",f.data.commentid).replace("[[user_url]]",m).replace("[[user_photo]]",e).replace("[[user_name]]",h).replace("[[content]]",f.data.content)}else{var j=Gulu.comment_template.replace("[[comment_id]]",f.data.commentid).replace("[[user_url]]",f.data.user_url).replace("[[user_photo]]",f.data.user_photo).replace("[[user_name]]",f.data.user_name).replace("[[content]]",f.data.content)}var l=b(j)}if(f.data.uid!=gUSER_ID){l.find(".close_btn_m").remove()}if(h){l.find("h4 a").text(h)}if(e){l.find(".user_pic img").attr("src",e)}n.find(".nothing_data.comment").css("display","none");if(n.hasClass("im")){if(f.data.html_im){l=b(f.data.html_im).hide()}else{if(h!=""){l=Gulu.comment_template_im.replace("[[comment_id]]",f.data.commentid).replace("[[user_url]]",m).replace("[[user_photo]]",e).replace("[[user_name]]",h).replace("[[content]]",f.data.content)}else{l=Gulu.comment_template_im.replace("[[comment_id]]",f.data.commentid).replace("[[user_url]]",f.data.user_url).replace("[[user_photo]]",f.data.user_photo).replace("[[user_name]]",f.data.user_name).replace("[[content]]",f.data.content)}l=b(l).hide()}if(f.data.eid!=n.find(".viewer_email").attr("value")){l.removeClass("pic_align_right");l.addClass("pic_align_left")}l.appendTo(n.find(".comment_list ul")).show();if(h){l.find(".user_name span").text(h)}if(e){l.find(".pic img").attr("src",e)}n.find(".comment_list").prop({scrollTop:n.find(".comment_list").prop("scrollHeight")});var g=n.find(".view_all_comments .comment_bd a span");if(g.size()){var i=parseInt(g.text(),10);g.text(i+1)}}else{if(n.hasClass("top_down")){l.prependTo(n.find(".comment_list")).fadeIn("slow");var g=n.find(".view_all_comments .comment_bd a span");if(g.size()){var i=parseInt(g.text(),10);g.text(i+1)}}else{l.hide();l.insertBefore(n.find("form")).fadeIn("slow");var o=n.find("textarea");o.animate({height:"15px"},200,function(){});var g=n.find(".all_comment_count");if(g.size()){var i=parseInt(g.text(),10);g.text(i+1)}}}}}};b.fn.globjectnotify=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.globjectnotify")}}return this};b.fn.globjectnotify.subscribe_object=function(c){b.comet.call({method:"subscribe_object",data:{object_id:c},success:function(d){b.fn.globjectnotify.bind_object(c)},error:b.fn.glchat.on_glchats_error});return this};b.fn.globjectnotify.bind_object=function(e){var c="update-"+e+".glnotify";var d=b(".glchat_rt_object."+e);d.data("globjectnotify",{code:d.attr("gulu:rtobject"),uuid:gParticipantUUID});b(window).unbind(c);b(window).bind(c,b.proxy(a.update,d));return this};b.fn.globjectnotify.on_update=function(e){if(e.object_ids){for(var d=0;d<e.object_ids.length;d++){var c="update-"+e.object_ids[d]+".glnotify";b(window).trigger(c,[{data:e}])}}else{if(e.object_id){var c="update-"+e.object_id+".glnotify";b(window).trigger(c,[{data:e}])}}}})(jQuery);(function(g){g.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(a,b){g.fx.step[b]=function(c){if(!c.colorInit){c.start=h(c.elem,b);c.end=e(c.end);c.colorInit=true}c.elem.style[b]="rgb("+[Math.max(Math.min(parseInt((c.pos*(c.end[0]-c.start[0]))+c.start[0]),255),0),Math.max(Math.min(parseInt((c.pos*(c.end[1]-c.start[1]))+c.start[1]),255),0),Math.max(Math.min(parseInt((c.pos*(c.end[2]-c.start[2]))+c.start[2]),255),0)].join(",")+")"}});function e(a){var b;if(a&&a.constructor==Array&&a.length==3){return a}if(b=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a)){return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]}if(b=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(a)){return[parseFloat(b[1])*2.55,parseFloat(b[2])*2.55,parseFloat(b[3])*2.55]}if(b=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(a)){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}if(b=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(a)){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}if(b=/rgba\(0, 0, 0, 0\)/.exec(a)){return f.transparent}return f[g.trim(a).toLowerCase()]}function h(a,c){var b;do{b=g.curCSS(a,c);if(b!=""&&b!="transparent"||g.nodeName(a,"body")){break}c="backgroundColor"}while(a=a.parentNode);return e(b)}var f={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]}})(jQuery);
