User:Jonesey95/AutoEd/coauthors.js

var AutoEd_baseurl = 'http://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Jonesey95/AutoEd/'; if (location.protocol === 'https:') { AutoEd_baseurl = 'https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Jonesey95/AutoEd/'; } mw.loader.load(AutoEd_baseurl + 'core2.js'); //Imports the "framework" script needed to make this function

//Sets variable configuration - Linter fixes autoEdTag2 = "Fix Linter obsolete tag errors. "; //Tweaks edit summary autoEdLinkName2 = "AutoEd center"; //Changes the link name at the top of the page autoEdLinkHover2 = "Run AutoEd to fix Linter center tag errors"; //When user hovers over link //Set up function function ReplaceTags(str) { //function to replace center tags //These do not work // str = str.replace(/(^\|)\(\s*)(\n\|)/gmi, '$1\{\{center\|1\=$2\}\}$3');  //center tag without end as table cell on its own line // str = str.replace(/(^\|)\([^\>]+)(\n\|)/gmi, '$1\{\{center\|1\=$2\}\}$3');  //center tag without end as table cell on its own line

str = str.replace(/\(\[\Filemag]+:[^\+)(\]\])\<\/center\>/gi, '$1\|center$2'); //Image: or File: wrapped in center tags, with no wikilinks in the caption

str = str.replace(/\([\d\'\"a-z _\%\&\;\|\}\{\-\=\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]+)\<\/center\>/gi, '\{\{center\|1\=$1\}\}'); //center tag with plain text inside  str = str.replace(/\(\s*\.+?(?=\<\/ref\>)\<\/ref\>\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}'); //center tag with ref inside; ".+?" means any character until what follows the ?; the ?= piece shows the string to stop at and exclude from the match

str = str.replace(/\([\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]+\s*\.+?(?=\<\/ref\>)\<\/ref\>\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}'); //center tag with plain text and then ref inside

str = str.replace(/\([\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]*\s*\.+?(?=\<\/ref\>)\<\/ref\>\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}'); //center tag with optional text and then named ref inside

str = str.replace(/\([\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]*\\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}'); //center tag with optional plain text and then self-closed ref inside

str = str.replace(/\(\s*\)\<\/span\>\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}'); //center tag with span inside; ".+?" means any character until what follows the ?; the ?= piece shows the string to stop at and exclude from the match

str = str.replace(/\([\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]+\[\d\'\"a-z \%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]+)\<\/center\>/gi, '\{\{center\|1\=$1\}\}');  //br tag inside of center tags, with text on either side

str = str.replace(/\<center\>([\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]*\[\[[\d\'a-z \%\&\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]+\]\][\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}');  //Plain wikilink inside of center tags, with optional text on either side

str = str.replace(/\<center\>([\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]*\s*\[\[[\d\'a-z _\%\&\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]+\|[\d\'a-z _\%\&\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]+\]\]\s*[\d\'\"a-z _\%\&\|\}\{\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?⊕⊗会話投稿記録日本穣投稿]*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}');  //Piped wikilink inside of center tags, with optional text on either side

str = str.replace(/\<center\>(\s*\[\[[\d\'\"a-z _\%\&\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]+\]\]\<ref\>.+?(?=\<\/ref\>)\<\/ref\>\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}');  //Plain wikilink with ref inside of center tags

str = str.replace(/\<center\>(\s*\[\[[\d\'\"a-z _\%\&\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]+\|[\d\'\"a-z \%\&\-\.\,\(\)–—\*:\+ößáàăâåäãāảạæćČçĐéèêếềễěëėęēệíìîïİįīịıĽńñóòôỗöõøōơờọœřšŞúùûüũūưứýỳ¡§:\!\?\#⊕⊗会話投稿記録日本穣投稿]+\]\]\<ref\>.+?(?=\<\/ref\>)\<\/ref\>\s*)\<\/center\>/gi, '\{\{center\|1\=$1\}\}');  //Piped wikilink with ref inside of center tags

str = str.replace(/\<center\>\<gallery\>/gi, '\<gallery class\=\"center\"\>');  //gallery tags str = str.replace(/\<\/gallery\>\<\/center\>/gi, '\<\/gallery\>');  //gallery tags

//fix center template with span tag (equals sign in span tag hides content) str = str.replace(/({\{center\|)([ \']*\<span)/gi, '$1 1\=$2'); str = str.replace(/{\{center\| +1\=/gi, '{\{center\|1\=');

//delete empty center tag pairs str = str.replace(/ <\/center>/gi, '');

return str; } function autoEdFunctions2 { //Activates individual modules when "auto ed" tab is clicked var txt = document.editform.wpTextbox1; txt.value = ReplaceTags(txt.value); }