/*
HTTP Host: b.static.ak.fbcdn.net
Generated: March 18th 2010 12:50:47 AM PDT
Machine: 10.16.140.101
Locale: nu_ll
Path: js/3snxh9drs9440404.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/3snxh9drs9440404.pkg.js"]); }


function typeahead_mentions(element,source,options){this.element=$(element);options=copy_properties({delimiter:'@',anchor_block:true,max_display:4,max_results:4,auto_select:false},options||{});this.active=true;this.selected=null;source=new search_friend_source(source,true);source.allowTypes([search_friend_source.TYPES.USER,search_friend_source.TYPES.PAGE,search_friend_source.TYPES.APP,search_friend_source.TYPES.GROUP,search_friend_source.TYPES.EVENT]);this.parent.construct(this,element,source,options);CSS.addClass(this.dropdown,'typeahead_search');CSS.addClass(this.dropdown,'typeahead_mentions');this.initializeCleanup();this.hide();}
typeahead_mentions.extend('typeaheadpro');copy_properties(typeahead_mentions.prototype,{_onchange:bagofholding,set_class:bagofholding,set_value:bagofholding,update_class:bagofholding,recalc_scroll:bagofholding,clear_placeholder:bagofholding,initializeCleanup:function(){Event.listen(this.element,'drop',Event.kill);Event.listen(this.element,'paste',function(){this.element.setOpacity(0);this.element.setStyle('height',this.element.offsetHeight+'px');this.cleanup.bind(this).defer(100);}.bind(this));},setup_anchor:function(){return this.element.parentNode.parentNode;},get_value:function(){var range=Text.getRange(),node=Text.getFocusNode(range,this.element),value=Text.getFocusValue(range,node),offset=Text.getFocusOffset(range,node);if(!range||!value||range.collapsed===false){return'';}
var index=value.lastIndexOf(this.delimiter,offset);if(index<0||(index>0&&(/\w/).test(value.charAt(index-1)))){return'';}
return value.slice(index,offset).trim();},check_value:function(){if(DOM.getText(this.element).lastIndexOf(this.delimiter)==-1){if(this.value==this.delimiter){this.hide();}
return;}
if(!this.ready||!this.active){if(!this.loading){this.loading=true;this.source.initialize(function(){this.ready=true;this.results_text=this.delimiter;this.check_value();}.bind(this));this.set_message(_tx("Cargando..."));this.show();}
return;}
var value=this.get_value();if(value!=this.value){this.dirty_results();this.value=value;}
if(value==this.delimiter){this.set_message(_tx("Escribe el nombre de alguien o algo..."));this.show();}},_onblur:function(event){this.fixBreak();this.hide();},_onfocus:function(event){this.fixBreak();this.focused=true;this.results_text='';},_onkeydown:function(event){event=$E(event);var code=event?Event.getKeyCode(event):-1;if(ua.firefox()&&event.getModifiers().meta&&(code==KEYS.LEFT||code==KEYS.RIGHT)){event.kill();}
if(code==KEYS.RETURN){if(this.visible){event.kill();}else if(document.selection){Text.insertBreak();event.kill();}}
if(this.visible){return this.parent._onkeydown(event);}},_onkeypress:function(event){if(this.visible){return this.parent._onkeypress(event);}
var code=event?Event.getKeyCode(event):-1;if(ua.firefox()&&code==KEYS.BACKSPACE){var node=Text.getFocusNode(),offset=Text.getFocusOffset();if(offset==0){node=node.previousSibling;}else if(node==this.element&&offset>0){node=this.element.childNodes[offset-1];}
if(this.isMention(node)){DOM.remove(node);}}},_onkeyup:function(event){this.check_value();if(this.visible){return this.parent._onkeyup(event);}},_onselect:function(selected){if(!selected){return;}
var value=this.value,nodes=this.element.childNodes;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(this.isText(node)){var text=node.data,index=text.lastIndexOf(value,Text.getFocusOffset());if(index>-1){var mention=this.createMention(selected);var prefix=document.createTextNode(text.substring(0,index).replace(/[\s\xa0]*$/g,'')+"\xa0");node.data="\xa0"+text.substring(index+value.length).replace(/^[\s\xa0]*/g,'');this.element.insertBefore(mention,node);this.element.insertBefore(prefix,mention);this.cleanup();Text.setFocusAfter(mention);break;}}}
this.hide();},createSpacer:function(){return document.createTextNode("\xa0");},createMention:function(obj){var data={id:obj.i,text:obj.t};var mention=$N('a',{href:'#',tabIndex:-1,className:'mention',unselectable:'on',contentEditable:false,oncontextmenu:Event.kill,onclick:Event.kill,onfocus:Event.kill},$N('span',{contentEditable:!!document.selection},data.text));Event.listen(mention,'mousedown',this.selectMention.bind(this,mention));DataStore.set(mention,'mention',data);return mention;},selectMention:function(mention,event){if(event){event.kill();}
if(!mention){return;}
if(!mention.previousSibling){DOM.insertBefore(this.createSpacer(),mention);}
setTimeout(function(){this.element.focus();Text.selectNode(mention);}.bind(this),0);},cleanup:function(){var node=this.element.firstChild;while(node){if(!this.isText(node)&&!this.isMention(node)&&!this.isBreak(node)){var target=document.createTextNode((DOM.getText(node)||''));this.element.replaceChild(target,node);node=target;}
var prev=node.previousSibling;if(prev&&this.isText(prev)&&this.isText(node)){node.data=prev.data+node.data;this.element.removeChild(prev);}else{node=node.nextSibling;}}
this.element.setStyle('height','').setOpacity(1);Text.focusElement(this.element);},getMessage:function(){var message=$A(this.element.childNodes).map(function(node){if(this.isBreak(node)){return"\n";}
var data=this.isMention(node);if(data){return'@['+data.id+':'+data.text+']';}
return DOM.getText(node);},this);return message.join('').replace(/\xa0/g,' ').trim();},setMessage:function(message){DOM.setText(this.element,message);this.fixBreak();},focusInput:function(){this.element.focus();},setActive:function(active){this.active=active;if(!active){DOM.setText(this.element,DOM.getText(this.element));}},enable:function(){this.element.contentEditable=true;return this;},disable:function(){this.element.contentEditable=false;return this;},isBreak:function(node){return DOM.isNode(node,'br');},isText:function(node){return DOM.isNode(node,['#text','#whitespace']);},isMention:function(node){return DOM.isNode(node,'a')&&DataStore.get(node,'mention');},fixBreak:document.selection?bagofholding:function(){var last=this.element.lastChild;if(!last||!this.isBreak(last)){this.element.appendChild($N('br'));}}});var Text=(function(){var functions;if(window.getSelection){functions={getRange:function(selection){selection=selection||this.getSelection();return selection.rangeCount>0?selection.getRangeAt(0):null;},getSelection:function(){return window.getSelection();},getFocusNode:function(range){range=range||this.getRange();return range&&range.endContainer;},getFocusValue:function(range,node){range=range||this.getRange();node=node||this.getFocusNode(range);return node.data;},getFocusOffset:function(range,node){range=range||this.getRange();return range.endOffset||0;},setFocus:function(node,offset){if(!node){return;}
this.getSelection().collapse(node,offset);},setFocusAfter:function(node){var parent=node.parentNode;this.setFocus(parent,$A(parent.childNodes).indexOf(node)+1);},focusElement:function(element){element.focus();this.setFocus(element,element.childNodes.length);},insertBreak:bagofholding,selectNode:function(node){if(!node){return;}
var sel=this.getSelection(),range=this.getRange(sel);sel.collapse(node,0);range.selectNode(node);sel.addRange(range);}};}
else if(document.selection){functions={getRange:function(){return this.getSelection().createRange();},getSelection:function(){return document.selection;},getFocusNode:function(range,node){if(node){return node;}
range=range||this.getRange();return range.parentElement();},getFocusValue:function(range,node){range=range||this.getRange();node=node||this.getFocusNode(range);return node.innerText;},getFocusOffset:function(range,node){range=range||this.getRange();node=node||this.getFocusNode(range);var parent=node,offset=0;while(parent==node){range.moveStart('character',-1);parent=range.parentElement();offset++;}
return range.text.length;},setFocus:function(node,offset){var range=this.getRange(),element=range.parentElement(),length=0,children=[],prev=node.previousSibling;while(prev){var temp=prev.previousSibling;children.push(element.removeChild(prev));prev=temp;}
range.moveToElementText(element);range.collapse();range.moveEnd('character',(offset+length));range.collapse(false);range.select();for(var i=0;i<children.length;i++){element.insertBefore(children[i],element.firstChild);}},setFocusAfter:function(node){var range=this.getRange();range.moveToElementText(node);range.moveEnd('character',1);range.collapse(false);range.select();},focusElement:function(element){element.focus();this.setFocusAfter(element);},insertBreak:function(){var range=this.getRange();range.pasteHTML('<br/>');range.moveEnd('character',1);range.collapse();range.select();},selectNode:function(node){var range=this.getRange();range.moveToElementText(node);range.moveStart('character',-1);range.moveEnd('character',1);range.select();}};}
return functions;})();

function UIComposerAttachmentArea(composer,root){this.composer=composer;this.root=root;this.area=root.find('div.UIComposer_AttachmentArea_Cache');this.cache={};this.visible=null;this.attachment={};this.dirtyOnReset=false;var closeButton=root.find('a.UIComposer_AttachmentArea_CloseButton');Event.listen(closeButton,'click',function(event){Event.kill(event);composer.reset(true);});}
UIComposerAttachmentArea.prototype={show:function(attachment,extraData){this.composer.addState(UIComposer.STATE.ATTACHMENT_AREA);this.attachment=attachment;this.dirtyOnReset=false;if(ua.ie()<7){this.area.setStyle('width',this.area.offsetWidth);}
var app_id=attachment.app_id;if(this.cache[app_id]&&!extraData){this.showAttachment(app_id);}else{this.loadAttachment(app_id,extraData);}},loadAttachment:function(app_id,extraData){var data={app_id:app_id,composer_id:this.composer.id,stream_id:this.composer.targetID,is_inbox:this.composer.isInbox};if(extraData){copy_properties(data,{data:extraData});}
new AsyncRequest().setURI(UIComposerAttachmentArea.ENDPOINT).setData(data).setHandler(UIComposerAttachmentArea.handleResponse.bind(this,extraData)).setErrorHandler(this.composer.handleError.bind(this.composer)).setTransportErrorHandler(this.composer.handleError.bind(this.composer)).send();},showAttachment:function(app_id){if(!this.composer.hasState(UIComposer.STATE.ATTACHMENT_AREA)){return;}
this.visible=this.cache[app_id];this.visible.addClass(UIComposerAttachmentArea.CLASS.VISIBLE);this.composer.addState(UIComposer.STATE.ATTACHMENT_LOADED);this.fireAttachmentEvent('load');},createAttachment:function(payload){var element=$N('div',{className:UIComposerAttachmentArea.CLASS.CACHED});this.area.appendChild(element).setContent(HTML(payload.html));return element;},setAttachment:function(controller){if(this.attachment){this.attachment.controller=controller;controller.initialize(this.composer,this.cache[this.attachment.app_id],this.attachment.app_id);}
return this;},getAttachment:function(){if(this.attachment&&this.attachment.controller){return this.attachment.controller;}
return null;},getData:function(){if(this.attachment&&this.attachment.controller){return this.attachment.controller.getData();}
return null;},getEndpoint:function(forbid_override){if(this.attachment&&this.attachment.controller){return this.attachment.controller.getEndpoint(forbid_override);}
return null;},post:function(){if(!this.visible){return;}
var data=this.getData();var endpoint=this.getEndpoint(true);if(!data||!endpoint){return;}
data.composer_id=this.composer.id;this.composer.removeState(UIComposer.STATE.ATTACHMENT_LOADED);new AsyncRequest().setURI(endpoint).setData(data).setHandler(UIComposerAttachmentArea.handleResponse.bind(this,null)).setErrorHandler(this.composer.handleError.bind(this.composer)).send();},reset:function(){if(!this.visible){return;}
this.visible.removeClass(UIComposerAttachmentArea.CLASS.VISIBLE);this.visible=null;if(this.dirtyOnReset){var app_id=this.attachment.app_id;this.cache[app_id].remove();this.cache[app_id]=null;}
this.fireAttachmentEvent('reset');},fireAttachmentEvent:function(event){if(this.attachment&&this.attachment.controller){this.attachment.controller[event]();}}};copy_properties(UIComposerAttachmentArea,{handleResponse:function(extraData,response){var app_id=this.attachment.app_id,attachment=this.cache[app_id],payload=response.getPayload(),error=response.getError(),errIsWarning=response.getErrorIsWarning();if(error&&errIsWarning){this.composer.showError(response.getErrorSummary(),response.getErrorDescription());}
if(!attachment){this.cache[app_id]=this.createAttachment(payload);this.dirtyOnReset=!!extraData;}else{attachment.setContent(HTML(payload.html));this.dirtyOnReset=true;}
this.showAttachment(app_id);}});copy_properties(UIComposerAttachmentArea,{CLASS:{CACHED:'UIComposer_Attachment_Cached',VISIBLE:'UIComposer_Attachment_Visible'},ENDPOINT:'/ajax/composer/attachment.php',PARAM_STRUCTURE:'app_data[attachment][params]'});

function UIComposer(root,input,user,options){if(!root){throw new Error('UIComposer instantiated with no root.');return false;}
this.root=root;this.id=root.id;this.input=input;this.user=user;var d={};try{d=JSON.decode(window.name);}catch(e){}
if(d.pub){options.autoload=d.pub;options.autoloadData=d.pubdata;window.name='';}
this.initialize=this.initialize.bind(this,options);this.resetState=this.root.className;this.initializeAttachments(options.attachments);this.initializeLocation(options.locationActivated);UIComposer.storeInstance(root.id,this);onunloadRegister(function(){delete UIComposer.instances[root.id];},true);if(options.autoload){this.ensureInitialized();}}
UIComposer.prototype={ensureInitialized:function(focus){if(this.initialized){return;}
this.initialized=true;this.initialize(focus);},initialize:function(overrides,focus){var options={contentArea:null,endpoint:'/ajax/updatestatus.php',autoload:null,autoloadData:null,targetID:0,attachments:[],contextData:{},placeholder:null,privacyWidget:null,defaultPrivacy:null,defaultPrivacyFbid:0,privacyOptions:{},maxInputLength:0,mentionsData:null,locationActivated:false,overrideAttachmentEndpoint:false,sourceAppID:null,initialTextareaHeight:36,targetedPrivacyWidget:null};copy_properties(this,copy_properties(options,overrides));this.lastLoc=null;this.shouldHide=true;this.submitButton=DOM.scry(this.root,'span.UIComposer_SubmitButton input.UIButton_Text')[0]||null;this.privacyButton=DOM.scry(this.root,'div.UIComposer_PrivacyWidget')[0]||null;this.privacyCallout=DOM.scry(this.root,'div.UIComposer_PrivacyCallout')[0]||null;this.targetedPrivacyButton=DOM.scry(this.root,'div.UIComposer_TargetedPrivacyWidget')[0]||null;this.doMentionsPromptUpdatePref=false;this.doMentionsPromptUpdateOnsubmit=false;this.doMentionsCallout='';this.shownMentionsCallout=false;if(this.privacyWidget){this.defaultPrivacy=this.privacyWidget.getData();this.defaultPrivacyFbid=this.privacyWidget.getSaveAsDefaultCheckboxFbid();}
if(options.mentionsData){this.initializeMentions(options.mentionsData.typeahead);if(this.mentions){this.doMentionsPromptUpdatePref=options.mentionsData.prompt;this.doMentionsCallout=options.mentionsData.callout;}}else{this.initializeTextarea(options.maxInputLength,options.initialTextareaHeight);}
this.initializeAutoscrape(focus);this.initializeEvents();if(options.autoload){this.loadAttachment(options.autoload,options.autoloadData);}},initializeAttachments:function(attachments){if(!attachments.length){return;}
this.apps=attachments.map(function(attachment){return attachment.app_id;});this.attachments=attachments;var attachmentList=this.root.find('ul.UIComposer_Attachments');var attachmentArea=this.root.find('div.UIComposer_AttachmentArea');this.attachmentList=new UIComposerAttachmentList(this,attachmentList);this.attachmentArea=new UIComposerAttachmentArea(this,attachmentArea);},initializeLocation:function(locationActivated){this.locationField=DOM.scry(this.root,'div.UIComposer_LocationField')[0]||null;this.locationButton=DOM.scry(this.root,'div.UIComposer_LocationButton')[0]||null;if(this.locationButton){this.locationButton.find('a').listen('click',this.toggleLocSetting.bind(this));if(locationActivated){this.locationButton.find('.UIActionButton').removeClass('UIButton_Suppressed').addClass('UIButton_Depressed');this.addState(UIComposer.STATE.LOC_ACTIVATED);}}},initializeTextarea:function(maxLength,initialHeight){new TextAreaControl(this.input).setMaxLength(maxLength).setOriginalHeight(initialHeight).setAutogrow(true).onfocus();this.input.onfocus='';},initializeMentions:function(source){if(ua.firefox()<3||ua.safariPreWebkit()||ua.opera()){return;}
var input=$N('div',{id:this.input.id,className:'Mentions_Input',contentEditable:true},document.createTextNode(''));CSS.setStyle(input,'width',this.input.offsetWidth+'px');DOM.replace(this.input,input);this.input=input;var mentions=new typeahead_mentions(input,source);this.getMessage=mentions.getMessage.bind(mentions);this.setMessage=mentions.setMessage.bind(mentions);this.focusInput=mentions.focusInput.bind(mentions);var enable=this.enable.bind(this);this.enable=function(){mentions.enable();enable();};var disable=this.disable.bind(this);this.disable=function(){mentions.disable();disable();};this.mentions=mentions;},initializeAutoscrape:function(focus){var detector=new UrlDetector(this.input);detector.subscribe('urlDetected',this.autoScrape.bind(this));detector.setSuppressDetectionCheck(this.hasState.bind(this,UIComposer.STATE.ATTACHMENT_AREA));if(focus){detector.startDetectionInterval();}},initializeEvents:function(){addEventBase(this.input,'focus',this.focus.bind(this));Event.listen(this.submitButton,'click',this.post.bind(this));if(this.locationButton){var link=this.locationButton.find('a.UIActionButton');Event.listen(link,'click',this.toggleLocSetting.bind(this));}
if(this.attachmentArea){var cancelHide=function(){this.shouldHide=false;}.bind(this);Event.listen(this.root,'click',cancelHide);Event.listen(this.root,'mousedown',cancelHide);Event.listen(document.body,'click',function(){if(this.shouldHide){this.blur();}
this.shouldHide=true;}.bind(this));}},focus:function(){this.ensureInitialized(true);if(!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)&&this.hasState(UIComposer.STATE.LOC_ACTIVATED)&&this.locationField){this.populateLoc();}
if(this.privacyWidget){if(this.privacyOptions.change_default_dialog&&!this.privacyChangedToken){this.privacyChangedToken=this.privacyWidget.subscribe('privacyChanged',function(type,privacy_data){this.showChangeDefaultPrivacyDialog(privacy_data);}.bind(this));}
if(this.privacyOptions.callout&&!this.privacyMenuActivatedToken){this.privacyMenuActivatedToken=this.privacyWidget.subscribe('menuActivated',function(type,data){this.closePrivacyCallout();this.privacyWidget.unsubscribe(this.privacyMenuActivatedToken);delete this.privacyMenuActivatedToken;}.bind(this));}}
this.showMentionsCallout();var message=this.getMessage().trim();if(!message||message==this.placeholder){this.input.removeClass('DOMControl_placeholder');this.clearMessage();}
this.showPrivacyCallout();this.mentionsPromptUpdatePref();return this.addState(UIComposer.STATE.INPUT_FOCUSED);},blur:function(){if(this.privacyWidget&&this.privacyWidget.dialogOpen()){if(!this.privacyCloseDialogToken){this.privacyCloseDialogToken=this.privacyWidget.subscribe('closeDialog',function(){this.privacyWidget.unsubscribe(this.privacyCloseDialogToken);delete this.privacyCloseDialogToken;}.bind(this));}}else{if(this.attachmentList&&!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.removeState(UIComposer.STATE.INPUT_FOCUSED);if(!this.getMessage()){this.clearMessage();}}
this.hidePrivacyCallout();this.hideLocField();}
if(!this.getMessage().trim()&&!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.resetMessage();}
this.hideMentionsCallout();return this;},autoScrape:function(event,url){this.loadAttachment(UIComposer.APP_ID_POSTED,{url:url});},setAttachment:function(controller){this.attachmentArea.setAttachment(controller);return this;},getAttachment:function(){return this.attachmentArea.getAttachment();},setSourceAppId:function(sourceAppID){this.sourceAppID=sourceAppID;return this;},getSourceAppId:function(){return this.sourceAppID;},loadAttachment:function(app_id,extraData){this.ensureInitialized();var attachment=this.attachments[this.apps.indexOf(app_id)];if(this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.reset(true,false,false);}
if(!attachment){this.input.blur();return this.blur();}
this.attachmentList.select(attachment,extraData);this.focus();},showAttachment:function(attachment,extraData){this.focus();this.hideLocWidget();if(attachment.supports_privacy){if(this.privacyWidget){if(attachment.default_privacy){this.privacyWidget.setData(attachment.default_privacy);}
if(attachment.default_privacy_fbid){this.privacyWidget.setSaveAsDefaultCheckboxFbid(attachment.default_privacy_fbid);}}
this.showPrivacyWidget();this.showTargetedPrivacyWidget();}else{this.hidePrivacyWidget();this.hideTargetedPrivacyWidget();}
this.hidePrivacyCallout();this.hideMentionsCallout();this.attachmentArea.show(attachment,extraData);return this;},reset:function(resetAttachment,resetMessage,focusInput){if(resetAttachment&&this.attachmentArea){this.attachmentList.reset();this.attachmentArea.reset();this.removeState(UIComposer.STATE.ATTACHMENT_AREA);this.removeState(UIComposer.STATE.ATTACHMENT_LOADED);}
this.resetSubmitButtonText();this.removeLoc();if(this.privacyWidget){this.privacyWidget.setData(this.defaultPrivacy);this.privacyWidget.setSaveAsDefaultCheckboxFbid(this.defaultPrivacyFbid);}
if(this.targetedPrivacyWidget){this.targetedPrivacyWidget.reset();}
this.showPrivacyWidget();this.showTargetedPrivacyWidget();this.showLocWidget();this.enable();if(resetMessage){this.resetMessage();}
if(focusInput!==false){this.focusInput();}else{this.removeState(UIComposer.STATE.INPUT_FOCUSED);}
this.shouldHide=true;return this;},addState:function(state){this.root.addClass(state);return this;},removeState:function(state){this.root.removeClass(state);return this;},hasState:function(state){return this.root.hasClass(state);},toggleState:function(state){CSS.toggleClass(this.root,state);return this;},disable:function(){this.input.disabled=true;return this.addState(UIComposer.STATE.INPUT_DISABLED).disableButton();},enable:function(){this.input.disabled=false;return this.removeState(UIComposer.STATE.INPUT_DISABLED).enableButton();},disableButton:function(){this.disabled=true;CSS.addClass(this.submitButton.parentNode,'UIButton_Disabled');return this;},enableButton:function(){this.disabled=false;CSS.removeClass(this.submitButton.parentNode,'UIButton_Disabled');return this;},getPrivacyData:function(){if(this.privacyWidget){return this.privacyWidget.getData();}
return null;},getTargetedPrivacyData:function(){if(this.targetedPrivacyWidget){return this.targetedPrivacyWidget.getData();}
return null;},getData:function(){var endpoint=this.getEndpoint();var data={},message=this.getMessage();if(!this.isValidPost()){return null;}
if(!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){copy_properties(data,this.targetID>0?UIComposer.TARGET_DATA:UIComposer.HOME_DATA);copy_properties(data,{status:message,target_id:this.targetID,profile_id:this.user,app_id:this.sourceAppID,privacy_data:{}});if(this.lastLoc){this.lastLoc.timestamp=Math.floor(this.lastLoc.timestamp.getTime()/1000);data.composer_loc_data=JSON.encode(this.lastLoc);}
if(this.attachmentArea&&this.attachmentArea.visible){copy_properties(data,this.attachmentArea.getData());if(!data.app_id){data.app_id=this.attachmentArea.attachment.app_id;}}}else{data=this.attachmentArea.getData();if(data){copy_properties(data,{id:this.user,target_id:this.targetID,app_id:this.attachmentArea.attachment.app_id,action:'post',button:'publish_button',comment_text:message});if(this.attachmentArea.attachment.supports_privacy){data.privacy_data={};}}}
if(data){data.composer_id=this.id;if(this.privacyWidget&&data.privacy_data){copy_properties(data.privacy_data,this.getPrivacyData());}
if(this.targetedPrivacyWidget){data.targeted_privacy_data={};copy_properties(data.targeted_privacy_data,this.getTargetedPrivacyData());}
if(this.contextData){copy_properties(data,this.contextData);}}
return data;},isValidPost:function(){var message=this.getMessage();if(message==this.placeholder){return false;}
if(this.endpoint==this.getEndpoint()&&!message){return false;}
return true;},getEndpoint:function(){var endpoint;if(this.hasState(UIComposer.STATE.ATTACHMENT_LOADED)){endpoint=this.attachmentArea.getEndpoint();}
return endpoint||this.endpoint;},post:function(){if(this.disabled||!this.initialized){return false;}
if(this.privacyOptions.everyone_warning&&this.privacyWidget&&this.privacyWidget.isEveryonePrivacy()){this.showConfirmEveryonePrivacyDialog();return false;}
this._post();return false;},_post:function(){var endpoint=this.getEndpoint(),data=this.getData();if(!data){return false;}
this.disable();if(this.doMentionsCallout=='inmsg'){data.mentions_suggest=1;}
if(this.shownMentionsCallout){data.shown_mentions_callout=1;if(this.doMentionsCallout){data.close_mentions_callout=1;}}
if(this.doMentionsPromptUpdateOnsubmit){data.mentions_composermsg_submit=1;this.doMentionsPromptUpdateOnsubmit=false;}
this.hideMentionsCallout();var req=new AsyncRequest().setURI(endpoint).setData(data).setHandler(bind(this,handle_require_email_conf_response,this.handleResponse.bind(this),null,null)).setErrorHandler(this.handleError.bind(this)).setFinallyHandler(this.enable.bind(this));for(key in this.contextData){req.setContextData(key,this.contextData[key]);}
req.send();},handleError:function(response){var error=response.getError();var payload=response.getPayload();switch(error){case kError_Platform_CallbackValidationFailure:return this.showError(payload.errorTitle,payload.errorMessage);case kError_Platform_ApplicationResponseInvalid:return this.showError(payload.errorTitle,payload.showDebug?payload.errorMessage:_tx("Se ha producido un error en la aplicaci\u00f3n. Por favor, int\u00e9ntalo de nuevo m\u00e1s tarde."));default:this.shouldHide=false;this.reset();return this.showError(response.getErrorSummary(),response.getErrorDescription());}},handleResponse:function(response){var error=response.getError();var errIsWarning=response.getErrorIsWarning();var payload=response.getPayload();if(payload.mentions_announce&&this.doMentionsCallout=='inmsg'){this.doMentionsCallout='focus';DOM.find(this.root,'div.UIComposer_MentionsCallout .UIComposer_PrivacyCallout_Text').setContent(payload.mentions_announce);this.showMentionsCallout();}else{this.closeMentionsCallout(true);this.reset(true,true).publish(response);if(error&&errIsWarning){ErrorDialog.showAsyncError(response);}}},publish:function(response){var content_area=this.contentArea;if(content_area&&content_area.addContent){var markup=response,status,story;if(response.getPayload){var payload=response.getPayload();status=payload.status;markup=payload.markup;if(payload.payload_is_content){story=payload;}}
story=story||HTML(markup).getRootNode();var displayDelay=500;content_area.addContent(story,displayDelay);if(content_area.setStatus&&status){setTimeout(function(){content_area.setStatus(status);},displayDelay);}}
if(this.privacyWidget){this.privacyWidget.reset();}
if(this.targetedPrivacyWidget){this.targetedPrivacyWidget.reset();}
return this;},populateLoc:function(){var new_results=false;var _populateLoc=function(pos){if(!this.hasState(UIComposer.STATE.LOC_ACTIVATED)||!this.hasState(UIComposer.STATE.INPUT_FOCUSED)||this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){return;}
if(this.lastLoc&&new_results!==false&&pos.coords.accuracy>=this.lastLoc.coords.accuracy){return;}
new_results=true;var desc=pos.desc.label||pos.desc.street||pos.desc.region;if(!desc){return;}
this.locationField.setContent(_tx("near {place}",{place:desc}));this.lastLoc=pos;if(!shown(this.locationField)){animation(this.locationField).to('height','auto').from('height',0).to('opacity',1).from('opacity',0).show().duration(100).ease(animation.ease.end).go();}};var error_count=0;var _errorCase=function(locError){if(++error_count>=2){return this.removeLoc();}};var _finder=function(){navigator.geolocation.getCurrentPosition(_populateLoc.bind(this),_errorCase.bind(this),{maximumAge:1000*60*60,enableHighAccuracy:false});navigator.geolocation.getCurrentPosition(_populateLoc.bind(this),_errorCase.bind(this),{maximumAge:1000*60*10,enableHighAccuracy:true});};Bootloader.loadComponents(['geolocation'],_finder.bind(this));},removeLoc:function(){if(this.locationField){this.locationField.empty();this.hideLocField();this.shouldHide=true;}
this.lastLoc=null;},toggleLocSetting:function(){this.toggleState(UIComposer.STATE.LOC_ACTIVATED);this.locationButton.find('.UIActionButton').toggleClass('UIButton_Suppressed').toggleClass('UIButton_Depressed');var locationActivated=this.hasState(UIComposer.STATE.LOC_ACTIVATED);new AsyncRequest('/ajax/geo/setting.php').setData({collect:locationActivated}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();if(locationActivated){this.input.focus();this.populateLoc();}else{this.removeLoc();}
return false;},showLocWidget:function(){show(this.locationButton);},hideLocWidget:function(){hide(this.locationButton);this.removeLoc();},hideLocField:function(){hide(this.locationField);},showPrivacyWidget:function(){show(this.privacyButton);},hidePrivacyWidget:function(){hide(this.privacyButton);},showTargetedPrivacyWidget:function(){show(this.targetedPrivacyButton);},hideTargetedPrivacyWidget:function(){hide(this.targetedPrivacyButton);},showPrivacyCallout:function(){this.root.scry('div.UIComposer_PrivacyCallout').map(show);},hidePrivacyCallout:function(){this.root.scry('div.UIComposer_PrivacyCallout').map(hide);},closePrivacyCallout:function(){this.hidePrivacyCallout();this.savePrivacyData('close','callout',function(){this.root.scry('div.UIComposer_PrivacyCallout').map(DOM.remove);}.bind(this));},showMentionsCallout:function(){if(this.doMentionsCallout!='focus'||this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){return;}
if(this.attachmentList){this.attachmentList.hide();}
this.shownMentionsCallout=true;this.root.scry('div.UIComposer_MentionsCallout').map(show);},hideMentionsCallout:function(){if(this.attachmentList&&!this.hasState(UIComposer.STATE.ATTACHMENT_AREA)){this.attachmentList.reset();}
this.root.scry('div.UIComposer_MentionsCallout').map(hide);},closeMentionsCallout:function(noasync){this.hideMentionsCallout();if(this.shownMentionsCallout&&this.doMentionsCallout){this.doMentionsCallout='';if(noasync){return;}
new AsyncRequest().setURI('/ajax/mentions_ue.php').setData({type:'callout'}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();}},mentionsPromptUpdatePref:function(){if(this.doMentionsPromptUpdatePref){new AsyncRequest().setURI("/ajax/mentions_ue.php").setData({type:'prompt'}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send()
this.doMentionsPromptUpdatePref=false;this.doMentionsPromptUpdateOnsubmit=true;}},savePrivacyData:function(data_key,response_key,callback){response_key=response_key||data_key;callback=callback||bagofholding;var data={};data[data_key]=true;new AsyncRequest().setData(data).setURI('/ajax/privacy/save_composer_data.php').setHandler(function(response){var payload=response.getPayload();this.privacyOptions[response_key]=payload[response_key];callback();}.bind(this)).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();},showChangeDefaultPrivacyDialog:function(privacy_data){var callback=function(){this.privacyWidget.unsubscribe(this.privacyChangedToken);delete this.privacyChangedToken;}.bind(this);new Dialog().setAsync(new AsyncRequest().setURI('/ajax/privacy/change_default_dialog.php').setData({privacy_data:privacy_data})).setHandler(this.savePrivacyData.bind(this,'seen_changed_default','change_default_dialog',callback)).show();},showConfirmEveryonePrivacyDialog:function(){new Dialog().setAsync(new AsyncRequest().setURI('/ajax/privacy/confirm_everyone_dialog.php')).setHandler(this.savePrivacyData.bind(this,'seen_everyone','everyone_warning',this._post.bind(this))).show();},getContextData:function(){return this.contextData;},resetMessage:function(){this.input.addClass('DOMControl_placeholder');this.input.setStyle('height','');this.setMessage(this.placeholder);},clearMessage:function(){this.setMessage('');},getMessage:function(){return this.input.value.trim();},setMessage:function(message){this.input.value=message;},showError:function(title,message){new ErrorDialog().setTitle(title).setBody(message||_tx("Se ha producido un error en la aplicaci\u00f3n. Por favor, int\u00e9ntalo de nuevo m\u00e1s tarde.")).setButtons([Dialog.OK]).show();},resetSubmitButtonText:function(){if(this.orig_button_text){this.setSubmitButtonText(this.orig_button_text);}},setSubmitButtonText:function(text){if(text){if(this.submitButton&&this.submitButton.value){this.orig_button_text=this.orig_button_text||this.submitButton.value;this.submitButton.value=text;}}},focusInput:function(){this.input.select();this.input.focus();}};copy_properties(UIComposer,{instances:{},getInstance:function(id){return this.instances[id];},storeInstance:function(id,composer){this.instances[id]=composer;},focusInstance:function(id){var instances=this.instances;onloadRegister(function(){instances[id].focus();setTimeout(function(){instances[id].input.focus();},0);});},animation:function(element,callback){return animation(element).ondone(callback||bagofholding).ease(animation.ease.end).duration(200);}});copy_properties(UIComposer,{DIALOG_WIDTH:560,DIALOG_WIDTH_PIC:620,APP_ID_POSTED:2309869772,HOME_DATA:{action:'HOME_UPDATE',home_tab_id:1,profile_id:null,status:null,target_id:null},TARGET_DATA:{action:'PROFILE_UPDATE',profile_id:null,status:null,target_id:null},STATE:{PIC_NONE:'UIComposer_STATE_PIC_NONE',PIC_INSIDE:'UIComposer_STATE_PIC_INSIDE',PIC_OUTSIDE:'UIComposer_STATE_PIC_OUTSIDE',LOC_ACTIVATED:'UIComposer_STATE_LOC_ACTIVATED',INPUT_FOCUSED:'UIComposer_STATE_INPUT_FOCUSED',INPUT_DISABLED:'UIComposer_STATE_INPUT_DISABLED',ATTACHMENT_AREA:'UIComposer_STATE_ATTACHMENT_AREA',ATTACHMENT_LOADED:'UIComposer_STATE_ATTACHMENT_LOADED'}});

function UIComposerAttachmentList(composer,root){this.composer=composer;this.root=root;this.title=composer.root.find('div.UIComposer_AttachmentTitle');var attachments=composer.attachments,items=$A(DOM.scry(root,'li.UIComposer_Attachment a')),count=items.length;var initializeItem=function(item,index){var attachment=attachments[index];attachment.index=index;Event.listen(item,'click',this.select.bind(this,attachment,null));}.bind(this);var buildItem=function(attachment,index){var item=$N('a',{href:"#",className:'UIComposer_MoreItem'},[$N('span',{className:'UIComposer_MoreIcon',style:{backgroundImage:'url('+attachment.menu_icon+')'}}),HTML(attachment.caption)]);initializeItem(item,index+count);return item;};items.each(initializeItem);if(attachments.length>count){this.menu=new UIActionMenu().setSuppressButton(true).setSuppressText(true).setTooltip(_tx("M\u00e1s")).setContentCallback(function(){return $N('div',attachments.slice(count).map(buildItem));});root.appendChild($N('li',{className:'UIComposer_More'},this.menu.root));}}
UIComposerAttachmentList.prototype={select:function(attachment,extraData){this.title.setContent(attachment.caption);this.title.setStyle('backgroundImage','url('+attachment.icon+')');this.composer.showAttachment(attachment,extraData);if(this.menu){this.menu.hideMenu();}
hide(this.root);return false;},hide:function(){hide(this.root);},reset:function(){show(this.root);}};

function UserActivity(){}
copy_properties(UserActivity,{_initialized:false,_listeners:[],initialize:function(){var activityFn=function(event){Arbiter.inform(Arbiter.USER_ACTIVITY,event);};UserActivity._listeners.push(Event.listen(document.body,'mouseover',activityFn));var key_context=window;if(ua.ie()){key_context=document.body;}
UserActivity._listeners.push(Event.listen(key_context,'keydown',activityFn));UserActivity._listeners.push(Event.listen(document.body,'click',activityFn));UserActivity._initialized=true;},subscribe:function(callback){if(!UserActivity._initialized){UserActivity.initialize();}
return Arbiter.subscribe(Arbiter.USER_ACTIVITY,callback,Arbiter.SUBSCRIBE_NEW);},unsubscribe:function(token){Arbiter.unsubscribe(token);}});onloadRegister(UserActivity.initialize);

function OnVisible(element,handler){this.targetY=Vector2.getElementPosition(element).y;var scroll_listener=function(){var y=Vector2.getScrollPosition().y+
Vector2.getViewportDimensions().y;if(y>this.targetY){this.remove();handler();}
return true;}.bind(this);if(DOMScroll.usingScrollWrapper()){var scroll_target=DOMScroll.getScrollRoot();}else{var scroll_target=window;}
this.scrollListener=Event.listen(scroll_target,'scroll',scroll_listener);this.resizeListener=Event.listen(window,'resize',scroll_listener);scroll_listener();onunloadRegister(this.remove.bind(this));}
copy_properties(OnVisible.prototype,{remove:function(){if(this.scrollListener){this.scrollListener.remove();this.resizeListener.remove();this.scrollListener=this.resizeListener=null;}}});

var NewHigh={ensureInitialized:function(){this.composer=DOM.scry(document.body,'div.UIComposer')[0];this.button=DOM.scry(document.body,'a.highlights_update_status')[0];this.ensureInitialized=bagofholding;},showComposer:function(focusComposer){this.ensureInitialized();this.composer&&this.composer.removeClass('hidden_elem');if(focusComposer){UIComposer.focusInstance(this.composer.id);}
this.button&&this.button.addClass('hidden_elem');},hideComposer:function(){this.ensureInitialized();this.composer&&this.composer.addClass('hidden_elem');this.button&&this.button.removeClass('hidden_elem');}};

function UIIntentionalStream(root,instanceName,newest,oldest,hiddenCount,hiddenIDCount,storyCount,hasAdditionalStories,defaultFilter,sourceType,hlGroup,stickyFilter,streamStoryCount,firstLoadIDs){if(!root){throw new Error('UIIntentionalStream instantiated with no root.');}
copy_properties(this,{id:root.id,root:root,instanceName:instanceName,newest:newest,oldest:oldest,firstLoadIDs:firstLoadIDs,hiddenCount:hiddenCount,hiddenIDCount:hiddenIDCount,shouldShowHidden:false,storyCount:storyCount,hasAdditionalStories:hasAdditionalStories,defaultFilter:defaultFilter,sourceType:sourceType,hlGroup:hlGroup,stickyFilter:stickyFilter,streamStoryCount:streamStoryCount,isAutoRefreshing:false,hasPendingRefresh:false,storyInterval:null,lastRefresh:new Date().getTime(),presenceCheckCounter:0,ignoreQueueTurningActive:false,storyQueue:[],storyQueueCount:0,showNewStories:root.find('div.UIIntentionalStream_ShowNewStories'),showNewStoriesMsg:root.find('a.UIIntentionalStream_ShowNewStories_Msg'),showNewStoriesTxt:root.find('span.UIIntentionalStream_ShowNewStories_Txt'),showNewStoriesCount:root.find('strong.UIIntentionalStream_ShowNewStories_Count'),pills:DOM.scry(document.body,'div.UIIntentionalStream_Top')[0],forceFilterKey:false,pageloadTime:new Date().getTime(),heavyRefreshCount:0,pushRefreshCount:0,pollRefreshCount:0,scrollLoadIsDone:false,error:DOM.scry(root,'div.UIIntentionalStream_Error')[0],pager:root.find('div.UIShowMore_Pager'),hiddenInfo:root.find('div.UIIntentionalStream_HiddenInfo'),streamContent:root.find('div.UIIntentionalStream_Content'),requestNum:0,firstStory:null,forceRefresh:false});if(this.pills){this.liveFeedBubble=DOM.scry(this.pills,'div.BubbleCount')[0];this.liveFeedCount=DOM.scry(this.pills,'div.BubbleCount_Number')[0];this.setUpHighlightsPillFilters();}
if(this.streamStoryCount>0){this.storyQueueCount=this.streamStoryCount;this.showLiveFeedCount();}
this.setAutoRefreshConfig({});onunloadRegister(this.unload.bind(this));this.userActivity();this.updateFirstStory();this.updatePager();CSS.removeClass(this.pager,'hidden_elem');this.uaToken=UserActivity.subscribe(this.userActivity.bind(this));if(!UIIntentionalStream.instances){UIIntentionalStream.instances={};}
UIIntentionalStream.instances[instanceName]=this;UIIntentionalStream.instance=this;this.setupAutoPageRefresh();}
UIIntentionalStream.prototype.unload=function(){if(this.logDetail&&this.allowAutoRefresh){var open_time=new Date().getTime()-this.pageloadTime;scribe_log('nile_refresh_detail','unload_stat '+open_time+' '+this.heavyRefreshCount+' '+this.pushRefreshCount+' '+this.pollRefreshCount);}
this.enableAutoRefresh(false);this.cleanupRefreshInterval();UIIntentionalStream.instance=null;UIIntentionalStream.instances[this.instanceName]=null;UserActivity.unsubscribe(this.uaToken);this.clearScrollLoader();}
UIIntentionalStream.getInstance=function(instanceName){return UIIntentionalStream.instances[instanceName];}
UIIntentionalStream.handleNewStoryMessage=function(type,data){var stream=UIIntentionalStream.instance;if(stream&&!stream.queueIsFull()){stream.pushRefreshCount++;stream.updateStream();}}
UIIntentionalStream.callOnInstance=function(fn_name){return function(){if(UIIntentionalStream.instance){var fn=UIIntentionalStream.instance[fn_name];return fn.apply(UIIntentionalStream.instance,arguments);}else{return null;}}}
UIIntentionalStream.prototype.presenceStreamCheck=function(time,asyncData,forceUpdate){if(!this.allowAutoRefresh||!this.presenceLoopPerPoll){return false;}
if(!presenceNotifications.requiresUpdate(time,asyncData,forceUpdate)){return false;}
if(!this.needsRefresh()){return false;}
++this.presenceCheckCounter;if(this.presenceCheckCounter>=this.presenceLoopPerPoll){var extraData=this.getCurrentParams();extraData.newest=this.newest;extraData.last_refresh=this.getMSSinceLastRefresh();this.lastPresenceRequestNum=++this.requestNum;asyncData['stream_query']=extraData;this.presenceCheckCounter=0;return true;}
return false;}
UIIntentionalStream.prototype._getUpdateInsertType=function(){if(this.isDarkRefresh){return UIIntentionalStream.REFRESH_DARK;}else if(this.isUsingPillFilters()&&this.isOnNewsFeed()){return UIIntentionalStream.REFRESH_PREPEND;}else if(this.queueNewStories){return UIIntentionalStream.REFRESH_QUEUE;}else{return UIIntentionalStream.REFRESH_PREPEND;}}
UIIntentionalStream.prototype.presenceStreamResponse=function(payload,time){this.lastRefresh=new Date().getTime();this.heavyRefreshCount++;this.handleResponsePayload(this.lastPresenceRequestNum,this._getUpdateInsertType(),payload);this.lastPresenceRequestNum=0;}
UIIntentionalStream.prototype.setStoryInterval=function(rate){this.storyInterval=rate;return this;}
UIIntentionalStream.prototype.setAutoRefreshConfig=function(config){config=config||{};var long_time=24*60*60*1000;this.allowAutoRefresh=coalesce(config.allow_auto_refresh,false);this.inactiveThreshold=coalesce(config.inactive_threshold,0);this.activeRefreshTime=coalesce(config.fast_refresh_rate,long_time);this.inactiveRefreshTime=coalesce(config.slow_refresh_rate,long_time);this.allowPolling=coalesce(config.allow_polling,false);this.refreshFactor=coalesce(config.refresh_factor,10);this.queueNewStories=coalesce(config.queue_new_stories,true);this.isDarkRefresh=coalesce(config.dark,false);this.presenceLoopPerPoll=coalesce(config.presence_loop_per_poll,0);this.maxQueueSize=coalesce(config.max_queue_size,0);this.minRefreshInterval=coalesce(config.min_refresh_interval,60*1000);this.logDetail=coalesce(config.log_detail,false);this.ignoreQueueTurningActive=coalesce(config.ignore_queue_turning_active,false);return this;}
UIIntentionalStream.prototype.queueIsFull=function(){return(this.maxQueueSize&&this.storyQueueCount>=this.maxQueueSize);}
UIIntentionalStream.prototype.shouldAutoRefresh=function(){return this.isAutoRefreshing&&this.allowAutoRefresh;}
UIIntentionalStream.prototype.clearPendingHighlights=function(){if(this.hlGroup!=UIIntentionalStream.HIGHLIGHTS_CONTROL&&this.isOnNewHighlights()&&(this.getMSSinceLastActivity()>UIIntentionalStream.HIGHLIGHTS_REFRESH_INACTIVE_THRESHOLD)){new AsyncSignal('/ajax/feed/save_view_state.php').send();}}
UIIntentionalStream.prototype.userActivity=function(){this.clearPendingHighlights();var wasInactive=this.isInactive();this.lastActivity=(new Date().getTime());if(wasInactive&&this.allowAutoRefresh&&this.needsRefresh(true)){this.updateStream();this.schedulePoll(this.getRefreshInterval());}
return true;}
UIIntentionalStream.prototype.getMSSinceLastActivity=function(){return(new Date().getTime())-this.lastActivity;}
UIIntentionalStream.prototype.getMSSinceLastRefresh=function(){return(new Date().getTime())-this.lastRefresh;}
UIIntentionalStream.prototype.isInactive=function(){return this.getMSSinceLastActivity()>this.inactiveThreshold;}
UIIntentionalStream.prototype.getRefreshInterval=function(){if(this.isInactive()){return this.inactiveRefreshTime;}else{if(this.storyInterval!=null){var interval=this.storyInterval*this.refreshFactor;return Math.max(interval,this.activeRefreshTime);}else{return this.activeRefreshTime;}}}
UIIntentionalStream.prototype.enableAutoRefresh=function(enabled,immediate){this.isAutoRefreshing=enabled;if(enabled){var delay=immediate?0:this.getRefreshInterval();this.schedulePoll(delay);}else{this.cancelUpdate();}}
UIIntentionalStream.prototype.cancelUpdate=function(){if(this.updateTask){clearTimeout(this.updateTask);this.updateTask=null;}}
UIIntentionalStream.prototype.schedulePoll=function(delay){this.cancelUpdate();if(this.allowPolling){this.updateTask=setTimeout(this.runUpdatePoll.bind(this),delay);}}
UIIntentionalStream.prototype.needsRefresh=function(turningActive){return!(this.hasPendingRefresh||(!(turningActive&&this.ignoreQueueTurningActive)&&this.queueIsFull())||this.getMSSinceLastRefresh()<this.minRefreshInterval);}
UIIntentionalStream.prototype.runUpdatePoll=function(){this.updateTask=null;if(!this.shouldAutoRefresh()){return;}
if(this.needsRefresh()){this.pollRefreshCount++;this.updateStream();}
this.schedulePoll(this.getRefreshInterval());}
UIIntentionalStream.prototype.updateStream=function(flush_on_complete){if(!this.allowAutoRefresh){return;}
this.loadNewer({showLoader:false,ignoreSelf:true,flushOnComplete:flush_on_complete,insertType:this._getUpdateInsertType()});}
UIIntentionalStream.prototype.clearScrollLoader=function(){if(this.currentScrollListener){this.currentScrollListener.remove();this.currentScrollListener=null;}
this.scrollLoadIsDone=true;}
UIIntentionalStream.prototype.loadMoreOnScroll=function(loadMoreStoryID,delayLoadCount,queryTime){if(this.scrollLoadIsDone){return;}
var scroll_handler=function(){this.clearScrollLoader();this.loadOlder({delayLoadCount:delayLoadCount,firstLoadIDs:this.firstLoadIDs,showLoader:false,queryTime:queryTime});}.bind(this);if(ge(loadMoreStoryID)){this.currentScrollListener=new OnVisible($(loadMoreStoryID),scroll_handler);}else{this.scroll_handler();}}
UIIntentionalStream.prototype.updatePageCache=function(){this.loadNewer({bundleAsync:true,showLoader:false,ignoreReqNum:true});}
UIIntentionalStream.prototype.getID=function(){return this.id;}
UIIntentionalStream.prototype.showPositioned=function(element,type,kwargs){if(type==UIIntentionalStream.REFRESH_APPEND){this.root.appendContent(element);}else if(type==UIIntentionalStream.REFRESH_PREPEND){this.root.prependContent(element);}else if(type==UIIntentionalStream.REFRESH_EXPAND){DOM.insertAfter($(kwargs.expandStoryID),element);}
element.setStyle('display','block');if(element.src){element.src=element.src;}}
UIIntentionalStream.prototype.showHiddenStories=function(){this.shouldShowHidden=true;var data=this.getCurrentParams();data.max_stories=this.storyCount+this.hiddenCount;data.show_hidden=true;this.refresh(UIIntentionalStream.REFRESH_TRANSITION,data);DOMScroll.scrollTo($('home_stream'),false);return false;}
UIIntentionalStream.prototype.showHiddenPeople=function(filterKey){if(filterKey==undefined){filterKey=this.getCurrentFilterKey();}
var onModified=function(){var data=this.getCurrentParams();this.refresh(UIIntentionalStream.REFRESH_TRANSITION,data);DOMScroll.scrollTo($('home_stream'),false);}.bind(this);NewsFeedEditor.show(filterKey,onModified);return false;}
UIIntentionalStream.prototype.getCurrentFilterKey=function(){var params=this.getCurrentParams();if(params&&params.filter){if(this.hlGroup==UIIntentionalStream.HIGHLIGHTS_STICKY&&this.stickyFilter&&params.filter==UIIntentionalStream.FEED_FILTER_KEY_NEWS_FEED){return this.stickyFilter;}
return params.filter;}else if(this.defaultFilter){return this.defaultFilter;}
return null;}
UIIntentionalStream.prototype.loadOlder=function(kwargs){kwargs=kwargs||{};if(!this.oldest){return;}
var params=this.getCurrentParams();params.oldest=this.oldest;if(this.shouldShowHidden){params.show_hidden=true;}
if(kwargs.delayLoadCount){params.delay_load_count=kwargs.delayLoadCount;}else{this.logFeedTrackingEvent(ft.NF_EVENT_SEE_MORE,'page');}
if(kwargs.firstLoadIDs){params.first_load_ids=kwargs.firstLoadIDs;}
params.query_time=kwargs.queryTime;this.refresh(UIIntentionalStream.REFRESH_APPEND,params,kwargs);return this;}
UIIntentionalStream.prototype.loadNewer=function(kwargs){if(!this.newest){return;}
kwargs=kwargs||{};var extraData=this.getCurrentParams();extraData.newest=this.newest;if(kwargs.ignoreSelf){extraData.ignore_self=true;}
extraData.load_newer=true;var type=coalesce(kwargs.insertType,UIIntentionalStream.REFRESH_PREPEND);this.lastRefresh=new Date().getTime();this.refresh(type,extraData,kwargs);return this;}
UIIntentionalStream.prototype.getCurrentParams=function(){var params={};var qdata=URI.getRequestURI(true,true).getQueryData();var valid_param=this.getValidParams();if(valid_param){valid_param.forEach(function(i){params[i]=qdata[i];});}else{params=qdata;}
params.hidden_count=this.hiddenCount||0;return params;}
UIIntentionalStream.prototype.setHomeFilter=function(home_filter){this._homeFilter=home_filter;}
UIIntentionalStream.prototype.setHomeFilterLoading=function(loading){if(this._homeFilter){this._homeFilter.setLoading(loading);}}
UIIntentionalStream.prototype.refresh=function(type,data,kwargs){this.lastRefresh=new Date().getTime();if(this.forceFilterKey){data.force_filter_key=true;this.forceFilterKey=false;}
if(this.hlGroup==UIIntentionalStream.HIGHLIGHTS_STICKY&&data.filter==UIIntentionalStream.FEED_FILTER_KEY_NEWS_FEED&&this.stickyFilter){data.filter=this.stickyFilter;}
kwargs=kwargs||{};var requestNum=++this.requestNum;var bundleAsync=coalesce(kwargs.bundleAsync,false);var showLoader=coalesce(kwargs.showLoader,true);var instanceName=this.instanceName;var handler=function(response){UIIntentionalStream.getInstance(instanceName).handleResponse(requestNum,type,response,kwargs);};var errHandler=function(response){UIIntentionalStream.getInstance(instanceName).handleError(requestNum,type,response);};var finallyHandler=function(response){UIIntentionalStream.getInstance(instanceName).handleFinally(type,response);};if(!(data.request_type=type)){data.request_type='none';}
if(data.filter){kwargs.show_hidden=data.show_hidden?data.show_hidden:false;}else{kwargs.show_hidden=this.shouldShowHidden;}
var is_replayable=true;if(data.newest){is_replayable=false;}
this.hasPendingRefresh=true;var loader;if(type==UIIntentionalStream.REFRESH_APPEND&&showLoader){loader=this.pager;}
new AsyncRequest().setURI(this.getEndpoint()).setReadOnly(true).setOption('retries',0).setMethod(this.getRefreshMethod()).setData(data).setOption('bundle',bundleAsync).setReplayable(is_replayable).setHandler(handler).setStatusElement(loader).setErrorHandler(errHandler).setTransportErrorHandler(errHandler).setFinallyHandler(finallyHandler).send();if(type==UIIntentionalStream.REFRESH_TRANSITION){this.storyCount=0;this.hasAdditionalStories=true;hide(this.pager);this.clearQueue();this.clearScrollLoader();this.oldest=this.newest=null;}
if(showLoader){this.setHomeFilterLoading(true);}}
UIIntentionalStream.prototype.updatePillVisibility=function(){if(this.pills){if(this.isOnNewsFeed()){this.swapPills(this.livePill,this.summaryPill);this.pills.removeClass('hidden_elem');NewHigh.hideComposer();}else if(this.isOnNewHighlights()){this.swapPills(this.summaryPill,this.livePill);this.pills.removeClass('hidden_elem');NewHigh.hideComposer();}else{this.pills.addClass('hidden_elem');NewHigh.showComposer();}}}
UIIntentionalStream.prototype.updateFirstStory=function(content){content=$(content||this.streamContent);var story=content.scry(UIIntentionalStream.FIRST_STORY_SELECTOR)[0];if(this.firstStory){CSS.removeClass(this.firstStory,UIIntentionalStream.FIRST_STORY_CLASS);}
if(story){CSS.addClass(story,UIIntentionalStream.FIRST_STORY_CLASS);}
this.firstStory=story;}
UIIntentionalStream.prototype.addContent=function(content,delay){CSS.addClass(content,UIIntentionalStream.FIRST_STORY_CLASS);this.addContentPrepend($N('div',{className:'UIStream'},content),delay);}
UIIntentionalStream.prototype.addContentPrepend=function(content,delay){this.updateFirstStory(content);CSS.setStyle(content,'overflow','hidden');CSS.setStyle(content,'height','0px');CSS.setOpacity(content,'0');this.streamContent.prependContent(content);var anim=animation(content).to('height','auto').to('opacity','1').duration(UIIntentionalStream.ANIMATION_DURATION).ondone(function(){CSS.setStyle(content,'overflow','');});delay?setTimeout(anim.go.bind(anim),delay):anim.go();}
UIIntentionalStream.prototype.addContentAppend=function(content){this.streamContent.appendContent(content);this.clearFirst(content);}
UIIntentionalStream.prototype.unfollow=function(data){var asyncData={value:data.id,action:'unfollow',filter_key:this.getCurrentFilterKey()};var asyncHandler=function(){var count=UIIntentionalStream.forEachStory(data.id,hide);this.hiddenCount+=count;this.hiddenIDCount++;this.updatePager();}.bind(this);new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData(asyncData).setReplayable(true).setHandler(asyncHandler).send();var selected_story=$(data.storyID);var msg_div=$N('div',{className:'unfollow_message'});var undo_link=$N('a',{className:'unfollow_undo','href':'#'},HTML(_tx("Deshacer")));var show_hidden_link=$N('a',{onclick:this.showHiddenPeople.shield(this)},HTML(_tx("Editar opciones")));undo_link.listen('click',this.undoUnfollow.bind(this,data,msg_div));var unfollow_msg;if(!data.isApp){unfollow_msg=_tx("<strong>Has ocultado a {name} de tus \"\u00daltimas noticias\".<\/strong><br>En adelante, no ver\u00e1s las publicaciones de {first_name}.",{'name':data.name,'first_name':data.firstName});}else{unfollow_msg=_tx("<strong>Has ocultado a {application} de tus \"\u00daltimas noticias\".<\/strong><br>En adelante, no ver\u00e1s las publicaciones de {application}.",{'application':data.name});}
msg_content=[undo_link,HTML(unfollow_msg),' (',show_hidden_link,')'];msg_div.setContent($N('p',msg_content));hide(msg_div);DOM.insertBefore(msg_div,selected_story);var count=UIIntentionalStream.forEachStory(data.id,hide);CSS.setOpacity(msg_div,'0');show(msg_div);if(count>1){DOMScroll.scrollTo(msg_div,false,true);}
animation(msg_div).to('opacity','1').duration(UIIntentionalStream.ANIMATION_DURATION).ondone(function(){setTimeout(function(){animation(msg_div).to('opacity','0').checkpoint().ease(animation.ease.both).to('height','0').to('padding','0').blind().duration(UIIntentionalStream.ANIMATION_DURATION).ondone(function(){if(msg_div.parentNode){msg_div.remove();}}).go();},10*1000);}).go();return false;}
UIIntentionalStream.forEachStory=function(id,fn){var stories=UIIntentionalStream.getStoriesByAssoc(id);stories.forEach(fn);return stories.length;}
UIIntentionalStream.prototype.undoUnfollow=function(data,msg_div){var asyncData={value:data.id,action:'undo_unfollow',filter_key:this.getCurrentFilterKey()};var asyncHandler=function(){var count=UIIntentionalStream.forEachStory(data.id,show);this.hiddenCount-=count;this.hiddenIDCount--;this.updatePager();}.bind(this);new AsyncRequest().setURI('/ajax/feed/filter_action.php').setData(asyncData).setReplayable(true).setHandler(asyncHandler).send();var count=UIIntentionalStream.forEachStory(data.id,show);if(count>1){DOMScroll.scrollTo(msg_div,false,true);}
msg_div.remove();return false;}
UIIntentionalStream.prototype.updatePager=function(){var show_hidden_link=null;var edit_prefs_link=null;if(this.hiddenCount>0&&!this.shouldShowHidden){var story_count_text;if(this.hiddenCount==1){story_count_text=_tx("una publicaci\u00f3n oculta");}else{story_count_text=_tx("{count} publicaciones ocultas",{'count':this.hiddenCount});}
show_hidden_link=$N('a',{href:'#'},_tx("Mostrar {count-stories}",{'count-stories':story_count_text}));Event.listen(show_hidden_link,'click',this.showHiddenStories.shield(this));}
if(this.hiddenIDCount>0){edit_prefs_link=$N('a',{href:'#'},_tx("Editar opciones"));Event.listen(edit_prefs_link,'click',this.showHiddenPeople.shield(this));}
var bottom_info='';if(show_hidden_link&&edit_prefs_link){bottom_info=[show_hidden_link,HTML(' &#183; '),edit_prefs_link];}else if(show_hidden_link){bottom_info=[show_hidden_link];}else if(edit_prefs_link){bottom_info=[edit_prefs_link];}
if(!this.storyCount||!this.hasAdditionalStories){CSS.addClass(this.pager,'UIShowMore_NoMore');if(this.hiddenIDCount){show(this.pager);}else{hide(this.pager);}}else{CSS.removeClass(this.pager,'UIShowMore_NoMore');show(this.pager);}
DOM.setContent(this.hiddenInfo,bottom_info);}
UIIntentionalStream.getStoriesByAssoc=function(assoc){return DOM.scry(UIIntentionalStream.instance.root,'div.aid_'+assoc);}
UIIntentionalStream.prototype.handleResponse=function(requestNum,type,response,kwargs){var ignore_req_num=response.isReplay()||kwargs.ignoreReqNum;return this.handleResponsePayload(requestNum,type,response.getPayload(),ignore_req_num,kwargs);}
UIIntentionalStream.prototype.handleDuplicateStories=function(content){var modified_textareas=[];var new_stories=content.scry("div.UIStory");for(var i=0;i<new_stories.length;i++){var new_story=new_stories[i];var story_id=new_story.id;var current_story=ge(story_id);if(!current_story){continue;}
var old_textareas=current_story.scry("textarea.add_comment_text");if(old_textareas.length==1){var old_textarea=old_textareas[0];if(old_textarea.hasClass("DOMControl_autogrow")){var new_textareas=new_story.scry("textarea.add_comment_text");if(new_textareas.length!=0){var new_textarea=new_textareas[0];new_textarea.value=old_textarea.value;modified_textareas.push(new_textarea);}}}
animation(current_story).to('height','0px').to('opacity','0').duration(UIIntentionalStream.ANIMATION_DURATION).ease(animation.ease.end).ondone(function(){DOM.remove(current_story)}).go();}
return modified_textareas;}
UIIntentionalStream.prototype.handleResponsePayload=function(requestNum,type,payload,ignore_request_num,kwargs){kwargs=kwargs||{};if(is_empty(payload)){return;}
if(payload.autoRefreshConfig){this.setAutoRefreshConfig(payload.autoRefreshConfig);}
this.setHomeFilterLoading(false);if(type==UIIntentionalStream.REFRESH_EXPAND){$(kwargs.expandStoryID).find('div.UIIntentionalStory_CollapsedStories').removeClass('UIIntentionalStory_CollapsedStoriesLoading').addClass('hidden_elem');}
if(this.error){hide(this.error);}
if(!ignore_request_num&&requestNum!=this.requestNum){return;}
if('show_hidden'in kwargs){this.shouldShowHidden=kwargs.show_hidden;}
this.hiddenCount=payload.hiddenCount;this.hiddenIDCount=payload.hiddenIDCount;this.storyCount+=payload.storyCount;if('newestStoryTime'in payload&&payload.newestStoryTime>this.newest){this.newest=payload.newestStoryTime;}
if('oldestStoryTime'in payload&&(!this.oldest||payload.oldestStoryTime<this.oldest)){this.oldest=payload.oldestStoryTime;}
if('hasAdditionalStories'in payload){this.hasAdditionalStories=payload.hasAdditionalStories;}else if(type==UIIntentionalStream.REFRESH_APPEND&&payload.storyCount==0){this.hasAdditionalStories=false;}
if('streamStoryCount'in payload){this.storyQueueCount=payload.streamStoryCount;this.showLiveFeedCount();}
this.updatePager();if(payload.html){var content=HTML(payload.html).getRootNode();switch(type){case UIIntentionalStream.REFRESH_QUEUE:this.queueStories(content,payload.storyCount);break;case UIIntentionalStream.REFRESH_PREPEND:this.addContentPrepend(content);break;case UIIntentionalStream.REFRESH_APPEND:this.addContentAppend(content);this.clearScrollLoader();break;case UIIntentionalStream.REFRESH_TRANSITION:this.streamContent.setContent(content);this.updateFirstStory();DOMScroll.scrollTo(new Vector2(0,0,"document"),false);break;case UIIntentionalStream.REFRESH_DARK:break;case UIIntentionalStream.REFRESH_EXPAND:CSS.setStyle(content,'overflow','hidden');CSS.setOpacity(content,'0');CSS.removeClass(content.childNodes[0],'UIStory_First');DOM.insertAfter($(kwargs.expandStoryID),content);animation(content).to('opacity','1').duration(UIIntentionalStream.ANIMATION_DURATION).go();break;}}
if(kwargs.flushOnComplete){this._flushQueue();}}
UIIntentionalStream.prototype.clearQueue=function(delay){delay=delay||0;this.storyQueue=[];this.storyQueueCount=0;this.hideShowNewStories(this.showNewStories,delay);if(this.liveFeedBubble){this.hideShowNewStories(this.liveFeedBubble,delay);}}
UIIntentionalStream.prototype.hideShowNewStories=function(elem,delay){if(delay){setTimeout(function(){animation(elem).to('opacity','0').checkpoint().to('height','0').hide().duration(150).go();}.bind(this),delay);}else{hide(elem);}}
UIIntentionalStream.prototype.flushQueue=function(){if(this.getMSSinceLastRefresh()<this.minRefreshInterval){this._flushQueue();}else{this.updateStream(true);}}
UIIntentionalStream.prototype._flushQueue=function(){var stories=[],newStories=$N('div',{className:'UIStream'});this.storyQueue.forEach(function(stream,i){if(i!=0){this.clearFirst(stream);}
newStories.appendContent($A(stream.childNodes));stream.remove();}.bind(this));var modified_textareas=this.handleDuplicateStories(newStories);this.addContentPrepend(newStories);for(var i=0;i<modified_textareas.length;i++){modified_textareas[i].onfocus();modified_textareas[i].onblur();}
this.clearQueue(UIIntentionalStream.ANIMATION_DURATION);}
UIIntentionalStream.prototype.clearFirst=function(content){var first=DOM.scry(content,UIIntentionalStream.FIRST_STORY_SELECTOR)[0];if(first){CSS.removeClass(first,UIIntentionalStream.FIRST_STORY_CLASS);}}
UIIntentionalStream.prototype.queueStories=function(content,numStories){var showMessage=(this.storyQueueCount==0);hide(content);this.streamContent.prependContent(content);this.storyQueue=[content].concat(this.storyQueue);var countString='';if(numStories){this.storyQueueCount+=numStories;countString=this.storyQueueCount;}
if(this.isUsingPillFilters()&&(this.isOnNewHighlights()||this.isOnNewsFeed())&&this.liveFeedCount){this.liveFeedCount.setContent(HTML(countString.toString()));}else if(this.isOnNewHighlights()){this.showNewStories.setClass('UIIntentionalStream_HighShowNewStories');var msg=_tx("Ver las \u00faltimas noticias");this.showNewStoriesTxt.setContent(HTML(msg));this.showNewStoriesCount.setContent(HTML(countString.toString()));this.showNewStoriesCount.setStyle('display','inline');}else{this.showNewStories.setClass('UIIntentionalStream_ShowNewStories');if(this.showNewStoriesCount){hide(this.showNewStoriesCount);}
var msg;if(this.storyQueueCount==1){msg=_tx("Mostrar 1 publicaci\u00f3n nueva");}else{msg=_tx("Mostrar {count} publicaciones nuevas",{count:countString});}
this.showNewStoriesTxt.setContent(HTML(msg));}
if(showMessage){this.showNewStoriesMessage();}}
UIIntentionalStream.prototype.showNewStoriesMessage=function(){this.logFeedTrackingEvent(ft.NF_EVENT_IMPRESSION,'new');if(this.isUsingPillFilters()&&(this.isOnNewHighlights()||this.isOnNewsFeed())){CSS.setStyle(this.liveFeedBubble,'display','inline');}else{CSS.setStyle(this.showNewStories,'display','block');animation(this.showNewStories).to('height','auto').to('opacity','1').go();}}
UIIntentionalStream.prototype.showLiveFeedCount=function(){if(this.storyQueueCount>0&&this.liveFeedCount){this.liveFeedCount.setContent(HTML(this.storyQueueCount.toString()));this.showNewStoriesMessage();}}
UIIntentionalStream.prototype.logFeedTrackingEvent=function(event,type,filter){if(!this.sourceType){return;}
if(!filter){filter=this.getCurrentFilterKey();}
var link_data={src:this.sourceType,evt:event,filter:filter};if(type){link_data.type=type;};ft.logData(link_data);}
UIIntentionalStream.prototype.handleError=function(requestNum,type,response){if(!response.isReplay()&&requestNum!=this.requestNum){return;}
this.setHomeFilterLoading(false);if(type==UIIntentionalStream.REFRESH_EXPAND){$(kwargs.expandStoryID).find('div.UIIntentionalStory_CollapsedStories').removeClass('UIIntentionalStory_CollapsedStoriesLoading');}
var error=response.getError();if(error==kError_Async_NotLoggedIn){var title=_tx("Tiempo de espera superado");var msg=_tx("Tu sesi\u00f3n ha caducado. Por favor, con\u00e9ctate de nuevo.");var log_in=Dialog.newButton('login',_tx("Iniciar sesi\u00f3n"),null,function(){goURI('/login.php');});new Dialog().setTitle(title).setBody(msg).setButtons([log_in,Dialog.CANCEL]).show();}
if(type!=UIIntentionalStream.REFRESH_PREPEND&&this.error){this.showPositioned(this.error,type);}}
UIIntentionalStream.prototype.handleFinally=function(type){if(type==UIIntentionalStream.REFRESH_TRANSITION){PageTransitions.transitionComplete();}
this.updatePillVisibility();this.hasPendingRefresh=false;}
UIIntentionalStream.prototype.getValidParams=function(){return UIIntentionalStream.VALID_PARAMS;}
UIIntentionalStream.prototype.getEndpoint=function(){return UIIntentionalStream.ENDPOINT;}
UIIntentionalStream.prototype.getRefreshMethod=function(){return UIIntentionalStream.REFRESH_METHOD;}
UIIntentionalStream.prototype.registerShowNewStoriesKey=function(){KeyEventController.registerKey("u",function(event,type){if(event.getModifiers().shift&&this.storyQueueCount>0){this.doShowNewStories();return false;}}.bind(this));}
UIIntentionalStream.prototype.isOnNewHighlights=function(){var filterKey=this.getCurrentFilterKey();return(filterKey==UIIntentionalStream.FEED_FILTER_KEY_NEW_HIGHLIGHTS);}
UIIntentionalStream.prototype.isOnNewsFeed=function(){var filterKey=this.getCurrentFilterKey();return(filterKey==UIIntentionalStream.FEED_FILTER_KEY_NEWS_FEED);}
UIIntentionalStream.prototype.isUsingPillFilters=function(){return(this.hlGroup==UIIntentionalStream.HIGHLIGHTS_STICKY);}
UIIntentionalStream.prototype.setupAutoPageRefresh=function(){if(this.hlGroup==UIIntentionalStream.HIGHLIGHTS_CONTROL){return;}
this.highlightsRefreshInterval=setInterval(function(){if(!this.allowAutoRefresh){return;}
if(this.getMSSinceLastRefresh()<UIIntentionalStream.HIGHLIGHTS_REFRESH_INACTIVE_THRESHOLD){return;}
var lastActivity=this.getMSSinceLastActivity();var shouldRefresh=(lastActivity>UIIntentionalStream.HIGHLIGHTS_REFRESH_INACTIVE_THRESHOLD);var shouldOverride=(lastActivity>UIIntentionalStream.HIGHLIGHTS_OVERRIDE_INACTIVE_THRESHOLD);if((shouldRefresh&&this.isOnNewHighlights())||shouldOverride){this.refreshFilter(UIIntentionalStream.FEED_FILTER_KEY_NEW_HIGHLIGHTS,shouldOverride,true);}}.bind(this),UIIntentionalStream.HIGHLIGHTS_CHECK_REFRESH_INTERVAL);}
UIIntentionalStream.prototype.cleanupRefreshInterval=function(){if(this.highlightsRefreshInterval){clearInterval(this.highlightsRefreshInterval);this.highlightsRefreshInterval=null;}}
UIIntentionalStream.prototype.setUpHighlightsPillFilters=function(){if(!this.pills){return;}
this.summaryPill={link:DOM.find(this.pills,'a.UIIntentionalStream_SummaryLink'),span:DOM.find(this.pills,'span.UIIntentionalStream_SummaryHeader')};this.livePill={link:DOM.find(this.pills,'a.UIIntentionalStream_LiveLink'),span:DOM.find(this.pills,'span.UIIntentionalStream_LiveHeader')};Event.listen(this.pills,'click',function(e){var target=e.getTarget();var filterKey='';if(DOM.contains(this.summaryPill.link,target)){filterKey=UIIntentionalStream.FEED_FILTER_KEY_NEW_HIGHLIGHTS;}else if(DOM.contains(this.livePill.link,target)){filterKey=UIIntentionalStream.FEED_FILTER_KEY_NEWS_FEED;}
if(filterKey){this.logFeedTrackingEvent(ft.NF_EVENT_PILL_CLICK,'',filterKey);this.forceFilterKey=true;this.stickyFilter=filterKey;}}.bind(this));}
UIIntentionalStream.prototype.swapPills=function(toHide,toShow){var he='hidden_elem';CSS.addClass(toHide.link,he);CSS.addClass(toShow.span,he);CSS.removeClass(toHide.span,he);CSS.removeClass(toShow.link,he);};UIIntentionalStream.prototype.refreshFilter=function(filterKey,force,pending){var req=URI.getRequestURI();req.addQueryData({'filter':filterKey});if(force){this.forceFilterKey=true;this.stickyFilter=filterKey;}
if(pending){req.addQueryData({pending:pending});}
this.logFeedTrackingEvent(ft.NF_PAGE_AUTOREFRESH,'',filterKey);goURI(req);}
UIIntentionalStream.prototype.doShowNewStories=function(){this.logFeedTrackingEvent(ft.NF_EVENT_SEE_MORE,'new');if(this.isOnNewHighlights()){this.refreshFilter(UIIntentionalStream.FEED_FILTER_KEY_NEWS_FEED,true);}else{this.flushQueue();}}
copy_properties(UIIntentionalStream,{ANIMATION_DURATION:300,REFRESH_METHOD:'GET',REFRESH_TRANSITION:1,REFRESH_PREPEND:2,REFRESH_APPEND:3,REFRESH_QUEUE:4,REFRESH_DARK:5,REFRESH_EXPAND:6,FIRST_STORY_CLASS:'UIStory_First',FIRST_STORY_SELECTOR:'div.UIStory_First',FEED_FILTER_KEY_NEW_HIGHLIGHTS:'h',FEED_FILTER_KEY_NEWS_FEED:'nf',HIGHLIGHTS_NEW:1,HIGHLIGHTS_STICKY:3,HIGHLIGHTS_CONTROL:4,VALID_PARAMS:['filter','show_hidden'],ENDPOINT:'/ajax/intent.php',_presenceInit:false,HIGHLIGHTS_CHECK_REFRESH_INTERVAL:5*60*1000,HIGHLIGHTS_REFRESH_INACTIVE_THRESHOLD:30*60*1000,HIGHLIGHTS_OVERRIDE_INACTIVE_THRESHOLD:240*60*1000});UIIntentionalStream.presenceRegister=function(){if(UIIntentionalStream._presenceInit){return true;}
var checkCB=UIIntentionalStream.callOnInstance('presenceStreamCheck');var responseCB=UIIntentionalStream.callOnInstance('presenceStreamResponse');Arbiter.registerCallback(function(){presenceUpdater.register('stream_update',checkCB,responseCB,bagofholding,bagofholding);},[PresenceMessage.PRESENCE_UPDATER_READY]);Arbiter.subscribe(PresenceMessage.getArbiterMessageType('feedpub'),UIIntentionalStream.handleNewStoryMessage);UIIntentionalStream._presenceInit=true;};

UIIntentionalStory={setup:function(root,data){if(!root||!data){return null;}
if(data.unfollow){var hover=Event.listen(root,'mouseover',function(){this.createUnfollowMenu(root,data);hover.remove();}.bind(this));}},createUnfollowMenu:function(root,data){var menuRoot=root.scry('div.UIStory_Hide')[0];if(!menuRoot){return;}
if(ua.ie()<7){Event.listen(root,'mouseover',function(){menuRoot.style.visibility='visible';});Event.listen(root,'mouseout',function(){menuRoot.style.visibility='hidden';});}
var title=data.title;data=data.unfollow;var menu=new UIActionMenu();var list=new UISelectList();var listCallback=function(root,menu,list,checked,data){menu.hideMenu();list.reset();var unfollowData=copy_properties({storyID:root.id},data);UIIntentionalStream.instance.unfollow(unfollowData);}.bind(this,root,menu,list);list.setMode(UISelectList.SINGLE_SELECT_MODE).setCallback(listCallback);data.users.each(function(user){list.addItem(HTML(user.hideString),false,user);});if(data.app){list.addItem(HTML(data.app.hideString),false,data.app);}
menu.setTitle(title).setContentCallback(list.getElement.bind(list)).setSuppressButton(true).setAlignRight(true);menuRoot.setContent(menu.getNodes());},_moreDetails:{},expandStory:function(story_id,actor_id,newest,oldest){var data=UIIntentionalStream.instance.getCurrentParams();data.expand_story_uid=actor_id;data.newest=newest;data.oldest=oldest;var kwargs={expandStoryID:story_id,showLoader:false};$(story_id).find('div.UIIntentionalStory_CollapsedStories').addClass('UIIntentionalStory_CollapsedStoriesLoading');UIIntentionalStream.instance.refresh(UIIntentionalStream.REFRESH_EXPAND,data,kwargs);},morePrivacyDetails:function(fbid,row,elem){if(is_empty(this._moreDetails)){onunloadRegister(function(){this._moreDetails={};}.bind(this));}
if(this._moreDetails[fbid]){return;}
this._moreDetails[fbid]=true;new AsyncRequest().setURI('/ajax/privacy/more_details.php').setData({fbid:fbid,privacy_data:row}).setHandler(function(response){var explanation=response.getPayload().explanation;DOM.setContent(DOM.find(elem,'span.UITooltip_Text'),explanation);}).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding).send();}};

if (window.Bootloader) { Bootloader.done(["js\/3snxh9drs9440404.pkg.js"]); }