User:Clear Arrow/global.js

/* Temporary */ window.ignoreWarnings = true; window.UploadFileOasis = true; window.UploadFile=(function($,k){var l={en:{updone:"You uploaded the file: ",duplicate:'This image is a doublon ',upcopy:"Copy",modaltitle:"Upload File",closemodal:"Close",defaultOpt:"None selected",browser:"Please, update your browser!",desc:"Description: ",problem:"A problem occured, upload cancelled",updateform:"Update form",nolicenses:"We couldn't find the licenses, please see MediaWiki:Licenses",alreadyname:"There is already a file named like that, please choose another name ",error:"Error",imagename:"Image",licensetext:'License: ',uploadfiles:'Upload all images',nofile:"You have to choose a file to upload it",filenamespace:"File:",licensetitle:"License",licenseerror:"You need to put a license",allfiles:"Files uploaded",filedescription:'File description',filename:"Name: ",deleted:"This file was deleted before, are you sure you want to reupload it?"},es:{updone:"Has subido el archivo: ",duplicate:'Este archivo es duplicado',upcopy:"Copiar",modaltitle:"Subir Archivo",closemodal:"Cerrar",defaultOpt:'Ninguna seleccionada',browser:"Por favor, ¡actualiza tu navegador!",desc:"Descripción: ",problem:"Ha ocurrido un problema, subida cancelada",updateform:"Actualizar formulario",nolicenses:"No pudimos encontrar las licencias, por favor revisa MediaWiki:Licenses",alreadyname:"Ya hay un archivo con ese nombre, por favor selecciona otro ",error:"Error",imagename:"Imagen",licensetext:'Licencia: ',uploadfiles:'Subir los archivos',nofile:"Tienes que seleccionar un archivo para subirlo",filenamespace:"Archivo:",licensetitle:"Licencia",licenseerror:"Tienes que poner una licencia",allfiles:"Archivos subidos",filedescription:'Descripción del archivo',filename:"Nombre: ",deleted:"Este archivo fue borrado anteriormente, ¿seguro que quieres resubirlo?"}},_i18n=$.extend(l['en'],l[(k.config.get('wgUserLanguage')).split("-")[0]],l[(k.config.get('wgUserLanguage'))]),_addComment=window.UFdescription||true,_noLicense=window.needsLicense||false,_allowMultiUpload=window.allowMultiUpload||true,_maxFiles=window.maxFiles||100,_ignoreWarnings=window.ignoreWarnings||0,_showDetails=window.uploadDetails||true,_useMono=window.UploadFileOasis||false,_licensesList=function{$.ajax({type:'GET',url:'/api.php?action=query&meta=allmessages&ammessages=Licenses&format=json',success:function(a){_throwLicenses(a.query.allmessages[0]['*']);},error:function(a){alert(_i18n['nolicenses'])}})},_throwLicenses=function(a){if(a!=null){var b=a.split('\n');if(b[b.length-1]==){b.splice(-1,1)}$('.licencias').replaceWith(' ');$('.licencias').prepend(' '+_i18n['defaultOpt']+' ');for(var i in b){if(b[i].indexOf('**')==0){b[i]=b[i].replace('**',);$('.licencias').find('optgroup:last-child').append(''+b[i].split('|')[1]+' ')}else{b[i]=b[i].replace('*',);$('.licencias').append(' ')}}}},_showModal=function{$.showCustomModal(_i18n['modaltitle'],'  '+_i18n['updateform']+' ',{id:'UploadFile',width:700,height:560,buttons:[{defaultButton:true,id:"CloseModal",message:_i18n['closemodal'],handler:function{$('#UploadFile').closeModal}}]});$('#UFdone').on('click',function{_update});if(_allowMultiUpload){$('#fileinput').attr('multiple',)}},_uploadFiles=function(d,e,f){var g=e;var h=new FormData;h.append('action','upload');h.append('filename',g);h.append('token',k.user.tokens.get('editToken'));h.append('file',d);h.append('text',f);h.append('format','json');if(_ignoreWarnings==false||_ignoreWarnings==0){_ignoreWarnings=0}else{_ignoreWarnings=1;h.append('ignorewarnings',_ignoreWarnings)}$.ajax({url:k.util.wikiScript('api'),contentType:false,processData:false,type:"POST",data:h,dataType:'json',async:false,success:function(a){console.log(a.upload.result);console.log(a.upload.warnings);if(a.upload.result=='Warning'){if(a.upload.warnings.hasOwnProperty('was-deleted')){var b=confirm(_i18n['deleted']);if(b){_ignoreWarnings=1;g=_uploadFiles(d,g,f)}else{console.log(_i18n["error"])}}else if(a.upload.warnings.hasOwnProperty('duplicate-archive')){alert(_i18n['duplicate'])}else if(a.upload.warnings.hasOwnProperty('exists')){g=prompt(_i18n['alreadyname'],g);if(g!=null){g=_uploadFiles(d,g,f)}else{alert(_i18n['error'])}}}else{console.log(_i18n['updone']);var c=+_i18n['filenamespace']+g+;_insertAtCaret('wpTextbox1',c)}},error:function(a,b,c){alert(c)}})},_insertAtCaret=function(a,b){var c=document.getElementById(a);if(!c){return}var d=c.scrollTop;var e=0;var f=((c.selectionStart||c.selectionStart=='0')?"ff":(document.selection?"ie":false));if(f=="ie"){c.focus;var g=document.selection.createRange;g.moveStart('character',-c.value.length);e=g.text.length}else if(f=="ff"){e=c.selectionStart}var h=(c.value).substring(0,e);var i=(c.value).substring(e,c.value.length);c.value=h+b+i;e=e+b.length;if(f=="ie"){c.focus;var j=document.selection.createRange;j.moveStart('character',-c.value.length);j.moveStart('character',e);j.moveEnd('character',0);j.select}else if(f=="ff"){c.selectionStart=e;c.selectionEnd=e;c.focus}c.scrollTop=d},_fileSelect=function{var a=document.getElementById('fileinput'),license;if(!a.files){alert(_i18n['browser']);$('#fileinput').prop("disabled",false)}else if(!a.files[0]){alert(_i18n["problem"]);$('#fileinput').prop("disabled",false)}else{var b=$('#UploadFile fieldset').length-1;var c,filename;if(b>0){for(var i=0;i<b;i++){c=a.files[i];filename=$('.imagename').eq(i).val||a.files[i].name;if($('#UploadContainer').find('select:eq('+i+')').find('option:selected').val!="none"){license='=='+_i18n['licensetitle']+'==\n'+'\n'+$('#UploadDescription').val}else if($('#UploadContainer').find('select:eq('+i+')').find('option:selected').val=="none"&&_noLicense==false){license=$('#UploadDescription').val}else{alert(_i18n['licenseerror']);return false}$('#loading'+(i+1)).css('display','initial');_uploadFiles(c,filename,license)}$('#UploadFile').closeModal;alert(_i18n['allfiles'])}}},_update=function{if($('#UploadFile fieldset').length>0){_fileSelect;return false}$('#editor').show;$('#fileinput').prop("disabled",true);var a=document.getElementById('fileinput');$('#editor').html('');if(a.files.length==0){alert(_i18n['nofile']);return false}var b;if(_maxFiles   '+_i18n["licensetext"]+' ')}_licensesList;$('#editor').append('  '+_i18n["filedescription"]+'  ');$('#UFdone').html(_i18n['uploadFiles'])},_needsLicense=function{if({edit:1,submit:1}[k.config.get('wgAction')]&&k.config.get('skin')=='oasis'&&!_useMono){WikiaEditor.load("WikiaMiniUpload").done(function{var a=setInterval(function{try{if(_showDetails){$('#WMU_div .advanced').css('display','block')}if($('#ImageUploadLicenseSpan').find('select').val==){$('#ImageUploadDetails input[type="submit"]').prop('disabled',true)}else{$('#ImageUploadDetails input[type="submit"]').prop('disabled',false)}if($('#ImageUploadDetails')&&$('#infoLicences').length<1){$('.modalWrapper .ImageUploadLeft').append(' '+_i18n["licenseerror"]+' ')}}catch(err){console.warn('This is not an error lol (?)')}},500)})}else if({Upload:1,MultipleUpload:1}[k.config.get('wgCanonicalSpecialPageName')]){$('#wpLicense').prop('required',true)}},_init=function{importStylesheetPage('MediaWiki:UploadInPage/code.css','dev');if({edit:1,submit:1}[k.config.get('wgAction')]&&k.config.get('skin')!='oasis'&&$('#mw-editbutton-addfile').length<1){k.loader.using('mediawiki.action.edit',function{if(k.toolbar){k.toolbar.addButton('https://vignette.wikia.nocookie.net/kirby/images/4/4a/A%C3%B1adirImagen.png/revision/latest?cb=20171020011105&format=original','UploadFile',,,,'mw-editbutton-addfile')}})}else if(_noLicense){$(_needsLicense)}if(_useMono&&k.config.get('skin')=='oasis'&&$('#mw-editbutton-addfile').length<1){if({edit:1,submit:1}[k.config.get('wgAction')]){k.loader.using('mediawiki.action.edit',function{if(k.toolbar){k.toolbar.addButton('https://vignette.wikia.nocookie.net/kirby/images/4/4a/A%C3%B1adirImagen.png/revision/latest?cb=20171020011105&format=original','UploadFile',,,'','mw-editbutton-addfile');$('#mw-editbutton-wmu').remove;window.onload=$('#mw-editbutton-addfile').insertBefore('#mw-editbutton-wpg')}})}}$('#mw-editbutton-addfile').on('click',function(a){a.preventDefault;_showModal})};return{uploadFiles:_uploadFiles,throwLicenses:_throwLicenses,licensesList:_licensesList,insertAtCaret:_insertAtCaret,init:_init,update:_update,fileSelect:_fileSelect}})(jQuery,mw);(typeof(window.jQuery)=='function'?jQuery:addOnloadHook)(window.UploadFile.init);

(function($,d){'use strict';var f=,_init=function{var a;if(window.location.href.indexOf('useskin=')==-1)return;a=_parseURL(window.location.href);if(a.query.useskin){f=(a.query.propagateskin||a.query.useskin)}if(f){$(document.body).bind('click.skinpropagation',_clicEvent);$('form').bind('submit.skinpropagation',_submitEvent)}},_parseURL=function(a){var b={base:,qs:,query:{},hash:},loc=a.indexOf('#'),paras,i,p;if(loc!=-1){b.hash=a.substr(loc+1);a=a.substr(0,loc)}loc=a.indexOf('?');if(loc!=-1){b.qs=a.substr(loc+1);a=a.substr(0,loc);paras=b.qs.split('&');for(i=0;i<paras.length;i++){p=paras[i].split('=');if(p.length==2){b.query[p[0]]=p[1]}}}b.base=a;return b},_getURL=function(a){var b,p;b=a.base+'?';for(p in a.query){if(a.query.hasOwnProperty(p)&&(a.query[p]||a.query[p]==='')){b+=p+'='+a.query[p]+'&'}}b=b.substr(0,b.length-1);if(a.hash){b+='#'+a.hash}return b},_clicEvent=function(e){var a,thisloc;if(e.target.tagName.toLowerCase!='a')return;if(e.target.href.indexOf(d.config.get('wgServer'))!==0)return;a=_parseURL(e.target.href);thisloc=_parseURL(window.location.href);if(a.base==thisloc.base&&a.qs==thisloc.qs&&a.hash){return}if(a.query.useskin&&a.query.useskin!=f){a.query.propagateskin=f}else{a.query.useskin=f}e.target.href=_getURL(a)},_submitEvent=function(e){var a;if(this.action.indexOf(d.config.get('wgServer'))!==0)return;if(this.method.toLowerCase=='post'){a=_parseURL(this.action);a.query.useskin=f;this.action=_getURL(a)}else{$('').val(f).appendTo(this)}},_addUseSkin=function(a,b){var c=_parseURL(a);c.query.useskin=b;c.query.propagateskin=false;return _getURL(c)};window.SkinPropagation={addUseSkin:_addUseSkin};$(_init)})(jQuery,mw);

if (wgCanonicalSpecialPageName == 'Chat') importScriptPage('ChatOptions/code.js', "dev");

window.ajaxSpecialPages = ["Recentchanges", "WikiActivity", "Watchlist", "Log", "Contributions"]; window.ajaxIndicator = 'http://images2.wikia.nocookie.net/__cb20100609110347/software/images/a/a9/Indicator.gif'; window.ajaxRefresh = 30000; window.AjaxRCRefreshText = 'Auto-refresh'; window.AjaxRCRefreshHoverText = 'Actualiza automáticamente la página'; importScriptPage("MediaWiki:ChatHacks.js", "dev"); window.pseudoVector = { loadCss: true, addReadTab: true, addContributionsTab: false, disableWatchIcon: false, visualEditorIcons: false, blacklist: [ 'es.pokemon.wikia.com', 'es.mario.wikia.com', 'es.kirby.wikia.com', "community.wikia.com", 'kirby.wikia.com', "es.metroid.wikia.com" ] }; importArticles({   type: 'script',    articles: [        'u:dev:PortableCSSPad/code.js',        'u:dev:WHAM/code.2.js',        'u:dev:View_Source/code.js',        'u:dev:WallGreetingButton/code.js',        'u:dev:RevealAnonIP/usercode.js',        'u:dev:RelatedDiscussionsModule/code.js',        'u:dev:PurgeButton/code.js',        "u:dev:RecentChangesMultiple/code.2.js",        'u:dev:MiniComplete/code.js',        'u:dev:QuickDiff/code.js',        'u:dev:ViewRemoved/code.js',        'u:dev:AjaxRC/code.js',        'u:dev:MediaWiki:Wikimarks/code.js',        "u:dev:MediaWiki:BotoneraPopups/BotoneraPopups.js",        "u:dev:MediaWiki:BotoneraPopups/WikiArticle.js",        'u:dev:Pseudo-Vector.js',        'u:dev:UserWikiInfo/code.js',        "u:dev:MediaWiki:BotoneraPopups/UILang/es.js",        "u:dev:MediaWiki:BotoneraPopups/code.js",        'u:dev:QuickTools/es/advanced.js'    ] });

$(function {    $('.wds-global-navigation__user-menu:not(a)').on('click', function  { window.location.replace('/wiki/Special:MyPage'); });   var oasis;    if (window.location.href.indexOf('?') != -1) {        oasis = window.location.href + '&useskin=wikia';    }    else {        oasis = window.location.href + '?useskin=wikia';    }    $('#p-tb ul').append('Usar oasis'); });

if ({ edit:1, submit:1 }[mw.config.get('wgAction')]) { mw.loader.using('mediawiki.action.edit', function {		if (mw.toolbar) {			mw.toolbar.addButton( 'http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png', 'Redirección', '#REDIRECT ',				'', 'Texto', 'mw-editbutton-redirect' );			mw.toolbar.addButton( 'http://upload.wikimedia.org/wikipedia/commons/b/b6/Button_category_link.png', 'Categoría', '[[Category:',			   ']]', 'Texto', 'mw-editbutton-category' );			mw.toolbar.addButton( 'http://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png', 'Galería', '',				'Imágenes', 'mw-editbutton-gallery' );		}	}); }

$(function {	if (!mw.config.get('wgMWSuggestTemplate') && mw.loader.getVersion('mediawiki.legacy.mwsuggest')) {		mw.config.set('wgMWSuggestTemplate', mw.util.wikiScript('api') + '?action=opensearch&search={searchTerms}&namespace={namespaces}&suggest');		mw.config.set('wgSearchNamespaces', [0, 6, 10, 14, 110]);		importScriptURI(mw.config.get('stylepath') + '/common/mwsuggest.js');		window.setTimeout(function { if (window.os_MWSuggestInit) { window.os_MWSuggestInit; }		}, 1000);	} });