User:Jj137/baseball-replace.js

From Wikipedia, the free encyclopedia

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.

//<pre>
 
function abbreves()
{
  var f = document.editform, t = f.wpTextbox1;
  t.value = t.value.split('FLA').join('[[Florida Marlins]]');
  t.value = t.value.split('WAS').join('[[Washington Nationals]]');
  t.value = t.value.split('ATL').join('[[Atlanta Braves]]');
  t.value = t.value.split('PHI').join('[[Philadelphia Phillies]]');
  t.value = t.value.split('NYM').join('[[New York Mets]]');
  t.value = t.value.split('CIN').join('[[Cincinnati Reds]]');
  t.value = t.value.split('STL').join('[[St. Louis Cardinals]]');
  t.value = t.value.split('HOU').join('[[Houston Astros]]');
  t.value = t.value.split('CHC').join('[[Chicago Cubs]]');
  t.value = t.value.split('MIL').join('[[Milwaukee Brewers]]');
  t.value = t.value.split('PIT').join('[[Pittsburgh Pirates]]');
  t.value = t.value.split('LAD').join('[[Los Angeles Dodgers]]');
  t.value = t.value.split('SFO').join('[[San Francisco Giants]]');
  t.value = t.value.split('ARI').join('[[Arizona Diamondbacks]]');
  t.value = t.value.split('COL').join('[[Colorado Rockies]]');
  t.value = t.value.split('NYY').join('[[New York Yankees]]');
  t.value = t.value.split('BOS').join('[[Boston Red Sox]]');
  t.value = t.value.split('BAL').join('[[Baltimore Orioles]]');
  t.value = t.value.split('TAM').join('[[Tampa Bay Rays|Tampa Bay Devil Rays]]');
  t.value = t.value.split('TOR').join('[[Toronto Blue Jays]]');
  t.value = t.value.split('MIN').join('[[Minnesota Twins]]');
  t.value = t.value.split('CHW').join('[[Chicago White Sox]]');
  t.value = t.value.split('CLE').join('[[Cleveland Indians]]');
  t.value = t.value.split('DET').join('[[Detroit Tigers]]');
  t.value = t.value.split('KCR').join('[[Kansas City Royals]]');
  t.value = t.value.split('OAK').join('[[Oakland Athletics]]');
  t.value = t.value.split('SEA').join('[[Seattle Mariners]]');
  t.value = t.value.split('TEX').join('[[Texas Rangers]]');
  t.value = t.value.split('lAA').join('[[Los Angeles Angels of Anaheim]]');
  t.value = t.value.split('SDG').join('[[San Diego Padres]]');
  f.wpSummary.value = "Changed team abbreviations to full names";
}
 
function MLBtab()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing ") != -1)
    {
      addPortletLink('p-cactions', 'javascript:abbreves()', "abbrev fixes");
    }
}
 
addOnloadHook(MLBtab);
 
// </pre>