User:Neier/monobook.js/recat.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
//function to do search/replace 
function wpTextboxCatReplace()
{
 
   var txt = document.editform.wpTextbox1;
 
//   txt.value = txt.value.replace(/([Cc]ategory:[Rr]ailway stations in \S+ Prefec[^\]]+\]\])/gi, '\$1\n[[Category:Tazawako Line]]');
 
////txt.value = txt.value.replace(/\[\[[Cc]ategory:[Oo]lympic competitors for /gi, '[[Category:Olympic athletes of ');
 
 
txt.value = txt.value.replace(/\[\[[Cc]ategory:[Cc]ompanies by city/gi, '[[Category:Companies by city in the United States');
 
//
 
 
//Sort (xyz in country) by country name 
//  var titletxt = document.title
//  titletxt = titletxt.replace(/Editing Category:Sports teams in (.*) - Wikipedia, the free encyclopedia/gi, '$1');
//
//  txt.value = txt.value.replace(/[Cc]ategory:[Ss]ports teams by country/gi, 'Category:Sports teams by country|' + titletxt);
//   document.editform.wpSummary.value = 'sort in category';
//   document.editform.wpMinoredit.checked = true;
//   document.editform.wpWatchthis.checked = false;
 
 
//txt.value = txt.value.replace(/\[\[[Cc]ategory:[Aa]merican football competitions\]\]/gi, '');
 
//txt.value = txt.value.replace(/(\[\[[Cc]ategory:[Ff]ootballers at the )/i, '[[Category:Olympic footballers of ]]\n\$1');
 
//txt.value = txt.value.replace(/\[\[:[Cc]ategory:[Dd]issolved districts of /gi, '[[:Category:Former districts of ');
 
//   document.editform.wpSummary.value = 'Add category to railway stations'; 
//   document.editform.wpSummary.value = 'remove redundant parent cat';
//
//   document.editform.wpSummary.value = 'recat Olympians by sport';
 
//   document.editform.wpSummary.value = 'recat Olympic soccer players';
 
   document.editform.wpSummary.value = 'Recategorize to US-specific category';
//   document.editform.wpSummary.value = 'cat was renamed';
   document.editform.wpMinoredit.checked = true;
//   document.editform.wpWatchthis.checked = true;
   document.editform.wpWatchthis.checked = false;
}