
(function($){$.fn.autoResize=function(options){var settings=$.extend({onResize:function(){},animate:$.browser.msie?false:true,animateDuration:150,animateCallback:function(){},extraSpace:20,min:0,minFocus:0,minContent:0,minAnim:25,limit:1000,limitEmpty:1000},options);this.filter('textarea').each(function(){var textarea=$(this).css({resize:'none','overflow-y':'hidden'}),origHeight=textarea.height(),clone=(function(){var props=['height','width','lineHeight','textDecoration','letterSpacing'],propOb={};$.each(props,function(i,prop){propOb[prop]=textarea.css(prop);});return textarea.clone().removeAttr('id').removeAttr('name').css({position:'absolute',top:0,left:-9999}).css(propOb).attr('tabIndex','-1').insertBefore(textarea);})(),lastScrollTop=null,updateSize=function(){var node=$(this);clone.height(0).width(textarea.outerWidth()).val($(this).val()).scrollTop(10000);var scrollTop=Math.max(clone.scrollTop(),origHeight)+settings.extraSpace,toChange=node.add(clone);var focus=node.hasClass('focus')?true:false;var content=node.val().length>0&&!node.hasClass('placeholder')?true:false;if(scrollTop<settings.min)scrollTop=settings.min;if(focus&&scrollTop<settings.minFocus)scrollTop=settings.minFocus;if(content&&scrollTop<settings.minContent)scrollTop=settings.minContent;if(!focus&&!content&&scrollTop>settings.limitEmpty)scrollTop=settings.limitEmpty;if(lastScrollTop===scrollTop){return;}
var diff=Math.abs(origHeight-scrollTop);if(lastScrollTop!=null)diff=Math.abs(lastScrollTop-scrollTop);lastScrollTop=scrollTop;if(scrollTop>=settings.limit){node.css('overflow-y','');if(diff<100)
return;else
scrollTop=settings.limit;}
settings.onResize.call(this);settings.animate&&textarea.css('display')==='block'&&diff>settings.minAnim?toChange.stop().animate({height:scrollTop},settings.animateDuration,settings.animateCallback):toChange.height(scrollTop);},onFocus=function(){$(this).addClass('focus').trigger('change');},onBlur=function(){$(this).removeClass('focus').trigger('change');};textarea.unbind('.dynSiz').bind('keyup.dynSiz',updateSize).bind('keydown.dynSiz',updateSize).bind('focus.dynSiz',onFocus).bind('blur.dynSiz',onBlur).bind('change.dynSiz',updateSize);});return this;};})(jQuery);;;(function($){var $scrollTo=$.scrollTo=function(target,duration,settings){$(window).scrollTo(target,duration,settings);};$scrollTo.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};$scrollTo.window=function(scope){return $(window)._scrollable();};$.fn._scrollable=function(){return this.map(function(){var elem=this,isWin=!elem.nodeName||$.inArray(elem.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)
return elem;var doc=(elem.contentWindow||elem).document||elem.ownerDocument||elem;return $.browser.safari||doc.compatMode=='BackCompat'?doc.body:doc.documentElement;});};$.fn.scrollTo=function(target,duration,settings){if(typeof duration=='object'){settings=duration;duration=0;}
if(typeof settings=='function')
settings={onAfter:settings};if(target=='max')
target=9e9;settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.speed||settings.duration;settings.queue=settings.queue&&settings.axis.length>1;if(settings.queue)
duration/=2;settings.offset=both(settings.offset);settings.over=both(settings.over);return this._scrollable().each(function(){var elem=this,$elem=$(elem),targ=target,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break;}
targ=$(targ,this);case'object':if(targ.is||targ.style)
toff=(targ=$(targ)).offset();}
$.each(settings.axis.split(''),function(i,axis){var Pos=axis=='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,old=elem[key],max=$scrollTo.max(elem,axis);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(targ.css('margin'+Pos))||0;attr[key]-=parseInt(targ.css('border'+Pos+'Width'))||0;}
attr[key]+=settings.offset[pos]||0;if(settings.over[pos])
attr[key]+=targ[axis=='x'?'width':'height']()*settings.over[pos];}else{var val=targ[pos];attr[key]=val.slice&&val.slice(-1)=='%'?parseFloat(val)/100*max:val;}
if(/^\d+$/.test(attr[key]))
attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&settings.queue){if(old!=attr[key])
animate(settings.onAfterFirst);delete attr[key];}});animate(settings.onAfter);function animate(callback){$elem.animate(attr,duration,settings.easing,callback&&function(){callback.call(this,target,settings);});};}).end();};$scrollTo.max=function(elem,axis){var Dim=axis=='x'?'Width':'Height',scroll='scroll'+Dim;if(!$(elem).is('html,body'))
return elem[scroll]-$(elem)[Dim.toLowerCase()]();var size='client'+Dim,html=elem.ownerDocument.documentElement,body=elem.ownerDocument.body;return Math.max(html[scroll],body[scroll])
-Math.min(html[size],body[size]);};function both(val){return typeof val=='object'?val:{top:val,left:val};};})(jQuery);;(function(window,$){'use strict';var Wall=$.createClass(Object,{bucky:window.Bucky('Wall'),constructor:function(element,settings){var self=this;if(Wall.initialized){return;}
this.bucky.timer.start('constructor');Wall.initialized=true;this.wall=$(element);this.settings=$.extend(true,{},Wall.settings,settings);this.deletedMessages={};this.isMonobook=window.skin&&window.skin==='monobook';this.hasMiniEditor=typeof window.wgEnableMiniEditorExt!=='undefined'&&!this.isMonobook;this.title=window.wgTitle;this.page={title:this.title,namespace:window.wgNamespaceNumber};this.WallTooltipMeta=$('#WallTooltipMeta');this.model=new Wall.BackendBridge();if(this.settings.pageController){this.model.pageController=this.settings.pageController;}
$.each(this.settings.classBindings,this.proxy(function(localName,ClassToBind){this[localName]=new ClassToBind(this.page,this.model);}));this.pagination.on('afterPageLoaded',this.proxy(this.afterPagination));this.newMessageForm.on('afterNewMessagePost',this.proxy(this.afterNewMessagePost));this.wall.on('click','.admin-delete-message',this.proxy(this.confirmAction)).on('click','.fast-admin-delete-message',this.proxy(this.confirmAction)).on('click','.delete-message',this.proxy(this.confirmAction)).on('click','.remove-message',this.proxy(this.confirmAction)).on('click','.message-restore',this.proxy(this.confirmAction)).on('click','.message-undo-remove',this.proxy(this.undoRemoveOrAdminDelete)).on('click','.follow',this.proxy(this.switchWatch)).on('keydown','textarea',this.proxy(this.focusButton)).on('click','.edit-notifyeveryone',this.proxy(this.editNotifyEveryone)).on('click','.close-thread',this.proxy(this.confirmAction)).on('click','.reopen-thread',this.proxy(this.doThreadChange)).on('click','.votes',this.proxy(this.showVotersModal)).on('click','.vote',this.proxy(this.vote)).on('click','.quote-button',this.proxy(this.quote)).on('click','.quote-of',this.proxy(this.scrollToQuoted)).on('mouseenter','.follow',this.proxy(this.hoverFollow)).on('mouseleave','.follow',this.proxy(this.unhoverFollow)).on('click','.load-more a',this.proxy(this.loadMore)).on('click','.related-topics .edit-topic-link',this.proxy(this.handleEditTopics)).on('click','.move-thread',this.proxy(this.moveThread)).find('textarea').removeAttr('disabled');$('#WikiaArticle').bind('afterWatching',this.proxy(this.onWallWatch)).bind('afterUnwatching',this.proxy(this.onWallUnwatch));this.setUpVoteTooltips();$('#ForumNewMessage .highlight').popover({content:function(){return self.WallTooltipMeta.find('.tooltip-highlight-thread').clone();},placement:'top'});$('.timeago').timeago();$(document).ready(this.initTextareas);$(window).bind('hashchange',this.proxy(this.onHashChange)).trigger('hashchange');this.bucky.timer.stop('constructor');},setUpVoteTooltips:function(){var self=this,votesLink,votingControls=$('.voting-controls');votingControls.find('.vote').popover({content:function(){var $this=$(this);if($this.hasClass('voted')||$this.hasClass('inprogress')){return self.WallTooltipMeta.find('.tooltip-votes-voted').clone();}
return self.WallTooltipMeta.find('.tooltip-votes-vote').clone();},placement:'top'});votesLink=votingControls.find('.votes');if(!votesLink.hasClass('notlink')){this.enableVotesLink(votesLink);}},enableVotesLink:function(votesLink){var self=this;votesLink.popover({content:function(){return self.WallTooltipMeta.find('.tooltip-votes-voterlist').clone();},placement:'top'});},disableVotesLink:function(votesLink){votesLink.popover('destroy');},onHashChange:function(){if(window.location.hash){var number=parseInt(window.location.hash.substr(1));$('li.message-'+number).removeClass('hide').addClass('show');}},onWallWatch:function(){$('.SpeechBubble .follow').fadeOut();},onWallUnwatch:function(){$('.SpeechBubble .follow').fadeIn();},focusButton:function(e){var $element,$button;if(e.keyCode===9&&!e.shiftKey){$element=$(e.target);$button=$element.closest('.SpeechBubble').find('button#WallMessageSubmit, .save-edit, .replyButton').first();if($element.attr('id')!=='WallMessageTitle'&&!$element.hasClass('title')){$button.focus();e.preventDefault();}}},afterPagination:function(){var wall=$('#Wall');wall.find('.timeago').timeago();wall.find('textarea, input').placeholder();if(!this.hasMiniEditor){wall.find('.new-reply textarea').autoResize(this.replyMessageForm.settings.reply);}
if(!this.isMonobook){window.WikiaButtons.init(wall);}},afterNewMessagePost:function(newmsg){newmsg.find('.timeago').timeago();newmsg.find('textarea, input').placeholder();if(!this.hasMiniEditor){newmsg.find('.new-reply textarea').autoResize(this.replyMessageForm.settings.reply);}},initTextareas:function(){setTimeout(function(){var title,body;$('.new-reply textarea').each(function(){var el=$(this);if(el.is(':focus')){el.trigger('focus');}});title=$('#WallMessageTitle');if(title.is(':focus')){title.trigger('focus');}
body=$('#WallMessageBody');if(body.is(':focus')){body.trigger('focus');}},50);},scrollToQuoted:function(e){var postfix,main,el,p;if($('.Wall.Thread').length!==0){return true;}
e.preventDefault();postfix=$(e.target).data('postfix');main=$(e.target).closest('.message-main');if(postfix>1){el=$('.message-'+postfix,main);}else{el=main;}
if(!el.is(':visible')){main.find('li.SpeechBubble').show();$('.load-more',main).remove();}
p=el.offset();window.scrollTo(0,p.top);},switchWatch:function(e){var element=$(e.target),isWatched=parseInt(element.attr('data-iswatched')),commentId=element.closest('[data-id]').attr('data-id');element.animate({'opacity':0.5},'slow');this.model.switchWatch(element,isWatched,commentId,this.proxy(this.afterSwitchWatch));},afterSwitchWatch:function(element,data){var isWatched=parseInt(element.attr('data-iswatched'));if(data.status){element.attr('data-iswatched',isWatched?0:1);if(isWatched){element.animate({'opacity':0.7},'slow',function(){element.css('opacity','');});element.text($.msg('oasis-follow')).addClass('secondary').removeClass('following');}else{element.animate({'opacity':0.7},'slow',function(){element.css('opacity','');});element.text($.msg('wikiafollowedpages-following')).removeClass('secondary').addClass('following');}}},hoverFollow:function(e){var target=$(e.target);if(target.html()===$.msg('wikiafollowedpages-following')){target.html($.msg('wall-message-unfollow'));}},unhoverFollow:function(e){var target=$(e.target);if(target.html()===$.msg('wall-message-unfollow')){target.html($.msg('wikiafollowedpages-following'));}},loadMore:function(e){var $target,commentId;e.preventDefault();$target=$(e.target);$target.closest('ul').find('li.SpeechBubble').show();$target.closest('.load-more').remove();commentId=$target.closest('li.message').attr('data-id');$.nirvana.sendRequest({controller:'WallNotificationsExternalController',method:'markAsRead',format:'json',type:'POST',data:{id:commentId}});},vote:function(e){e.preventDefault();if(!window.wgUserName){require(['AuthModal'],function(authModal){authModal.load({forceLogin:true,url:'/signin?redirect='+encodeURIComponent(window.location.href),origin:'wall-and-forum',onAuthSuccess:this.proxy(function(){this.voteBase(e,function(){window.location.reload();});})});}.bind(this));}else{this.voteBase(e,this.proxy(function(target,data,dir){var votes=target.closest('li.message').find('.votes:first'),number=votes.find('.number:first'),val=dir+parseInt(number.text());number.html(val);votes.data('votes',val);if(val>0){votes.removeClass('notlink');this.enableVotesLink(votes);}else{votes.addClass('notlink');this.disableVotesLink(votes);}
target.toggleClass('voted').removeClass('inprogress');}));}},voteBase:function(e,callback){var $target=$(e.target).closest('a'),id=$target.closest('li.message').attr('data-id'),dir=$target.hasClass('voted')?-1:1;if($target.hasClass('inprogress')){return true;}
$target.addClass('inprogress');$.nirvana.sendRequest({controller:'WallExternalController',method:'vote',format:'json',type:'POST',data:{dir:dir,id:id},callback:function(data){callback($target,data,dir);}});},showVotersModal:function(e){var $target=$(e.target),id=$target.closest('li.message').data('id'),votes=parseInt($target.closest('.votes').data('votes'),10);if(votes>0){$.nirvana.sendRequest({controller:'WallExternalController',method:'votersModal',format:'html',data:{id:id},callback:function(data){require(['wikia.ui.factory'],function(uiFactory){uiFactory.init(['modal']).then(function(uiModal){var votersModalConfig={vars:{id:'WallVotersModalWrapper',size:'small',content:data,title:$.msg('wall-votes-modal-title')}};uiModal.createComponent(votersModalConfig,function(votersModal){votersModal.show();});});});}});$.getResources([$.getSassCommonURL('/extensions/wikia/Wall/css/WallVoters.scss')]);}},undoRemoveOrAdminDelete:function(e){var $target=$(e.target),id=$target.attr('data-id');$.nirvana.sendRequest({controller:'WallExternalController',method:'undoAction',type:'POST',data:{msgid:id},callback:this.proxy(function(){var msg=$target.closest('li');msg.fadeOut('fast',this.proxy(function(){if(this.deletedMessages[id]){msg.remove();this.deletedMessages[id].fadeIn('slow');}}));})});},doRestore:function(id,target,formdata){$.nirvana.sendRequest({controller:'WallExternalController',method:'restoreMessage',type:'POST',data:{msgid:id,formdata:formdata},callback:this.proxy(function(){window.location.reload();})});},confirmAction:function(e){e.preventDefault();var $target=$(e.target),isreply=$target.closest('.SpeechBubble').attr('data-is-reply'),wallMsg=$target.closest('li.message, .message-restore'),id=wallMsg.attr('data-id'),type=isreply?'reply':'thread',mode=$target.attr('data-mode').split('-'),submode='',formdata={},msg,title,cancelmsg,okmsg,form=$('<form>'),self=this;if(mode[1]){submode=mode[1];}
mode=mode[0];if(submode==='fast'||mode==='fastadmin'){this.doAction(id,mode,wallMsg,$target,formdata);return true;}
title=$.msg('wall-action-'+mode+'-'+type+'-title');okmsg=$.msg('wall-action-'+mode+'-confirm-ok');cancelmsg=$.msg('wall-action-all-confirm-cancel');msg=$.msg('wall-action-'+mode+'-confirm');form.append($('<textarea>').attr({'class':'wall-action-reason','name':'reason','id':'reason'}));if(mode!=='restore'){form.append($('<div>').text($.msg('wall-action-'+mode+'-'+type+'-confirm-info')).addClass('subtle'));if(mode==='admin'||mode==='remove'){form.append($('<input>').attr({'name':'notify-admin','id':'notify-admin','type':'checkbox'}));form.append($('<label for="notify-admin">').text($.msg('wall-action-all-confirm-notify')));}}
msg+='<form>'+form.html()+'</form>';if(mode==='rev'){if(isreply){msg=$.msg('wall-action-rev-reply-confirm');}else{msg=$.msg('wall-action-rev-thread-confirm');}}
require(['wikia.ui.factory'],function(uiFactory){uiFactory.init(['modal']).then(function(uiModal){var modalPrimaryBtnId='WikiaConfirmOk',confirmModalConfig={vars:{id:'WikiaConfirm',size:'medium',content:msg,title:title,buttons:[{vars:{id:modalPrimaryBtnId,value:okmsg,classes:['normal','primary'],disabled:(mode!=='rev'),data:[{key:'event',value:modalPrimaryBtnId}]}},{vars:{value:cancelmsg,data:[{key:'event',value:'close'}]}}]}};uiModal.createComponent(confirmModalConfig,function(confirmModal){confirmModal.bind('WikiaConfirmOk',function(){var formdata=confirmModal.$element.find('form').serializeArray();confirmModal.deactivate();self.doAction(id,mode,wallMsg,$target,formdata,confirmModal);});confirmModal.$element.find('textarea.wall-action-reason').bind('keydown keyup change',function(e){var $target=$(e.target);if($target.val().length>0){confirmModal.$element.find('#'+modalPrimaryBtnId).removeAttr('disabled');}else{confirmModal.$element.find('#'+modalPrimaryBtnId).attr('disabled','disabled');}});confirmModal.show();});});});},doAction:function(id,mode,msg,target,formdata,modal){switch(mode){case'close':this.doThreadChangeSendRequest(id,'close',formdata);break;case'restore':this.doRestore(id,target,formdata);break;default:this.doDelete(id,mode,msg,formdata,modal);break;}},doDelete:function(id,mode,msg,formdata,modal){$.nirvana.sendRequest({controller:'WallExternalController',method:'deleteMessage',type:'POST',format:'json',data:{mode:mode,msgid:id,username:this.username,formdata:formdata},callback:this.proxy(function(data){if(data.status){if(data.html){this.deletedMessages[id]=msg;msg.fadeOut('fast',this.proxy(function(){$(data.html).hide().insertBefore(msg).fadeIn('fast');}));}else{msg.fadeOut('fast',function(){msg.remove();});}
if(typeof(modal)!=='undefined'){modal.trigger('close');}}})});},doThreadChangeSendRequest:function(id,newState,formdata){$.nirvana.sendRequest({controller:'WallExternalController',method:'changeThreadStatus',format:'json',type:'POST',data:{msgid:id,newState:newState,formdata:formdata},callback:this.proxy(function(json){if(json.status){if(typeof window.UserLoginAjaxForm==='function'){window.UserLoginAjaxForm.prototype.reloadPage();}else{window.location.reload();}}})});},doThreadChange:function(e){e.preventDefault();var $target=$(e.target),id=$target.closest('li.message').attr('data-id'),newState='';if($target.hasClass('reopen-thread')){newState='open';}else if($target.hasClass('close-thread')){newState='close';}
if(id&&newState){this.doThreadChangeSendRequest(id,newState,{});}},editNotifyEveryone:function(e){var $element=$(e.target),wallMsg,id;e.preventDefault();if($element.attr('data-inprogress')){return true;}
wallMsg=$element.closest('li.message');id=wallMsg.attr('data-id');$element.animate({'opacity':0.5},'slow');$element.attr('data-inprogress',true);this.model.notifyEveryone(wallMsg.attr('data-id'),$element.attr('data-dir'),function(){window.location.reload();});},quote:function(e){e.preventDefault();var replyForm=this.replyMessageForm,message=$(e.target).closest('.message'),reply=message.find(replyForm.replyWrapper),quotedFrom=message.data('id'),formTarget,$editorPromise,$editorDeferred,$deferredQuote,$quotePromise;if(reply.length===0){reply=message.parent().find(replyForm.replyWrapper);}
formTarget=reply.find(replyForm.replyBody);$('body').scrollTo(reply,{duration:600});if(typeof replyForm.initEditor==='function'){$editorPromise=replyForm.initEditor({target:formTarget});}else{$editorDeferred=$.Deferred();$editorPromise=$editorDeferred.promise();$editorDeferred.resolve('');}
$deferredQuote=$.Deferred();$quotePromise=$deferredQuote.promise();$.nirvana.sendRequest({controller:'WallExternalController',method:'getFormattedQuoteText',format:'json',data:{messageId:message.data('id'),convertToFormat:replyForm.editor&&replyForm.editor.data('wikiaEditor')?window.WikiaEditor.modeToFormat(replyForm.editor.data('wikiaEditor').mode):'wikitext'},callback:function(data){$deferredQuote.resolve(data);}});$.when($editorPromise,$quotePromise).done(function(){var data=arguments[1];if(data.status==='success'){replyForm.setContent(reply,data.markup);}});reply.data('quotedFrom',quotedFrom);},handleEditTopics:function(e){e.preventDefault();var rootMessageId=$(e.target).closest('.message').data('id');if(window.wgDisableAnonymousEditing&&!window.wgUserName){require(['AuthModal'],function(authModal){authModal.load({forceLogin:true,url:'/signin?redirect='+encodeURIComponent(window.location.href),origin:'wall-and-forum',onAuthSuccess:this.proxy(function(){this.editTopics(rootMessageId);})});}.bind(this));}else{this.editTopics(rootMessageId);}},editTopics:function(rootMessageId){var relatedTopics=$('.related-topics'),messageTopicEditSection=$('.message-topic-edit'),messageTopicSection=messageTopicEditSection.find('.message-topic'),topics=[],model=this.model,messageTopic;relatedTopics.hide();messageTopicEditSection.show();relatedTopics.find('.related-topic').each(function(){topics.push($(this).data('topic'));});messageTopic=messageTopicSection.data('messageTopic');if(messageTopic){messageTopic.resetSelections(topics);}else{messageTopic=messageTopicSection.messageTopic({'topics':topics}).data('messageTopic');messageTopicEditSection.on('click.MessageTopic','.save-button',function(){var buttons=messageTopicEditSection.find('button'),topics=messageTopic.getTopics();buttons.attr('disabled',true);model.updateTopics(rootMessageId,topics,function(json){buttons.attr('disabled',false);relatedTopics.find('.related-topic').remove();relatedTopics.prepend($('#RelatedTopicTemplate').mustache({topics:json.topics}));relatedTopics.show();messageTopicEditSection.hide();});}).on('click.MessageTopic','.cancel-button',function(){relatedTopics.show();messageTopicEditSection.hide();});}
messageTopic.input.focus();},moveThread:function(e){e.preventDefault();var id=$(e.target).closest('.message').data('id');$.nirvana.sendRequest({controller:'WallExternalController',method:'moveModal',format:'html',type:'POST',data:{id:id},callback:function(html){require(['wikia.ui.factory'],function(uiFactory){uiFactory.init(['modal']).then(function(uiModal){var moveThreadModalConfig={vars:{id:'WallMoveModalWrapper',size:'small',content:html,title:$.msg('wall-action-move-thread-heading'),buttons:[{vars:{classes:['normal','primary'],value:$.msg('wall-action-move-thread-ok'),data:[{key:'event',value:'submit'}]}},{vars:{value:$.msg('cancel'),data:[{key:'event',value:'close'}]}}]}};uiModal.createComponent(moveThreadModalConfig,function(moveThreadModal){var form=new window.WikiaForm(moveThreadModal.$content.find('.WikiaForm'));moveThreadModal.bind('submit',function(event){event.preventDefault();moveThreadModal.deactivate();$.nirvana.sendRequest({controller:'WallExternalController',method:'moveThread',format:'json',type:'POST',data:{destinationBoardId:moveThreadModal.$content.find('.destinationBoardId option:selected').val(),rootMessageId:id},callback:function(json){if(json.status==='ok'){Wikia.Querystring().addCb().goTo();}else if(json.status==='error'){form.clearAllInputErrors();if(json.errorfield){form.showInputError(json.errorfield,json.errormsg);}else{form.showGenericError(json.errormsg);}
moveThreadModal.activate();}}});});moveThreadModal.show();});});});}});},proxy:function(func){return $.proxy(func,this);}});Wall.settings={classBindings:{}};$.fn.wikiaWall=function(settings){return this.each(function(){$(this).data('Wall',new Wall(this,settings)).triggerHandler('WallInit',[this]);});};window.Wall=Wall;})(window,jQuery);;(function($){Wall.Pagination=$.createClass(Observable,{constructor:function(page,model){Wall.Pagination.superclass.constructor.apply(this,arguments);this.page=page;this.model=model;this.$wall=$('#Wall');this.$page=this.$wall.find('.comments, .ThreadList');this.$wall.on('click','.Pagination a',this.proxy(this.switchPage));this.model.pageController=this.$wall.find('.Pagination').attr('data-controller')||this.model.pageController;this.model.bind('pageLoaded',this.proxy(this.onPageLoaded));},switchPage:function(e){var page=$(e.target).closest('li').attr('data-page');this.$page.animate({opacity:0.5},'slow');this.model.loadPage(this.page,page);e.preventDefault();},onPageLoaded:function(page,pagination){this.scrollUp();this.$page.html(page.html()).animate({opacity:1},'slow');this.$wall.find('.Pagination').html(pagination.html());this.fire('afterPageLoaded');},scrollUp:function(){var destination=this.$wall.offset().top-15;if($.browser.msie){$(document).scrollTop(destination);}else{$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination},500);}}});Wall.settings.classBindings.pagination=Wall.Pagination;})(jQuery);;(function($){'use strict';Wall.BackendBridge=$.createClass(Observable,{pageController:'WallExternalController',bucky:window.Bucky('Wall.BackendBridge'),loadPage:function(page,pagenumber,callback){this.bucky.timer.start('loadPage');$.nirvana.sendRequest({controller:this.pageController,method:'getCommentsPage',format:'json',data:{page:pagenumber,pagetitle:page.title,pagenamespace:page.namespace},callback:this.proxy(function(data){var html=data.html,page=$('.comments, .ThreadList',html),pagination=$('.Pagination',html);if($.isFunction(callback)){callback(page,pagination);}
this.fire('pageLoaded',page,pagination);this.bucky.timer.stop('loadPage');})});},postNew:function(page,title,body,convertToFormat,notifyEveryone,relatedTopics,successCallback,failCallback){this.bucky.timer.start('postNew');$.nirvana.sendRequest({controller:this.pageController,method:'postNewMessage',type:'POST',data:{body:body,messagetitle:title,notifyeveryone:notifyEveryone,pagetitle:page.title,pagenamespace:page.namespace,convertToFormat:convertToFormat,relatedTopics:relatedTopics,token:window.mw.user.tokens.get('editToken')}}).done(this.proxy(function(data){var newmsg=$(data.message);if($.isFunction(successCallback)){successCallback(newmsg);}
this.fire('newPosted',newmsg);})).fail(this.proxy(function(data){if($.isFunction(failCallback)){failCallback(data);}})).always(this.proxy(function(){this.bucky.timer.stop('postNew');}));},postReply:function(page,body,convertToFormat,parent,quotedFrom,successCallback,failCallback){this.bucky.timer.start('postReply');$.nirvana.sendRequest({controller:this.pageController,method:'replyToMessage',type:'POST',data:{body:body,parent:parent,pagetitle:page.title,pagenamespace:page.namespace,convertToFormat:convertToFormat,quotedFrom:quotedFrom||'',token:window.mw.user.tokens.get('editToken')}}).done(this.proxy(function(data){var newMessage=$(data.message);if($.isFunction(successCallback)){successCallback(newMessage);}
this.fire('postReply',newMessage);})).fail(this.proxy(function(data){if($.isFunction(failCallback)){failCallback(data);}})).always(this.proxy(function(){this.bucky.timer.stop('postReply');}));},loadEditData:function(page,id,mode,convertToFormat,callback){this.bucky.timer.start('loadEditData');this.fire('beforeEditDataLoad',id);$.nirvana.sendRequest({controller:this.pageController,method:'editMessage',format:'json',data:{msgid:id,pagetitle:page.title,pagenamespace:page.namespace,convertToFormat:convertToFormat},callback:this.proxy(function(data){if(data.status===false&&data.forcereload===true){var url=window.location.href;if(url.indexOf('#')>=0){url=url.substring(0,url.indexOf('#'));}
this.bucky.timer.stop('loadEditData');this.bucky.flush();window.location.href=url+'?reload='+Math.floor(Math.random()*999);return;}
data.mode=mode;data.id=id;if($.isFunction(callback)){callback(data);}
this.fire('editDataLoaded',data);this.bucky.timer.stop('loadEditData');})});},saveEdit:function(page,id,title,body,isreply,convertToFormat,successCallback,failCallback){this.bucky.timer.start('saveEdit');$.nirvana.sendRequest({controller:this.pageController,method:'editMessageSave',format:'json',type:'POST',data:{msgid:id,newtitle:title,newbody:body,isreply:isreply,pagetitle:page.title,pagenamespace:page.namespace,convertToFormat:convertToFormat,token:window.mw.user.tokens.get('editToken')}}).done(this.proxy(function(data){if($.isFunction(successCallback)){successCallback(data);}
this.fire('editSaved',data);})).fail(this.proxy(function(data){if($.isFunction(failCallback)){failCallback(data);}})).always(this.proxy(function(){this.bucky.timer.stop('saveEdit');}));},switchWatch:function(element,isWatched,commentId,callback){var buckyString='switchWatch.'+(isWatched?'unfollow':'follow');this.bucky.timer.start(buckyString);$.nirvana.sendRequest({controller:this.pageController,method:'switchWatch',format:'json',type:'POST',data:{isWatched:isWatched,commentId:commentId},callback:this.proxy(function(data){if($.isFunction(callback)){callback(element,data);}
this.fire('afterSwitchWatch',element,data);this.bucky.timer.stop(buckyString);})});},notifyEveryone:function(msgid,dir,callback){this.bucky.timer.start('notifyEveryone');$.nirvana.sendRequest({controller:this.pageController,method:'notifyEveryoneSave',format:'json',type:'POST',data:{msgid:msgid,dir:dir},callback:this.proxy(function(data){if($.isFunction(callback)){callback(data);}
this.fire('notifyEveryoneSaved',data);this.bucky.timer.stop('notifyEveryone');})});},updateTopics:function(msgid,relatedTopics,callback){this.bucky.timer.start('updateTopics');$.nirvana.sendRequest({controller:this.pageController,method:'updateTopics',format:'json',type:'POST',data:{msgid:msgid,relatedTopics:relatedTopics},callback:this.proxy(function(json){if($.isFunction(callback)){callback(json);}
this.bucky.timer.stop('updateTopics');})});}});})(jQuery);;(function(window,$){'use strict';Wall.MessageForm=$.createClass(Observable,{bucky:window.Bucky('Wall.MessageForm'),constructor:function(page,model){Wall.MessageForm.superclass.constructor.apply(this,arguments);this.model=model;this.page=page;this.wall=$('#Wall');},showPreviewModal:function(format,metatitle,body,width,publishCallback){var self=this;this.bucky.timer.start('showPreviewModal');require(['wikia.ui.factory'],function(uiFactory){uiFactory.init(['modal']).then(function(uiModal){var previewModalConfig={vars:{id:'WallPreviewModal',size:'medium',content:'<div class="WallPreview"><div class="WikiaArticle"></div></div>',title:$.msg('preview'),buttons:[{vars:{value:$.msg('savearticle'),classes:['normal','primary'],data:[{key:'event',value:'publish'}]}},{vars:{value:$.msg('back'),data:[{key:'event',value:'close'}]}}]}};uiModal.createComponent(previewModalConfig,function(previewModal){previewModal.bind('publish',function(){previewModal.trigger('close');publishCallback();});previewModal.show();previewModal.deactivate();$.nirvana.sendRequest({controller:'WallExternalController',method:'preview',format:'json',data:{convertToFormat:format,metatitle:metatitle,body:body},callback:function(data){var $content=previewModal.$content.find('.WallPreview .WikiaArticle');$content.html(data.body);mw.hook('wikipage.content').fire($content);previewModal.activate();self.bucky.timer.stop('showPreviewModal');}});});});});return false;},getMessageWidth:function(msg){return msg.find('.editarea').width();},loginBeforeSubmit:function(action){if(window.wgDisableAnonymousEditing&&!window.wgUserName){require(['AuthModal'],function(authModal){authModal.load({forceLogin:true,url:'/signin?redirect='+encodeURIComponent(window.location.href),origin:'wall-and-forum',onAuthSuccess:this.proxy(function(){action(false);return true;})});}.bind(this));}else{action(true);return true;}},reloadAfterLogin:function(){UserLoginAjaxForm.prototype.reloadPage();},getFormat:function(){return'';},proxy:function(func){return $.proxy(func,this);}});})(window,jQuery);;(function(window,$){'use strict';Wall.NewMessageForm=$.createClass(Wall.MessageForm,{constructor:function(){Wall.NewMessageForm.superclass.constructor.apply(this,arguments);this.initElements();this.model.bind('newPosted',this.proxy(this.afterPost));this.messageSubmit.bind('click',this.proxy(this.postNewMessage));this.messagePreview.bind('click',this.proxy(this.showPreview));this.initEvents();},initElements:function(){this.buttons=$('#WallMessageBodyButtons button');this.comments=$('#Wall').find('.comments');this.message=$('.new-message');this.loading=this.message.find('.loadingAjax');this.messageNoTitle=this.message.find('.no-title-warning');this.messageTitle=$('#WallMessageTitle');this.messageBody=$('#WallMessageBody');this.messageSubmit=$('#WallMessageSubmit');this.messagePreview=$('#WallMessagePreview');this.notifyEveryone=$('#NotifyEveryone');},initEvents:function(){var self=this;this.messageTitle.keydown(function(e){if(e.which===13){self.messageBody.focus();return false;}}).autoResize({min:30,minFocus:30,minContent:30,limit:300,limitEmpty:30,extraSpace:15});this.messageBody.keydown(function(e){if(e.which===9&&e.shiftKey){e.preventDefault();self.messageTitle.focus();return false;}}).autoResize({minFocus:100,minContent:100,limit:9999,limitEmpty:70,extraSpace:30});this.messageTitle.add(this.messageBody).keydown(this.proxy(this.postNewMessageChangeTextPre)).keyup(this.proxy(this.postNewMessageChangeTextPre)).change(this.proxy(this.postNewMessageChangeTextPre)).focus(this.proxy(this.postNewMessageFocus)).blur(this.proxy(this.postNewMessageBlur));},getTitle:function(){var msgTitleVal=$.trim(this.messageTitle.val()),title=!this.messageTitle.hasClass('placeholder')&&msgTitleVal.length>0;return title?this.messageTitle.val():'';},postNewMessage:function(){var title=this.getTitle();if(!title&&this.messageSubmit.html()!==$.msg('wall-button-to-submit-comment-no-topic')){this.messageSubmit.html($.msg('wall-button-to-submit-comment-no-topic'));this.messageNoTitle.fadeIn();this.messageTitle.addClass('no-title');return;}
this.loginBeforeSubmit(this.proxy(function(isAlreadyLogged){this.doPostNewMessage(title);this.reload=!isAlreadyLogged;}));},getMessageBody:function(){return $.trim(this.messageBody.val());},showPreview:function(){this.showPreviewModal(this.getFormat(),this.getTitle(),this.getMessageBody(),this.getMessageWidth(this.message),this.proxy(function(){this.postNewMessage();}));},doPostNewMessage:function(title){var topics=this.messageTopic?this.messageTopic.data('messageTopic').getTopics():[];this.buttons.attr('disabled',true);this.model.postNew(this.page,title?this.messageTitle.val():'',this.getMessageBody(),this.getFormat(),this.notifyEveryone.is(':checked')?'1':'0',topics,this.proxy(function(){this.disableNewMessage();this.clearNewMessageTitle();}),this.proxy(function(){$.showModal($.msg('wall-posting-message-failed-title'),$.msg('wall-posting-message-failed-body'));this.buttons.removeAttr('disabled');}.bind(this)));},clearNewMessageBody:function(){this.messageBody.val('').trigger('blur');},clearNewMessageTitle:function(){this.messageTitle.val('').trigger('blur');},afterPost:function(newmsg){newmsg.hide();this.clearNewMessageBody();this.enableNewMessage();mw.hook('wikipage.content').fire(newmsg);this.comments.prepend(newmsg);if($.browser.msie){newmsg.show();}else{newmsg.css('opacity',0).slideDown('slow').animate({opacity:1},'slow');}
newmsg.find('.msg-body').show();if(window.skin&&window.skin!=='monobook'){WikiaButtons.init(newmsg);}
this.fire('afterNewMessagePost',newmsg);if(this.reload){this.reloadAfterLogin();}},postNewMessageChangeTextPre:function(e){var target=$(e.target),title;if(target.hasClass('title')){title=target.val();if(title.length>=200){target.val(title.slice(0,200));}}
setTimeout(this.proxy(this.postNewMessageChangeText),50);},postNewMessageChangeText:function(){var topicStr=$.trim(this.messageTitle.val()),topic=!this.messageTitle.hasClass('placeholder')&&topicStr.length>0;this.handleNewMessageTextChangeContent();if(topic&&this.messageSubmit.html()===$.msg('wall-button-to-submit-comment-no-topic')){this.messageSubmit.html($.msg('wall-button-to-submit-comment'));this.messageNoTitle.fadeOut('fast');this.messageTitle.removeClass('no-title');}},handleNewMessageTextChangeContent:function(){var content=this.canSubmit();if(content){this.messageSubmit.removeAttr('disabled');this.messagePreview.removeAttr('disabled');}else{this.messageSubmit.attr('disabled','disabled');this.messagePreview.attr('disabled','disabled');}},canSubmit:function(){var message=this.getMessageBody();return!this.messageBody.hasClass('placeholder')&&message.length>0;},postNewMessageFocus:function(e){this.buttons.show();if($(e.target).hasClass('body')){this.messageBody.css('font-size','13px');}},postNewMessageBlur:function(){var content=this.canSubmit(),title=this.messageTitle.val();if(title.length>0){this.messageTitle.val($.trim(title));}
if(!content){this.buttons.hide();this.messageSubmit.attr('disabled','disabled');this.messageBody.css('font-size','14px');}},disableNewMessage:function(){this.messageSubmit.add(this.messageBody).attr('disabled','disabled');this.message.addClass('loading');this.loading.show();},enableNewMessage:function(){this.messageSubmit.add(this.messageBody).removeAttr('disabled');this.messageSubmit.html($.msg('wall-button-to-submit-comment'));this.messageTitle.removeClass('no-title');this.messageNoTitle.fadeOut('fast');this.message.removeClass('loading');this.loading.hide();}});Wall.settings.classBindings.newMessageForm=Wall.NewMessageForm;})(window,jQuery);;(function(window,$){Wall.EditMessageForm=$.createClass(Wall.MessageForm,{oldHTML:{},constructor:function(page){Wall.EditMessageForm.superclass.constructor.apply(this,arguments);var $wall=$('#Wall');$wall.on('click','.source-message',this.proxy(this.viewSource));$wall.on('click','.edit-message',this.proxy(this.editMessage));$wall.on('click','.edit-buttons .cancel-edit',this.proxy(this.cancelEdit));$wall.on('click','.edit-buttons .preview',this.proxy(this.showPreview));$wall.on('click','.edit-buttons .save-edit',this.proxy(this.saveEdit));},initEditForm:function(msg,data,mode){if(mode!='source'){$('.msg-title',msg).first().html('<textarea class="title">'+$('.msg-title a',msg).html()+'</textarea>');this.showEditTextArea(msg,data.htmlorwikitext);}else{this.showSourceTextArea(msg,data.htmlorwikitext);$('.edit-buttons.sourceview',msg).first().show();}
msg.find('.buttonswrapper').hide();$('.follow',msg).hide();$('textarea.title',msg).first().keydown(function(e){if(e.which==13){return false;}}).autoResize({min:30,minFocus:30,minContent:30,limit:300,limitEmpty:30,extraSpace:0}).trigger('change');},editMessage:function(e){e.preventDefault();this.editOrSource(e,'edit');},viewSource:function(e){e.preventDefault();this.editOrSource(e,'source');},editOrSource:function(e,mode){var msg=$(e.target).closest('li.message');var id=msg.attr('data-id');var isreply=msg.attr('data-is-reply');var bubble=$('.speech-bubble-message',msg).first();var format=mode=='source'?'':this.getEditFormat(msg);msg.find('.wikia-menu-button').removeClass("active");this.model.loadEditData(this.page,id,mode,format,this.proxy(function(data){this.setOldHTML(id,bubble);this.initEditForm(msg,data,mode);}));},showEditTextArea:function(msg,text){$('.edit-buttons.edit',msg).first().show();$('.msg-body',msg).first().html('<textarea class="body">'+text+'</textarea>');$('textarea.body',msg).first().focus().autoResize({minFocus:100,minContent:100,limit:9999,limitEmpty:70,extraSpace:30}).trigger('change');},showSourceTextArea:function(msg,text){var sourceTextarea=$('<textarea readonly="readonly" class="body">'+text+'</textarea>');$('.msg-body',msg).first().html("").append(sourceTextarea);sourceTextarea.autoResize({minFocus:100,minContent:100,limit:9999,limitEmpty:70,extraSpace:30}).trigger('change');},cancelEdit:function(e){e.preventDefault();var target=$(e.target),isSource=target.hasClass('cancel-source'),msg=target.closest('li.message'),bubble=msg.children('.speech-bubble-message'),id=msg.attr('data-id'),body=msg.find('.msg-body').first();this.insertOldHTML(id,bubble);msg.find('.buttonswrapper').show();if(window.skin&&window.skin!="monobook"){WikiaButtons.init(bubble);}
this.afterCancel(body,isSource,target,bubble);},getNewBody:function(container){return $('.msg-body textarea.body',container).val();},getNewTitle:function(container){return $('.msg-title textarea.title',container).val();},getEditFormat:function(){return this.getFormat();},getSaveFormat:function(){return this.getFormat();},showPreview:function(e){var msg=$(e.target).closest('li.message');this.showPreviewModal(this.getSaveFormat(msg),this.getNewTitle(msg),this.getNewBody(msg),this.getMessageWidth(msg),this.proxy(function(){this.saveEdit(e);}));},saveEdit:function(e){var target=$(e.target);var buttons=target.parent().children('.wikia-button');var msg=target.closest('li.message');var id=msg.attr('data-id');var isreply=msg.attr('data-is-reply');var newtitle=this.getNewTitle(msg);var newbody=this.getNewBody(msg);var format=this.getSaveFormat(msg);buttons.attr('disabled',true);this.model.saveEdit(this.page,id,newtitle,newbody,isreply,format,this.proxy(function(data){var $bubble,$body,$timestamp,$editor;$bubble=$('.speech-bubble-message',msg).first();this.resetHTMLAfterEdit(id,$bubble);$('.msg-title',msg).first().html(data.msgTitle);$body=$('.msg-body',msg).first().html(data.body);mw.hook('wikipage.content').fire($body);$timestamp=$bubble.find('.timestamp');$editor=$timestamp.find('.username');if($editor.exists()){$timestamp.find('.username').html(data.username).attr('href',data.userUrl);}else{$timestamp.prepend($($.msg('wall-message-edited',data.userUrl,data.username,data.historyUrl)));}
$timestamp.find('.timeago').attr('title',data.isotime).timeago();$timestamp.find('.timeago-fmt').html(data.fulltime);if(window.skin&&window.skin!="monobook"){WikiaButtons.init(msg);}
buttons.removeAttr('disabled');msg.find('.buttonswrapper').show();}),this.proxy(function(){buttons.removeAttr('disabled');$.showModal($.msg('wall-posting-message-failed-title'),$.msg('wall-posting-message-failed-body'));}));},resetHTMLAfterEdit:function(id,bubble){this.insertOldHTML(id,bubble);},setOldHTML:function(id,bubble){this.oldHTML[id]=bubble.html();},insertOldHTML:function(id,bubble){bubble.html(this.oldHTML[id]);},afterCancel:function(){},afterEdit:function(){}});Wall.settings.classBindings.editMessageForm=Wall.EditMessageForm;})(window,jQuery);;(function($){Wall.ReplyMessageForm=$.createClass(Wall.MessageForm,{constructor:function(page,model){Wall.ReplyMessageForm.superclass.constructor.apply(this,arguments);this.settings={reply:{minFocus:100,minContent:100,limit:9999,limitEmpty:30,extraSpace:30}};this.initElements();this.initEvents();this.model.bind('pageLoaded',this.proxy(function(page,data){this.initEvents(page);}));},initElements:function(){this.replyWrapper='.new-reply';this.replyButton='.replyButton';this.replyBody='.replyBody';this.replyBodyContent='.replyBody.content';this.replyThread='.comments > .SpeechBubble';this.replyPreviewButton='.previewButton';this.replyThreadFollow='.follow';this.replyThreadMessages='ul .message';this.replyThreadCount='ul .load-more .count';this.mainContent='body';},initEvents:function(){$(this.mainContent).on('click',this.replyPreviewButton,this.proxy(this.showPreview)).on('click',this.replyButton,this.proxy(this.replyToMessage)).on('keydown keyup change',this.replyBody,this.proxy(this.change)).on('focus',this.replyBody,this.proxy(this.focus)).on('blur',this.replyBody,this.proxy(this.blur)).find(this.replyBody).autoResize(this.settings.reply);},focus:function(e){var textarea=$(e.target);var reply=textarea.closest(this.replyWrapper);reply.addClass('open');},setContent:function(replyWrapper,content){if(content){replyWrapper.find(this.replyBody).val(content).addClass('content').putCursorAtEnd();this.enable(replyWrapper);}},change:function(e){var target=$(e.target),hasContent=target.val()!='';var wraper=target.closest(this.replyWrapper);if(hasContent&&!target.hasClass('placeholder')&&!target.hasClass('content')){target.addClass('content');wraper.find(this.replyButton).removeAttr('disabled');wraper.find(this.replyPreviewButton).removeAttr('disabled');}else if(!hasContent){target.removeClass('content');wraper.find(this.replyButton).attr('disabled',true);wraper.find(this.replyPreviewButton).attr('disabled',true);}},blur:function(e){var target=$(e.target);if(!target.hasClass('content')){target.closest(this.replyWrapper).removeClass('open');}},disable:function(replyWrapper){replyWrapper.addClass('loading');replyWrapper.find(this.replyBody).attr('disabled',true);replyWrapper.find(this.replyButton).attr('disabled',true);replyWrapper.find(this.replyPreviewButton).attr('disabled',true);},enable:function(replyWrapper){replyWrapper.removeClass('loading');replyWrapper.find(this.replyBody).removeAttr('disabled');replyWrapper.find(this.replyButton).removeAttr('disabled');replyWrapper.find(this.replyPreviewButton).removeAttr('disabled');},replyToMessage:function(e){var target=$(e.target),thread=target.closest(this.replyThread);reply=target.closest(this.replyWrapper);this.disable(reply);this.loginBeforeSubmit(this.proxy(function(isAlreadyLogged){this.doReplyToMessage(thread,reply,!isAlreadyLogged);}));},showPreview:function(e){var target=$(e.target),reply=target.closest(this.replyWrapper);this.showPreviewModal(this.getFormat(reply),'',this.getMessageBody(reply),this.getMessageWidth(reply),function(){reply.find('.replyButton').click();});},resetEditor:function(reply){reply.find(this.replyBody).val('').trigger('blur');},getMessageBody:function(reply){return reply.find(this.replyBodyContent).val();},doReplyToMessage:function(thread,reply,reload){this.model.postReply(this.page,this.getMessageBody(reply),this.getFormat(reply),thread.attr('data-id'),reply.data('quotedFrom'),this.proxy(function(newMessage){newMessage=$(newMessage);this.enable(reply);this.resetEditor(reply);mw.hook('wikipage.content').fire(newMessage);newMessage.insertBefore(reply).hide().fadeIn('slow').find('.timeago').timeago();if(window.skin&&window.skin!='monobook'){WikiaButtons.init(newMessage);}
thread.find(this.replyThreadCount).html(thread.find(this.replyThreadMessages).length);thread.find(this.replyThreadFollow).text($.msg('wikiafollowedpages-following')).removeClass('secondary');if(reload){this.reloadAfterLogin();}}),this.proxy(function(){this.enable(reply);$.showModal($.msg('wall-posting-message-failed-title'),$.msg('wall-posting-message-failed-body'));}));}});Wall.settings.classBindings.replyMessageForm=Wall.ReplyMessageForm;})(jQuery);;(function(window,$){Wall.SortingBar=$.createClass(Observable,{constructor:function(){this.initElements();this.sortingSelected.on('click',this.proxy(this.showSortingMenu));this.sortingList.on('mouseleave',this.proxy(this.hideSortingMenu));},initElements:function(){this.sortingOption=$('.SortingOption');this.sortingSelected=$('.SortingSelected');this.sortingList=$('.SortingList');},hideSortingMenu:function(event){this.sortingList.hide();},showSortingMenu:function(event){this.sortingList.show();var firstItemOffset=this.sortingList.find('li:first').offset().top,currentItemOffset=this.sortingList.find('.current').offset().top,newOffset=(currentItemOffset-firstItemOffset)*-1;this.sortingList.css('top',newOffset);}});Wall.settings.classBindings.sortingBar=Wall.SortingBar;})(window,jQuery);;jQuery(function($){$('#Wall').wikiaWall();});(function($)
{jQuery.fn.putCursorAtEnd=function()
{return this.each(function()
{$(this).focus()
if(this.setSelectionRange)
{var len=$(this).val().length*2;this.setSelectionRange(len,len);}
else
{$(this).val($(this).val());}
this.scrollTop=999999;});};jQuery.fn.putCursorAtEndCE=function()
{return this.each(function()
{var range,selection;if(document.createRange)
{range=document.createRange();range.selectNodeContents(this);range.collapse(false);selection=window.getSelection();selection.removeAllRanges();selection.addRange(range);}
else if(document.selection)
{range=document.body.createTextRange();range.moveToElementText(this);range.collapse(false);range.select();}});};})(jQuery);;