User:Alexis Jazz/RemoveDoubleNamespace.js

// automatically filter double namespaces from move form. why do I keep messing this up // This script is public domain, irrevocably released as WTFPL Version 2[www.wtfpl.net/about/] by its author, Alexis Jazz. var AJmvNS = {}; AJmvNS.do = function { AJmvNS.NS = $('#wpNewTitleNs select option[value='+$('#wpNewTitleNs select')[0].value+']')[0].innerText; AJmvNS.title = $('#wpNewTitleMain input')[0].value; if ( AJmvNS.title.match(new RegExp('^'+AJmvNS.NS+':')) ) { $('#wpNewTitleMain input')[0].value = AJmvNS.title.replace(new RegExp('^'+AJmvNS.NS+':'),''); } }; if ( mw.config.get('wgNamespaceNumber') == -1 && mw.config.get('wgCanonicalSpecialPageName') == 'Movepage' ) { $('#wpNewTitleMain input,#wpNewTitle span,#mw-teleport-target').on('change focus click blur',function{AJmvNS.do}); }