mw.loader.implement("ext.centralNotice.bannerController",function(){(function($,mw){var rPlus=/\+/g;function decode(s){try{return decodeURIComponent(s.replace(rPlus,' '));}catch(e){return'';}}$.ajaxSetup({cache:true});mw.centralNotice={data:{getVars:{},bannerType:'default',bucket:null,testing:false},bannerData:{},loadBanner:function(){if(mw.centralNotice.data.getVars.banner){mw.centralNotice.loadTestingBanner(mw.centralNotice.data.getVars.banner,'none','testing');}else{mw.centralNotice.loadRandomBanner();}},loadTestingBanner:function(bannerName,campaign){var bannerPageQuery,bannerScript,scriptUrl;mw.centralNotice.data.testing=true;bannerPageQuery={title:'Special:BannerLoader',banner:bannerName,campaign:campaign,userlang:mw.config.get('wgUserLanguage'),db:mw.config.get('wgDBname'),sitename:mw.config.get('wgSiteName'),country:mw.centralNotice.data.country};scriptUrl=mw.config.get('wgCentralPagePath')+'?'+$.param(bannerPageQuery);bannerScript='';$('#centralNotice').prepend(bannerScript);},loadRandomBanner:function(){var RAND_MAX=30;var bannerDispatchQuery={userlang:mw.config.get('wgUserLanguage'),sitename:mw.config.get('wgSiteName'),project:mw.config.get('wgNoticeProject'),anonymous:mw.config.get('wgUserName')===null,bucket:mw.centralNotice.data.bucket,country:mw.centralNotice.data.country,slot:Math.floor(Math.random()*RAND_MAX)+1};var scriptUrl=mw.config.get('wgCentralBannerDispatcher')+'?'+$.param(bannerDispatchQuery);var bannerScript='';$('#centralNotice').prepend(bannerScript);},recordImpression:function(data){var url=mw.config.get('wgCentralBannerRecorder')+'?'+$.param(data);(new Image()).src=url;},getQueryStringVariables:function(){document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g,function(str,p1,p2){mw.centralNotice.data.getVars[decode(p1)]=decode(p2);});},waitForCountry:function(){if(Geo.country){mw.centralNotice.data.country=Geo.country;mw. centralNotice.loadBanner();}else{mw.centralNotice.data.waitCycle++;if(mw.centralNotice.data.waitCycle<10){window.setTimeout(mw.centralNotice.waitForCountry,100);}else{mw.centralNotice.data.country='XX';mw.centralNotice.loadBanner();}}},initialize:function(){if(mw.config.get('wgNamespaceNumber')==-1){return;}var dataString=$.cookie('centralnotice_bucket')||'';mw.centralNotice.data.bucket=dataString.split('-')[0];var bucketValidityString=dataString.split('-')[1];var expectedValidityString=mw.config.get('wgNoticeNumberOfBuckets')+'.'+mw.config.get('wgNoticeNumberOfControllerBuckets');if((mw.centralNotice.data.bucket===null)||(bucketValidityString!==expectedValidityString)){mw.centralNotice.data.bucket=Math.floor(Math.random()*mw.config.get('wgNoticeNumberOfControllerBuckets'));$.cookie('centralnotice_bucket',mw.centralNotice.data.bucket+'-'+expectedValidityString,{expires:mw.config.get('wgNoticeBucketExpiry'),path:'/'});}mw.centralNotice.getQueryStringVariables();$('#siteNotice').prepend( '
');mw.centralNotice.data.country=mw.centralNotice.data.getVars.country||Geo.country||'XX';if(mw.centralNotice.data.country==='XX'){$('body').append('');mw.centralNotice.data.waitCycle=0;mw.centralNotice.waitForCountry();}else{mw.centralNotice.loadBanner();}}};window.insertBanner=function(bannerJson){var url,targets,data;var impressionData={country:mw.centralNotice.data.country,userlang:mw.config.get('wgUserLanguage'),project:mw.config.get('wgNoticeProject'),db:mw.config.get('wgDBname'),sitename:mw.config.get('wgSiteName'),bucket:mw.centralNotice.data.bucket};var impressionResultData=null;if(!bannerJson){impressionResultData={result:'hide',reason:'empty'}}else{mw.centralNotice.data.bannerType=(bannerJson.fundraising?'fundraising':'default');if($.cookie('stopMobileRedirect')==='true'){impressionResultData={result:'hide',reason:'mobile'}}else if($.cookie('centralnotice_'+encodeURIComponent(mw.centralNotice. data.bannerType))==='hide'){impressionResultData={result:'hide',reason:'cookie'}}else{$('div#centralNotice').attr('class',mw.html.escape('cn-'+mw.centralNotice.data.bannerType)).prepend(bannerJson.bannerHtml);if(bannerJson.autolink){url=mw.config.get('wgNoticeFundraisingUrl');if((bannerJson.landingPages!==null)&&bannerJson.landingPages.length){targets=String(bannerJson.landingPages).split(',');if($.inArray(mw.centralNotice.data.country,mw.config.get('wgNoticeXXCountries'))!==-1){mw.centralNotice.data.country='XX';}url+="?"+$.param({landing_page:targets[Math.floor(Math.random()*targets.length)].replace(/^\s+|\s+$/,''),utm_medium:'sitenotice',utm_campaign:bannerJson.campaign,utm_source:bannerJson.bannerName,language:mw.config.get('wgUserLanguage'),country:mw.centralNotice.data.country});$('#cn-landingpage-link').attr('href',url);}}var bannerShown=true;if(typeof mw.centralNotice.bannerData.alterImpressionData==='function'){bannerShown=mw.centralNotice.bannerData.alterImpressionData( impressionData);}if(bannerShown){impressionResultData={banner:bannerJson.bannerName,campaign:bannerJson.campaign,result:'show'};}else{impressionResultData={result:'hide'};}}}if(!mw.centralNotice.data.testing){mw.centralNotice.recordImpression($.extend(impressionResultData,impressionData));}};window.hideBanner=function(){$('#centralNotice').hide();var bannerType=mw.centralNotice.data.bannerType||'default';var d=new Date();d.setTime(d.getTime()+(14*24*60*60*1000));document.cookie='centralnotice_'+encodeURIComponent(bannerType)+'=hide; expires='+d.toGMTString()+'; path=/';};window.toggleNotice=function(){window.hideBanner();};})(jQuery,mediaWiki);;},{},{});mw.loader.implement("ext.postEdit",function(){(function(mw,$){'use strict';var div=document.createElement('div'),key=mw.config.get('wgCookiePrefix')+'showPostEdit';div.className='postedit-container';div.innerHTML='