
(function($,window){var EditPageEditorLoader=$.createClass(Object,{element:false,constructor:function(){this.element=$('#EditPage');this.body=$('#wpTextbox1');},getToolbarsConfig:function(){var data={main:!!window.wgEditPageIsWidePage,rte:typeof window.RTE!='undefined',wide:false,readOnly:window.wgEditPageIsReadOnly};data.wide=data.rte&&data.main;window.WikiaEditor.fire('wikiaeditorspacesbeforelayout',this.element,data);var layout={tabs:[],toolbar:[],rail:[]};if(data.rte){layout.tabs.push('ModeSwitch');}
layout.toolbar.push('ToolbarMediawiki');if(data.rte){layout.toolbar.push('Format');layout.toolbar.push('FormatExpanded');}
if(data.wide){layout.toolbar.push('ToolbarWidescreen');}else if(data.readOnly){layout.rail.push('RailLicense');}else{layout.rail.push('RailInsert','RailCategories','RailTemplates','RailLicense');}
window.WikiaEditor.fire('wikiaeditorspaceslayout',this.element,layout,data);if(layout.rail.length>0){layout.rail=[{cls:'rail-auto-height',items:layout.rail}];}
return layout;},isFormatExpanded:function(){var ns=window.wgNamespaceNumber;return(ns%2==1)||(ns==110);},getData:function(){var rte=typeof window.RTE!='undefined',mode='source';if(rte){mode=window.RTEInitMode||'wysiwyg';}
var plugins=['wikiacore',rte?'ckeditorsuite':'mweditorsuite'];var config={body:this.body,element:this.element,toolbars:this.getToolbarsConfig(),toolbarTypes:{rail:'railcontainer'},spaces:{tabs:$('#EditPageTabs')},formatExpanded:this.isFormatExpanded(),uiElements:window.wgEditorExtraButtons||{},popularTemplates:window.wgEditPagePopularTemplates||[],autoResizeMode:(window.wgEditPageIsConflict||window.wgEditPageFormType=='diff')?'editpage':'editarea',categorySelectEnabled:(typeof window.wgCategorySelect!='undefined'),wideInSourceInitial:window.wgEditPageWideSourceMode,wideInSourceDisabled:window.wgEditPageHasEditPermissionError,isWidePage:!!window.wgEditPageIsWidePage,extraPageWidth:(window.sassParams&&window.sassParams.hd)?200:0,mode:mode};return{plugins:plugins,config:config};},initWikiaEditor:function(){var data=this.getData();window.WikiaEditor.create(data.plugins,data.config);$(window).bind('UserLoginSubmit',window.WikiaEditor.storeContent);},initAceEditor:function(){require(['wikia.editpage.ace.editor'],function(aceEditor){aceEditor.init();});},launchInfoboxPreview:function(){var editorValue=window.wgEnableCodePageEditor?ace.edit('editarea').getValue():WikiaEditor.getInstance().getContent(),wikiaDomain=mw.config.get('wgServer').split('://')[1],templateName=(new mw.Title(mw.config.get('wgPageName'))).getMain(),infoboxPreviewURL=mw.config.get('wgInfoboxPreviewURL');$('<form>').attr({'action':infoboxPreviewURL,'method':'POST','target':'_blank'}).append($('<textarea>').val(editorValue).attr({'name':'editor_value'}),$('<input>').val(wikiaDomain).attr({'name':'wikia_domain'}),$('<input>').val(templateName).attr({'name':'template_name'})).submit();},init:function(){$('.InfoboxPreview').click(this.launchInfoboxPreview);if(window.wgEnableCodePageEditor){this.initAceEditor();}else{this.initWikiaEditor();}}});$(function(){if(!window.WikiaAutostartDisabled){var editor=new EditPageEditorLoader();editor.init();}});})(jQuery,this);;define('wikia.preview',['wikia.window','wikia.nirvana','jquery','wikia.loader','wikia.mustache','JSMessages','wikia.tracker','wikia.csspropshelper','wikia.breakpointsLayout'],function(window,nirvana,$,loader,mustache,msg,tracker,cssPropHelper,breakpointsLayout){'use strict';var $article,$previewTypeDropdown=$(),previewTemplate,isWidePage=false,articleWrapperWidth,FIT_SMALL_SCREEN=80,previewTypes,currentTypeName,editPageOptions,previewLoaded;function renderDialog(title,options,callback){options=$.extend({callback:function(){var $editPageDialog=$('#EditPageDialog'),$contentNode=$editPageDialog.find('.ArticlePreviewInner'),modalHeight=options.height||$(window).height()-250,modalHeightModifier=0;$contentNode.startThrobbing();$contentNode.on('click',function(ev){var target=$(ev.target);target.closest('a').not('[href^="#"]').attr('target','_blank');}).closest('.ArticlePreview').css({'height':modalHeight,'overflow':'auto','overflow-x':'hidden'});if(typeof callback==='function'){callback($contentNode);}},id:'EditPageDialog',width:680},options);var content='<div class="ArticlePreview"><div class="ArticlePreviewInner"></div></div>';$.showCustomModal(title,content,options);}
function handleDesktopPreview(data){$article.html(data.html+data.catbox+data.interlanglinks);}
function loadPreview(type,opening){if(!opening){$previewTypeDropdown.attr('disabled',true);$article.html('');$article.parent().startThrobbing();}
editPageOptions.getPreviewContent(function(data){previewLoaded=true;$previewTypeDropdown.attr('disabled',false);$article.parent().stopThrobbing();if(type!==previewTypes.mobile.name){handleDesktopPreview(data);}
if(window.wgOasisResponsive||window.wgOasisBreakpoints){if(opening){previewTypes.mobile.value=$article.width();articleWrapperWidth=$article.parent().width()-editPageOptions.scrollbarWidth;}
if(currentTypeName){var articleWidth=breakpointsLayout.getArticleWidth(currentTypeName,isWidePage);$article.width(articleWidth);}}
if(opening){$article.find('.editsection').each(function(){var $this=$(this);$this.appendTo($this.next());});if(data){addEditSummary($article,editPageOptions.width,data.summary);}
$(window).trigger('EditPageAfterRenderPreview',[$article]);mw.hook('wikipage.content').fire($article);}},previewTypes[currentTypeName].skin);}
function handlePreviewDropdown(template){var $dialog=$('#EditPageDialog'),dialog=$dialog[0],tooltipParams={placement:'right'},params={options:[{value:previewTypes.current.name,name:$.htmlentities(msg('wikia-editor-preview-current-width'))},{value:previewTypes.min.name,name:$.htmlentities(msg('wikia-editor-preview-min-width'))},{value:previewTypes.max.name,name:$.htmlentities(msg('wikia-editor-preview-max-width'))},{value:previewTypes.mobile.name,name:$.htmlentities(msg('wikia-editor-preview-mobile-width'))}],toolTipMessage:$.htmlentities(msg('wikia-editor-preview-type-tooltip'))},html;html=mustache.render(template,params);$(html).insertAfter($dialog.find('h1:first'));$previewTypeDropdown=$('#previewTypeDropdown').on('change',function(event){switchPreview($(event.target).val());}).val(currentTypeName);if(previewLoaded){$previewTypeDropdown.attr('disabled',false);}
if(dialog&&dialog.style&&dialog.style.zIndex){tooltipParams['z-index']=parseInt(dialog.style.zIndex,10);}
$('.tooltip-icon').tooltip(tooltipParams);}
function renderPreview(options){editPageOptions=options;isWidePage=!!options.isWidePage;getPreviewTypes();if(typeof options.currentTypeName!=='undefined'){currentTypeName=options.currentTypeName;}
var dialogOptions={buttons:[{id:'close',message:$.htmlentities(msg('back')),handler:function(){$('#EditPageDialog').closeModal();$(window).trigger('EditPagePreviewClosed');}},{id:'publish',defaultButton:true,message:$.htmlentities(msg('savearticle')),handler:options.onPublishButton}],width:((isWidePage===false)||!window.wgOasisResponsive||!window.wgOasisBreakpoints)?options.width:options.width-FIT_SMALL_SCREEN,className:'preview',onClose:function(){previewLoaded=false;$(window).trigger('EditPagePreviewClosed');}};$(window).trigger('EditPageRenderPreview',[dialogOptions]);renderDialog($.htmlentities(msg('preview')),dialogOptions,function(contentNode){$article=contentNode;loadPreview(previewTypes[currentTypeName].name,true);if(window.wgOasisResponsive||window.wgOasisBreakpoints){scalePreview(previewTypes[currentTypeName].name);if(!previewTemplate){loader({type:loader.MULTI,resources:{mustache:'extensions/wikia/EditPreview/templates/preview_type_dropdown.mustache'}}).done(function(response){previewTemplate=response.mustache[0];handlePreviewDropdown(previewTemplate);});}else{handlePreviewDropdown(previewTemplate);}}});}
function addEditSummary(contentNode,width,summary){if(typeof summary!=='undefined'){var $editPagePreviewEditSummary=$('<div>',{id:'EditPagePreviewEditSummary'}),$articlePreview=contentNode.closest('.ArticlePreview'),articlePreviewWidth=$articlePreview.width(),$modalToolbar=$('.modalToolbar'),modalToolbarWidth=$modalToolbar.outerWidth(true);$editPagePreviewEditSummary.width(articlePreviewWidth-modalToolbarWidth).html(summary);$modalToolbar.before($editPagePreviewEditSummary);}}
function switchPreview(type){var lastTypeName=currentTypeName;currentTypeName=type;if(type===previewTypes.mobile.name||lastTypeName===previewTypes.mobile.name){loadPreview(previewTypes[currentTypeName].name);}
$article.width(previewTypes[currentTypeName].value);scalePreview(currentTypeName);$article.toggleClass('large-typography',type==='max'&&!$article.hasClass('large-typography'));tracker.track({action:Wikia.Tracker.ACTIONS.CLICK,category:'edit-preview',label:'preview-type-changed',trackingMethod:'analytics',value:type});}
function scalePreview(type){var selectedPreviewWidth=previewTypes[type].value,scaleRatio=articleWrapperWidth/selectedPreviewWidth,cssTransform=cssPropHelper.getSupportedProp('transform'),cssTransformOrigin=cssPropHelper.getSupportedProp('transform-origin'),scaleVar='scale('+scaleRatio+')';setClassesForWidePage(type,$article);if(selectedPreviewWidth>articleWrapperWidth){$article.css(cssTransformOrigin,'left top');$article.css(cssTransform,scaleVar);}else{$article.css(cssTransform,'');}
$article.hide();$article.height();$article.show();}
function setClassesForWidePage(type,$article){var dataSize;switch(type){case'min':dataSize='min';break;case'max':dataSize='max';break;default:dataSize='';}
$article.attr('data-size',dataSize);}
function getPreviewTypes(){if(!previewTypes){previewTypes={current:{name:'current',value:breakpointsLayout.getArticleWidth('current',isWidePage)},min:{name:'min',value:breakpointsLayout.getArticleWidth('min',isWidePage)},max:{name:'max',value:breakpointsLayout.getArticleWidth('max',isWidePage)},mobile:{name:'mobile',skin:'wikiamobile',type:'full',value:null}};}
if(!currentTypeName){currentTypeName=previewTypes.current.name;}
return previewTypes;}
return{renderPreview:renderPreview,renderDialog:renderDialog};});;define('editpage.event.preview',['editpage.event.helper','jquery','wikia.window','wikia.querystring'],function(helper,$,window,qs){'use strict';function onPreview(ev,editor){ev.preventDefault();renderPreview({},'current');if(editor){editor.track('preview-desktop');}}
function onPreviewMobile(ev,editor){ev.preventDefault();renderPreview({},'mobile');if(editor){editor.track('preview-mobile');}}
function renderPreview(extraData,type){var isWebkit=navigator.userAgent.toLowerCase().indexOf(' applewebkit/')>-1,isWidePage=!!window.wgEditPageIsWidePage,isGridLayout=$('.WikiaGrid').length>0,extraPageWidth=(window.sassParams&&window.sassParams.hd)?200:0,scrollbarWidth=helper.getScrollbarWidth();require(['wikia.fluidlayout'],function(fluidlayout){var previewPadding=22,articleWidth=660,width=articleWidth+(isGridLayout?30:0),railBreakPoint=fluidlayout.getBreakpointSmall();if(isWidePage){width+=320+(isGridLayout?20:0);}
if(extraPageWidth){width+=extraPageWidth;}
if(window.wgOasisResponsive||window.wgOasisBreakpoints){var pageWidth=$('#WikiaPage').width(),widthArticlePadding=fluidlayout.getWidthGutter(),railWidth=fluidlayout.getRightRailWidth()+fluidlayout.getWidthPadding(),minWidth=fluidlayout.getMinArticleWidth();if(pageWidth<=minWidth){pageWidth=minWidth;}
width=(isWidePage||pageWidth<=railBreakPoint)?pageWidth:pageWidth-railWidth;width-=widthArticlePadding;if(isWebkit&&pageWidth>=1370||pageWidth<=railBreakPoint){width-=scrollbarWidth;}}
width+=previewPadding;width+=scrollbarWidth;var previewOptions={width:width,scrollbarWidth:scrollbarWidth,onPublishButton:function(){$('#wpSave').click();},getPreviewContent:function(callback,skin){$.when(helper.getContent()).done(function(content,mode){preparePreviewContent(content,mode,extraData,callback,skin);});}};if(pageWidth<=railBreakPoint&&(window.wgOasisResponsive||window.wgOasisBreakpoints)){previewOptions.isRailDropped=true;}
previewOptions.isWidePage=isWidePage;previewOptions.currentTypeName=type;require(['wikia.preview'],function(preview){preview.renderPreview(previewOptions);});});}
function preparePreviewContent(content,mode,extraData,callback,skin){var categories=helper.getCategories();if(window.wgEditPageSection==='new'){content='== '+getSummary()+' ==\n\n'+content;}else{extraData.summary=getSummary();}
extraData.content=content;if(window.wgEditPageSection!==null){extraData.section=window.wgEditPageSection;}
if(categories.length){extraData.categories=categories.val();}
if(skin==='wikiamobile'){var previewFrame=new helper.IFrameForm(qs(window.wgEditPreviewMercuryUrl).addCb());previewFrame.addParameter('title',window.wgEditedTitle);previewFrame.addParameter(mode==='wysiwyg'?'CKmarkup':'wikitext',content);previewFrame.send($('.ArticlePreviewInner'),function(data){callback(data);});}else{helper.ajax('preview',extraData,function(data){callback(data);},skin);}}
function getSummary(){var summary=$('#wpSummary').val();if(summary===$('#wpSummary').attr('placeholder')){summary='';}
return summary;}
return{onPreview:onPreview,onPreviewMobile:onPreviewMobile};});;define('editpage.event.diff',['editpage.event.helper','wikia.window','jquery'],function(helper,win,$){'use strict';function onDiff(ev,editor){ev.preventDefault();$(ev.target).focus();renderChanges();if(editor){editor.track('diff');}}
function renderChanges(){require(['wikia.ui.factory'],function(uiFactory){uiFactory.init(['modal']).then(function(uiModal){var previewModalConfig={vars:{id:'EditPageDialog',title:$.htmlentities($.msg('editpagelayout-pageControls-changes')),content:'<div class="ArticlePreview modalContent"><div class="ArticlePreviewInner">'+'</div></div>',size:'large'}};uiModal.createComponent(previewModalConfig,function(previewModal){previewModal.deactivate();previewModal.$content.on('click',function(event){var target=$(event.target);target.closest('a').not('[href^="#"]').attr('target','_blank');});$.when(helper.getContent()).done(function(content,mode){prepareDiffContent(previewModal,content);previewModal.show();});});});});}
function prepareDiffContent(previewModal,content){var section=$.getUrlVar('section')||0,categories=helper.getCategories(),extraData={content:content,section:parseInt(section,10)};if(categories.length){extraData.categories=categories.val();}
$.when(helper.ajax('diff',extraData),win.mw.loader.using('mediawiki.action.history.diff')).done(function(ajaxData){var data=ajaxData[0],html='<h1 class="pagetitle">'+win.wgEditedTitle+'</h1>'+data.html;previewModal.$content.find('.ArticlePreview .ArticlePreviewInner').html(html);previewModal.activate();});}
return{onDiff:onDiff};});;define('editpage.event.helper',['wikia.window'],function(window,ace){'use strict';function getContent(){var dfd=new $.Deferred(),editor=typeof RTE=='object'?RTE.getInstance():false,mode=editor?editor.mode:'mw',content='';if(window.wgEnableCodePageEditor){require(['wikia.ace.editor'],function(ace){content=ace.getContent();dfd.resolve(content,mode);});}else{switch(mode){case'mw':content=$('#wpTextbox1').val();break;case'source':case'wysiwyg':content=editor.getData();break;}
dfd.resolve(content,mode);}
return dfd.promise();}
function ajax(method,params,callback,skin){var editor=typeof RTE=='object'?RTE.getInstance():false;params=$.extend({page:window.wgEditPageClass?window.wgEditPageClass:'',method:method,mode:editor.mode},params);var url=window.wgEditPageHandler.replace('$1',encodeURIComponent(window.wgEditedTitle));if(skin){url+='&type=full&skin='+encodeURIComponent(skin);}
return $.post(url,params,function(data){if(typeof callback=='function'){callback(data);}},'json');}
function getScrollbarWidth(){var inner=document.createElement('p'),outer=document.createElement('div'),w1,w2;inner.style.width='100%';inner.style.height='100px';outer.style.position='absolute';outer.style.top='0px';outer.style.left='0px';outer.style.visibility='hidden';outer.style.width='100px';outer.style.height='100px';outer.style.overflow='hidden';outer.appendChild(inner);document.body.appendChild(outer);w1=inner.offsetWidth;outer.style.overflow='scroll';w2=inner.offsetWidth;if(w1===w2){w2=outer.clientWidth;}
document.body.removeChild(outer);return(w1-w2);}
function getCategories(){return $('#categories');}
function IFrameForm(url){if(!this instanceof IFrameForm){return new IFrameForm(url);}
this.time=new Date().getTime();this.form=$('<form></form>').attr('action',url).attr('style','display:none').attr('target','iframe'+this.time).attr('method','post').attr('id','form'+this.time).attr('name','form'+this.time);this.iframe=$('<iframe></iframe>').attr('data-time',this.time).attr('id','iframe'+this.time).attr('name','iframe'+this.time);this.iframeWrapper=$('<div></div>').attr('class','mobile-preview');this.addParameter=function(parameter,value){$('<input type=\'hidden\' />').attr('name',parameter).attr('value',value).appendTo(this.form);};this.send=function(frameRoot,callback){var $frameRoot=$(frameRoot);this.iframeWrapper.append(this.iframe);$frameRoot.append(this.iframeWrapper).append(this.form);this.iframe.load((function(){$('#form'+this.time).remove();callback();}).bind(this));this.form.submit();};}
return{ajax:ajax,getCategories:getCategories,getContent:getContent,getScrollbarWidth:getScrollbarWidth,IFrameForm:IFrameForm};});;define('editpage.events',['editpage.event.preview','editpage.event.diff','jquery'],function(preview,diff,$){'use strict';function attachDiff(id,editor){$('#'+id).on('click',function(e){diff.onDiff(e,editor);});}
function attachDesktopPreview(id,editor){var $editPage=$('#EditPage'),$previewButton=$('#'+id);$previewButton.on('click',function(e){preview.onPreview(e,editor);}).popover({placement:'top',content:$.htmlentities($.msg('editpagelayout-preview-label-desktop')),trigger:'manual'}).on('mouseenter',function(){if($editPage.hasClass('mode-source')&&$editPage.hasClass('editpage-sourcewidemode-on')){$(this).popover('show');}}).on('mouseleave',function(){$(this).popover('hide');});if($.browser.msie){$(window).on('keydown',function(e){if(e.altKey&&String.fromCharCode(e.keyCode)===$previewButton.attr('accesskey').toUpperCase()){$previewButton.click();}});}}
function attachMobilePreview(id,editor){var $editPage=$('#EditPage');$('#'+id).on('click',function(e){preview.onPreviewMobile(e,editor);}).popover({placement:'top',content:$.htmlentities($.msg('editpagelayout-preview-label-mobile')),trigger:'manual'}).on('mouseenter',function(){if($editPage.hasClass('mode-source')&&$editPage.hasClass('editpage-sourcewidemode-on')){$(this).popover('show');}}).on('mouseleave',function(){$(this).popover('hide');});}
return{attachDiff:attachDiff,attachDesktopPreview:attachDesktopPreview,attachMobilePreview:attachMobilePreview};});;(function($,undefined){$.ui=$.ui||{};if($.ui.version){return;}
$.extend($.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});$.fn.extend({propAttr:$.fn.prop||$.fn.attr,_focus:$.fn.focus,focus:function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem);}},delay);}):this._focus.apply(this,arguments);},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}
return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex);}
if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value;}}
elem=elem.parent();}}
return 0;},disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault();});},enableSelection:function(){return this.unbind(".ui-disableSelection");}});if(!$("<a>").outerWidth(1).jquery){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.curCSS(elem,"padding"+this,true))||0;if(border){size-=parseFloat($.curCSS(elem,"border"+this+"Width",true))||0;}
if(margin){size-=parseFloat($.curCSS(elem,"margin"+this,true))||0;}});return size;}
$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this);}
return this.each(function(){$(this).css(type,reduce(this,size)+"px");});};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size);}
return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px");});};});}
function focusable(element,isTabIndexNotNaN){var nodeName=element.nodeName.toLowerCase();if("area"===nodeName){var map=element.parentNode,mapName=map.name,img;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false;}
img=$("img[usemap=#"+mapName+"]")[0];return!!img&&visible(img);}
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"==nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&visible(element);}
function visible(element){return!$(element).parents().andSelf().filter(function(){return $.curCSS(this,"visibility")==="hidden"||$.expr.filters.hidden(this);}).length;}
$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName);};}):function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")));},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN);}});$(function(){var body=document.body,div=body.appendChild(div=document.createElement("div"));div.offsetHeight;$.extend(div.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});$.support.minHeight=div.offsetHeight===100;$.support.selectstart="onselectstart"in div;body.removeChild(div).style.display="none";});if(!$.curCSS){$.curCSS=$.css;}
$.extend($.ui,{plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css("overflow")==="hidden"){return false;}
var scroll=(a&&a==="left")?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true;}
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);}});})(jQuery);;(function($,undefined){if($.cleanData){var _cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){try{$(elem).triggerHandler("remove");}catch(e){}}
_cleanData(elems);};}else{var _remove=$.fn.remove;$.fn.remove=function(selector,keepData){return this.each(function(){if(!keepData){if(!selector||$.filter(selector,[this]).length){$("*",this).add([this]).each(function(){try{$(this).triggerHandler("remove");}catch(e){}});}}
return _remove.call($(this),selector,keepData);});};}
$.widget=function(name,base,prototype){var namespace=name.split(".")[0],fullName;name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget;}
$.expr[":"][fullName]=function(elem){return!!$.data(elem,name);};$[namespace]=$[namespace]||{};$[namespace][name]=function(options,element){if(arguments.length){this._createWidget(options,element);}};var basePrototype=new base();basePrototype.options=$.extend(true,{},basePrototype.options);$[namespace][name].prototype=$.extend(true,basePrototype,{namespace:namespace,widgetName:name,widgetEventPrefix:$[namespace][name].prototype.widgetEventPrefix||name,widgetBaseClass:fullName},prototype);$.widget.bridge(name,$[namespace][name]);};$.widget.bridge=function(name,object){$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;if(isMethodCall&&options.charAt(0)==="_"){return returnValue;}
if(isMethodCall){this.each(function(){var instance=$.data(this,name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false;}});}else{this.each(function(){var instance=$.data(this,name);if(instance){instance.option(options||{})._init();}else{$.data(this,name,new object(options,this));}});}
return returnValue;};};$.Widget=function(options,element){if(arguments.length){this._createWidget(options,element);}};$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(options,element){$.data(element,this.widgetName,this);this.element=$(element);this.options=$.extend(true,{},this.options,this._getCreateOptions(),options);var self=this;this.element.bind("remove."+this.widgetName,function(){self.destroy();});this._create();this._trigger("create");this._init();},_getCreateOptions:function(){return $.metadata&&$.metadata.get(this.element[0])[this.widgetName];},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled");},widget:function(){return this.element;},option:function(key,value){var options=key;if(arguments.length===0){return $.extend({},this.options);}
if(typeof key==="string"){if(value===undefined){return this.options[key];}
options={};options[key]=value;}
this._setOptions(options);return this;},_setOptions:function(options){var self=this;$.each(options,function(key,value){self._setOption(key,value);});return this;},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget()
[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",value);}
return this;},enable:function(){return this._setOption("disabled",false);},disable:function(){return this._setOption("disabled",true);},_trigger:function(type,event,data){var prop,orig,callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();event.target=this.element[0];orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop];}}}
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};})(jQuery);;(function($,undefined){$.ui=$.ui||{};var horizontalPositions=/left|center|right/,verticalPositions=/top|center|bottom/,center="center",support={},_position=$.fn.position,_offset=$.fn.offset;$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments);}
options=$.extend({},options);var target=$(options.of),targetElem=target[0],collision=(options.collision||"flip").split(" "),offset=options.offset?options.offset.split(" "):[0,0],targetWidth,targetHeight,basePosition;if(targetElem.nodeType===9){targetWidth=target.width();targetHeight=target.height();basePosition={top:0,left:0};}else if(targetElem.setTimeout){targetWidth=target.width();targetHeight=target.height();basePosition={top:target.scrollTop(),left:target.scrollLeft()};}else if(targetElem.preventDefault){options.at="left top";targetWidth=targetHeight=0;basePosition={top:options.of.pageY,left:options.of.pageX};}else{targetWidth=target.outerWidth();targetHeight=target.outerHeight();basePosition=target.offset();}
$.each(["my","at"],function(){var pos=(options[this]||"").split(" ");if(pos.length===1){pos=horizontalPositions.test(pos[0])?pos.concat([center]):verticalPositions.test(pos[0])?[center].concat(pos):[center,center];}
pos[0]=horizontalPositions.test(pos[0])?pos[0]:center;pos[1]=verticalPositions.test(pos[1])?pos[1]:center;options[this]=pos;});if(collision.length===1){collision[1]=collision[0];}
offset[0]=parseInt(offset[0],10)||0;if(offset.length===1){offset[1]=offset[0];}
offset[1]=parseInt(offset[1],10)||0;if(options.at[0]==="right"){basePosition.left+=targetWidth;}else if(options.at[0]===center){basePosition.left+=targetWidth/2;}
if(options.at[1]==="bottom"){basePosition.top+=targetHeight;}else if(options.at[1]===center){basePosition.top+=targetHeight/2;}
basePosition.left+=offset[0];basePosition.top+=offset[1];return this.each(function(){var elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseInt($.curCSS(this,"marginLeft",true))||0,marginTop=parseInt($.curCSS(this,"marginTop",true))||0,collisionWidth=elemWidth+marginLeft+
(parseInt($.curCSS(this,"marginRight",true))||0),collisionHeight=elemHeight+marginTop+
(parseInt($.curCSS(this,"marginBottom",true))||0),position=$.extend({},basePosition),collisionPosition;if(options.my[0]==="right"){position.left-=elemWidth;}else if(options.my[0]===center){position.left-=elemWidth/2;}
if(options.my[1]==="bottom"){position.top-=elemHeight;}else if(options.my[1]===center){position.top-=elemHeight/2;}
if(!support.fractions){position.left=Math.round(position.left);position.top=Math.round(position.top);}
collisionPosition={left:position.left-marginLeft,top:position.top-marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:offset,my:options.my,at:options.at});}});if($.fn.bgiframe){elem.bgiframe();}
elem.offset($.extend(position,{using:options.using}));});};$.ui.position={fit:{left:function(position,data){var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft();position.left=over>0?position.left-over:Math.max(position.left-data.collisionPosition.left,position.left);},top:function(position,data){var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(position.top-data.collisionPosition.top,position.top);}},flip:{left:function(position,data){if(data.at[0]===center){return;}
var win=$(window),over=data.collisionPosition.left+data.collisionWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:-data.targetWidth,offset=-2*data.offset[0];position.left+=data.collisionPosition.left<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0;},top:function(position,data){if(data.at[1]===center){return;}
var win=$(window),over=data.collisionPosition.top+data.collisionHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=data.collisionPosition.top<0?myOffset+atOffset+offset:over>0?myOffset+atOffset+offset:0;}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative";}
var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if('using'in options){options.using.call(elem,props);}else{curElem.css(props);}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null;}
if(options){return this.each(function(){$.offset.setOffset(this,options);});}
return _offset.call(this);};}
(function(){var body=document.getElementsByTagName("body")[0],div=document.createElement("div"),testElement,testElementParent,testElementStyle,offset,offsetTotal;testElement=document.createElement(body?"div":"body");testElementStyle={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};if(body){jQuery.extend(testElementStyle,{position:"absolute",left:"-1000px",top:"-1000px"});}
for(var i in testElementStyle){testElement.style[i]=testElementStyle[i];}
testElement.appendChild(div);testElementParent=body||document.documentElement;testElementParent.insertBefore(testElement,testElementParent.firstChild);div.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";offset=$(div).offset(function(_,offset){return offset;}).offset();testElement.innerHTML="";testElementParent.removeChild(testElement);offsetTotal=offset.top+offset.left+(body?2000:0);support.fractions=offsetTotal>21&&offsetTotal<22;})();}(jQuery));;(function($,undefined){var requestIndex=0;$.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var self=this,doc=this.element[0].ownerDocument,suppressKeyPress;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(event){if(self.options.disabled||self.element.propAttr("readOnly")){return;}
suppressKeyPress=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:self._move("previousPage",event);break;case keyCode.PAGE_DOWN:self._move("nextPage",event);break;case keyCode.UP:self._move("previous",event);event.preventDefault();break;case keyCode.DOWN:self._move("next",event);event.preventDefault();break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:if(self.menu.active){suppressKeyPress=true;event.preventDefault();}
case keyCode.TAB:if(!self.menu.active){return;}
self.menu.select(event);break;case keyCode.ESCAPE:self.element.val(self.term);self.close(event);break;default:clearTimeout(self.searching);self.searching=setTimeout(function(){if(self.term!=self.element.val()){self.selectedItem=null;self.search(null,event);}},self.options.delay);break;}}).bind("keypress.autocomplete",function(event){if(suppressKeyPress){suppressKeyPress=false;event.preventDefault();}}).bind("focus.autocomplete",function(){if(self.options.disabled){return;}
self.selectedItem=null;self.previous=self.element.val();}).bind("blur.autocomplete",function(event){if(self.options.disabled){return;}
clearTimeout(self.searching);self.closing=setTimeout(function(){self.close(event);self._change(event);},150);});this._initSource();this.response=function(){return self._response.apply(self,arguments);};this.menu=$("<ul></ul>").addClass("ui-autocomplete").appendTo($(this.options.appendTo||"body",doc)[0]).mousedown(function(event){var menuElement=self.menu.element[0];if(!$(event.target).closest(".ui-menu-item").length){setTimeout(function(){$(document).one('mousedown',function(event){if(event.target!==self.element[0]&&event.target!==menuElement&&!$.ui.contains(menuElement,event.target)){self.close();}});},1);}
setTimeout(function(){clearTimeout(self.closing);},13);}).menu({focus:function(event,ui){var item=ui.item.data("item.autocomplete");if(false!==self._trigger("focus",event,{item:item})){if(/^key/.test(event.originalEvent.type)){self.element.val(item.value);}}},selected:function(event,ui){var item=ui.item.data("item.autocomplete"),previous=self.previous;if(self.element[0]!==doc.activeElement){self.element.focus();self.previous=previous;setTimeout(function(){self.previous=previous;self.selectedItem=item;},1);}
if(false!==self._trigger("select",event,{item:item})){self.element.val(item.value);}
self.term=self.element.val();self.close(event);self.selectedItem=item;},blur:function(event,ui){if(self.menu.element.is(":visible")&&(self.element.val()!==self.term)){self.element.val(self.term);}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if($.fn.bgiframe){this.menu.element.bgiframe();}
self.beforeunloadHandler=function(){self.element.removeAttr("autocomplete");};$(window).bind("beforeunload",self.beforeunloadHandler);},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();$(window).unbind("beforeunload",this.beforeunloadHandler);$.Widget.prototype.destroy.call(this);},_setOption:function(key,value){$.Widget.prototype._setOption.apply(this,arguments);if(key==="source"){this._initSource();}
if(key==="appendTo"){this.menu.element.appendTo($(value||"body",this.element[0].ownerDocument)[0])}
if(key==="disabled"&&value&&this.xhr){this.xhr.abort();}},_initSource:function(){var self=this,array,url;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term));};}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(self.xhr){self.xhr.abort();}
self.xhr=$.ajax({url:url,data:request,dataType:"json",autocompleteRequest:++requestIndex,success:function(data,status){if(this.autocompleteRequest===requestIndex){response(data);}},error:function(){if(this.autocompleteRequest===requestIndex){response([]);}}});};}else{this.source=this.options.source;}},search:function(value,event){value=value!=null?value:this.element.val();this.term=this.element.val();if(value.length<this.options.minLength){return this.close(event);}
clearTimeout(this.closing);if(this._trigger("search",event)===false){return;}
return this._search(value);},_search:function(value){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:value},this.response);},_response:function(content){if(!this.options.disabled&&content&&content.length){content=this._normalize(content);this._suggest(content);this._trigger("open");}else{this.close();}
this.pending--;if(!this.pending){this.element.removeClass("ui-autocomplete-loading");}},close:function(event){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",event);}},_change:function(event){if(this.previous!==this.element.val()){this._trigger("change",event,{item:this.selectedItem});}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items;}
return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item};}
return $.extend({label:item.label||item.value,value:item.value||item.label},item);});},_suggest:function(items){var ul=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(ul,items);this.menu.deactivate();this.menu.refresh();ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next(new $.Event("mouseover"));}},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth()+1,this.element.outerWidth()));},_renderMenu:function(ul,items){var self=this;$.each(items,function(index,item){self._renderItem(ul,item);});},_renderItem:function(ul,item){return $("<li></li>").data("item.autocomplete",item).append($("<a></a>").text(item.label)).appendTo(ul);},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return;}
if(this.menu.first()&&/^previous/.test(direction)||this.menu.last()&&/^next/.test(direction)){this.element.val(this.term);this.menu.deactivate();return;}
this.menu[direction](event);},widget:function(){return this.menu.element;}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value);});}});}(jQuery));(function($){$.widget("ui.menu",{_create:function(){var self=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(event){if(!$(event.target).closest(".ui-menu-item a").length){return;}
event.preventDefault();self.select(event);});this.refresh();},refresh:function(){var self=this;var items=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");items.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(event){self.activate(event,$(this).parent());}).mouseleave(function(){self.deactivate();});},activate:function(event,item){this.deactivate();if(this.hasScroll()){var offset=item.offset().top-this.element.offset().top,scroll=this.element.scrollTop(),elementHeight=this.element.height();if(offset<0){this.element.scrollTop(scroll+offset);}else if(offset>=elementHeight){this.element.scrollTop(scroll+offset-elementHeight+item.height());}}
this.active=item.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",event,{item:item});},deactivate:function(){if(!this.active){return;}
this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null;},next:function(event){this.move("next",".ui-menu-item:first",event);},previous:function(event){this.move("prev",".ui-menu-item:last",event);},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length;},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length;},move:function(direction,edge,event){if(!this.active){this.activate(event,this.element.children(edge));return;}
var next=this.active[direction+"All"](".ui-menu-item").eq(0);if(next.length){this.activate(event,next);}else{this.activate(event,this.element.children(edge));}},nextPage:function(event){if(this.hasScroll()){if(!this.active||this.last()){this.activate(event,this.element.children(".ui-menu-item:first"));return;}
var base=this.active.offset().top,height=this.element.height(),result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base-height+$(this).height();return close<10&&close>-10;});if(!result.length){result=this.element.children(".ui-menu-item:last");}
this.activate(event,result);}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"));}},previousPage:function(event){if(this.hasScroll()){if(!this.active||this.first()){this.activate(event,this.element.children(".ui-menu-item:last"));return;}
var base=this.active.offset().top,height=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var close=$(this).offset().top-base+height-$(this).height();return close<10&&close>-10;});if(!result.length){result=this.element.children(".ui-menu-item:first");}
this.activate(event,result);}else{this.activate(event,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"));}},hasScroll:function(){return this.element.height()<this.element[$.fn.prop?"prop":"attr"]("scrollHeight");},select:function(event){this._trigger("selected",event,{item:this.active});}});}(jQuery));;jQuery.md5=function(string){function RotateLeft(lValue,iShiftBits){return(lValue<<iShiftBits)|(lValue>>>(32-iShiftBits));}
function AddUnsigned(lX,lY){var lX4,lY4,lX8,lY8,lResult;lX8=(lX&0x80000000);lY8=(lY&0x80000000);lX4=(lX&0x40000000);lY4=(lY&0x40000000);lResult=(lX&0x3FFFFFFF)+(lY&0x3FFFFFFF);if(lX4&lY4){return(lResult^0x80000000^lX8^lY8);}
if(lX4|lY4){if(lResult&0x40000000){return(lResult^0xC0000000^lX8^lY8);}else{return(lResult^0x40000000^lX8^lY8);}}else{return(lResult^lX8^lY8);}}
function F(x,y,z){return(x&y)|((~x)&z);}
function G(x,y,z){return(x&z)|(y&(~z));}
function H(x,y,z){return(x^y^z);}
function I(x,y,z){return(y^(x|(~z)));}
function FF(a,b,c,d,x,s,ac){a=AddUnsigned(a,AddUnsigned(AddUnsigned(F(b,c,d),x),ac));return AddUnsigned(RotateLeft(a,s),b);};function GG(a,b,c,d,x,s,ac){a=AddUnsigned(a,AddUnsigned(AddUnsigned(G(b,c,d),x),ac));return AddUnsigned(RotateLeft(a,s),b);};function HH(a,b,c,d,x,s,ac){a=AddUnsigned(a,AddUnsigned(AddUnsigned(H(b,c,d),x),ac));return AddUnsigned(RotateLeft(a,s),b);};function II(a,b,c,d,x,s,ac){a=AddUnsigned(a,AddUnsigned(AddUnsigned(I(b,c,d),x),ac));return AddUnsigned(RotateLeft(a,s),b);};function ConvertToWordArray(string){var lWordCount;var lMessageLength=string.length;var lNumberOfWords_temp1=lMessageLength+8;var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1%64))/64;var lNumberOfWords=(lNumberOfWords_temp2+1)*16;var lWordArray=Array(lNumberOfWords-1);var lBytePosition=0;var lByteCount=0;while(lByteCount<lMessageLength){lWordCount=(lByteCount-(lByteCount%4))/4;lBytePosition=(lByteCount%4)*8;lWordArray[lWordCount]=(lWordArray[lWordCount]|(string.charCodeAt(lByteCount)<<lBytePosition));lByteCount++;}
lWordCount=(lByteCount-(lByteCount%4))/4;lBytePosition=(lByteCount%4)*8;lWordArray[lWordCount]=lWordArray[lWordCount]|(0x80<<lBytePosition);lWordArray[lNumberOfWords-2]=lMessageLength<<3;lWordArray[lNumberOfWords-1]=lMessageLength>>>29;return lWordArray;};function WordToHex(lValue){var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;for(lCount=0;lCount<=3;lCount++){lByte=(lValue>>>(lCount*8))&255;WordToHexValue_temp="0"+lByte.toString(16);WordToHexValue=WordToHexValue+WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);}
return WordToHexValue;};function Utf8Encode(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;};var x=Array();var k,AA,BB,CC,DD,a,b,c,d;var S11=7,S12=12,S13=17,S14=22;var S21=5,S22=9,S23=14,S24=20;var S31=4,S32=11,S33=16,S34=23;var S41=6,S42=10,S43=15,S44=21;string=Utf8Encode(string);x=ConvertToWordArray(string);a=0x67452301;b=0xEFCDAB89;c=0x98BADCFE;d=0x10325476;for(k=0;k<x.length;k+=16){AA=a;BB=b;CC=c;DD=d;a=FF(a,b,c,d,x[k+0],S11,0xD76AA478);d=FF(d,a,b,c,x[k+1],S12,0xE8C7B756);c=FF(c,d,a,b,x[k+2],S13,0x242070DB);b=FF(b,c,d,a,x[k+3],S14,0xC1BDCEEE);a=FF(a,b,c,d,x[k+4],S11,0xF57C0FAF);d=FF(d,a,b,c,x[k+5],S12,0x4787C62A);c=FF(c,d,a,b,x[k+6],S13,0xA8304613);b=FF(b,c,d,a,x[k+7],S14,0xFD469501);a=FF(a,b,c,d,x[k+8],S11,0x698098D8);d=FF(d,a,b,c,x[k+9],S12,0x8B44F7AF);c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);a=FF(a,b,c,d,x[k+12],S11,0x6B901122);d=FF(d,a,b,c,x[k+13],S12,0xFD987193);c=FF(c,d,a,b,x[k+14],S13,0xA679438E);b=FF(b,c,d,a,x[k+15],S14,0x49B40821);a=GG(a,b,c,d,x[k+1],S21,0xF61E2562);d=GG(d,a,b,c,x[k+6],S22,0xC040B340);c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);b=GG(b,c,d,a,x[k+0],S24,0xE9B6C7AA);a=GG(a,b,c,d,x[k+5],S21,0xD62F105D);d=GG(d,a,b,c,x[k+10],S22,0x2441453);c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);b=GG(b,c,d,a,x[k+4],S24,0xE7D3FBC8);a=GG(a,b,c,d,x[k+9],S21,0x21E1CDE6);d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);c=GG(c,d,a,b,x[k+3],S23,0xF4D50D87);b=GG(b,c,d,a,x[k+8],S24,0x455A14ED);a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);d=GG(d,a,b,c,x[k+2],S22,0xFCEFA3F8);c=GG(c,d,a,b,x[k+7],S23,0x676F02D9);b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);a=HH(a,b,c,d,x[k+5],S31,0xFFFA3942);d=HH(d,a,b,c,x[k+8],S32,0x8771F681);c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);a=HH(a,b,c,d,x[k+1],S31,0xA4BEEA44);d=HH(d,a,b,c,x[k+4],S32,0x4BDECFA9);c=HH(c,d,a,b,x[k+7],S33,0xF6BB4B60);b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);d=HH(d,a,b,c,x[k+0],S32,0xEAA127FA);c=HH(c,d,a,b,x[k+3],S33,0xD4EF3085);b=HH(b,c,d,a,x[k+6],S34,0x4881D05);a=HH(a,b,c,d,x[k+9],S31,0xD9D4D039);d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);b=HH(b,c,d,a,x[k+2],S34,0xC4AC5665);a=II(a,b,c,d,x[k+0],S41,0xF4292244);d=II(d,a,b,c,x[k+7],S42,0x432AFF97);c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);b=II(b,c,d,a,x[k+5],S44,0xFC93A039);a=II(a,b,c,d,x[k+12],S41,0x655B59C3);d=II(d,a,b,c,x[k+3],S42,0x8F0CCC92);c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);b=II(b,c,d,a,x[k+1],S44,0x85845DD1);a=II(a,b,c,d,x[k+8],S41,0x6FA87E4F);d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);c=II(c,d,a,b,x[k+6],S43,0xA3014314);b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);a=II(a,b,c,d,x[k+4],S41,0xF7537E82);d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);c=II(c,d,a,b,x[k+2],S43,0x2AD7D2BB);b=II(b,c,d,a,x[k+9],S44,0xEB86D391);a=AddUnsigned(a,AA);b=AddUnsigned(b,BB);c=AddUnsigned(c,CC);d=AddUnsigned(d,DD);}
var temp=WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);return temp.toLowerCase();};;var Mustache=(typeof module!=="undefined"&&module.exports)||{};(function(exports){exports.name="mustache.js";exports.version="0.5.0-dev";exports.tags=["{{","}}"];exports.parse=parse;exports.compile=compile;exports.render=render;exports.clearCache=clearCache;exports.to_html=function(template,view,partials,send){var result=render(template,view,partials);if(typeof send==="function"){send(result);}else{return result;}};var _toString=Object.prototype.toString;var _isArray=Array.isArray;var _forEach=Array.prototype.forEach;var _trim=String.prototype.trim;var isArray;if(_isArray){isArray=_isArray;}else{isArray=function(obj){return _toString.call(obj)==="[object Array]";};}
var forEach;if(_forEach){forEach=function(obj,callback,scope){return _forEach.call(obj,callback,scope);};}else{forEach=function(obj,callback,scope){for(var i=0,len=obj.length;i<len;++i){callback.call(scope,obj[i],i,obj);}};}
var spaceRe=/^\s*$/;function isWhitespace(string){return spaceRe.test(string);}
var trim;if(_trim){trim=function(string){return string==null?"":_trim.call(string);};}else{var trimLeft,trimRight;if(isWhitespace("\xA0")){trimLeft=/^\s+/;trimRight=/\s+$/;}else{trimLeft=/^[\s\xA0]+/;trimRight=/[\s\xA0]+$/;}
trim=function(string){return string==null?"":String(string).replace(trimLeft,"").replace(trimRight,"");};}
var escapeMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':'&quot;',"'":'&#39;'};function escapeHTML(string){return String(string).replace(/&(?!\w+;)|[<>"']/g,function(s){return escapeMap[s]||s;});}
function debug(e,template,line,file){file=file||"<template>";var lines=template.split("\n"),start=Math.max(line-3,0),end=Math.min(lines.length,line+3),context=lines.slice(start,end);var c;for(var i=0,len=context.length;i<len;++i){c=i+start+1;context[i]=(c===line?" >> ":"    ")+context[i];}
e.template=template;e.line=line;e.file=file;e.message=[file+":"+line,context.join("\n"),"",e.message].join("\n");return e;}
function lookup(name,stack,defaultValue){if(name==="."){return stack[stack.length-1];}
var names=name.split(".");var lastIndex=names.length-1;var target=names[lastIndex];var value,context,i=stack.length,j,localStack;while(i){localStack=stack.slice(0);context=stack[--i];j=0;while(j<lastIndex){context=context[names[j++]];if(context==null){break;}
localStack.push(context);}
if(context&&typeof context==="object"&&target in context){value=context[target];break;}}
if(typeof value==="function"){value=value.call(localStack[localStack.length-1]);}
if(value==null){return defaultValue;}
return value;}
function renderSection(name,stack,callback,inverted){var buffer="";var value=lookup(name,stack);if(inverted){if(value==null||value===false||(isArray(value)&&value.length===0)){buffer+=callback();}}else if(isArray(value)){forEach(value,function(value){stack.push(value);buffer+=callback();stack.pop();});}else if(typeof value==="object"){stack.push(value);buffer+=callback();stack.pop();}else if(typeof value==="function"){var scope=stack[stack.length-1];var scopedRender=function(template){return render(template,scope);};buffer+=value.call(scope,callback(),scopedRender)||"";}else if(value){buffer+=callback();}
return buffer;}
function parse(template,options){options=options||{};var tags=options.tags||exports.tags,openTag=tags[0],closeTag=tags[tags.length-1];var code=['var buffer = "";',"\nvar line = 1;","\ntry {",'\nbuffer += "'];var spaces=[],hasTag=false,nonSpace=false;var stripSpace=function(){if(hasTag&&!nonSpace&&!options.space){while(spaces.length){code.splice(spaces.pop(),1);}}else{spaces=[];}
hasTag=false;nonSpace=false;};var sectionStack=[],updateLine,nextOpenTag,nextCloseTag;var setTags=function(source){tags=trim(source).split(/\s+/);nextOpenTag=tags[0];nextCloseTag=tags[tags.length-1];};var includePartial=function(source){code.push('";',updateLine,'\nvar partial = partials["'+trim(source)+'"];','\nif (partial) {','\n  buffer += render(partial,stack[stack.length - 1],partials);','\n}','\nbuffer += "');};var openSection=function(source,inverted){var name=trim(source);if(name===""){throw debug(new Error("Section name may not be empty"),template,line,options.file);}
sectionStack.push({name:name,inverted:inverted});code.push('";',updateLine,'\nvar name = "'+name+'";','\nvar callback = (function () {','\n  return function () {','\n    var buffer = "";','\nbuffer += "');};var openInvertedSection=function(source){openSection(source,true);};var closeSection=function(source){var name=trim(source);var openName=sectionStack.length!=0&&sectionStack[sectionStack.length-1].name;if(!openName||name!=openName){throw debug(new Error('Section named "'+name+'" was never opened'),template,line,options.file);}
var section=sectionStack.pop();code.push('";','\n    return buffer;','\n  };','\n})();');if(section.inverted){code.push("\nbuffer += renderSection(name,stack,callback,true);");}else{code.push("\nbuffer += renderSection(name,stack,callback);");}
code.push('\nbuffer += "');};var sendPlain=function(source){code.push('";',updateLine,'\nbuffer += lookup("'+trim(source)+'",stack,"");','\nbuffer += "');};var sendEscaped=function(source){code.push('";',updateLine,'\nbuffer += escapeHTML(lookup("'+trim(source)+'",stack,""));','\nbuffer += "');};var line=1,c,callback;for(var i=0,len=template.length;i<len;++i){if(template.slice(i,i+openTag.length)===openTag){i+=openTag.length;c=template.substr(i,1);updateLine='\nline = '+line+';';nextOpenTag=openTag;nextCloseTag=closeTag;hasTag=true;switch(c){case"!":i++;callback=null;break;case"=":i++;closeTag="="+closeTag;callback=setTags;break;case">":i++;callback=includePartial;break;case"#":i++;callback=openSection;break;case"^":i++;callback=openInvertedSection;break;case"/":i++;callback=closeSection;break;case"{":closeTag="}"+closeTag;case"&":i++;nonSpace=true;callback=sendPlain;break;default:nonSpace=true;callback=sendEscaped;}
var end=template.indexOf(closeTag,i);if(end===-1){throw debug(new Error('Tag "'+openTag+'" was not closed properly'),template,line,options.file);}
var source=template.substring(i,end);if(callback){callback(source);}
var n=0;while(~(n=source.indexOf("\n",n))){line++;n++;}
i=end+closeTag.length-1;openTag=nextOpenTag;closeTag=nextCloseTag;}else{c=template.substr(i,1);switch(c){case'"':case"\\":nonSpace=true;code.push("\\"+c);break;case"\r":break;case"\n":spaces.push(code.length);code.push("\\n");stripSpace();line++;break;default:if(isWhitespace(c)){spaces.push(code.length);}else{nonSpace=true;}
code.push(c);}}}
if(sectionStack.length!=0){throw debug(new Error('Section "'+sectionStack[sectionStack.length-1].name+'" was not closed properly'),template,line,options.file);}
stripSpace();code.push('";',"\nreturn buffer;","\n} catch (e) { throw {error: e, line: line}; }");var body=code.join("").replace(/buffer \+= "";\n/g,"");if(options.debug){if(typeof console!="undefined"&&console.log){console.log(body);}else if(typeof print==="function"){print(body);}}
return body;}
function _compile(template,options){var args="view,partials,stack,lookup,escapeHTML,renderSection,render";var body=parse(template,options);var fn=new Function(args,body);return function(view,partials){partials=partials||{};var stack=[view];try{return fn(view,partials,stack,lookup,escapeHTML,renderSection,render);}catch(e){throw debug(e.error,template,e.line,options.file);}};}
var _cache={};function clearCache(){_cache={};}
function compile(template,options){options=options||{};if(options.cache!==false){if(!_cache[template]){_cache[template]=_compile(template,options);}
return _cache[template];}
return _compile(template,options);}
function render(template,view,partials){return compile(template)(view,partials);}})(Mustache);(function(context){context.Mustache=Mustache;if(context.define&&context.define.amd){context.define('wikia.mustache',Mustache);}}(window));;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable()),slice=[].slice;WE.config={};WE.plugins={};WE.modules={};WE.instances={};WE.instanceId='';WE.instanceCount=0;WE.debounce=false;WE.load=(function(){var components={VideoEmbedTool:{loaded:false,requires:[wgResourceBasePath+'/extensions/wikia/VideoEmbedTool/js/VET_WikiaEditor.js']},WikiaMiniUpload:{loaded:false,requires:[$.loadYUI,$.loadJQueryAIM,$.getSassCommonURL('extensions/wikia/WikiaMiniUpload/css/WMU.scss'),wgResourceBasePath+'/extensions/wikia/WikiaMiniUpload/js/WMU.js']}};return function(name){var component=components[name],deferred=new $.Deferred();if(component){if(component.loaded){deferred.resolve();}else{component.loaded=true;deferred=$.when($.getResources(component.requires));}}else{deferred.reject({error:'WikiaEditor.load: invalid component name "'+name+'"'});}
return deferred.promise();}})();WE.setInstanceId=function(instanceId,event,forceEvents){var editor;if(typeof event=='boolean'){forceEvents=event;event=undefined;}
if(instanceId==WE.instanceId){if(!forceEvents){$().log('instance "'+WE.instanceId+'" already active','WikiaEditor');return;}}else{if((editor=WE.instances[WE.instanceId])){editor.fire('editorDeactivated',event);$().log('instance "'+WE.instanceId+'" deactivated','WikiaEditor');}
WE.instanceId=instanceId;}
if((editor=WE.instances[instanceId])){editor.fire('editorActivated',event);$().log('instance "'+WE.instanceId+'" activated','WikiaEditor');}};WE.getInstance=function(instanceId){return WE.instances[instanceId||WE.instanceId];};WE.formatToMode=function(format){return format=='richtext'?'wysiwyg':'source';};WE.modeToFormat=function(mode){return mode=='wysiwyg'?'richtext':'wikitext';};WE.create=function(plugins,config,event){var instance=new WE.Editor(plugins,config),instanceId=config.body.attr('id');if(!instanceId){instanceId='WikiaEditor-'+WE.instanceCount;config.body.attr('id',instanceId);}
instance.event=event;instance.instanceId=instanceId;WE.instances[instanceId]=instance;WE.setInstanceId(instanceId,event);WE.instanceCount++;config.body.data('wikiaEditor',instance);instance.fire('instanceCreated',event);instance.show();return instance;};WE.functions=[];WE.addFunction=function(callback,scope){var id=WE.functions.length;WE.functions.push({fn:callback,scope:scope||window});return id;};WE.callFunction=function(id){if(WE.debounce)return;setTimeout(function(){WE.debounce=false;},500);WE.debounce=true;var args=Array.prototype.slice.call(arguments,1);var conf=WE.functions[id];return conf.fn.apply(conf.scope,args);};WE.initAddons=(function(){var done=false;return function(){if(!done){window.GlobalTriggers.fire('wikiaeditoraddons',WE);}
done=true;};})();WE.reloadEditor=function(){var editorInstance=WE.getInstance(),editorForm=editorInstance.ui.getForm();editorForm.find('input[name=wpEditToken]').val('');editorInstance.setState(editorInstance.states.RELOADING);this.storeContent();window.location.reload(true);};WE.storeContent=function(){window.WikiaEditorStorage.store();}
WE.Editor=$.createClass(Observable,{states:{IDLE:1,INITIALIZING:2,SAVING:3,LOADING_SOURCE:4,LOADING_VISUAL:5,RELOADING:6},ready:false,editorElement:false,constructor:function(plugins,config){WE.initAddons();WE.Editor.superclass.constructor.call(this);WE.fire('newInstance',plugins,config);this.pluginConfigs=plugins;this.config=$.extend(true,{},WE.config,config);this.initialized=false;this.state=false;this.mode=false;},getFormat:function(){return WE.modeToFormat(this.mode);},initPlugins:function(){var order=[];var loaded={};function queuePlugin(name){if(loaded[name]){return;}
var plugin=WE.plugins[name];loaded[name]=true;if(!plugin){this.warn('Plugin not found: '+name);return;}
var requires=plugin.requires||plugin.prototype.requires;if($.isArray(requires)){for(var i=0;i<requires.length;i++){queuePlugin.call(this,requires[i]);}}
order.push(name);}
for(var i=0;i<this.pluginConfigs.length;i++){queuePlugin.call(this,this.pluginConfigs[i]);}
this.plugins={};for(var i=0;i<order.length;i++){var cls=WE.plugins[order[i]];if(typeof cls=='function'){this.plugins[order[i]]=new cls(this);}}},initPlugin:function(name){if(!this.plugins[name]){var cls=WE.plugins[name];if(typeof cls=='function'){this.plugins[name]=new cls(this);}}
return this.plugins[name];},markAsReady:function(){if(!this.ready){this.ready=true;this.setState(this.states.IDLE);this.fire('editorReady',this.event);GlobalTriggers.fire('WikiaEditorReady',this);$().log('Editor is ready!','WikiaEditor');WE.track({action:Wikia.Tracker.ACTIONS.IMPRESSION,label:'edit-page-ready',value:Math.round(new Date()-window.wgNow)});if(!this.config.isMiniEditor&&window.veTrack){veTrack({action:'ck-edit-page-stop'});}}},setState:function(state){if(this.state==state)return;this.state=state;this.fire('state',this,state);},setMode:function(mode,forceEvents){if(this.mode==mode&&!forceEvents)return;this.element.removeClass('mode-'+this.mode);this.mode=mode;this.element.addClass('mode-'+mode);this.fire('mode',this,mode);},setAsActiveInstance:function(event,forceEvents){if(typeof event=='boolean'){forceEvents=event;event=undefined;}
WE.setInstanceId(this.instanceId,event,forceEvents);},show:function(){if(!this.initialized){this.initPlugins();this.element=this.config.element;this.config.mode=this.config.mode||'source';this.setMode(this.config.mode);this.setState(this.states.INITIALIZING);this.fire('initConfig',this);this.fire('beforeInit',this);this.fire('init',this);this.fire('initEditor',this);this.fire('initDom',this);this.initialized=true;this.fire('afterShow',this,this.editorElement);}},_log:function(type,args){if(window.console){if(typeof window.console[type]=='function'&&typeof window.console[type].apply=='function'){window.console[type].apply(window.console,args);}else if(typeof window.console[type]=='object'){var x=[];for(var i=0;i<args.length;i++)x.push("args["+i+"]");eval("window.console."+type+"("+x.join(',')+");");}}else if(window.opera){window.opera.postError.apply(window.opera,args);}},log:function(){this._log('log',Array.prototype.slice.call(arguments,0));},warn:function(){this._log('warn',Array.prototype.slice.call(arguments,0));},error:function(){this._log('error',Array.prototype.slice.call(arguments,0));throw arguments[0];}});WE.plugin=$.createClass(Observable,{constructor:function(editor){WE.plugin.superclass.constructor.call(this);var methodName,autobindMethods=['initConfig','beforeInit','init','initEditor','initDom','afterShow'],i=0,l=autobindMethods.length;this.editor=editor;for(;methodName=autobindMethods[i],i<l;i++){if(typeof this[methodName]=='function'){this.editor.on(methodName,this[methodName],this);}}},proxy:function(fn){return $.proxy(fn,this);}});WE.plugins.messages=$.createClass(WE.plugin,{MESSAGE_NAMESPACE:'wikia-editor-',beforeInit:function(){this.editor.msg=this.proxy(this.msg);},msg:function(msg){var args=Array.prototype.slice.call(arguments,0);args[0]=this.MESSAGE_NAMESPACE+args[0];return $.msg.apply($,args);}});WE.plugins.ui=$.createClass(WE.plugin,{priority:0,ready:true,initDomCalled:false,uiReadyFired:false,initConfig:function(){this.items={};this.handlers={};this.providers=[this];},beforeInit:function(){this.editor.ui=this;var self=this;$('body').click(function(ev){self.fire('bodyClick',ev,this);});},init:function(){var chk=function(){if(!this.initDomCalled)return;if(this.uiReadyFired)return;for(var i=0;i<this.providers.length;i++){if(!this.providers[i].ready)return;}
this.uiReadyFired=true;this.addDefaults();this.editor.fire('uiReady',this);}
var chkInitDom=function(){this.initDomCalled=true;chk.apply(this);}
this.editor.on({uiExternalProviderReady:chk,initDom:chkInitDom,scope:this});},buildClickHandler:function(config){var editor=this.editor;if(config.forceLogin&&wgUserName==null&&typeof UserLogin!='undefined'){config.click=function(){WE.track('force-login-'+config.ckcommand);UserLogin.rteForceLogin();}}else if(!config.click){config.click=function(){var mode=editor.mode;if(typeof config['click'+mode]=='function'){return config['click'+mode].apply(this,arguments);}else{editor.warn('Mode "'+mode+'" not supported for button: '+config.name);}};this.editor.fire('uiBuildClickHandler',this.editor,config);}},addDefaults:function(){var elements={},config=this.editor.config;if(config.uiElements){$.extend(elements,config.uiElements);}
this.editor.fire('uiFetchDefaults',this.editor,elements);for(var name in elements){if(typeof elements[name].precondition!='function'||elements[name].precondition()){this.addElement(name,elements[name]);}}},addExternalProvider:function(externalProvider){this.providers=this.providers||[];for(var i=0;i<this.providers.length;i++){if(this.providers[i].priority>=externalProvider.priority){this.providers.splice(i,0,externalProvider);return;}}
if(i>=this.providers.length){this.providers.push(externalProvider)}
this.editor.fire('uiAddExternalProvider',this.editor,externalProvider);},addHandler:function(type,handler){this.handlers[type]=handler;this.editor.fire('uiAddHandler',this.editor,type,handler);},getHandler:function(type){return this.handlers[type];},addElement:function(name,def){def.name=name;this.buildClickHandler(def);this.items[name]=def;this.editor.fire('uiAddElement',this.editor,name,def);},getElement:function(name){return this.items[name];},getForm:function(){return this.editor.element.parent('form');},createElement:function(name){var element=this.getElement(name);if(!element)return false;var handler=this.getHandler(element.type);if(!handler)return false;var data={};var html=handler.render(element,data);this.editor.fire('uiStandardElementCreated',this.editor,element,data);return html;},create:function(name){for(var i=0;i<this.providers.length;i++){var html=this.providers[i].createElement(name);if(html){return html;}}
this.editor.warn('UI Element not found: '+name);return'';}});WE.plugins.uiautoregister=$.createClass(WE.plugin,{requires:['ui','functions'],init:function(){if(WE.ui){for(var i in WE.ui){if(i!='base'){this.editor.ui.addHandler(i,this);}}}},render:function(config,data){var type=config.type;if(!WE.ui[type])return'';var e=new WE.ui[type](this.editor,config,data);return e.render();}});WE.plugins.spaces=$.createClass(WE.plugin,{SPACE_TYPE_ATTRIBUTE:'data-space-type',EDITOR_SPACE:'editor',element:false,spaces:false,beforeInit:function(){this.element=this.editor.config.element;this.editor.getSpace=this.proxy(this.getSpace);this.editor.getEditorSpace=this.proxy(this.getEditorSpace);this.editor.getSpaces=this.proxy(this.getSpaces);this.spaces={};var spaces=this.element.find('['+this.SPACE_TYPE_ATTRIBUTE+']');for(var i=0;i<spaces.length;i++){var space=$(spaces.get(i));this.spaces[space.attr(this.SPACE_TYPE_ATTRIBUTE)]=space;}
if(this.editor.config.spaces){this.spaces=$.extend(this.spaces,this.editor.config.spaces);}},init:function(){this.editorElement=this.getEditorSpace();},getSpace:function(name){return this.spaces[name]||false;},getSpaces:function(){return this.spaces;},getEditorSpace:function(){return this.getSpace(this.EDITOR_SPACE);}});WE.plugins.modules=$.createClass(WE.plugin,{locals:false,globals:false,beforeInit:function(){this.locals={};this.globals=WE.modules;this.editor.modules=this;},add:function(name,module){this.local[name]=module;},get:function(name){if(this.locals[name])
return this.locals[name];if(this.globals[name])
return this.globals[name];return false;},create:function(config){if(typeof config=='string'){config={type:config};}
var module=this.get(config.type);if(module)
module=new module(this.editor,config);if(!module){this.editor.warn('Module not found: '+config.type);}
return module;}});WE.plugins.toolbarspaces=$.createClass(WE.plugin,{requires:['ui','spaces','modules'],AUTO_SHOW_ATTRIBUTE:'data-space-autoshow',beforeInit:function(){this.editor.on('uiReady',this.proxy(this.renderToolbars));this.toolbars={};},renderToolbars:function(){var spaces=this.editor.getSpaces();var toolbars=this.toolbars={};for(var spaceName in spaces){if(typeof this.editor.config.toolbars[spaceName]!='undefined'){toolbars[spaceName]={name:spaceName,el:spaces[spaceName],config:this.editor.config.toolbars[spaceName]};}}
var types=this.editor.config.toolbarTypes||{};for(var name in toolbars){var config=toolbars[name].config;if($.isArray(config))config={items:config};config.type=config.type||types[name]||'container';config.element=toolbars[name].el;toolbars[name].module=this.editor.modules.create(config);}
for(var name in toolbars){if(toolbars[name].module){toolbars[name].dom=toolbars[name].module.render();toolbars[name].module.afterAttach();}}
for(var name in toolbars){if(toolbars[name].dom&&toolbars[name].el.attr(this.AUTO_SHOW_ATTRIBUTE)=='true'){toolbars[name].el.show();}}
this.editor.fire('toolbarsRendered',this.editor);this.editor.fire('toolbarsResized',this.editor);}});WE.plugins.functions=$.createClass(WE.plugin,{ids:false,beforeInit:function(){this.ids={};this.editor.addFunction=this.proxy(this.add);this.editor.callFunction=this.proxy(this.call);this.editor.on('destroy',this.proxy(this.clear));},add:function(callback,scope){var id=WE.addFunction(callback,scope);this.ids[id]=true;return id;},call:function(id){return WE.callFunction.apply(WE,arguments);},clear:function(){for(var id in this.ids){WE.functions[id]=false;}}});WE.plugins.core=$.createClass(WE.plugin,{requires:['functions','messages','ui','uiautoregister','spaces','toolbarspaces','collapsiblemodules','tracker']});WE.plugins.mweditor=$.createClass(WE.plugin,{requires:['ui'],proxyMethods:['getContent','setContent','getEditbox','getEditboxWrapper','getEditorElement','editorFocus','editorBlur'],initConfig:function(){this.editor.config.mode='source';},beforeInit:function(){var i=0,l=this.proxyMethods.length;for(;methodName=this.proxyMethods[i],i<l;i++){this.editor[methodName]=this.proxy(this[methodName]);}},initEditor:function(){this.textarea=this.editor.config.body;if(!this.textarea.is('textarea')){this.textarea=$('<textarea>').addClass('body').attr('id','mw_'+this.editor.instanceId).val($.trim(this.textarea.text())).insertAfter(this.textarea.hide());}
this.textarea.focus(this.proxy(this.editorFocused)).blur(this.proxy(this.editorBlurred)).click(this.proxy(this.editorClicked)).keyup(this.proxy(this.editorKeyUp));this.editor.markAsReady();},initDom:function(){this.editor.fire('editboxReady',this.editor,this.getEditbox());},getContent:function(){return this.textarea.val();},getEditbox:function(){return this.textarea;},getEditboxWrapper:function(){return this.editor.element;},getEditorElement:function(){return this.editor.config.body;},editorFocus:function(){this.textarea.focus();},editorBlur:function(){this.textarea.blur();},setContent:function(content,datamode){var editbox=this.getEditbox();if(datamode=='wysiwyg'){this.html2wiki({html:content,title:wgPageName},function(data){editbox.val(data.wikitext);});}else{editbox.val(content);}},html2wiki:function(params,callback){if(typeof params!='object'){params={};}
params.method='html2wiki';jQuery.post(window.wgScript+'?action=ajax&rs=RTEAjax',params,function(data){if(typeof callback=='function'){callback(data);}},'json');},editorFocused:function(){this.getEditbox().addClass('focused');this.editor.fire('editorFocus',this.editor);},editorBlurred:function(){this.getEditbox().removeClass('focused');this.editor.fire('editorBlur',this.editor);},editorClicked:function(){this.editor.fire('editorClick',this.editor);},editorKeyUp:function(){this.editor.fire('editorKeyUp',this.editor);}});WE.plugins.ckeditor=$.createClass(WE.plugin,{requires:['ui'],proxyEvents:['blur','focus','instanceReady','keyUp','mode','modeSwitch','modeSwitchCancelled','sourceModeReady','themeLoaded','wysiwygModeReady'],proxyMethods:['getContent','setContent','getEditbox','getEditboxWrapper','getEditorElement','editorFocus','editorBlur'],beforeInit:function(){var i=0,l=this.proxyMethods.length;for(;methodName=this.proxyMethods[i],i<l;i++){this.editor[methodName]=this.proxy(this[methodName]);}},initEditor:function(){this.editor.on('ck-mode',this.proxy(this.modeChanged));this.editor.on('ck-modeSwitch',this.proxy(this.beforeModeChange));this.editor.on('ck-modeSwitchCancelled',this.proxy(this.modeChangeCancelled));this.editor.on('ck-themeLoaded',this.proxy(this.themeLoaded));this.editor.on('ck-focus',this.proxy(this.editorFocused));this.editor.on('ck-blur',this.proxy(this.editorBlurred));this.editor.on('ck-keyUp',this.proxy(this.editorKeyUp));this.editor.on('ckInstanceCreated',this.proxy(this.ckInstanceCreated));this.editor.on('afterLoadingStatus',this.proxy(this.afterLoadingStatus));RTE.init(this.editor);},afterLoadingStatus:function(){this.editor.markAsReady();$(this.editor.ck.container.$).addClass('visible').unbind('keydown.preventTyping');},ckInstanceCreated:function(ck){this.editor.ck=ck;for(var i=0,l=this.proxyEvents.length;i<l;i++){(function(eventName){this.editor.ck.on(eventName,function(){this.editor.fire.apply(this.editor,['ck-'+eventName,this.editor].concat(slice.call(arguments)));},this);}).call(this,this.proxyEvents[i]);}},getContent:function(){return this.editor.ck.getData();},getEditbox:function(){return $(this.editor.ck.mode=='wysiwyg'?this.editor.ck.document.getBody().$:this.editor.ck.textarea.$);},getEditboxWrapper:function(){return $(this.editor.ck.getThemeSpace('contents').$);},getEditorElement:function(){return $(this.editor.ck.element.$);},beforeModeChange:function(){$(this.editor.ck.container.$).removeClass('visible').bind('keydown.preventTyping',function(e){e.preventDefault();});this.editor.setState(this.editor.ck.mode=='wysiwyg'?this.editor.states.LOADING_SOURCE:this.editor.states.LOADING_VISUAL);},modeChanged:function(){this.editor.setMode(this.editor.ck.mode);this.editor.setState(this.editor.states.IDLE);this.getEditbox().click(this.proxy(this.editorClicked)).addClass('focused');},modeChangeCancelled:function(){this.editor.setState(this.editor.states.IDLE);},themeLoaded:function(){this.editor.fire('editboxReady',this.editor,$(this.editor.ck.getThemeSpace('contents').$));},editorFocus:function(){this.editor.ck.focus();},editorBlur:function(){this.editor.ck.blur();},setContent:function(content,datamode){var ckeditor=this.editor.ck;if(datamode&&ckeditor.mode!=datamode){var params={title:wgPageName};var isWysiwyg=ckeditor.mode=='wysiwyg';params[isWysiwyg?'wikitext':'html']=content;RTE.ajax(isWysiwyg?'wiki2html':'html2wiki',params,function(data){ckeditor.setData(data[isWysiwyg?'html':'wikitext']);});}else{ckeditor.setData(content);}},editorFocused:function(){this.getEditbox().addClass('focused');this.editor.fire('editorFocus',this.editor);},editorBlurred:function(){this.getEditbox().removeClass('focused');this.editor.fire('editorBlur',this.editor);},editorClicked:function(){this.editor.fire('editorClick',this.editor);},editorKeyUp:function(){this.editor.fire('editorKeyUp',this.editor);}});WE.plugins['ui-ckeditor']=$.createClass(WE.plugin,{requires:['ui','ckeditor'],priority:-1,ready:false,modeAwareCommands:{},stateProxiedCommands:{},beforeInit:function(){this.editor.ui.addExternalProvider(this);this.editor.on('ck-themeLoaded',this.ckReady,this);this.editor.on('uiBuildClickHandler',this.buildWysiwygClickHandler,this);this.editor.on('uiStandardElementCreated',this.elementCreated,this);this.editor.on('mode',this.modeChanged,this);},modeChanged:function(editor,mode){for(var name in this.modeAwareCommands){var command=this.editor.ck.getCommand(name);if(command&&command.modes){for(var i=0;i<command.uiItems.length;i++){var button=command.uiItems[i],ignores=['ModeWysiwyg','ModeSource'];if($.inArray(button.command,ignores)<0){if(button._.id){$('#'+button._.id).parent()[command.modes[mode]?'removeClass':'addClass']('cke_hidden');}}}}}
this.proxyAllCommandsState();},proxyAllCommandsState:function(){for(var commandName in this.stateProxiedCommands)
this.proxyCommandState(commandName);},proxyCommandState:function(commandName){var command=this.editor.ck.getCommand(commandName),state=command&&command.state,elements=this.stateProxiedCommands[commandName];if(!command)return;for(var i=0;i<elements.length;i++){var id=elements[i],el=$('#'+id);if(el){el=el.parent();el.removeClass('cke_on cke_off cke_disabled');if(this.editor.ck.mode=='wysiwyg'){el.addClass('cke_'+(state==CKEDITOR.TRISTATE_ON?'on':state==CKEDITOR.TRISTATE_DISABLED?'disabled':'off'));}else{el.addClass('cke_off');}}}},elementCreated:function(editor,element,data){if(element.ckcommand){var commandName=element.ckcommand;if(!this.stateProxiedCommands[commandName]){var command=this.editor.ck.getCommand(commandName);if(command){command.on('state',$.proxy(function(){this.proxyCommandState(commandName);},this));}
this.stateProxiedCommands[commandName]=[];}
this.stateProxiedCommands[commandName].push(data.id);}},ckReady:function(){this.ready=true;this.editor.fire('uiExternalProviderReady',this.editor);},buildWysiwygClickHandler:function(editor,button){button.clickwysiwyg=function(){this.editor.ck.execCommand(button.ckcommand,button.clickdatawysiwyg);};},createElement:function(name){var ck=this.editor.ck,ui=this.editor.ck.ui,item;if(ui._.items[name]&&(item=ui.create(name))){var output=[];item.render(ck,output);if(item.command){this.modeAwareCommands[item.command]=true;}
return output.join('');}
return false;}});WE.plugins.mweditorsuite=$.createClass(WE.plugin,{requires:['core','mweditor']});WE.plugins.ckeditorsuite=$.createClass(WE.plugin,{requires:['core','ckeditor','ui-ckeditor']});GlobalTriggers.fire('wikiaeditor',WE);})(this,jQuery);;var WikiaEditorStorage=function(){};WikiaEditorStorage.prototype={categories:undefined,summary:undefined,content:undefined,editorMode:undefined,articleId:undefined,editorDirty:false,store:function(){if(typeof wgArticleId!=='undefined'){var editorInstance=window.WikiaEditor.getInstance();if(typeof editorInstance.plugins.leaveconfirm==='undefined'||editorInstance.plugins.leaveconfirm.isDirty()){var summary=$('#wpSummary');var categorySelect=$('#CategorySelect').data('categorySelect');var toStore={articleId:wgArticleId,content:editorInstance.getContent(),editorMode:editorInstance.mode,summary:summary.exists()?summary.val():undefined,categories:typeof categorySelect!=='undefined'?categorySelect.getData():undefined};try{$.storage.set(this.getStoreContentKey(),toStore);}catch(e){$().log('Local Storage Exception:'+e.message);$.storage.flush();}}}},init:function(){this.fetchData();GlobalTriggers.bind('WikiaEditorReady',$.proxy(function(editor){if(this.getEditorDirty()){editor.fire('markDirty');this.modifySummary();this.modifyEditorContent(editor);this.modifyCategories($('#CategorySelect').data('categorySelect'));}},this));},fetchData:function(){var storageKey=this.getStoreContentKey();var storageData=$.storage.get(storageKey);if(storageData!=null&&storageData.articleId==wgArticleId){this.editorDirty=true;this.summary=storageData.summary;this.articleId=storageData.articleId;this.content=storageData.content;this.editorMode=storageData.editorMode;this.categories=storageData.categories;}
$.storage.del(storageKey);},modifyEditorContent:function(editor){var content=this.getContent();var editorMode=this.getEditorMode();if(typeof content!=='undefined'&&typeof editorMode!=='undefined'){editor.setContent(content,editorMode);}},modifySummary:function(){var summary=this.getSummary();if(typeof summary!=='undefined'){$('#wpSummary').val(summary);}},modifyCategories:function(categorySelect){var categories=this.getCategories();if(typeof categories!=='undefined'){var actualCategories=categorySelect.getCategories();var promises=[];for(var i=0;i<actualCategories.length;i++){promises.push(categorySelect.removeCategory(actualCategories[i]));}
$.when.apply(null,promises).done(function(){for(var i=0;i<categories.length;i++){categorySelect.addCategory(categories[i]);}});}},getContent:function(){return this.content;},getSummary:function(){return this.summary;},getEditorMode:function(){return this.editorMode;},getCategories:function(){return this.categories;},getEditorDirty:function(){return this.editorDirty;},getStoreContentKey:function(){return'WikiaEditorData';}};var WikiaEditorStorage=new WikiaEditorStorage();window.WikiaEditorStorage=WikiaEditorStorage;WikiaEditorStorage.init();;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.ui=WE.ui||{};WE.ui.base=$.createClass(Observable,{constructor:function(editor,config,data){WE.ui.base.superclass.constructor.call(this);this.editor=editor;this.config=config;if(typeof config=='object'){for(var k in config){this[k]=config[k];}}
this.data=data||{};this.data.button=this;this.init();},init:function(){},beforeRender:function(){},renderHtml:function(){return'';},render:function(){if(!this.config)
return'';this.beforeRender();return this.renderHtml();},proxy:function(fn){return $.proxy(fn,this);}});WE.ui.button=$.createClass(WE.ui.base,{statics:{nextId:1},clickButtonHandler:function(){var mode=this.editor.mode;if(typeof this['click'+mode]=='function'){return this['click'+mode].apply(this,arguments);}else{this.editor.warn('Mode "'+mode+'" not supported for button: '+this.name);}},buildClickHandler:function(){this.click=this.clickButtonHandler;this.editor.fire('uiBuildClickHandler',this.editor,this);},beforeRender:function(){this.label||(this.label=$.msg(this.labelId));if(typeof this.label!='undefined'){if(this.label.match(/<.*>/)){this.label=$.msg(this.label.replace('<','').replace('>',''));}}
this.label=this.label||'';this.title||(this.titleId&&(this.title=$.msg(this.titleId)))||(this.title=this.label);this.title=this.title||'';this.id='uielem_'+WE.ui.button.nextId++;this.buttonClass='cke_'+this.type;this.classes=(this.className||'');this.labelClass=this.labelClass||'cke_label';this.arrowClass=this.arrowClass||'cke_openbutton';this.click=this.click||this.buildClickHandler();this.clickFn=this.clickFn||this.editor.addFunction(this.proxy(this.click));},renderHtml:function(){var html='<span class="'+this.buttonClass+' '+this.classes+'">'
+'<a id="'+this.id+'" class="cke_off '+this.classes+'"'
+' title="'+this.title+'"'
+' tabindex="-1"'
+' hidefocus="true"'
+' role="button"'
+' aria-labelledby="'+this.id+'_label"'
+' onmousedown="WikiaEditor.callFunction('+this.clickFn+', this); return false;">';if(this.hasIcon!==false){html+='<span class="cke_icon">&nbsp;</span>';}
if(this.hasLabel!==false){html+='<span id="'+this.id+'_label" class="'+this.labelClass+'">'+this.label+'</span>';}
if(this.hasArrow){html+='<span class="'+this.arrowClass+'">&nbsp;</span>';}
html+='</a>'+'</span>';this.data.id=this.id;return html;}});WE.ui.panelbutton=$.createClass(WE.ui.button,{getEl:function(){var button=$('#'+this.id);return button.exists()&&button.closest('.cke_'+this.type);},moveInside:function(){this.data.inside++;},moveOutside:function(){this.data.inside--;},renderPanel:function(){var button=$('#'+this.id),el=this.getEl();if(button&&el&&!this.panel){var pos=el.position();var panel=this.panel=$('<div>');panel.addClass('cke_panel_dropdown').addClass(this.panelClass||'').appendTo(el.offsetParent());this.positionPanel();this.panelOnInit&&this.panelOnInit(this.panel,this,panel);panel.hide();button.add(panel).mouseenter(this.proxy(this.moveInside)).mouseleave(this.proxy(this.moveOutside));panel.delegate('.cke_button, .text-links a','mouseenter',this.proxy(this.moveOutside)).delegate('.cke_button, .text-links a','mouseleave',this.proxy(this.moveInside));}},positionPanel:function(){var el=this.getEl();var pos=el.position();var mod={left:5,top:-20};this.panel.css({position:'absolute',left:pos.left+mod.left,top:pos.top+mod.top+el.outerHeight(),'padding-top':-mod.top});},clickHandler:function(){var button=$('#'+this.id),el=button.closest('.cke_'+this.type);if(!this.panel)
this.renderPanel();if(!this.opened){el.addClass('cke_opened');this.panelOnShow&&this.panelOnShow(this.panel,this);this.positionPanel();this.panel.show();this.opened=true;this.inside=1;}else{el.removeClass('cke_opened');this.panelOnHide&&this.panelOnHide(this.panel,this);this.panel.hide();this.opened=false;this.inside=0;}},beforeRender:function(){this.opened=false;this.click=this.clickHandler;WE.ui.panelbutton.superclass.beforeRender.call(this);this.editor.ui.on('bodyClick',this.proxy(function(){if(this.opened&&this.inside==0){this.click();}}));this.editor.on('editorFocus',this.proxy(function(){if(this.opened){this.click();}}));this.hasArrow=true;this.labelClass='cke_text';if(this.autorenderpanel){this.editor.on('toolbarsRendered',this.proxy(this.renderPanel));};},panelOnInit:function(){},panelOnShow:function(){},panelOnHide:function(){}});WE.ui.modulebutton=$.createClass(WE.ui.panelbutton,{panelOnInit:function(panel,config,data){var module=this.moduleObject=this.editor.modules.create(config.module);var el=module.render();var headerClass=module.getHeaderClass();var elcontent=$('<div>').addClass('module_content').append(el)
var elmodule=$('<div>').addClass('module module_'+headerClass).attr('data-id',headerClass).append(elcontent);panel.append(elmodule);module.afterAttach();},beforeRender:function(){this.panelClass=this.panelClass?this.panelClass+' ':'';WE.ui.modulebutton.superclass.beforeRender.call(this);}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.module=$.createClass(Observable,{MODULE_MESSAGES_PREFIX:'modules-',modes:{wysiwyg:true},enabled:true,headerClass:'',headerText:'',headerTextId:'',constructor:function(editor,options){WE.module.superclass.constructor.call(this);this.editor=editor;this.options=options;this.ui=this.editor.ui;this.init();},init:function(){},getHeaderClass:function(){return this.headerClass;},getHeaderText:function(){if(this.headerTextId){return this.msg(this.headerTextId);}
if(this.headerText){return this.headerText;}
return'';},setHeaderText:function(text){this.headerText=text;this.fire('headerchange',this,text);},getTemplate:function(){return this.template;},getData:function(){return this.data;},renderHtml:function(){return Mustache.render(this.getTemplate(),this.getData());},render:function(){if(!this.enabled){return false;}
var el=$(this.renderHtml());this.el=el;this.afterRender();return el;},afterRender:function(){},afterAttach:function(){},show:function(){this.el.show();this.fire('show',this);},hide:function(){this.el.hide();this.fire('hide',this);},msg:function(){var args=Array.prototype.slice.call(arguments,0);args[0]=this.MODULE_MESSAGES_PREFIX+args[0];return this.editor.msg.apply(this.editor,args);},proxy:function(fn){return $.proxy(fn,this);}});WE.modules.base=WE.module;})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.editorsurvey=$.createClass(WE.plugin,{init:function(){if(window.EditorSurvey){EditorSurvey.bindUnload();this.editor.on('state',this.proxy(this.stateChanged));}},stateChanged:function(editor,state){if(state==editor.states.SAVING){EditorSurvey.handleSuccess();}}});})(this,jQuery);;(function(window,$){var slice=[].slice,Wikia=window.Wikia,WikiaEditor=window.WikiaEditor;if(!(Wikia||Wikia.Tracker)){return;}
WikiaEditor.plugins.tracker=$.createClass(WikiaEditor.plugin,{config:{action:Wikia.Tracker.ACTIONS.CLICK,trackingMethod:'analytics'},init:function(){var isMiniEditor=this.editor.config.isMiniEditor,editorType=(isMiniEditor?'-mini-':'-')+
((window.RTE!==undefined&&!window.RTEEdgeCase)?'ck':'mw');this.config.category='editor'+editorType;if(!isMiniEditor){if(window.veTrack){veTrack({action:'ck-edit-page-start'});}
this.track({action:Wikia.Tracker.ACTIONS.IMPRESSION,label:'edit-page'});}
this.editor.track=this.proxy(this.track);this.editor.trackWithEventData=this.proxy(this.trackWithEventData);this.editor.on('ckInstanceCreated',this.proxy(this.onCkInstanceCreated));},onCkInstanceCreated:function(ck){ck.on('buttonClick',this.proxy(this.onCkButtonClick));ck.on('dialogCancel',this.proxy(this.onCkDialogCancel));ck.on('dialogClose',this.proxy(this.onCkDialogClose));ck.on('dialogOk',this.proxy(this.onCkDialogOk));ck.on('dialogShow',this.proxy(this.onCkDialogShow));ck.on('panelClick',this.proxy(this.onCkPanelClick));ck.on('panelShow',this.proxy(this.onCkPanelShow));},onCkButtonClick:function(event){var label=event.data.button.label.toLowerCase();this.track('button-'+label);},onCkDialogCancel:function(event){var label=event.data._.name.toLowerCase();this.track('dialog-'+label+'-button-cancel');},onCkDialogClose:function(event){var label=event.data._.name.toLowerCase();this.track('dialog-'+label+'-button-close');},onCkDialogOk:function(event){var label=event.data._.name.toLowerCase();this.track('dialog-'+label+'-button-ok');},onCkDialogShow:function(event){var label=event.data._.name.toLowerCase();this.track({action:Wikia.Tracker.ACTIONS.OPEN,label:'dialog-'+label});},onCkPanelClick:function(event){var label=event.data.me.label.toLowerCase(),value=event.data.value;this.track('panel-'+label+'-item-'+value);},onCkPanelShow:function(event){var label=event.data.me.label.toLowerCase();this.track({action:Wikia.Tracker.ACTIONS.OPEN,label:'panel-'+label});},track:function(){var args=slice.call(arguments),data={},labelParts=[];$.each(args,function(i,arg){if(typeof arg==='string'){arg={label:arg};}else if(arg.category){labelParts.push(arg.category);}
$.extend(data,arg);});delete data.category;if(data.label!=undefined&&data.label!=''){labelParts.push(data.label);}
data.label=labelParts.join('-');Wikia.Tracker.track(this.config,data);},trackWithEventData:function(event){var data;if(typeof event==='object'&&typeof event.data==='object'&&(typeof event.condition!=='function'||event.condition()!==false)){data=event.data;data.browserEvent=event;this.track(data);}}});(function(){var i,l,methodNames=['track','trackWithEventData'];for(i=0,l=methodNames.length;i<l;i++){(function(methodName){WikiaEditor[methodName]=function(){var tracker=WikiaEditor.getInstance().plugins.tracker;tracker[methodName].apply(tracker,slice.call(arguments));}})(methodNames[i]);}})();$(function(){(function(){var label='toolbar-';$('#EditPageToolbar').on('mousedown','.cke_toolbar_expand',function(e){var title=$(e.currentTarget).find('.expand').is(':visible')?'more':'less';WikiaEditor.track(label+title);});})();});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.pagecontrols=$.createClass(WE.plugin,{hiddenFields:false,callbackFields:false,titleNode:false,textarea:false,minorEditCheck:false,beforeInit:function(){this.editor.controls=this;$('#wpSave').attr('disabled',true);this.editor.on('editorReady',this.proxy(this.onEditorReady));},init:function(){var $pageControls=$('#EditPageRail .module_page_controls'),self=this;this.categories=$('#categories');this.textarea=$pageControls.find('textarea');this.textarea.placeholder();this.textarea.on('keypress',this.proxy(this.onSummaryKeypress));this.minorEditCheck=$pageControls.find('#wpMinoredit');this.minorEditCheck.on('keypress',this.proxy(this.onMinorEditKeypress));this.minorEditCheck.on('change',this.proxy(function(){this.editor.track('minor-edit');}));require(['editpage.events'],function(editpageEvents){editpageEvents.attachDesktopPreview('wpPreview',self.editor);editpageEvents.attachMobilePreview('wpPreviewMobile',self.editor);editpageEvents.attachDiff('wpDiff',self.editor);});this.editform=$('#editform').on('submit',this.proxy(this.onSave));this.hiddenFields=$('#EditPageHiddenFields');this.callbackFields=$('#EditPageCallbackFields');this.titleNode=$('#EditPageHeader > h1');if($('#EditPageHiddenFields input[type="text"]').exists()){$('#EditPageTitle').addClass('enabled').on('click',this.proxy(function(){this.renderHiddenFieldsDialog();}));var noFields=$('#EditPageHiddenFields').find('input[type!="hidden"]').length;if(noFields>=2){$('#EditPageTitle').attr('title',$.msg('editpagelayout-edit-info'));}}
if(this.checkForEmptyFields(this.hiddenFields)){this.renderHiddenFieldsDialog();if(typeof RTE=='object'){RTE.config.startupFocus=false;}}else if($('#EditPageHiddenFields [name=wpTitle]').exists()){this.updateEditedTitle();}
if(this.callbackFields.exists()){this.renderCallbackFieldsDialog();if(typeof RTE=='object'){RTE.config.startupFocus=false;}}},onEditorReady:function(){$('#wpSave').removeAttr('disabled');},onSave:function(event){event.preventDefault();if(this.editor.fire('save')===false){return;}
if(this.textarea.val()==this.textarea.attr('placeholder')){this.textarea.val('');}
this.editor.setState(this.editor.states.SAVING);if(window.veTrack){veTrack({action:'ck-save-button-click',isDirty:(typeof this.editor.plugins.leaveconfirm==='undefined'||this.editor.plugins.leaveconfirm.isDirty())?'yes':'no'});}
this.editor.track({action:Wikia.Tracker.ACTIONS.SUBMIT,label:'publish'});this.editform.off('submit');setTimeout(this.proxy(function(){this.editform.submit();}),100);$('#wpSave').attr('disabled',true);},onSummaryKeypress:function(ev){if(ev.keyCode==13){this.editor.track({action:Wikia.Tracker.ACTIONS.SUBMIT,label:'summary-enter'});this.editform.submit();}},onMinorEditKeypress:function(ev){if(ev.keyCode==13){ev.preventDefault();return;}},ajax:function(method,params,callback,skin){var editor=typeof RTE=='object'?RTE.getInstance():false;params=$.extend({page:window.wgEditPageClass?window.wgEditPageClass:"",method:method,mode:editor.mode},params);var url=window.wgEditPageHandler.replace('$1',encodeURIComponent(window.wgEditedTitle));if(skin){url+='&type=full&skin='+encodeURIComponent(skin);}
return jQuery.post(url,params,function(data){if(typeof callback=='function'){callback(data);}},'json');},updateEditedTitle:function(){var title=$('[name=wpTitle]');if(title.exists()){window.wgEditedTitle=title.val();}
var prefix='';if(wgEditedTitleNS!==''){prefix=wgEditedTitleNS+':';}
if(wgEditedTitlePrefix!==''){prefix+=wgEditedTitlePrefix;}
window.wgEditedTitle=prefix+window.wgEditedTitle;$(window).trigger('editTitleUpdated',[window.wgEditedTitle]);this.titleNode.children('a').attr('href',wgArticlePath.replace('$1',window.wgEditedTitle)).attr('title',$.htmlentities(window.wgEditedTitle)).text(window.wgEditedTitle);$('#EditPageHeader').find('.hiddenTitle').show();},checkForEmptyFields:function(fields){var emptyRequiredFields=fields.find('label > *[data-required="1"]'),emptyCounter=0;emptyRequiredFields.each(function(){if($(this).val()==''){emptyCounter++;}});return emptyCounter>0;},renderHiddenFieldsDialog:function(){var self=this,dialogTitle=document.title;$.showCustomModal(dialogTitle,'<div class="fields"></div>',{id:'HiddenFieldsDialog',width:400,buttons:[{id:'ok',defaultButton:true,message:$.htmlentities($.msg('ok')),handler:function(){var dialog=$('#HiddenFieldsDialog');if(!self.checkForEmptyFields(dialog)){self.hiddenFields.append(dialog.find('label'));self.updateEditedTitle();dialog.closeModal();if(typeof RTE=='object'){self.editor.ck.config.startupFocus=true;}
self.editor.editorFocus();}}}],callback:function(){self.hiddenFields.children('label').appendTo($('#HiddenFieldsDialog .fields'));$('#HiddenFieldsDialog label').children().focus();$('#HiddenFieldsDialog input[name="wpTitle"]').keypress(function(event){if(event.keyCode==13){$('#ok').click();}});},showCloseButton:false,onClose:function(){return false;}});},renderCallbackFieldsDialog:function(){var self=this,dialogTitle=document.title;if($('#wpCaptchaWord').exists()){dialogTitle=$.htmlentities($.msg('editpagelayout-captcha-title'));}
$.showCustomModal(dialogTitle,'<div class="fields"></div>',{id:'HiddenFieldsDialog',width:400,buttons:[{id:'ok',defaultButton:true,message:$.htmlentities($.msg('savearticle')),handler:function(){var dialog=$('#HiddenFieldsDialog');self.callbackFields.append(dialog.find('.fields'));$('#wpSave').click();dialog.closeModal();}}],callback:function(){self.callbackFields.children().appendTo($('#HiddenFieldsDialog .fields'));$('#HiddenFieldsDialog input[type!="hidden"]').focus();}});},getPreviewContent:function(content,extraData,callback,skin){if(window.wgEditPageSection==='new'){content='== '+this.getSummary()+' ==\n\n'+content;}else{extraData.summary=this.getSummary();}
extraData.content=content;if(window.wgEditPageSection!==null){extraData.section=window.wgEditPageSection;}
if(this.categories.length){extraData.categories=this.categories.val();}
this.ajax('preview',extraData,function(data){callback(data);},skin);},renderPreview:function(extraData,type){var self=this;require(['wikia.breakpointsLayout'],function(breakpointsLayout){var previewPadding=22,articleWidth=660,width=articleWidth+(self.isGridLayout?30:0),config=self.editor.config;if(config.isWidePage){width+=breakpointsLayout.getRailWidthWithSpacing()+(self.isGridLayout?20:0);}
if(config.extraPageWidth){width+=config.extraPageWidth;}
if(window.wgOasisResponsive||window.wgOasisBreakpoints){var pageWidth=$('#WikiaPage').width(),minWidth=breakpointsLayout.getArticleMinWidth();if(pageWidth<=minWidth){pageWidth=minWidth;}
width=pageWidth-breakpointsLayout.getArticlePadding();}
width+=previewPadding;var previewOptions={width:width,scrollbarWidth:20,onPublishButton:function(){$('#wpSave').click();},getPreviewContent:function(callback,skin){self.getContent(function(content){self.getPreviewContent(content,extraData,callback,skin);});}};previewOptions.isWidePage=config.isWidePage;previewOptions.currentTypeName=type;require(['wikia.preview'],function(preview){preview.renderPreview(previewOptions);});});},renderChanges:function(){var self=this;require(['wikia.ui.factory'],function(uiFactory){uiFactory.init(['modal']).then(function(uiModal){var previewModalConfig={vars:{id:'EditPageDialog',title:$.htmlentities($.msg('editpagelayout-pageControls-changes')),content:'<div class="ArticlePreview modalContent"><div class="ArticlePreviewInner">'+'</div></div>',size:'large'}};uiModal.createComponent(previewModalConfig,function(previewModal){previewModal.deactivate();previewModal.$content.on('click',function(event){var target=$(event.target);target.closest('a').not('[href^="#"]').attr('target','_blank');});self.getContent(function(content){var section=$.getUrlVar('section')||0,extraData={content:content,section:parseInt(section,10)};if(self.categories.length){extraData.categories=self.categories.val();}
$.when(self.ajax('diff',extraData),mw.loader.using('mediawiki.action.history.diff')).done(function(ajaxData){var data=ajaxData[0],html='<h1 class="pagetitle">'+window.wgEditedTitle+'</h1>'+data.html;previewModal.$content.find('.ArticlePreview .ArticlePreviewInner').html(html);previewModal.activate();});});previewModal.show();});});});},getSummary:function(){var $wpSummary=$('#wpSummary'),summary=$wpSummary.val();if(summary===$wpSummary.attr('placeholder')){summary='';}
return summary;},getContent:function(callback){var editor=typeof RTE=='object'?RTE.getInstance():false,mode=editor?editor.mode:'mw';callback=callback||function(){};switch(mode){case'mw':callback($('#wpTextbox1').val());return;case'source':case'wysiwyg':callback(editor.getData());return;}}});})(this,jQuery);;(function(window,$){var $window=$(window);var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.autoresizer=$.createClass(WE.plugin,{requires:['sizechangedevent'],editarea:false,editbox:false,editboxOffsetHeight:0,mode:false,minPageHeight:300,rightrail:false,widemode:false,wikiaBarEnabled:false,beforeInit:function(){this.mode=this.editor.config.autoResizeMode;this.wikiaBarEnabled=window.wgEnableWikiaBarExt&&typeof window.WikiaBar==='object';if(this.mode!==false){this.editor.on('editboxReady',this.proxy(this.editboxReady));this.editor.on('mode',this.proxy(this.delayedResize));this.editor.on('toolbarsRendered',this.proxy(this.delayedResize));this.editor.on('sizeChanged',this.proxy(this.delayedResize));this.editor.on('mainpagewidemodeinit',this.proxy(function(){this.widemode=true;}));}},initDom:function(){this.editarea=$('#EditPageEditor');this.editPage=$('#EditPage');this.editPageEditorWrapper=$('#EditPageEditorWrapper');this.editPageMain=$('#EditPageMain');this.wikiaBarWrapper=$('#WikiaBarWrapper');if(this.widemode===false){this.rightrail=this.editor.getSpace('rail');}
if(this.enabled){this.delayedResize();}},editboxReady:function(editor,editbox){var node,footerHeight=$("#WikiaFooter").outerHeight(true)||0,offsetHeight=0,self=this;this.editbox=editbox;if(!footerHeight){this.editarea.addClass("noFooter");}
this.editbox.parentsUntil(this.editPageEditorWrapper).andSelf().each(function(){node=$(this);offsetHeight+=(node.outerHeight(true)-node.height());});this.editboxOffsetHeight=(offsetHeight+footerHeight);this.delayedResize();this.editbox.css('visibility','visible');},delayedResize:function(){setTimeout(this.proxy(this.resize),10);},getHeightToFit:function(node){var topOffset=node.offset().top,viewportHeight=$window.height(),dimensions={nodeHeight:parseInt(viewportHeight-topOffset-this.editboxOffsetHeight),viewportHeight:viewportHeight};if(this.wikiaBarEnabled&&!this.wikiaBarWrapper.hasClass('hidden')){dimensions.nodeHeight-=this.wikiaBarWrapper.outerHeight(true);}
if(dimensions.nodeHeight<this.minPageHeight){dimensions.nodeHeight=this.minPageHeight;}
return dimensions;},resize:function(){switch(this.mode){case'editarea':if(this.editbox){var dimensions=this.getHeightToFit(this.editbox);if(dimensions.viewportHeight>this.minPageHeight){this.editbox.height(dimensions.nodeHeight);}}
break;case'editpage':this.editarea.css('minHeight',this.getHeightToFit(this.editarea).nodeHeight);break;}
if(this.rightrail){this.rightrail.height(this.editPageMain.height());}}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.addfile=$.createClass(WE.plugin,{init:function(){if(window.wgEditPageAddFileType){var message='';if(this.editor.mode=='wysiwyg'){message=$.msg('wikia-editor-add-file-notice',window.wgEditPageAddFileType);}else{message=$.msg('wikia-editor-add-file-notice-no-wysiwyg',window.wgEditPageAddFileType);}
new window.BannerNotification(message,'notify').show();}}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.collapsiblemodules=$.createClass(WE.plugin,{requires:['modules'],MODULE_ID_ATTRIBUTE:'data-id',storageEntry:'wgRightRailModulesState',lastId:0,modules:false,beforeInit:function(){this.modules={};this.editor.collapsiblemodules=this;},add:function(moduleObj,el){if(!el.children('h3').exists()){return;}
this.lastId++;var id=el.attr(this.MODULE_ID_ATTRIBUTE);id=id?id:this.lastId;var module={id:id,module:moduleObj,el:el,header:el.children('h3'),chevron:false,content:el.children('.module_content'),state:true};module.chevron=module.header.find('.chevron');this.modules[id]=module;var self=this;module.header.bind('click.collapse',function(ev){self.toggle(id);});var defaultState=this.getDefaultState();module.state=this.readState(id,defaultState);this[module.state?'expand':'collapse'](id);},toggle:function(id){var module=this.modules[id],state=module.state;this[state?'collapse':'expand'](id,true);this.setState(id,!state);},collapse:function(id,animate){var module=this.modules[id];if(animate){module.content.slideUp(this.proxy(this.fireToolbarsResized));}
else{module.content.hide();this.fireToolbarsResized();}
module.chevron.removeClass('collapse').addClass('expand');},expand:function(id,animate){var module=this.modules[id];if(animate){module.content.slideDown(this.proxy(this.fireToolbarsResized));}
else{module.content.show();this.fireToolbarsResized();}
module.chevron.removeClass('expand').addClass('collapse');},readState:function(id,defaultState){var stateSet=$.storage.get(this.storageEntry),retval;if(stateSet&&(typeof stateSet[id]!='undefined')){retval=!!stateSet[id];}
else{retval=defaultState;this.saveState(id,defaultState);}
return retval;},saveState:function(id,state){var stateSet=$.storage.get(this.storageEntry)||{};stateSet[id]=!!state;$.storage.set(this.storageEntry,stateSet);},setState:function(id,state){var module=this.modules[id];module.state=state;this.saveState(id,state);},getDefaultState:function(){var viewport=$(window).height();if(viewport<600){return(this.lastId<2);}
else if(viewport<900){return(this.lastId<3);}
else{return true;}},fireToolbarsResized:function(){this.editor.fire('toolbarsResized',this.editor);}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.cssloadcheck=$.createClass(WE.plugin,{CSS_STATE_NAME:'ck-stylesheets',pollStylesheetsTimer:false,pollStylesheetsTimerDelay:100,currentDelay:0,maxAllowedDelay:10000,lastAnnounced:false,enabled:false,beforeInit:function(){this.enabled=!!$.browser.mozilla&&(parseInt($.browser.version)>=2);if(this.enabled){this.pollStylesheetsTimer=new Timer(this.proxy(this.pollStylesheets),this.pollStylesheetsTimerDelay);this.editor.on('state',this.proxy(this.stateChanged));this.editor.on('editorReady',this.proxy(function(){if(this.editor.ck){this.editor.ck.on('modeSwitchCancelled',this.proxy(function(){this.fireState(this.editor.states.IDLE);}));}}));}},init:function(){if(this.enabled){this.stateChanged(this.editor,this.editor.state);}},stateChanged:function(editor,state){var states=this.editor.states;this.pollStylesheetsTimer.stop();if((state==states.INITIALIZING&&this.editor.mode=='wysiwyg')||state==states.LOADING_VISUAL){this.fireState(states.INITIALIZING);}else if(state==states.IDLE&&this.lastAnnounced==states.INITIALIZING){this.currentDelay=0;this.pollStylesheets();}else{this.fireState(states.IDLE);}},pollStylesheets:function(){this.pollStylesheetsTimer.stop();var ed=this.editor.element;if(ed){var iframe=ed.find('iframe');if(iframe.exists()){var doc=iframe.get(0).contentDocument,head=doc&&$('head',$(doc)),headColor=head&&head.css('color');if((typeof headColor=='string')&&$.inArray(headColor.toLowerCase(),['transparent','rgb(0, 0, 0)','white','#ffffff','#fff'])==-1){this.fireState(this.editor.states.IDLE);return;}}}
this.currentDelay+=this.pollStylesheetsTimerDelay;if(this.currentDelay>this.maxAllowedDelay){this.fireState(this.editor.states.IDLE);return;}
this.pollStylesheetsTimer.start();},fireState:function(state){if(this.lastAnnounced!==state){this.editor.fire('extraState',this.editor,this.CSS_STATE_NAME,state);this.lastAnnounced=state;}}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.edittools=$.createClass(WE.plugin,{LINK_CAPTION_MESSAGE:'editpagelayout-more',DIALOG_TITLE_MESSAGE:'edittools-dialog-title',modal:false,html:false,beforeInit:function(){this.editor.on('mediawikiToolbarRendered',this.proxy(this.mediawikiToolbarRendered));},mediawikiToolbarRendered:function(editor,el){this.html=this.editor.element.find('.mw-editTools').html();if(this.html){var link=$('<span class="cke_toolbar_expand" />');link.html('<a class="expand" href="#" style="display: inline;"><label>'+$.msg(this.LINK_CAPTION_MESSAGE)+'</label><span>+</span></a>');link.click(this.proxy(this.showEdittools));$(el).append(link);}},showEdittools:function(evt){evt&&evt.preventDefault();var title=$.htmlentities(this.editor.msg(this.DIALOG_TITLE_MESSAGE));$.showModal(title,this.html,{callback:function(){$('#EditPageEditTools').delegate('a','click',function(){$('#EditPageEditTools').closeModal();});},id:'EditPageEditTools',width:680,rawHTML:true});}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.loadingstatus=$.createClass(WE.plugin,{requires:['spaces'],MESSAGE_PREFIX:'loadingStates-',extraStates:{},extraStatesCount:0,init:function(){if((this.el=this.editor.getSpace('loading-status'))){this.textEl=this.el.find('.loading-text');this.editarea=this.editor.getSpace('editarea');this.editor.on('state',this.proxy(this.stateChanged));this.editor.on('extraState',this.proxy(this.extraStateChanged));}},extraStateChanged:function(editor,name,state){var states=editor.states;if(state==states.INITIALIZING){if(!this.extraStates[name]){this.extraStates[name]=1;this.extraStatesCount++;this.stateChanged(editor,editor.state);}}else{if(this.extraStates[name]){delete this.extraStates[name];this.extraStatesCount--;this.stateChanged(editor,editor.state);}}},stateChanged:function(editor,state){var states=editor.states,value=false;if(state==states.INITIALIZING){value='loading';}else if(state==states.LOADING_SOURCE){value='toSource';}else if(state==states.LOADING_VISUAL){value='toVisual';}else if(state==states.SAVING){value='saving';}
if(value==false&&this.extraStatesCount>0){return;}
this.set(value);},set:function(state){this.editor.log('loading-status: ',state);if((this.state=state)){var text=this.editor.msg(this.MESSAGE_PREFIX+state);if(state==='saving'&&window.wgSavingMessage){text=window.wgSavingMessage;}
this.textEl.text(text);this.el.show();}else{this.el.hide();this.editor.fire('afterLoadingStatus');}}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.noticearea=$.createClass(WE.plugin,{requires:['spaces'],visible:false,itemClass:'notice-item',itemActionClass:'notice-action',dataAttr:'data-hash',totalItemsCount:0,beforeInit:function(editor){editor.on('notice',this.proxy(this.add));editor.on('editorClick',this.proxy(this.dismissClicked));},initDom:function(editor){var self=this;self.el=editor.getSpace('notices-short');self.ul=self.el.find('ul').first();self.htmlEl=editor.getSpace('notices-html');self.notificationsLink=$('#NotificationsLink > a').click(self.proxy(self.areaClicked));self.notificationsLinkSplotch=self.notificationsLink.children('span');self.notificationsAreaSplotch=self.el.children('.splotch').first();if(!self.notificationsLinkSplotch.exists()){self.notificationsLink.first().prepend(self.notificationsLinkSplotch=$('<span/>'));self.notificationsLinkSplotch.hide();}
self.html=self.htmlEl.html();self.totalItemsCount=self.getCount();self.ul.delegate(' .'+self.itemActionClass,'click',function(ev){ev.stopPropagation();self.areaClicked(ev);}).delegate('.'+self.itemClass,'click',self.proxy(self.areaClicked)).children('.'+self.itemClass+'['+self.dataAttr+']').each(function(){if(self.wasNoticeAlreadyShown(this)){self.markNoticeAsShown(this);}});this.update();},getAllNotices:function(){return this.ul.children('.'+this.itemClass);},getCount:function(){return this.getAllNotices().length;},getTotalCount:function(){return this.totalItemsCount;},getNoticeByHash:function(hash){return this.getAllNotices().filter('['+this.dataAttr+'="'+hash+'"]');},getNotice:function(hashOrElement){var el;if(typeof hashOrElement=='string'){el=this.getNoticeByHash(hashOrElement);}
if(!el||!el.hasClass(this.itemClass)){el=$(hashOrElement);}
return(el.hasClass(this.itemClass))?el:null;},updateSplotch:function(){var val=this.getTotalCount();this.notificationsLinkSplotch.html(val);this.notificationsAreaSplotch.html(val);if(val>0){this.notificationsLinkSplotch.fadeIn('slow');this.notificationsAreaSplotch.fadeIn('slow');}},hideSplotch:function(){this.notificationsLinkSplotch.fadeOut('slow');this.notificationsAreaSplotch.fadeOut('slow');},generateNoticeKey:function(hash){return wgTitle+'-'+hash;},getNoticeAreaStatus:function(){return $.storage.get('WE-Noticearea-status');},setNoticeAreaStatus:function(status){$.storage.set('WE-Noticearea-status',status);},update:function(){var count=this.getCount();if(count>0){this.visible=true;this.updateSplotch();}else{this.visible=false;}
this.el[this.visible?'show':'hide']();},wasNoticeAlreadyShown:function(hashOrElement){this.updateNoticeareaStatus();var notice=this.getNotice(hashOrElement),hash=(notice)?notice.attr(this.dataAttr):null,isMainPageEduNote=this.isNoticeMainPageEduNote(notice),result=false;if(hash&&!isMainPageEduNote){var noticeKey=this.generateNoticeKey(hash),noticeareaStatus=this.getNoticeAreaStatus();if(noticeareaStatus!=null){$.each(noticeareaStatus,function(index,value){if(index==noticeKey){result=true;}});}}
return result;},isNoticeMainPageEduNote:function(notice){var hash=notice.attr(this.dataAttr),result=false;if(hash&&window.mainPageEduNoteHash&&hash==window.mainPageEduNoteHash){result=true;}
return result;},markNoticeAsShown:function(hashOrElement){var notice=this.getNotice(hashOrElement),isMainPageEduNote=this.isNoticeMainPageEduNote(notice);if(notice){var hash=notice.attr(this.dataAttr);if(hash&&!isMainPageEduNote){var ts=(new Date()).getTime()/1000,noticeKey=this.generateNoticeKey(hash),noticeareaStatus=this.getNoticeAreaStatus()||{};noticeareaStatus[noticeKey]=ts;this.setNoticeAreaStatus(noticeareaStatus);}else if(hash&&isMainPageEduNote&&window.wgUserName){$.nirvana.sendRequest({controller:'WikiaUserPropertiesController',method:'performPropertyOperation',data:{handlerName:'EditorUserPropertiesHandler',methodName:'dismissEditorMainPageNotice'},type:'post',format:'json',callback:$.proxy(this.onDismissMainPageNotice,this)});}
notice.remove();}},onDismissMainPageNotice:function(response){if(response.result&&response.result.success!=true){$().log('Noticearea error: wrong during dissmissing main page edu note');if(response.result.error){$().log(response.result.error);}}},updateNoticeareaStatus:function(){var noticeareaStatus=this.getNoticeAreaStatus();if(noticeareaStatus!=null){var currentTs=(new Date()).getTime()/1000,statusTTL=86400,noticeareaStatusUpdated={};$.each(noticeareaStatus,function(index,value){if(currentTs<(value+statusTTL)){noticeareaStatusUpdated[index]=value;}});this.setNoticeAreaStatus(noticeareaStatusUpdated);}},dismissFromNotice:function(notice){this.totalItemsCount=0;this.updateSplotch();this.dismissClicked(notice,true);},areaClicked:function(ev){var self=this,target=$(ev.target);if(target.hasClass(self.itemActionClass)){self.dismissFromNotice(target.closest('.'+self.itemClass));}else{ev.preventDefault();var header=$.htmlentities(self.editor.msg('notices-dialog-title')),content=self.html;if(window.wgCopywarn){content+=window.wgCopywarn;}
$.showModal(header,content,{width:700,onClose:function(){self.dismissFromNotice(ev.target);}});}},dismissClicked:function(sourceElement,hideSplotch){var self=this,notices=self.getNotice(sourceElement)||self.getAllNotices(),clean=function(){notices.each(function(){self.markNoticeAsShown(this);});};if(hideSplotch===true){self.hideSplotch();}
if(notices.length==self.getCount()){self.el.fadeOut('slow',clean);}else{clean();}},add:function(message,type,html){var li=$('<li>').html(message).addClass(this.itemClass+' notice-'+(type||'warning'));this.ul.append(li);if(html){this.html+=html;}else{this.html+='<div>'+message+'</div>';}
this.totalItemsCount++;this.update();return li;}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.railminimumheight=$.createClass(WE.plugin,{requires:['sizechangedevent'],MINIMUM_VIEWPORT_HEIGHT:775,CONTAINER_SELECTOR:'> .rail-auto-height',beforeInit:function(){this.editor.on('sizeChanged',this.proxy(this.delayedResize));},delayedResize:function(){setTimeout(this.proxy(this.resize),10);},resize:function(){var viewportHeight=$(window).height();var el,rail=this.editor.getSpace('rail');if(rail.exists()&&(el=rail.find(this.CONTAINER_SELECTOR))&&el.exists()){if(viewportHeight>this.MINIMUM_VIEWPORT_HEIGHT){el.css({'overflow-y':'hidden','height':'auto'});}else{var h=$('body').height()-el.offset().top-(el.outerHeight(true)-el.height())-$('#WikiaFooter').outerHeight();el.css({'overflow-y':'auto','height':h});}}}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.sizechangedevent=$.createClass(WE.plugin,{initDom:function(){var self=this,editor=this.editor;this.fireResizeEvent();$(window).bind('resize',function(){self.fireResizeEvent();});this.editor.element.bind('resize',function(){self.fireResizeEvent();});},fireResizeEvent:function(){this.editor.fire('sizeChanged',this.editor);}});})(this,jQuery);;(function(window,$){'use strict';var WE=window.WikiaEditor=window.WikiaEditor||(new window.Observable()),templateClassificationForceModal;WE.plugins.templateclassificationeditorplugin=$.createClass(WE.plugin,{init:function(){this.editor.on('save',this.proxy(this.forceType));require(['TemplateClassificationModalForce'],function forceTemplateClassificationModal(tcForce){templateClassificationForceModal=tcForce;});},forceType:function(){return!templateClassificationForceModal.forceType();}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable()),requires=['core','noticearea','loadingstatus','pagecontrols','autoresizer','edittools','widemodemanager','railminimumheight','tracker','cssloadcheck','preloads','leaveconfirm','addfile','editorsurvey'];if(window.enableWikitextSyntaxHighlighting){requires.push('syntaxhighlighterqueueinit');}
if(window.enableTemplateClassificationEditorPlugin){requires.push('templateclassificationeditorplugin');}
WE.plugins.wikiacore=$.createClass(WE.plugin,{requires:requires});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.sourcewidemode=$.createClass(WE.plugin,{requires:['spaces'],className:'editpage-sourcewidemode',wideClassName:'editpage-sourcewidemode-on',narrowClassName:'editpage-sourcewidemode-off',storageEntry:'wgSourceModeWidescreen',triggerClassName:'editpage-widemode-trigger',$rail:null,$toolbar:null,$editpage:null,expandedToolbarBreakpoint:null,initialized:false,enabled:false,trigger:false,wide:false,initNodes:function(){this.$rail=$('#EditPageRail');this.$editpage=$('#EditPage');this.$toolbar=$('#EditPageToolbar .cke_toolbar_source');this.expandedToolbarBreakpoint=this.$toolbar.width()+this.$rail.width();this.initialized=true;},sizeChanged:function(){if(this.initialized){if(this.editor.mode==='source'&&this.wide&&this.$editpage.width()<this.expandedToolbarBreakpoint){this.$editpage.addClass('toolbar-expanded');}else{this.$editpage.removeClass('toolbar-expanded');}}},activate:function(){this.enabled=true;if(this.enabled){this.active=this.editor.mode==='source';this.trigger=this.editor.element.find('.'+this.triggerClassName);this.trigger.click(this.proxy(this.toggle));this.editor.element.addClass(this.className);this.loadState(true);this.editor.on('ck-sourceModeReady',this.modeChanged,this);this.editor.on('toolbarsRendered',this.modeChanged,this);this.editor.on('sizeChanged',this.sizeChanged,this);}},modeChanged:function(){var toolbar=this.editor.getSpace('toolbar');var cssTop=toolbar.offset().top+toolbar.outerHeight(true)-this.trigger.offsetParent().offset().top;this.trigger.css('top',cssTop);if(this.editor.ck){this.editor.ck.fire('resize');}
if(!this.initialized&&this.editor.mode==='source'&&this.wide){this.initNodes();}
$(window).trigger('resize');},toggle:function(){this.setState(!this.getState());this.saveState();this.modeChanged();},loadState:function(initial){var wide=$.storage.get(this.storageEntry)==true;this.editor.log('widescreen::load() - wide = '+(wide?'true':'false'));if(initial){if(typeof this.editor.config.wideInSourceInitial!='undefined'){wide=!!this.editor.config.wideInSourceInitial;this.editor.log('widescreen::load() - wide[2] = '+(wide?'true':'false'));}}
this.setState(wide);},setState:function(wide){this.wide=wide;this.editor.element[wide?'addClass':'removeClass'](this.wideClassName);this.editor.element[!wide?'addClass':'removeClass'](this.narrowClassName);},saveState:function(){$.storage.set(this.storageEntry,this.wide);$.post(window.wgScript+'?action=ajax&rs=EditPageLayoutAjax&method=setWidescreen',{state:this.wide?'1':'0'});},getState:function(){return this.editor.element.hasClass(this.wideClassName);}});WE.plugins.mainpagewidemode=$.createClass(WE.plugin,{requires:['spaces'],enabled:false,initialized:false,pageControlsHeight:false,activate:function(){this.enabled=true;if(this.enabled){this.editor.element.addClass('editpage-visualwidemode');this.editor.on('toolbarsRendered',this.adjustHeights,this);}},init:function(){if(this.enabled){this.editor.fire('mainpagewidemodeinit');}},adjustHeights:function(){var toolbar=this.editor.getSpace('toolbar'),rail=this.editor.getSpace('rail');if(!toolbar.exists()||!rail.exists()){return;}
var deltaToolbar=toolbar.innerHeight()-toolbar.height();toolbar.css('min-height',rail.innerHeight()-deltaToolbar);}});WE.plugins.widemodemanager=$.createClass(WE.plugin,{beforeInit:function(){var config=this.editor.config;if(!config.wideModeDisabled){if(config.toolbars&&(!config.toolbars.rail||config.toolbars.rail.length==0)){this.editor.log('choosing wide mode plugin: mainpage');this.editor.initPlugin('mainpagewidemode').activate();}else{if(!config.wideInSourceDisabled){this.editor.log('choosing wide mode plugin: source');this.editor.initPlugin('sourcewidemode').activate();}}}}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.preloads=$.createClass(WE.plugin,{MIN_HEIGHT:80,EXPANDED_CLASS:'expanded',preloads:[],init:function(){this.preloads=this.editor.element.find('.editpage-intro');this.preloads.each(this.proxy(this.setupPreloadArea));},setupPreloadArea:function(i,area){area=$(area);area.data('expanded',false);var content=area.find('.editpage-intro-wrapper > div'),contentHeight=content.height(),expandLink=area.children('.expand');if(contentHeight>this.MIN_HEIGHT){expandLink.bind('click',this.proxy(this.expand)).show();}},expand:function(ev){var expandLink=$(ev.target).closest('.expand'),area=expandLink.parent(),isExpanded=!!area.data('expanded');area.toggleClass(this.EXPANDED_CLASS).data('expanded',!isExpanded);$(window).trigger('resize');expandLink.children('label').text($.msg('editpagelayout-'+(!isExpanded?'less':'more')));expandLink.children('span').text(!isExpanded?'-':'+');}});})(this,jQuery);;(function(window,$){var WE=window.WikiaEditor=window.WikiaEditor||(new Observable());WE.plugins.leaveconfirm=$.createClass(WE.plugin,{disableLeaveConfirm:false,isDirtyFlag:false,initialContent:false,dialogShown:false,leaveMessage:false,init:function(){this.leaveMessage=$.msg('wikia-editor-leaveconfirm-message');this.editor.on('editorReady',this.proxy(this.onEditorReady));this.editor.on('markDirty',this.proxy(this.onMarkDirty));this.editor.on('state',this.proxy(this.onStateChange));$(window).bind('beforeunload.leaveconfirm',this.proxy(this.onBeforeUnload));$(window).bind('UserLoginSubmit',this.proxy(this.onUserLoginSubmit));$('#wpSummary').on('change',$.proxy(function(){this.editor.fire('markDirty')},this));},onEditorReady:function(){this.initialContent=this.editor.getContent();},onMarkDirty:function(){this.isDirtyFlag=true;this.editor.log('edit page marked as dirty');},onStateChange:function(editor,state){var states=editor.states;switch(state){case states.SAVING:case states.RELOADING:$(window).unbind('.leaveconfirm');break;}},onBeforeUnload:function(ev){if(this.shouldDisplayConfirm()){this.dialogShown=true;if(ev){ev.returnValue=this.leaveMessage;}
return this.leaveMessage;}},onUserLoginSubmit:function(){this.disableLeaveConfirm=true;},isEditorDirty:function(){if(this.editor.ck){return this.editor.ck.checkDirty();}
else{return this.initialContent!=this.editor.getContent();}},isDirty:function(){return this.isDirtyFlag||this.isEditorDirty();},shouldDisplayConfirm:function(){return(!this.disableLeaveConfirm&&this.isDirty());}});})(this,jQuery);;(function(window,$){'use strict';var WE=window.WikiaEditor=window.WikiaEditor||(new window.Observable()),WikiTextSyntaxHighlighter;WE.plugins.syntaxhighlighterqueueinit=$.createClass(WE.plugin,{init:function(){this.editor.on('mode',this.proxy(this.initSyntaxHighlighting));this.editor.on('editorReady',this.proxy(this.initSyntaxHighlighting));require(['WikiTextSyntaxHighlighter'],this.proxy(function(syntaxHighlighter){WikiTextSyntaxHighlighter=syntaxHighlighter;this.initSyntaxHighlighting();}));},initConfig:function(){var config;if(window.wgIsDarkTheme){config=this.initDarkThemeColors();}else{config=this.initLightThemeColors();}
return config;},initSyntaxHighlighting:function(){if(WikiTextSyntaxHighlighter){if(this.editor.mode==='source'){var textarea=this.editor.getEditbox()[0],config=this.initConfig();WikiTextSyntaxHighlighter.init(textarea,config);}else{WikiTextSyntaxHighlighter.reset();}}},initDarkThemeColors:function(){return{boldOrItalicColor:'#44466d',commentColor:'#4d1a19',entityColor:'#474d23',externalLinkColor:'#244d491',headingColor:'#44466d',hrColor:'#44466d',listOrIndentColor:'#4d1a19',parameterColor:'#66331e',signatureColor:'#66331e',tagColor:'#662946',tableColor:'#5e5129',templateColor:'#5e5129',wikilinkColor:'#245477'};},initLightThemeColors:function(){return{boldOrItalicColor:'#e4e5f3',commentColor:'#f8dbda',entityColor:'#e8ebda',externalLinkColor:'#dbeceb',headingColor:'#e4e5f3',hrColor:'#e4e5f3',listOrIndentColor:'#f8dbda',parameterColor:'#f5e0d8',signatureColor:'#f5e0d8',tagColor:'#f6dde9',tableColor:'#f0ebdb',templateColor:'#f0ebdb',wikilinkColor:'#d9eaf6'};}});})(this,jQuery);;define('WikiTextSyntaxHighlighter',['wikia.window','wikia.document','wikia.log'],function(window,document,log){'use strict';var highlightSyntaxIfNeededIntervalId,highlightSyntaxInputTimeoutId,initialized=false,lastText,maxSpanNumber,syntaxHighlighterConfig,syntaxStyleTextNode,wpTextbox0,wpTextbox1,assumedBold,assumedItalic,before,css,lastColor,parserLocation,spanNumber,text,defaultBreakerRegex,headingBreakerRegex,namedExternalLinkBreakerRegex,parameterBreakerRegex,tableBreakerRegex,tagBreakerRegexCache,templateBreakerRegex,wikilinkBreakerRegex,breakerRegexBase;breakerRegexBase="\\[(?:\\[|(?:https?:|ftp:)?//|mailto:)|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-\\.\u00B7\u0300-\u036F\u203F-\u203F-\u2040]*(?=/?>| |\n)|!--[^]*?-->\n*)|(?:https?://|ftp://|mailto:)[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|&(?:(?:n(?:bsp|dash)|m(?:dash|inus)|lt|e[mn]sp|thinsp|amp|quot|gt|shy|zwn?j|lrm|rlm|Alpha|Beta|Epsilon|Zeta|Eta|Iota|Kappa|[Mm]u|micro|Nu|[Oo]micron|[Rr]ho|Tau|Upsilon|Chi)|#x[0-9a-fA-F]+);\n*";function breakerRegexWithPrefix(prefix){return new RegExp('('+prefix+')\n*|'+breakerRegexBase,'gm');}
function writeText(text,color){if(color!==lastColor){css+='\'}#s'+spanNumber;if(before){css+=':before{';before=false;}
else{css+=':after{';before=true;++spanNumber;}
if(color){css+='background-color:'+color+';';}
css+='content:\'';lastColor=color;}
css+=text;}
function highlightSyntax(){var startTime,endTime,diffTime,fragment;lastText=wpTextbox1.value;text=lastText.replace(/['\\]/g,'\\$&')+'\n';parserLocation=0;before=true;css='';lastColor=undefined;spanNumber=0;assumedBold=false;assumedItalic=false;startTime=Date.now();highlightBlock('',defaultBreakerRegex);if(parserLocation<text.length){writeText(text.substring(parserLocation),'');}
endTime=Date.now();diffTime=endTime-startTime;if(diffTime>syntaxHighlighterConfig.timeout){resetHighlightSyntax(diffTime);return;}
if(maxSpanNumber<spanNumber){fragment=document.createDocumentFragment();do{fragment.appendChild(document.createElement('span')).id='s'+(++maxSpanNumber);}
while(maxSpanNumber<spanNumber);wpTextbox0.appendChild(fragment);}
syntaxStyleTextNode.nodeValue=css.substring(2).replace(/\n/g,'\\A ')+'\'}';}
function resetHighlightSyntax(diffTime){if(initialized){clearInterval(highlightSyntaxIfNeededIntervalId);wpTextbox1.removeEventListener('keydown',debouncedHighlightSyntax);wpTextbox1.removeEventListener('scroll',syncScrollX);wpTextbox1.removeEventListener('scroll',syncScrollY);syntaxStyleTextNode.nodeValue='';if(diffTime){log('Syntax highlighting took too long. The maximum allowed '+'highlighting time is '+syntaxHighlighterConfig.timeout+', and your computer took '+diffTime+'.');}}}
function highlightBlock(color,breakerRegex){var match,endIndexOfLastColor,tagEnd,tagName,stopAfter,endIndex;for(breakerRegex.lastIndex=parserLocation;match=breakerRegex.exec(text);breakerRegex.lastIndex=parserLocation){if(match[1]){writeText(text.substring(parserLocation,breakerRegex.lastIndex),color);parserLocation=breakerRegex.lastIndex;return;}
endIndexOfLastColor=breakerRegex.lastIndex-match[0].length;if(parserLocation<endIndexOfLastColor){writeText(text.substring(parserLocation,endIndexOfLastColor),color);}
parserLocation=breakerRegex.lastIndex;switch(match[0].charAt(0)){case'[':if(match[0].charAt(1)==='['){writeText('[[',syntaxHighlighterConfig.wikilinkColor||color);highlightBlock(syntaxHighlighterConfig.wikilinkColor||color,wikilinkBreakerRegex);}
else{writeText(match[0],syntaxHighlighterConfig.externalLinkColor||color);highlightBlock(syntaxHighlighterConfig.externalLinkColor||color,namedExternalLinkBreakerRegex);}
break;case'{':if(match[0].charAt(1)==='{'){if(match[0].length===3){writeText('{{{',syntaxHighlighterConfig.parameterColor||color);highlightBlock(syntaxHighlighterConfig.parameterColor||color,parameterBreakerRegex);}
else{writeText('{{',syntaxHighlighterConfig.templateColor||color);highlightBlock(syntaxHighlighterConfig.templateColor||color,templateBreakerRegex);}}
else{writeText('{|',syntaxHighlighterConfig.tableColor||color);highlightBlock(syntaxHighlighterConfig.tableColor||color,tableBreakerRegex);}
break;case'<':if(match[0].charAt(1)==='!'){writeText(match[0],syntaxHighlighterConfig.commentColor||color);break;}
else{tagEnd=text.indexOf('>',parserLocation)+1;tagName=match[0].substring(1);if(tagEnd===0){writeText('<',color);parserLocation=parserLocation-match[0].length+1;break;}
if(text.charAt(tagEnd-2)==='/'||tagName==='br'){writeText(text.substring(parserLocation-match[0].length,tagEnd),syntaxHighlighterConfig.tagColor||color);parserLocation=tagEnd;}
else if(/^(?:nowiki|pre|math|syntaxhighlight|source|timeline|hiero)$/.test(tagName)){stopAfter='</'+tagName+'>';endIndex=text.indexOf(stopAfter,parserLocation);if(endIndex===-1){endIndex=text.length;}
else{endIndex+=stopAfter.length;}
writeText(text.substring(parserLocation-match[0].length,endIndex),syntaxHighlighterConfig.tagColor||color);parserLocation=endIndex;}
else{writeText(text.substring(parserLocation-match[0].length,tagEnd),syntaxHighlighterConfig.tagColor||color);parserLocation=tagEnd;if(!tagBreakerRegexCache[tagName]){tagBreakerRegexCache[tagName]=breakerRegexWithPrefix('</'+tagName+'>');}
highlightBlock(syntaxHighlighterConfig.tagColor||color,tagBreakerRegexCache[tagName]);}}
break;case'h':case'f':case'm':writeText(match[0],syntaxHighlighterConfig.externalLinkColor||color);break;case'=':if(/[^=]=+$/.test(text.substring(parserLocation,text.indexOf('\n',parserLocation)))){writeText('=',syntaxHighlighterConfig.headingColor||color);highlightBlock(syntaxHighlighterConfig.headingColor||color,headingBreakerRegex);}
else{writeText('=',color);}
break;case'*':case'#':case':':writeText(match[0],syntaxHighlighterConfig.listOrIndentColor||color);break;case';':writeText(';',syntaxHighlighterConfig.headingColor||color);highlightBlock(syntaxHighlighterConfig.headingColor||color,headingBreakerRegex);break;case'-':writeText(match[0],syntaxHighlighterConfig.hrColor||color);break;case'\\':writeText(match[0],syntaxHighlighterConfig.boldOrItalicColor||color);if(match[0].length===6){if(assumedBold){assumedBold=false;return;}
else{assumedBold=true;highlightBlock(syntaxHighlighterConfig.boldOrItalicColor||color,defaultBreakerRegex);}}
else{if(assumedItalic){assumedItalic=false;return;}
else{assumedItalic=true;highlightBlock(syntaxHighlighterConfig.boldOrItalicColor||color,defaultBreakerRegex);}}
break;case'&':writeText(match[0],syntaxHighlighterConfig.entityColor||color);break;case'~':writeText(match[0],syntaxHighlighterConfig.signatureColor||color);}}}
function syncScrollX(){wpTextbox0.scrollLeft=wpTextbox1.scrollLeft;}
function syncScrollY(){wpTextbox0.scrollTop=wpTextbox1.scrollTop;}
function debouncedHighlightSyntax(e){var key=e.which;if(highlightSyntaxInputTimeoutId){clearTimeout(highlightSyntaxInputTimeoutId);}
if(key===13||key===8){setTimeout(highlightSyntax,0);}else{highlightSyntaxInputTimeoutId=setTimeout(highlightSyntax,100);}}
function highlightSyntaxIfNeeded(){if(wpTextbox1.value!==lastText){highlightSyntax();}
if(wpTextbox1.scrollLeft!==wpTextbox0.scrollLeft){syncScrollX();}
if(wpTextbox1.scrollTop!==wpTextbox0.scrollTop){syncScrollY();}
if(wpTextbox1.offsetHeight!==wpTextbox0.offsetHeight){wpTextbox0.style.height=wpTextbox1.offsetHeight+'px';}}
function setup(textarea){var focus,scrollTop,syntaxStyleElement,textboxContainer,wpTextbox1Style;wpTextbox0=document.createElement('div');wpTextbox0.id='wpTextbox0';wpTextbox1=textarea;wpTextbox1.id='wpTextbox1';wpTextbox1.classList.add('highlighted');syntaxHighlighterConfig.timeout=syntaxHighlighterConfig.timeout||100;textboxContainer=document.createElement('div');syntaxStyleElement=document.createElement('style');syntaxStyleTextNode=syntaxStyleElement.appendChild(document.createTextNode(''));wpTextbox1Style=window.getComputedStyle(wpTextbox1);scrollTop=wpTextbox1.scrollTop;focus=(document.activeElement===wpTextbox1);wpTextbox0.dir=wpTextbox1.dir;wpTextbox0.lang=wpTextbox1.lang;wpTextbox0.style.backgroundColor=wpTextbox1Style.backgroundColor;wpTextbox0.style.fontFamily=wpTextbox1Style.fontFamily;wpTextbox0.style.fontSize=wpTextbox1Style.fontSize;wpTextbox0.style.resize=(wpTextbox1Style.resize==='vertical'||wpTextbox1Style.resize==='both'?'vertical':'none');wpTextbox0.style.tabSize=wpTextbox1Style.tabSize;wpTextbox1.style.cssText+='background-color: transparent !important';wpTextbox1.style.fontSize=wpTextbox1Style.fontSize;wpTextbox1.style.resize=wpTextbox0.style.resize;wpTextbox0.style.height=wpTextbox1.offsetHeight+'px';wpTextbox1.style.height=wpTextbox0.style.height;textboxContainer.style.clear='both';textboxContainer.style.position='relative';wpTextbox1.parentNode.insertBefore(textboxContainer,wpTextbox1);textboxContainer.appendChild(wpTextbox1);textboxContainer.appendChild(wpTextbox0);wpTextbox0.scrollTop=scrollTop;wpTextbox1.scrollTop=scrollTop;if(focus){wpTextbox1.focus();}
$('.tool-select *').css({zIndex:5});document.head.appendChild(syntaxStyleElement);$(wpTextbox1).on('keydown',debouncedHighlightSyntax);wpTextbox1.addEventListener('scroll',syncScrollX);wpTextbox1.addEventListener('scroll',syncScrollY);highlightSyntaxIfNeededIntervalId=setInterval(highlightSyntaxIfNeeded,500);highlightSyntax();initialized=true;}
function queueSetup(textarea){setTimeout(function(){setup(textarea);},0);}
function init(textarea,config){maxSpanNumber=-1;defaultBreakerRegex=new RegExp(breakerRegexBase,'gm');wikilinkBreakerRegex=breakerRegexWithPrefix(']][a-zA-Z]*');namedExternalLinkBreakerRegex=breakerRegexWithPrefix(']');parameterBreakerRegex=breakerRegexWithPrefix('}}}');templateBreakerRegex=breakerRegexWithPrefix('}}');tableBreakerRegex=breakerRegexWithPrefix('\\|}');headingBreakerRegex=breakerRegexWithPrefix('\n');tagBreakerRegexCache={};syntaxHighlighterConfig=config;if(document.readyState==='complete'){queueSetup(textarea);}
else{$(window).load(queueSetup(textarea));}}
return{init:init,reset:resetHighlightSyntax};});;(function(window,$){'use strict';var buttons=window.wgEditorExtraButtons,extensionsPath=window.wgExtensionsPath,mediawikiButtons=window.mwCustomEditButtons;if(!buttons){buttons=window.wgEditorExtraButtons={};}
function checkGallery(){return typeof window.WikiaPhotoGallery!=='undefined'&&!window.wgEnableMediaGalleryExt;}
function getTextarea(){return WikiaEditor.getInstance().getEditbox()[0];}
buttons.InsertImage={type:'button',labelId:'wikia-editor-media-image',titleId:'wikia-editor-media-image-tooltip',className:'RTEImageButton',forceLogin:true,clicksource:function(){WikiaEditor.load('WikiaMiniUpload').done(function(){WMU_show();});},ckcommand:'addimage'};buttons.InsertGallery={type:'button',labelId:'wikia-editor-media-gallery',titleId:'wikia-editor-media-gallery-tooltip',className:'RTEGalleryButton',forceLogin:true,clicksource:function(){WikiaPhotoGallery.showEditor({from:'source',type:WikiaPhotoGallery.TYPE_GALLERY});},ckcommand:'addgallery',precondition:checkGallery};buttons.InsertSlideshow={type:'button',labelId:'wikia-editor-media-slideshow',titleId:'wikia-editor-media-slideshow-tooltip',className:'RTESlideshowButton',forceLogin:true,clicksource:function(){WikiaPhotoGallery.showEditor({from:'source',type:WikiaPhotoGallery.TYPE_SLIDESHOW});},ckcommand:'addslideshow',precondition:checkGallery};buttons.InsertSlider={type:'button',labelId:'wikia-editor-media-slider',titleId:'wikia-editor-media-slider-tooltip',className:'RTESliderButton',forceLogin:true,clicksource:function(){WikiaPhotoGallery.showEditor({from:'source',type:WikiaPhotoGallery.TYPE_SLIDER});},ckcommand:'addslider',precondition:checkGallery};if(window.wgEnableVideoToolExt){buttons.InsertVideo={type:'button',labelId:'wikia-editor-media-video',titleId:'wikia-editor-media-video-tooltip',className:'RTEVideoButton',forceLogin:true,clicksource:function(){WikiaEditor.load('VideoEmbedTool').done(function(){window.vetWikiaEditor({target:{id:'mw-editbutton-vet'}});});},ckcommand:'addvideo'};}
buttons.SourceBold={type:'button',labelId:'wikia-editor-source-bold',titleId:'wikia-editor-source-bold-tooltip',className:'cke_button_bold',clicksource:function(){insertTags("'''","'''",'Bold text',getTextarea());}};buttons.SourceItalic={type:'button',labelId:'wikia-editor-source-italic',titleId:'wikia-editor-source-italic-tooltip',className:'cke_button_italic',clicksource:function(){insertTags("''","''",'Italic text',getTextarea());}};buttons.SourceLink={type:'button',labelId:'wikia-editor-source-link',titleId:'wikia-editor-source-link-tooltip',className:'cke_button_link',clicksource:function(){insertTags('[[',']]','Link title',getTextarea());}};if(window.skin==='oasis'&&mediawikiButtons){if(window.wgEnableWikiaMiniUploadExt){mediawikiButtons.push({imageFile:extensionsPath+'/wikia/WikiaMiniUpload/images/button_wmu.png',speedTip:wmu_imagebutton,imageId:'mw-editbutton-wmu',onclick:function(){WikiaEditor.load('WikiaMiniUpload').done(function(){WMU_show();});}});}
if(window.wgEnableWikiaPhotoGalleryExt&&!window.wgEnableMediaGalleryExt){mediawikiButtons.push({imageFile:extensionsPath+'/wikia/WikiaPhotoGallery/images/gallery_add.png',speedTip:window.WikiaPhotoGalleryAddGallery,imageId:'mw-editbutton-wpg',onclick:function(){WikiaPhotoGallery.showEditor({from:'source'});}});}
if(window.wgEnableVideoToolExt&&window.showAddVideoBtn){mediawikiButtons.push({imageFile:extensionsPath+'/wikia/VideoEmbedTool/images/button_vet.png',speedTip:$.msg('vet-imagebutton'),imageId:'mw-editbutton-vet',onclick:function(event){WikiaEditor.load('VideoEmbedTool').done(function(){window.vetWikiaEditor(event);});}});}}})(window,jQuery);;(function(window){var WE=window.WikiaEditor;WE.modules.Container=$.createClass(WE.modules.base,{items:false,modules:false,moduleEls:false,init:function(){if(this.options.items&&!this.items){this.items=this.options.items;}
this.modules={};this.moduleEls={};var modules=this.modules;function traverse(item){if(typeof item=='string'){modules[item]=false;}else if($.isArray(item)){for(var i=0;i<item.length;i++){traverse(item[i]);}}else{traverse(item.items);}}
traverse(this.items);var module=false;for(var name in modules){modules[name]=this.editor.modules.create(name);}},afterRenderChild:function(no,module,el){return el;},renderChildren:function(el,children){var childEls=[];for(var i=0;i<children.length;i++){var child=children[i],childEl=false;if(typeof child=='string'){if(this.modules[child]){childEl=this.modules[child].render();}
if(childEl){this.moduleEls[child]=childEl;}
if(childEl){childEl=this.afterRenderChild(child,this.modules[child],childEl);}}else{childEl=$('<div>');if(child['cls'])childEl.addClass(child.cls);childEl=this.renderChildren(childEl,child.items);}
if(childEl)
childEls.push(childEl);}
if(childEls.length==0){return false;}
for(var i=0;i<childEls.length;i++){if(childEls[i])
el.append(childEls[i]);}
return el;},modeChanged:function(){var mode=this.editor.mode;for(var name in this.modules){if(this.modules[name]&&this.moduleEls[name]){var module=this.modules[name];if(typeof module.modes=='object'){module[module.modes[mode]?'show':'hide']();}}}},render:function(){var el=this.options.element||$('<div>');el.addClass(this.containerClass);this.el=this.renderChildren(el,this.items)||el;return this.el;},afterAttach:function(){for(var name in this.modules){if(this.modules[name]&&this.moduleEls[name]){this.modules[name].afterAttach();this.afterAttachChild(this.modules[name],this.moduleEls[name]);}}
this.editor.on('mode',this.modeChanged,this);this.modeChanged();},afterAttachChild:function(module,el){}});WE.modules.container=WE.modules.Container;})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.RailContainer=$.createClass(WE.modules.Container,{afterRenderChild:function(no,module,el){el=WE.modules.RailContainer.superclass.afterRenderChild.call(this,no,module,el);var html='';var headerText=module.getHeaderText();var headerClass=module.getHeaderClass();var collapse='<img src="'+wgBlankImgUrl+'" class="chevron collapse" />';html+='<div class="module module_'+headerClass+'" data-id="'+headerClass+'">';html+=headerText?'<h3><span>'+($.htmlentities(headerText)||'')+'</span>'+collapse+'</h3>':'';html+='<div class="module_content"></div>';html+='</div>';var wrapper=$(html);wrapper.find('.module_content').append(el);var headerDom=wrapper.find('h3').first().children('span').first();module.on({headerchange:function(module,text){headerDom.text(text);},hide:function(){wrapper.hide();},show:function(){wrapper.show();}});this.editor.collapsiblemodules&&this.editor.collapsiblemodules.add(this,wrapper);return wrapper;}});WE.modules.railcontainer=WE.modules.RailContainer;})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.ButtonsList=$.createClass(WE.modules.base,{items:[],getItems:function(){return this.items;},template:'<span class="{{className}}">{{#elements}}{{{.}}}{{/elements}}</span>',getData:function(){var items=this.getItems(),elements=[];for(var n=0;n<items.length;n++){elements.push(this.ui.create(items[n]));}
return{className:'cke_buttons cke_toolbar_'+this.headerClass,elements:elements};}});})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.Format=$.createClass(WE.modules.ButtonsList,{headerClass:'format',items:['Bold','Italic','Link','|','BulletedList','NumberedList','Indent','Outdent','|','Format','JustifyLeft','JustifyCenter','JustifyRight','|','Undo','Redo']});})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.FormatExpanded=$.createClass(WE.modules.ButtonsList,{headerClass:'format_expanded',items:['Underline','Strike','Signature'],storageEntry:'wgFormatToolbarExpandState',buttonsTemplate:'<div class="cke_toolbar_expand">'+'<a class="expand"><label>{{more}}</label><span>+</span></a>'+'<a class="collapse"><label>{{less}}</label><span>-</span></a>'+'</div>',afterAttach:function(){var buttonsData={more:$.msg('editpagelayout-more'),less:$.msg('editpagelayout-less')};this.buttons=$(Mustache.render(this.buttonsTemplate,buttonsData));this.buttons.insertAfter(this.el);this.expandButton=this.buttons.find('.expand');this.collapseButton=this.buttons.find('.collapse');var self=this;this.expandButton.bind('click',function(ev){self.expand(true);});this.collapseButton.bind('click',function(ev){self.expand(false);});this.show();},readState:function(){if(this.editor.config.formatExpanded){return true;}
return $.storage.get(this.storageEntry)||false;},saveState:function(isExpanded){if(!this.editor.config.formatExpanded){$.storage.set(this.storageEntry,isExpanded===true);}},show:function(){var isShown=this.readState();this.expand(isShown);this.buttons.show();},hide:function(){this.el.hide();this.buttons.hide();},expand:function(expand){if(expand){this.el.show();this.expandButton.hide();this.collapseButton.show();}
else{this.el.hide();this.expandButton.show();this.collapseButton.hide();}
this.saveState(expand);this.editor.element.trigger('resize');}});})(this);;(function(window){var WE=window.WikiaEditor,items;items=['InsertImage','InsertGallery','InsertSlideshow','InsertSlider','InsertMedia','Poll','Table'];if(window.showAddVideoBtn){items.splice(4,0,'InsertVideo');}
WE.modules.Insert=$.createClass(WE.modules.ButtonsList,{modes:true,headerClass:'insert',headerTextId:'insert-title',cuttingPosition:false,cuttingText:false,items:items,init:function(){WE.modules.Insert.superclass.init.call(this);this.editor.on('beforemediawikibutton',this.beforeMediawikiButton,this);if(this.editor.config.insertCutPosition>=0&&this.editor.config.insertCutText){this.cuttingPosition=this.editor.config.insertCutPosition;this.cuttingText=this.editor.config.insertCutText;}},beforeMediawikiButton:function(editor,button){var disabled={'mw-editbutton-wmu':1,'mw-editbutton-wpg':1,'mw-editbutton-vet':1};return typeof button.imageId==='undefined'||typeof disabled[button.imageId]==='undefined';},afterRender:function(){WE.modules.Insert.superclass.afterRender.call(this);var buttons=this.el.find('.cke_button'),link;buttons.addClass('cke_button_big');if(this.cuttingPosition!==false){buttons.slice(this.cuttingPosition).hide();link=$('<a>').addClass('cke_more_buttons').html(this.cuttingText).click(function(){link.remove();buttons.show();});this.el.append(link);}}});WE.modules.ToolbarInsert=WE.modules.Insert;WE.modules.RailInsert=WE.modules.Insert;})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.License=$.createClass(WE.modules.base,{modes:true,headerClass:'license',template:'<p class="{{wrapperClass}}">{{{text}}}</p>',defaultLicense:'CC-BY-SA',getData:function(){var icons='',wrapperClass='cke_license';if(window.wgRightsText==this.defaultLicense){icons='<img src="'+wgBlankImgUrl+'" class="cke_license_icon icon1">'+'<img src="'+wgBlankImgUrl+'" class="cke_license_icon icon2">';wrapperClass+=' cke_license_with_icons';}
var text=$.msg('wikia-editor-modules-license-text',icons,window.wgEditPageLicensingUrl,window.wgRightsText);text=text.replace('<a href','<a target="_blank" href');return{text:text,wrapperClass:wrapperClass};}});WE.modules.ToolbarLicense=WE.modules.License;WE.modules.RailLicense=WE.modules.License;})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.ModeSwitch=$.createClass(WE.modules.ButtonsList,{modes:true,headerClass:'mode_switch',items:['ModeSource','ModeWysiwyg','|']});})(this);;(function(window){var WikiaEditor=window.WikiaEditor,wgCategorySelect=window.wgCategorySelect;WikiaEditor.modules.Categories=$.createClass(WikiaEditor.modules.base,{modes:true,headerClass:'categories',headerTextId:'categories-title',template:'<div></div>',data:{},init:function(){WikiaEditor.modules.Categories.superclass.init.call(this);this.enabled=this.editor.config.categorySelectEnabled;},afterAttach:function(){var $categories=$('#categories'),$categorySelect=$('#CategorySelect'),namespace='categorySelect',editor=WikiaEditor.getInstance();this.el.replaceWith($categorySelect);this.el=$categorySelect;$categorySelect.categorySelect({animations:{remove:{options:{duration:400},properties:{opacity:0,height:0}}},popover:{placement:'top'}}).on('add.'+namespace,function(event,cs,data){cs.elements.list.append(data.element);}).on('update.'+namespace,function(event){$categories.val(JSON.stringify($categorySelect.data('categorySelect').getData()));editor.fire('markDirty');});}});WikiaEditor.modules.ToolbarCategories=$.createClass(WikiaEditor.modules.ButtonsList,{modes:true,headerClass:'categories_button',init:function(){WikiaEditor.modules.ToolbarCategories.superclass.init.call(this);this.enabled=this.editor.config.categorySelectEnabled;},items:['CategoriesButton']});WikiaEditor.modules.RailCategories=WikiaEditor.modules.Categories;window.wgEditorExtraButtons['CategoriesButton']={type:'modulebutton',label:$.msg('wikia-editor-modules-categories-title'),title:$.msg('wikia-editor-modules-categories-title'),module:'RailCategories',autorenderpanel:true};})(window);;(function(window){var WE=window.WikiaEditor;WE.modules.Templates=$.createClass(WE.modules.ButtonsList,{modes:true,headerClass:'templates',headerTextId:'templates-title',items:false,usedTemplates:false,init:function(){this.items=[];var list=this.editor.config.popularTemplates||[];for(var i=0;i<list.length;i++){var templateName=list[i],buttonId='Template_Popular'+i,self=this,label=this.msg('templates-add-tooltip',templateName);this.editor.ui.addElement(buttonId,{type:'button',label:templateName,title:label,clicksource:(function(templateName){var buttonId=i+1;return function(sourceEditor){insertTags('{{'+templateName,'}}','');};})(templateName),ckcommand:'InsertTemplate',clickdatawysiwyg:{templateName:templateName,buttonId:i}});this.items.push(buttonId);}},getLinkHtml:function(cls,msg,fn){var fnId=this.editor.addFunction(fn);return'<li class="'+cls+'"><a onclick="WikiaEditor.callFunction('+fnId+')">'
+this.msg('templates-'+msg)+'</a></li>'},getTemplate:function(){var self=this;var tmpl=WE.modules.Templates.superclass.getTemplate.call(this);tmpl+='<ul class="text-links">';if(typeof window.RTE!='undefined'){tmpl+=this.getLinkHtml('tmpl_other','otherTemplates',function(){self.openTemplatesShowcase();});}
tmpl+=this.getLinkHtml('tmpl_listused','showUsedList',function(){self.showUsedTemplates();});if(typeof window.PLBMakeLayoutUrl!='undefined'){tmpl+=this.getLinkHtml('tmpl_makelayout','makeLayout',function(){self.makeLayoutFromPage();});}
tmpl+='</ul>';return tmpl;},modeChanged:function(){this.el.filter('.cke_text_links')[this.editor.mode=='wysiwyg'?'show':'hide']();this.el.find('.cke_text_links')[this.editor.mode=='wysiwyg'?'show':'hide']();this.el.find('.tmpl_other')[this.editor.mode=='wysiwyg'?'show':'hide']();},afterRender:function(){WE.modules.Templates.superclass.afterRender.call(this);this.el.find('.cke_button').addClass('cke_button_big');this.editor.bind({mode:this.modeChanged,scope:this});this.modeChanged();},openTemplatesShowcase:function(){RTE.templateEditor.createTemplateEditor(false);},showUsedTemplates:function(){var self=this;if(self.usedTemplates===false){self.usedTemplates=true;var url=window.wgEditPageHandler.replace('$1',encodeURIComponent(window.wgEditedTitle));return $.post(url,{method:'getTemplatesList',},function(data){if(typeof data.templates=='undefined'){return;}
var list=$('<div>');list.html(data.templates);list.children().not('ul').remove();list.find('a').attr('target','_blank');self.usedTemplates=list.html();self.showUsedTemplates();},'json');}else if(self.usedTemplates===true){}else{$.showModal(this.msg('templates-showUsedList-dialog-title'),self.usedTemplates,{width:400});}},makeLayoutFromPage:function(){if(typeof window.PLBMakeLayoutUrl!='undefined'){$.confirm({title:this.msg('templates-makeLayout-confirmation-title'),content:this.msg('templates-makeLayout-confirmation-text'),width:500,onOk:function(){$("#editform").attr("action",window.PLBMakeLayoutUrl).submit();}});}else{}}});WE.modules.ToolbarTemplates=$.createClass(WE.modules.ButtonsList,{modes:true,headerClass:'templates_button',items:['TemplatesButton']});WE.modules.RailTemplates=WE.modules.Templates;window.wgEditorExtraButtons['TemplatesButton']={type:'modulebutton',label:$.msg('wikia-editor-modules-templates-title'),title:$.msg('wikia-editor-modules-templates-title'),module:'RailTemplates'};})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.ToolbarMediawiki=$.createClass(WE.modules.base,{modes:{source:true},toolbarBuilt:false,template:'<div class="cke_toolbar_source" id="cke_toolbar_source_{{id}}"></div>',getData:function(){return{id:this.id};},init:function(){WE.modules.ToolbarMediawiki.superclass.init.call(this);this.id=WE.modules.ToolbarMediawiki.nextId++;},copyFromToolbar:function(){var els=$('#toolbar').children().not('script');if(els.exists()&&this.toolbarBuilt){$(this.toolbarNode).append(els);}},buildToolbar:function(toolbarNode){var editor=this.editor,i,len,addButton=function(button){if(editor.fire('beforemediawikibutton',editor,button)){mw.toolbar.insertButton.apply(mw.toolbar,button);}};mw.toolbar.$toolbar=$(toolbarNode);for(i=0,len=mw.toolbar.buttons.length;i<len;i++){addButton(mw.toolbar.buttons[i]);}
for(i=0,len=mwCustomEditButtons.length;i<len;i++){var c=mwCustomEditButtons[i];addButton([c.imageFile,c.speedTip,c.tagOpen,c.tagClose,c.sampleText,c.imageId,c.selectText,c.onclick]);}
GlobalTriggers.fire("beforeMWToolbarRender",toolbarNode);this.toolbarNode=toolbarNode;this.toolbarBuilt=true;this.copyFromToolbar();setTimeout($.proxy(this.copyFromToolbar,this),1000);this.editor.fire('mediawikiToolbarRendered',this.editor,$(this.toolbarNode));this.editor.log('loading source mode toolbar');},afterRender:function(){this.editor.on({mode:this.modeChanged,scope:this});this.modeChanged();},modeChanged:function(){var mode=this.editor.mode;if(mode=='source'){if(!this.toolbarBuilt&&typeof mw.toolbar!='undefined'){this.buildToolbar(this.el.get(0));}}}});WE.modules.ToolbarMediawiki.nextId=1;})(this);;(function(window){var WE=window.WikiaEditor;WE.modules.ToolbarWidescreen=$.createClass(WE.modules.Container,{modes:true,containerClass:'cke_toolbar_widescreen',items:['ToolbarInsert',{cls:'right right-top',items:['ToolbarCategories','ToolbarTemplates']},{cls:'right right-bottom',items:['ToolbarLicense']}]});})(this);;