
define('ext.wikia.spitfires.experiments.tracker',['wikia.tracker','wikia.abTest','wikia.cookies'],function(tracker,abTest,cookies){'use strict';var track=tracker.buildTrackingFunction({category:'spitfires-contribution-experiments',trackingMethod:'analytics'}),freshlyRegisteredExperimentId=5654433460,usersWithoutEditExperimentId=5735670451;function trackVerboseClick(experiment,label){trackClick(prepareStructuredLabel(experiment,label));}
function trackVerboseImpression(experiment,label){trackImpression(prepareStructuredLabel(experiment,label));}
function trackVerboseSuccess(experiment,label){trackSuccess(prepareStructuredLabel(experiment,label));}
function trackClick(label){track({action:tracker.ACTIONS.CLICK,label:label});}
function trackImpression(label){track({action:tracker.ACTIONS.IMPRESSION,label:label});}
function trackSuccess(label){track({action:tracker.ACTIONS.SUCCESS,label:label});}
function getUserStatus(){if(cookies.get('newlyregistered')){return'newlyregistered';}else if(cookies.get('userwithoutedit')){return'userwithoutedit';}else{return'userStatusNaN';}}
function getVariationName(){if(window.optimizely.activeExperiments.indexOf(freshlyRegisteredExperimentId)!==-1){return window.optimizely.variationNamesMap[freshlyRegisteredExperimentId].toLowerCase();}
return window.optimizely.variationNamesMap[usersWithoutEditExperimentId].toLowerCase();}
function prepareStructuredLabel(experiment,label){var group=getVariationName(),userStatusLabel=getUserStatus();return[experiment,group,userStatusLabel,label].join('-');}
return{trackVerboseClick:trackVerboseClick,trackVerboseImpression:trackVerboseImpression,trackVerboseSuccess:trackVerboseSuccess};});;define('VisualEditorTourExperiment',['jquery','wikia.loader','wikia.mustache','mw','ext.wikia.spitfires.experiments.tracker'],function($,loader,mustache,mw,tracker){'use strict';var EXPERIMENT_NAME='contribution-experiments';function Tour(tourConfig){this.tourConfig=tourConfig;this.steps=[];}
Tour.prototype.start=function(){this.step=-1;loader({type:loader.MULTI,resources:{mustache:'extensions/wikia/VisualEditorTourExperiment/templates/'+'VisualEditorTourExperiment_content.mustache'}}).done(this._setupTour.bind(this));};Tour.prototype.destroyStep=function(step){var tourStepData=this.steps[step],$element=tourStepData?tourStepData.$element:null;if($element){$element.popover('destroy');}};Tour.prototype.openStep=function(step){var tourStepData=this.steps[step],$element=tourStepData?tourStepData.$element:null;if(!$element){return;}
$element.popover({content:tourStepData.content,html:true,placement:this.tourConfig[step].placement,trigger:'manual',template:'<div class="popover ve-tour">'+'<div class="arrow"></div>'+'<div class="popover-inner">'+'<div class="popover-content"></div>'+'</div>'+'</div>'});$element.popover('show');tracker.trackVerboseImpression(EXPERIMENT_NAME,'tour-step-'+this.step);};Tour.prototype.nextHandle=function(){this._setDisabled();this.next();tracker.trackVerboseClick(EXPERIMENT_NAME,'next-go-to-'+this.step);};Tour.prototype.next=function(){if(this.step===this.steps.length-1){this.destroyStep(this.step);tracker.trackVerboseClick(EXPERIMENT_NAME,'tour-complete');return;}
this.destroyStep(this.step);this.openStep(++this.step);};Tour.prototype.prevHandle=function(){this.destroyStep(this.step);this.openStep(--this.step);tracker.trackVerboseClick(EXPERIMENT_NAME,'next-go-to-'+this.step);};Tour.prototype.close=function(){this._setDisabled();this.destroyStep(this.step);tracker.trackVerboseClick(EXPERIMENT_NAME,'close-'+this.step);};Tour.prototype._setDisabled=function(){if(!$.cookie('vetourdisabled')){$.cookie('vetourdisabled',1,{expires:30,path:mw.config.get('wgCookiePath'),domain:mw.config.get('wgCookieDomain')});}};Tour.prototype._setupTour=function(assets){var $body=$('body');mw.hook('ve.cancelButton').add(function(){$body.off('.VETour');this.destroyStep(this.step);}.bind(this));$body.on('click.VETour','.ve-tour-next',this.nextHandle.bind(this));$body.on('click.VETour','.ve-tour-prev',this.prevHandle.bind(this));$body.on('click.VETour','.ve-tour-experiment .close',this.close.bind(this));this.contentTemplate=assets.mustache[0];this.tourConfig.forEach(this._setupStep.bind(this));setTimeout(this.next.bind(this),200);};Tour.prototype._setupStep=function(item,id){var buttonLabel=id===this.tourConfig.length-1?'Start editing':'Next',showPrev=id>0;this.steps[id]={$element:$(item.selector),content:mustache.render(this.contentTemplate,{title:item.title,description:item.description,buttonLabel:buttonLabel,showPrev:showPrev})};};return Tour;});;define('VisualEditorTourExperimentConfig',[],function(){'use strict';return[{selector:'#WikiaArticle',placement:'top',title:'Write content',description:'Share your knowledge with the Community! This space is yours: write, fix typos, '+'add links. Make this article better with each edit!'},{selector:'.oo-ui-icon-link',placement:'bottom',title:'Add links',description:'Highlight a text you want to add link to. You can now write the name of the wiki page '+'you want the link to point at. Remember that you can always remove a link, by clicking on ‘remove the '+'link’ button after highlighting the text.'},{selector:'.oo-ui-icon-video',placement:'right',title:'Add Video',description:'Upload videos to a specified place in the article. Search for a video already present on '+'this Wiki or provide an URL from such sources as YouTube, Vimeo or Dailymotion.'},{selector:'.oo-ui-icon-image',placement:'right',title:'Add Image',description:'Upload pictures to a specified place in the article. You will be able to change the size '+'of the element later.'},{selector:'.oo-ui-icon-gallery',placement:'right',title:'Add Gallery',description:'Choose from the photos uploaded to this Wiki and create a gallery.'},{selector:'.oo-ui-icon-bullet-list',placement:'right',title:'Bullet list and Numbered list',description:'Organize your text into neat lists. You can highlight a few paragraphs and insert a list '+'of your choice or simply insert a list and start typing. If you want to turn a list into a regular text'+', just unclick the selected list.'},{selector:'.oo-ui-labelElement.oo-ui-listToolGroup',placement:'bottom',title:'Add extra content',description:'Click ‘Insert’ to choose from a number of extra elements: Infobox, Template, Reference, '+'Reference List and Table.'},{selector:'.ve-ui-toolbar-saveButton',placement:'bottom',title:'Publish your edit',description:'After you’ve made your edit, save the changed article by clicking on ‘Save page’. Now you '+'can add a description of your changes for other users to read, but you don’t have to do that. Click '+'‘save’ and go ahead, make another page on this Wiki better!'}];});;define('VisualEditorTourExperimentInit',['jquery','VisualEditorTourExperiment','VisualEditorTourExperimentConfig','wikia.abTest','ext.wikia.spitfires.experiments.tracker'],function($,VETour,veTourConfig,abTest,tracker){'use strict';var experimentName='contribution-experiments',freshlyRegisteredExperimentId=5654433460,usersWithoutEditExperimentId=5735670451;function init(){if(isEnabled()){clearEntrypointPopover();(new VETour(veTourConfig)).start();}}
function isEnabled(){return isExperimentVariation()&&(isNewlyregistered()||isUserwithoutedit())&&!$.cookie('vetourdisabled');}
function trackPublish(){if(isExperimentVariation()&&(isNewlyregistered()||isUserwithoutedit())){tracker.trackVerboseSuccess(experimentName,'publish');}}
function clearEntrypointPopover(){$('#ca-ve-edit').popover('destroy');}
function isExperimentVariation(){return window.optimizely&&(window.optimizely.variationNamesMap[freshlyRegisteredExperimentId]==='VE-TOUR'||window.optimizely.variationNamesMap[usersWithoutEditExperimentId]==='VE-TOUR');}
function isNewlyregistered(){return $.cookie('newlyregistered');}
function isUserwithoutedit(){return $.cookie('userwithoutedit');}
return{init:init,isEnabled:isEnabled,trackPublish:trackPublish};});;require(['jquery','mw','VisualEditorTourExperimentInit','ext.wikia.spitfires.experiments.tracker'],function($,mw,veTourInit,tracker){'use strict';var EXPERIMENT_NAME='contribution-experiments';function initEntry(){var $editButton=$('#ca-ve-edit');if(veTourInit.isEnabled()&&mw.config.get('wgNamespaceNumber')===0&&mw.config.get('wgVisualEditorPreferred')){$editButton.popover({content:'<div class="ve-tour-experiment">'+'<div class="close"></div>'+'<h2>Enter edit mode</h2>'+'<p>Click on the Edit button to go into edit mode - there you will be able to add content '+'and media to an article page.</p>'+'<nav class="nav-buttons"><button class="ve-tour-next">Next</button></nav>'+'</div>',html:true,placement:'right',trigger:'manual'});$editButton.popover('show');$('.ve-tour-next').click(startTour.bind(this,$editButton));$('.ve-tour-experiment .close').click(close.bind(this,$editButton));tracker.trackVerboseImpression(EXPERIMENT_NAME,'tour-step-article-entry-point');}}
function startTour($editButton){$editButton.click();$editButton.popover('destroy');tracker.trackVerboseClick(EXPERIMENT_NAME,'edit-entry-point');}
function close($element){$.cookie('vetourdisabled',1,{expires:30,path:mw.config.get('wgCookiePath'),domain:mw.config.get('wgCookieDomain')});$element.popover('destroy');tracker.trackVerboseClick(EXPERIMENT_NAME,'close-article-entry-point');}
$(initEntry);});;