User:Jonesey95/AutoEd/pages.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 + 'core6.js'); //Imports the "framework" script needed to make this function

//Sets variable configuration autoEdTag6 = "Fix invalid character(s) in short description"; //Tweaks edit summary autoEdLinkName6 = "AutoEd SD"; //Changes the link name at the top of the page autoEdLinkHover6 = "Run AutoEd to fix one-off problem"; //When user hovers over link //Set up function function Replace6(str) { //function to replace duplicate page= parameters

//Replace invalid characters in short description str = str.replace(/({{short description\|[^}]+\d\d *)[−—‐]( *\d\d[^}]+\})/gi, '$1–$2');

//Fix excess spaces in year range str = str.replace(/({{short description\|[^}]+\(\d\d\d\d) +– +(\d\d\d\d\).+?(?=[\}]))/gi, '$1–$2');

//Replace invisible characters with space str = str.replace(/({{short description\|[^}]+)[￼\t 	  ‍⁠⁠‍]+(.+?(?=[\}]))/gi, '$1 $2'); str = str.replace(/({{short description\|[^}]+)[￼\t 	  ⁠⁠‍‍]+(.+?(?=[\}]))/gi, '$1 $2'); str = str.replace(/({{short description\|[^}]+)[￼\t 	  ⁠⁠‍‍]+(.+?(?=[\}]))/gi, '$1 $2'); str = str.replace(/({{short description\|[^}]+)[￼\t 	  ⁠⁠‍‍]+(.+?(?=[\}]))/gi, '$1 $2'); str = str.replace(/({{short description\|[^}]+) (.+?(?=[\}]))/gi, '$1 $2'); str = str.replace(/({{short description\|[^}]+)&thinsp;(.+?(?=[\}]))/gi, '$1 $2');

//Replace invalid apostrophe or quote mark str = str.replace(/({{short description\|[^}]+[a-z])’(s.+?(?=[\}]))/gi, '$1\'$2'); str = str.replace(/({{short description\|[^}]+[a-z])”(.+?(?=[\}]))/gi, '$1\"$2'); str = str.replace(/({{short description\|[^}]+ )“(.+?(?=[\}]))/gi, '$1\"$2');

//Other str = str.replace(/Gilgit−Baltistan/gi, 'Gilgit-Baltistan');

return str; } function autoEdFunctions6 { //Activates individual modules when "auto ed" tab is clicked var txt = document.editform.wpTextbox1; //leave this value as 1 txt.value = Replace6(txt.value); }