var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opens = _____WB$wombat$assign$function_____("opens"); /*1304302700,169776319*/ if (window.CavalryLogger) { CavalryLogger.start_js(["iJB9Y"]); } WidgetArbiter={_findSiblings:function(){if(WidgetArbiter._siblings)return;WidgetArbiter._siblings=[];for(var b=parent.frames.length-1;b>=0;b--)try{if(parent.frames[b]&&parent.frames[b].Arbiter&&parent.frames[b].Arbiter.inform)WidgetArbiter._siblings.push(parent.frames[b].Arbiter);}catch(a){}},inform:function(){WidgetArbiter._findSiblings();var a=$A(arguments);WidgetArbiter._siblings.each(function(b){b.inform.apply(b,a);});}}; WindowComm={_callbacks:{},makeHandler:function(a,c){c=c||'opener';var b='f'+(Math.random()*(1<<30)).toString(16).replace('.','');WindowComm._callbacks[b]=a;return new URI('/connect/window_comm.php').setQueryData({_id:b,_relation:c}).getQualifiedURI().toString();},_recv:function(b){var a=new URI(b).getQueryData();WindowComm._callbacks[a._id](a);}}; var PopupResizer={_opts:{allowShrink:true,timeout:100},init:function(a){copy_properties(PopupResizer._opts,a);PopupResizer._resizeCheck.recur(PopupResizer._opts.timeout);},_resizeCheck:function(){var e=Vector2.getViewportDimensions(),a=PopupResizer._getDocumentSize(),c=a.y-e.y,d=a.x-e.x;if(d<0)d=0;if(!PopupResizer._opts.allowShrink&&c<0)c=0;if(c||d)try{window.resizeBy(d,c);if(d)window.moveBy(d/-2,0);}catch(b){}},_getDocumentSize:function(){var a={x:ua.firefox()?document.documentElement.scrollWidth:document.body.scrollWidth,y:document.body.scrollHeight};if(a.x<=0||a.x>document.documentElement.scrollWidth)a.x=document.documentElement.scrollWidth;if(a.y<=0||a.y>document.documentElement.scrollHeight)a.y=document.documentElement.scrollHeight;if(window.Dialog&&Dialog.max_bottom&&Dialog.max_bottom>a.y)a.y=Dialog.max_bottom;return a;},open:function(i,b,j){var f=typeof window.screenX!='undefined'?window.screenX:window.screenLeft,g=typeof window.screenY!='undefined'?window.screenY:window.screenTop,e=typeof window.outerWidth!='undefined'?window.outerWidth:document.body.clientWidth,d=typeof window.outerHeight!='undefined'?window.outerHeight:(document.body.clientHeight-22),c=parseInt(f+((e-j)/2),10),h=parseInt(g+((d-b)/2.5),10),a=('width='+j+',height='+b+',left='+c+',top='+h);return window.open(i,'_blank',a);}}; var PlatformOptInPopup=function(){};copy_properties(PlatformOptInPopup,{DIALOG_URL:'/connect/uiserver.php',DIALOG_WIDTH:420,DIALOG_HEIGHT:450,APP_ID:127760087237610,open:function(d,c,a){if(!d)d='generic';if(!c)c='opt.in';var b=new URI(PlatformOptInPopup.DIALOG_URL);b.addQueryData({social_plugin:d,method:c,display:'popup',secure:URI.getRequestURI().isSecure(),app_id:PlatformOptInPopup.APP_ID});if(a)b.addQueryData(a);return PopupResizer.open(b.toString(),PlatformOptInPopup.DIALOG_WIDTH,PlatformOptInPopup.DIALOG_HEIGHT);}}); function ConnectSocialWidget(a,b){ConnectSocialWidget.setInstance(b,this);ConnectSocialWidget.delayUntilDisplayed(function(){this.initializeObject.call(this,a,b);}.bind(this));}copy_properties(ConnectSocialWidget,{OPT_IN_FACEBOOK_APP_ID:'127760087237610',TYPE_ACTIVITY:'A',TYPE_RECOMMENDATIONS:'R',TYPE_LIKEBOX:'L',instances:{},setInstance:function(b,a){ConnectSocialWidget.instances[b]=a;},getInstance:function(a){return ConnectSocialWidget.instances[a];},popups:{},login:function(a,b){ConnectSocialWidget.popups[b]={popup:PlatformOptInPopup.open('login','opt.in')};},aDelayedFunctions:[],delayUntilDisplayed:function(a){ConnectSocialWidget.aDelayedFunctions.push(a);if(ConnectSocialWidget.aDelayedFunctions.length===1){if(!ConnectSocialWidget.ndTestDim){var b=document.createElement('div'),c={position:'absolute',width:'1px',height:'1px',overflow:'hidden',top:'0px'};for(var d in c)if(typeof c[d]==='string')CSS.setStyle(b,d,c[d]);document.body.appendChild(b);ConnectSocialWidget.ndTestDim=b;}ConnectSocialWidget.testForDisplay();}},testForDisplay:function(){var a=Vector2.getElementDimensions(ConnectSocialWidget.ndTestDim).y;if(a!==0){ConnectSocialWidget.aDelayedFunctions.forEach(function(b){b();});ConnectSocialWidget.aDelayedFunctions=[];}else ConnectSocialWidget.testForDisplay.defer(100);},listenForLogin:function(){if(!ConnectSocialWidget.listenerAttached){Arbiter.subscribe('platform/socialplugins/login',function(a){if(a.user!==Env.user)document.location.reload();});ConnectSocialWidget.listenerAttached=true;}}});copy_properties(ConnectSocialWidget.prototype,{initializeObject:function(e,g){var d=DOM.scry(document.body,e.sOverflowContainerSelector)[0],c=DOM.scry(d,'.fbConnectWidgetFooter')[0],a=c?Vector2.getElementDimensions(c).y:0,f=e.sOverflowItemsSelector,b=DOM.scry(document.body,e.sStreamContainerSelector)[0];this.fRemoveOverflowElements=this.removeOverflowElements.bind(this,d,b,f,-a);copy_properties(this,{bInitialized:true,sWidgetId:g,iFooterHeight:a,ndTop:d,ndFooter:c,ndContentContainer:b,oQueryParams:new URI(window.location.href).getQueryData(),bComboMode:e.bComboMode,sOverflowItemsSelector:f});copy_properties(this.oQueryParams,{post_form_id:Env.post_form_id,user:Env.user});this.fRemoveOverflowElements();CSS.setStyle(b,'visibility','visible');animation(b).from('opacity',0).to('opacity',1).duration(200).go();ConnectSocialWidget.listenForLogin();new ClickThroughMonitor({ndTop:this.ndContentContainer,fValidateLink:this.getElementTop.bind(this),fGetMonitorData:function(h){var i={site:this.oQueryParams.site,type:this.getLinkType(),plugin:this.getPluginType(),social:(DOM.scry(h,'^div.fbSocial').length>0),pos:this.getItemPosition(this.getElementTop(h)),signature:this.getItemSignature(this.getElementTop(h))};if(this.oQueryParams.api_key)i.api_key=this.oQueryParams.api_key;return i;}.bind(this)});},getElementTop:function(b){var a=DOM.scry(b,'^'+this.sOverflowItemsSelector);return a[0];},getItemPosition:function(d){var a=DOM.scry(this.ndContentContainer,this.sOverflowItemsSelector),c=a.length,b=a.indexOf(d)+1;return b+'/'+c;},getItemSignature:function(c){var a=c.className.split(' ');for(var b=0;b0&&(f=$(a.pop()))&&(Vector2.getElementDimensions(f).y+Vector2.getElementPosition(f).y)>e)DOM.remove(f);},login:function(){ConnectSocialWidget.login(this.appID,this.sWidgetId);},toggleLogin:function(){DOM.scry(this.ndTop,'.fbToggleLogin').forEach(function(a){CSS.toggle(a);});this.fRemoveOverflowElements();}});function ActivityWidget(a,b){this.parent.construct(this,a,b);}ActivityWidget.extend('ConnectSocialWidget');ActivityWidget.ENDPOINT='/ajax/connect/activity_widget.php';ActivityWidget.REQUEST_INTERVAL=15*1000;ActivityWidget.ACTIVITY_HEIGHT=45;ActivityWidget.MAX_INTERVAL=30;ActivityWidget.MAX_ITEMS=24;copy_properties(ActivityWidget.prototype,{initializeObject:function(a,b){this.parent.initializeObject.call(this,a,b);this.oQueryParams.nb_activities=Math.min(ActivityWidget.MAX_ITEMS,Math.round((this.oQueryParams.height||300)/ActivityWidget.ACTIVITY_HEIGHT));this.oQueryParams.newest=a.iNewestStoryTime||0;},getLinkType:function(){return ConnectSocialWidget.TYPE_ACTIVITY;},getPluginType:function(){return ConnectSocialWidget.TYPE_ACTIVITY;},removeOverflowElements:function(){if(this.bComboMode&&!this.bFirstRound){this.bFirstRound=true;var d=Vector2.getElementPosition(this.ndTop).y,b=Vector2.getElementDimensions(document.body).y-(d+this.iFooterHeight),c=Math.round(b/2),a=$A(arguments);a[a.length]=c;ConnectSocialWidget.prototype.removeOverflowElements.apply(this,a);}else ConnectSocialWidget.prototype.removeOverflowElements.apply(this,arguments);},hasFriendsActivity:function(){return DOM.scry(this.ndContentContainer,'div.fbFriendsActivity')[0].childNodes.length>0;},hasContent:function(){return DOM.scry(this.ndTop,this.sOverflowItemsSelector).length>0;},getEmptyMessage:function(){return DOM.find(this.ndContentContainer,'div.fbEmptyWidget');},showEmptyMessage:function(){var a=this.getEmptyMessage();if(a)CSS.show(a);}});function RecommendationsWidget(a,b){this.parent.construct(this,a,b);}RecommendationsWidget.extend('ConnectSocialWidget');copy_properties(RecommendationsWidget.prototype,{getLinkType:function(){return ConnectSocialWidget.TYPE_RECOMMENDATIONS;},getPluginType:function(){return this.sActivityParent?ConnectSocialWidget.TYPE_ACTIVITY:ConnectSocialWidget.TYPE_RECOMMENDATIONS;},initializeObject:function(a,b){this.parent.initializeObject.call(this,a,b);this.sActivityParent=a.sActivityParent;this.cropImages();},cropImages:function(){var a=DOM.scry(this.ndContentContainer,".fbImageContainer img");if(a.length>0){var b=function(event){RecommendationsWidget.image_resize({image:event.getTarget(),dimension:RecommendationsWidget.IMAGE_HEIGHT});};a.forEach(function(c){if(c.complete){RecommendationsWidget.image_resize({image:c,dimension:RecommendationsWidget.IMAGE_HEIGHT});}else Event.listen(c,'load',b);});}},hasContent:function(){return this.ndContentContainer.childNodes.length>0;},getParent:function(){if(this.sActivityParent)return ConnectSocialWidget.getInstance(this.sActivityParent);},showRecommendationsSeparator:function(){var b=this.getParent();if(b&&b.hasContent()){var a=DOM.scry(this.ndTop,'div.fbRecommendationsSeparator')[0];CSS.show(a);CSS.setStyle(a,'visibility','visible');}return this;},removeOverflowElements:function(){ConnectSocialWidget.prototype.removeOverflowElements.apply(this,arguments);if(this.sActivityParent&&!this.hasContent()){var a=DOM.scry(this.ndTop,'div.fbRecommendationsSeparator')[0];CSS.hide(a);}}});RecommendationsWidget.ENDPOINT='/ajax/connect/recommendations_widget.php';RecommendationsWidget.IMAGE_HEIGHT=35;RecommendationsWidget.ITEM_HEIGHT=45;function LikeBoxWidget(a,b){this.parent.construct(this,a,b);}LikeBoxWidget.extend('ConnectSocialWidget');copy_properties(LikeBoxWidget.prototype,{getLinkType:function(){return ConnectSocialWdiget.TYPE_LIKEBOX;},getPluginType:function(){return ConnectSocialWidget.TYPE_LIKEBOX;}});RecommendationsWidget.image_resize=function(j){var h=j.image,i=Vector2.getElementDimensions(h),a=i.y,g=i.x,e=j.dimension,k=e+'px';if(a<=5||g<=5)return;var d=a/g;if(d<.5||d>2)return;if(a===g){CSS.setStyle(h,'width',k);}else if(a0){this.adminLinks=[];for(var a=0;a0?i[0]:null;if(h.showFaces&&h.viewer>0)this.loggedInUserPhotoDiv=DOM.find(this.widget,'div.connect_widget_logged_in_user');}if(this.layout===ExternalNodeConnectWidget.SIMPLE_LAYOUT){this.originalButtonWidth=this.computeButtonDimensions().width;this.summaryIncluding=DOM.find(this.widget,'td.connect_widget_simple_including');this.supportCommenting=false;this.usingInlineCommenting=false;}this.setQueryData();if(this.pageId)copy_properties(this.popupOptInParams,{connect_id:this.pageId});this.errorSpans=DOM.scry(this.widget,'span.connect_widget_error_span');if(this.errorSpans.length>0){this.errorLinks=[];for(var b=0;b0){this.confirmLinks=[];for(var d=0;d0;},updateConnectionWithComment:function(event){Event.kill(event);if(this.commentButtonIsActive){this.postInlineComment();this.resetInlineComment();this.closeInlineComment();}},postInlineComment:function(){this.postUserComment(this.inlineCommentInput.value.trim());},resetInlineComment:function(){this.concealCommentButton();var a=this.inlineCommentInput.getAttribute('placeholder');this.inlineCommentInput.value=a;},showInlineComment:function(event){Event.kill(event);if(!this.inlineCommentFlyoutOpen||this.inlineCommentFlyoutVisible||this.error)return;this.inlineCommentFlyoutVisible=true;CSS.show(this.inlineCommentFlyout);},hideInlineComment:function(event){Event.kill(event);if(!this.inlineCommentFlyoutOpen||!this.inlineCommentFlyoutVisible)return;if(DOM.contains(this.inlineCommentFlyout,event.getRelatedTarget()))return;var b=this.inlineCommentInput.value.trim();var a=this.inlineCommentInput.getAttribute('placeholder');if(b.length>0&&b!=a)return;this.inlineCommentFlyoutVisible=false;CSS.hide(this.inlineCommentFlyout);},closeInlineComment:function(){this.inlineCommentFlyoutVisible=false;this.inlineCommentFlyoutOpen=false;CSS.hide(this.inlineCommentFlyout);this.resetInlineComment();},concealCommentButton:function(){CSS.addClass(this.inlineCommentButton,'hidden_elem');CSS.setStyle(this.inlineCommentInput,'width',this.textInputWidthWithoutButton+'px');CSS.setStyle(this.inlineCommentInput,'margin-right',0);},positionInlineCommentFlyout:function(){CSS.addClass(this.inlineCommentFlyout,'comment_widget_offscreen');CSS.removeClass(this.inlineCommentFlyout,'hidden_elem');var b=0;var a=this.computeButtonDimensions();var e=a.height;var d=this.grayOut?b:b+20;var g=intl_locale_is_rtl()?'right':'left';if(this.showFaces){var k=DOM.scry(this.widget,'span.connect_widget_text')[0];var h=intl_locale_is_rtl()?'paddingRight':'paddingLeft';var l=CSS.getStyle(k,h);d=this.grayOut?b:b+parseInt(l,10);var i=Vector2.getElementDimensions(this.sampleConnections).y;e=i-3;}var j=Vector2.getElementDimensions(this.summaryText).y;if(j>15)e+=2;CSS.setStyle(this.inlineCommentFlyout,g,d+'px');CSS.setStyle(this.inlineCommentFlyout,'top',(-e)+'px');var n=Vector2.getElementPosition(this.widget,'document').x;var m=Vector2.getElementDimensions(this.widget).x;var o=n+m-d-5;CSS.setStyle(this.inlineCommentFlyout,'width',o+'px');CSS.removeClass(this.inlineCommentButton,'hidden_elem');var f=Vector2.getElementDimensions(this.inlineCommentButton).x;CSS.addClass(this.inlineCommentButton,'hidden_elem');var c=(this.inlineCommentClose)?15:0;this.textInputWidthWithoutButton=o-24-c;this.textInputWidthWithButton=this.textInputWidthWithoutButton-f-this.textInputMarginWithButton-1;CSS.setStyle(this.inlineCommentInput,'width',this.textInputWidthWithoutButton+'px');CSS.setStyle(this.inlineCommentInput,'margin-right',0);CSS.removeClass(this.inlineCommentFlyout,'comment_widget_offscreen');CSS.addClass(this.inlineCommentFlyout,'hidden_elem');},postUserComment:function(a){var b={href:this.externalUrl,node_type:this.nodeType,edge_type:this.edgeType,page_id:this.pageId,connect_text:this.connectText,story_fbid:this.connectStoryFbid,comment:a};Bootloader.loadComponents(['async','async-postlude'],function(){new AsyncRequest().setURI(this.getCommentAjaxEndpoint()).setData(b).setNectarModuleDataSafe().setNectarImpressionIdSafe().send();}.bind(this));this.closeCommentWidget();},closeCommentWidget:function(){if(this.commentWidgetOpen){delete this.inGracePeriod;delete this.commentWidgetIsExpanded;this.commentWidgetVisible=false;this.commentWidgetOpen=false;UnverifiedXD.send({type:'dismissEdgeCommentDialog'});}},presentAdminPage:function(){var a='_blank';window.open(this.adminUrl.toString(),a);},presentErrorDialog:function(){var c='_blank';var b='toolbar=0, status=0, width=960, height=300';var a=new URI('/connect/connect_to_node_error.php');a.addQueryData({title:this.error.brief,body:this.error.full});window.open(a.toString(),c,b);},presentConfirmDialog:function(){var b='_blank';var a='toolbar=0,status=0,width=450,height=200,scrollbars=0,location=0,menubar=0';if(!window.confirmDialogReturn)window.confirmDialogReturn={};window.confirmDialogReturn[this.widgetID]=this;var c=this.getConfirmURL();window.open(c,b,a);},returnFromConfirmDialog:function(a){if(a){this.showConfirm=null;this.confirmedConnect=a;this.connectToNode(!this.alreadyConnected);}else this.updateWidget({nowConnected:this.alreadyConnected,showConfirm:null,isAdmin:this.viewerIsAdmin},false);},syncWidgetDisplay:function(){var a=this.alreadyConnected;this.setButtonState(a);this.showElementIf(this.connectedMessage,a);this.showElementIf(this.notConnectedMessage,!a);if(this.adminSpans)for(var b=0;b0)this.inlineCommentClose=this.inlineCommentClose[0];this.commentButtonIsActive=false;Event.listen(this.inlineCommentInput,'keyup',this.conditionallyActivateButton.bind(this));Event.listen(this.inlineCommentInput,'focus',this.exposeCommentButton.bind(this));Event.listen(this.inlineCommentButton,'click',this.updateConnectionWithComment.bind(this));Event.listen(this.widget,'mouseout',this.hideInlineComment.bind(this));Event.listen(this.widget,'mouseover',this.showInlineComment.bind(this));if(this.inlineCommentClose)Event.listen(this.inlineCommentClose,'click',function(event){for(var a=0;a0){f=f[0];var e=50;var d=Vector2.getElementDimensions(f);var g=e/d.x;if(g<1){CSS.setStyle(f,'width',e);CSS.setStyle(f,'height',d.y*g);}}}this.setupCommentHooks(this.commentDocument);this.commentWidgetIsExpanded=!this.inlineUnlikeLink;var b=this.getCommentActivatingComponent();b.onmouseout=this.hideCommentWidget.bind(this);b.onmouseover=this.showCommentWidget.bind(this);this.commentDocument.body.onmouseout=this.hideCommentWidget.bind(this);this.commentDocument.body.onmouseover=this.showCommentWidget.bind(this);this.inGracePeriod=false;},setupCommentHooks:function(a){this.placeholderInputRegion=DOM.find(a,'div.connect_comment_widget_placeholder_input_region');this.placeholderInput=DOM.find(this.placeholderInputRegion,'input.connect_comment_widget_placeholder_input');this.fullInputRegion=DOM.find(a,'div.connect_comment_widget_full_input_region');this.fullInputTextarea=DOM.find(this.fullInputRegion,'textarea.connect_comment_widget_full_input_textarea');this.widgetButtonRegion=DOM.find(a,'div.connect_comment_widget_button_region');this.postToFacebookButton=DOM.find(this.widgetButtonRegion,'.connect_comment_widget_post_button input');this.inlineUnlikeLink=DOM.scry(a,'a.connect_comment_widget_unlike_link');if(this.inlineUnlikeLink.length>0)this.inlineUnlikeLink=this.inlineUnlikeLink[0];this.defaultInputText=this.placeholderInput.value;this.placeholderInput.onfocus=this.transitionToFullInputMode.bind(this);this.fullInputTextarea.onfocus=this.removePlaceholderText.bind(this);this.fullInputTextarea.onblur=this.restorePlaceholderText.bind(this);this.postToFacebookButton.onclick=this.updateUserComment.bind(this);if(this.inlineUnlikeLink)this.inlineUnlikeLink.onclick=this.connectToNodeOnClick.bind(this);},getCommentActivatingComponent:function(){if(this.layout===ExternalNodeConnectWidget.BOX_COUNT_LAYOUT||this.layout===ExternalNodeConnectWidget.BUTTON_COUNT_LAYOUT){return this.widget;}else if(this.layout===ExternalNodeConnectWidget.SIMPLE_LAYOUT){return this.widget;}else if(this.grayOut){return DOM.find(this.widget,'table.connect_widget_interactive_area');}else return this.confirmationCell;},showCommentWidget:function(event){if(this.otherCommentWidgetOpen)return false;this.inGracePeriod=true;this.killCloseThread();if(this.commentWidgetOpen&&!this.commentWidgetVisible){this.commentWidgetVisible=true;CSS.show(this.commentDocument.body);UnverifiedXD.send({type:'showEdgeCommentDialog'});}return false;},hideCommentWidget:function(event){if(this.otherCommentWidgetOpen)return false;this.inGracePeriod=false;if(this.commentWidgetOpen&&this.commentWidgetVisible){var a=function(){if(!this.inGracePeriod&&this.shouldHideExpandedWidget()){this.fullInputTextarea.blur();this.commentWidgetVisible=false;if(!this.socialBar)CSS.hide(this.commentDocument.body);UnverifiedXD.send({type:'hideEdgeCommentDialog'});}this.inGracePeriod=false;this.killCloseThread();}.bind(this);this.closeThreadID=setTimeout(a,100);}return false;},shouldHideExpandedWidget:function(){return !this.commentWidgetIsExpanded||this.fullInputTextarea.value===''||this.fullInputTextarea.value===this.defaultInputText;},killCloseThread:function(){if(this.closeThreadID){clearTimeout(this.closeThreadID);delete this.closeThreadID;}},transferCSSStyles:function(){var d=DOM.scry(window.document,'link');var e=DOM.scry(window.document,'style');var c=DOM.find(window.document,'html');var g=DOM.find(this.commentDocument,'html');var f=DOM.find(this.commentDocument,'head');for(var a=0;a0&&c<=5){CSS.setStyle(this.connectButton,'width',(b.button_width-parseInt(CSS.getStyle(this.connectButton,'paddingLeft'))-parseInt(CSS.getStyle(this.connectButton,'paddingRight'))-parseInt(CSS.getStyle(this.connectButton,'borderLeftWidth'))-parseInt(CSS.getStyle(this.connectButton,'borderRightWidth')))+'px');this.sizeNumberCloud();}if(this.layout===ExternalNodeConnectWidget.STANDARD_LAYOUT){var d=Vector2.getElementDimensions(this.widget).y;CSS.setStyle(this.widget,'height',(d+5)+'px');var e=ua.firefox();var f=ua.ie();var g=intl_locale_is_rtl();var h=g?'right':'left';if(f&&f<9){CSS.setStyle(this.connectButton,'position','absolute');CSS.setStyle(this.connectButton,h,-(b.button_width+10)+'px');}else{CSS.setStyle(this.connectButton,'position','fixed');CSS.setStyle(this.connectButton,h,'0px');}if(f&&this.connectButtonSlider){CSS.setStyle(this.connectButtonSlider,h,b.button_width+'px');if(f<=7)this.fixIEButtonDoubleLineBug();}CSS.setStyle(this.confirmationCell,'position','absolute');CSS.setStyle(this.confirmationCell,h,(b.button_width+a+5)+'px');CSS.setStyle(this.confirmationCell,'top','5px');if(this.sampleConnections){CSS.setStyle(this.sampleConnections,'position','fixed');CSS.setStyle(this.sampleConnections,h,'0');}this.invertedButtons=true;this.repositionFacepileVertically();}},repositionFacepileVertically:function(){if(this.invertedButtons&&this.sampleConnections){var a=Vector2.getElementDimensions(this.summaryText).y;CSS.setStyle(this.sampleConnections,'margin-top',(5+a+5)+'px');}}}); function fbpage_set_fan_status(c,f,a,h,g,d,e){g=g?g:function(j){_fbpage_show_change_status_feedback(c,j.getPayload());};var b={fbpage_id:f,add:a,reload:h};if(e!=null)copy_properties(b,e);var i=new AsyncRequest().setURI('/ajax/pages/fan_status.php').setData(b).setNectarModuleDataSafe(c).setHandler(g);if(d)i.setErrorHandler(d);i.send();return false;}function fbpage_set_favorite_status(d,e,a){var f=function(){_fbpage_show_change_status_feedback(d,this.getUserData());};var c={fbpage_id:e,add:a};var b=new AsyncRequest().setMethod('POST').setURI('/ajax/pages/favorite_status.php').setData(c);new Dialog().setAsync(b).setCloseHandler(f).show();return false;}function _fbpage_show_change_status_feedback(b,a){if(!a||!b)return;if(a.reload){fbpage_reload_on_fan_status_changed(a.preserve_tab);}else fbpage_redraw_on_fan_status_changed(b,a.feedback);}function fbpage_reload_on_fan_status_changed(a){var c=URI.getRequestURI();if(a){var b=Arbiter.query('SideNav.selectedKey');if(!c.getQueryData().sk&&b)c.addQueryData({sk:b});}window.location.href=c;}function fbpage_redraw_on_fan_status_changed(a,b){if(!b)return;var d=document.createElement('span');d.innerHTML=b;CSS.setClass(d,'fan_status_inactive');a.parentNode.replaceChild(d,a);var c=function(){if(data.can_repeat_action)d.parentNode.replaceChild(a,d);};animation(d).duration(3000).checkpoint().to('backgroundColor','#FFFFFF').duration(1000).ondone(c).go();} function ConnectWidget(h,f,a,e,b){copy_properties(this,{channel_url:b,like_mode:e,profile_id:f,viewer_id:h,status:null,popup:null,busy:false,new_fan:null,user_profile:null});this.fan_hidden=[];this.fan_shown=[];var c=DOM.scry(document,'div.connections');if(c.length>0){c=c[0];this.user_profile=DOM.find(c,'div.user_profile');this.new_fan=DOM.find(c,'div.grid_item_plus');this.fan_shown.push(this.new_fan);this.fan_shown.push(DOM.find(c,'span.total_plus'));var g=DOM.scry(c,'span.total');var d=DOM.scry(c,'div.grid_item');if(d.length>1)this.fan_hidden.push(d[1]);this.fan_hidden.push(g[g.length-1]);}if(!this.like_mode){this.button=$(a);this.popup_uri=new URI('/login.php');this.popup_uri.addQueryData({connect_id:this.profile_id,popup:true});Event.listen(this.button,'click',this.connectClickHandler.bind(this));}else Arbiter.subscribe('platform/like/connection',this.updateWidgetFromLike.bind(this));ConnectWidget.instances[a]=this;if(this.channel_url)XD.init({channelUrl:this.channel_url});}ConnectWidget.instances={};ConnectWidget.is_connect=true;ConnectWidget.prototype.setLoggedIn=function(a){this.viewer_id=a;return this;};ConnectWidget.prototype.connectClickHandler=function(a){a.kill();if(this.viewer_id!=0){this.connect();}else this.popUpLogin();};ConnectWidget.prototype.connect=function(){if(!this.busy){this.busy=true;fbpage_set_fan_status(this.button,this.profile_id,true,false,this.connectDoneHandler.bind(this),this.connectErrorHandler.bind(this),this.getAsyncData());}};ConnectWidget.prototype.disconnect=function(){if(!this.busy){this.busy=true;fbpage_set_fan_status(this.button,this.profile_id,false,false,this.connectUndoneHandler.bind(this),function(){},this.getAsyncData());}};ConnectWidget.prototype.getAsyncData=function(){var a={source:'connect',is_connect:ConnectWidget.is_connect};if(ge('post_form_id'))a.post_form_id=$('post_form_id').value;if(env_get('fb_dtsg'))a.fb_dtsg=env_get('fb_dtsg');return a;};ConnectWidget.prototype.popUpLogin=function(){window.open(this.popup_uri.toString(),'_blank','toolbar=0,status=0,width=626,height=400');};ConnectWidget.prototype.updateWidgetFromLike=function(b,f){if(!f.userProfile)return;if(this.user_profile){var c=DOM.find(this.user_profile,'img');var a=DOM.find(this.user_profile,'a');var e=DOM.find(this.user_profile,'div.name');c.src=f.userProfile.pic_square;a.href=f.userProfile.profile_url;DOM.setContent(e,f.userProfile.name);}var d;if(f.nowConnected){d='likeboxLiked';this.showNewFan();}else{d='likeboxUnliked';this.hideNewFan();}if(this.channel_url)XD.send({type:d});};ConnectWidget.prototype.connectErrorHandler=function(b){if(b.error==1357001){this.viewer_id=0;this.popUpLogin();}else if(b.error==1357013){CSS.hide(this.button);var a=$N('a',{href:DOM.find(document,'div.name_block a').href,target:'_blank'},_tx("Verification is needed to connect."));this.status=$N('span',{className:'connect_span'},a);DOM.insertAfter(this.button,this.status);}else{CSS.hide(this.button);if(b.error==1431001){this.status=$N('span',{className:'connect_span'},_tx("You like this."));}else this.status=$N('span',{className:'connect_span'},b.getErrorSummary()+': '+b.getErrorDescription());animation(this.status).from('opacity',0).to('opacity',1).go();DOM.insertAfter(this.button,this.status);}this.busy=false;};ConnectWidget.prototype.connectDoneHandler=function(c){var b=c.getPayload();if(!b||!b.feedback)return;this.status=$N('span',{className:'connect_span'},HTML(b.feedback));var d=$N('a',{className:'undo'},_tx("Undo"));Event.listen(d,'click',function(e){e.kill();this.disconnect();}.bind(this));DOM.appendContent(this.status,d);animation(this.status).from('opacity',0).to('opacity',1).go();DOM.insertAfter(this.button,this.status);CSS.hide(this.button);if(this.new_fan!=null&&b.connect_fan_div){var a=$N('div',{},HTML(b.connect_fan_div));DOM.setContent(this.new_fan,DOM.find(a,'a'));}this.showNewFan();this.busy=false;};ConnectWidget.prototype.showNewFan=function(){this.fan_shown.forEach(function(b){if(!CSS.hasClass(b,'hidden_elem'))return;var a=CSS.getStyle(b,'width');CSS.setStyle(b,'width',0);CSS.setStyle(b,'opacity',0);CSS.show(b);animation(b).to('width',a).duration(100).checkpoint().to('opacity',1).duration(400).go();});this.fan_hidden.forEach(function(a){CSS.hide(a);});};ConnectWidget.prototype.connectUndoneHandler=function(b){var a=b.getPayload();DOM.remove(this.status);animation(this.button).from('opacity',0).to('opacity',1).go();CSS.show(this.button);this.hideNewFan();this.busy=false;};ConnectWidget.prototype.hideNewFan=function(){this.fan_shown.forEach(function(a){if(CSS.hasClass(a,'hidden_elem'))return;animation(a).to('opacity',0).duration(100).checkpoint(.25).to('width',0).duration(100).ondone(function(){CSS.setStyle(a,'width',null);CSS.hide(a);this.fan_hidden.forEach(function(b){CSS.show(b);});}.bind(this)).go();}.bind(this));};ConnectWidget.loadStream=function(b,a){new AsyncRequest().setMethod('GET').setURI('/ajax/connect/connect_widget.php').setData({id:b,uniqid:a}).setReadOnly(true).setErrorHandler(bagofholding).send();};ConnectWidget.loggedIn=function(c,a){if(ge('post_form_id')){DOM.replace($('post_form_id'),HTML(a));}else DOM.appendContent(DOM.find(document,'body'),HTML(a));for(var b in ConnectWidget.instances){ConnectWidget.instances[b].setLoggedIn(c);ConnectWidget.instances[b].connect();}};ConnectWidget.setIsConnect=function(a){ConnectWidget.is_connect=a;};ConnectWidget.popUpConnect=function(c){var b={id:c,captcha:true,post_form_id:$('post_form_id').value};var d=URI('/plugins/likebox.php').addQueryData(b);var a=window.open(d,'_blank','toolbar=0,status=0,width=640,height=480');}; var ExternalPageLikeWidget=function(a){a.edgeType='like';this.parent.construct(this,a);this.unactionLink=DOM.scry(this.widget,'span.unlike_link')[0];if(this.unactionLink)Event.listen(this.unactionLink,'click',this.connectToNodeOnClick.bind(this));this.hasShowedInsights=false;this.showInsights();};ExternalPageLikeWidget.extend('ExternalNodeConnectWidget');copy_properties(ExternalPageLikeWidget.prototype,{getSyncEndpointName:function(){return 'platform/like/sync';},getConnectionEndpointName:function(){return 'platform/like/connection';},getPluginName:function(){return 'like';},presentInsightsPage:function(){var a=this.adminUrl.split('/');var b=a[a.length-1];window.open('/insights/?sk=po_'+b,'_blank');},showInsights:function(){if(this.hasShowedInsights)return;var b=DOM.scry(this.widget,'a.connect_widget_insights_link');if(b)for(var a=0;a