Jump to content

User:Alexis Jazz/EditNoticesOnMobile.min.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<nowiki>
window.enom={};var enom=window.enom;var mw=window.mw;if(! window.location.host.match(/(^|\.)m\./)&&mw.config.get('skin')=='minerva'){mw.util.addCSS('.content.fmbox,.content.tmbox {display:unset !important} .mw-editnotice * {display:unset !important}');$('.editnotice-page .fmbox,.editnotice-page .tmbox,.editnotice-page .tmbox-content').removeClass(['fmbox','tmbox','tmbox-content']);}else if(mw.config.get('skin')=='minerva'){enom.AA=function(){$('#enom').remove();};enom.AB=function(){mw.util.addCSS('.fmbox,.tmbox {display:unset !important}.enomDismiss{color:#3366cc !important;}#enom *{background:#f6f6f6}#enom{padding:0.5em;margin-top:0.5em;border:0.1em solid #ddd;background:#f6f6f6;max-height:12em;overflow:auto;}.noHide{display:unset !important}#enom .mw-parser-output table{margin:0 !important}');enom.AC={format:'json',action:'parse',disablelimitreport:true,title:mw.config.get('wgPageName'),pst:'1',prop:'text',formatversion:'2',text:'{{#invoke:string|replace|source=<div id="EditNoticeOnMobile" class="EditNoticeOnMobile" style="margin-top:0.5em">{{#ifexist:MediaWiki:Editnotice-{{NAMESPACENUMBER}}-{{#invoke:String|replace|{{PAGENAME}}|/|-}}|{{MediaWiki:Editnotice-{{NAMESPACENUMBER}}-{{#invoke:String|replace|{{PAGENAME}}|/|-}}}}|{{#ifexist:MediaWiki:Editnotice-{{NAMESPACENUMBER}}|{{MediaWiki:Editnotice-{{NAMESPACENUMBER}}}}}}}}</div>|nomobile|unbreakNow}}',};mw.loader.using(['mediawiki.api'],function(){var api=new mw.Api();api.post( enom.AC ).done(function(data){enom.AD=document.createElement('div');enom.AD.id='enom';enom.AD.innerHTML=data.parse.text.replace(/([" ])nomobile([" ])/,'$1$2');enom.AE=document.createElement('a');enom.AE.title='dismiss';enom.AE.class='enomDismiss';enom.AE.innerText='[X]';enom.AE.onclick=function(){enom.AA();};enom.AF=0;enom.AG=function(){enom.AF=enom.AF+1;var DelayedNotice=setInterval(function(){clearInterval(DelayedNotice);if($('.editor-overlay')[0]&&$('.overlay-header-container')[0]&&$('.editor-container.content')[0]){
$('.editor-container.content').prepend(enom.AD);}else if($('.editor-overlay')[0]&&$('.overlay-header-container')[0]&&$('.ve-ce-sectionNode,.ve-ce-branchNode')[0]&&$('.surface .mw-body-content.content')[0]&&getComputedStyle($('.ve-ce-sectionNode,.ve-ce-branchNode')[0])['padding-top']!='0px'){
enom.AH=getComputedStyle($('.ve-ce-sectionNode,.ve-ce-branchNode')[0])['padding-top'];enom.AI=Number(enom.AH.match(/^[0-9]*/)[0])*1.25+enom.AH.match(/[^0-9]*$/)[0];enom.AD.style='margin-top:'+enom.AI;$('.surface .mw-body-content.content').prepend(enom.AD);$('.ve-ce-sectionNode,.ve-ce-branchNode')[0].style='padding-top:0.5em';}else if(enom.AF<200){
enom.AG();return;}if($('#enom')[0]){$('#enom .mw-parser-output .mf-section-0').addClass('noHide');$('#enom .mw-parser-output .tmbox').removeClass('tmbox');$('#enom .mw-parser-output .tmbox-content').removeClass('tmbox-content');$('#enom')[0].scrollIntoView({behavior:'smooth',block:'center',inline:'nearest'});if($('.editnotice-link')[0]){$('.editnotice-link')[0].append(enom.AE);}else{if($('#mw-content-text')[0].attributes&&$('#mw-content-text')[0].attributes.dir&&$('#mw-content-text')[0].attributes.dir.value=='rtl'){enom.AJ='left';}else{enom.AJ='right';}enom.AE.style='float:'+enom.AJ;$('#enom')[0].prepend(enom.AE);}}},50);};enom.AG();});});};if($('#ca-edit')[0]){$('#ca-edit')[0].addEventListener('click',function(){enom.AB();} );}if(window.location.href.match(/\#\/editor\//)){enom.AB();}}
//</nowiki>