跳转到内容

User:Date delinker/Sources.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
function news_sources() {
 var txt=document.editform.wpTextbox1;

   txt.value=txt.value.replace(/\{\{[i-z]{5}ews(|2|cat|has|portal|table|-inline)(\|[^\}]+|)\}\}\s*/gi, '');
   txt.value=txt.value.replace(/\*[ ]*\{\{Find a Grave\|\d{4}\|(\|[^\}]+)\}\}\s*/gi, '');

    //citation template fixes
txt.value=txt.value.replace(/(\|[ ]*(?:agency|author|journal|publisher|newspaper|work))[ ]*=[ ]*/gi, '$1=');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?\'\'\[\[([^\]]{1,40})\]\]\'\')/gi, '|work=[[$1]]');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?\'\'([^\]]{1,40})\'\')/gi, '|work=$1');

 txt.value=txt.value.replace(/\[\[(ABC|AP|AFP)\]\]/g, '$1');
 txt.value=txt.value.replace(/\[\[Time\s\(magazine\)\|(Time|Time Magazine)\]\]/g, 'TIME');
 txt.value=txt.value.replace(/\[\[Billboard\s\(magazine\)\|(Billboard|Billboard Magazine)\]\]/g, '$1'); 

//returns 'work=' for traditional media with websites
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.com\.au]?\]?)/gi, '|work=Australian Broadcasting Corporation ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.com\]?\]?)/gi, '|work=American Broadcasting Co |location=USA');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?billboard\.com\]?\]?)/gi, '|work=Billboard ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?boston.com\]?\]?)/gi, '|work=Boston Globe ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?businessweek\.com\]?\]?)/gi, '|work=BusinessWeek ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chicagotribune\.com\]?\]?)/gi, '|work= Chicago Tribune ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chinadaily\.com\.cn\]?\]?)/gi, '|work=China Daily ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?people(?:daily|)\.com\.cn\]?\]?)/gi, '|work=People\'s Daily ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chron\.com\]?\]?)/gi, '|work=Houston Chronicle ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?dailymail.co\.uk\]?\]?)/gi, '|work=The Daily Mail |location=London');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?denverpost\.com\]?\]?)/gi, '|work=Denver Post');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(derspiegel\.de|spiegel online)\]?\]?)/gi, '|work=Der Spiegel ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?economist\.com\]?\]?)/gi, '|work=The Economist ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ew.com\]?\]?)/gi, '|work=Entertainment Weekly ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?forbes\.com\]?\]?)/gi, '|work=Forbes');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ft.com\]?\]?)/gi, '|work=Financial Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Guardian(\.co\.uk|\sUnlimited)\]?\]?)/gi, '|work=The Guardian |location=London');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Hellomagazine\.com\]?\]?)/gi, '|work=Hello! ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?iht\.com\]?\]?)/gi, '|work=International Herald Tribune');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,7}independent\.co\.uk\]?\]?)/gi, '|work=The Independent |location=London');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?independent\.ie\]?\]?)/gi, '|work=The Irish Independent ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?irishtimes\.com\]?\]?)/gi, '|work=The Irish TImes ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?latimes\.com\]?\]?)/gi, '|work=Los Angeles Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lefigaro\.fr\]?\]?)/gi, '|work=Le Figaro |location=Paris');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lemonde\.fr\]?\]?)/gi, '|work=Le Monde |location=Paris');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?liberation.fr\]?\]?)/gi, '|work=Libération |location=Paris');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?La-Croix\.com\]?\]?)/gi, '|work=La Croix |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LeParisien\.com\]?\]?)/gi, '|work=Le Parisien |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LaTribune\.fr\]?\]?)/gi, '|work=La Tribune |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lesechos\.fr\]?\]?)/gi, '|work=Les Échos |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?FranceSoir\.fr\]?\]?)/gi, '|work=France Soir |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?20Minutes\.fr\]?\]?)/gi, '|work=20 Minutes |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lequipe\.fr\]?\]?)/gi, '|work=L\'Équipe |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Canardenchaîne\.com\]?\]?)/gi, '|work=Le Canard Enchaîné |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?NouvelObs\.com\]?\]?)/gi, '|work=Le Nouvel Observateur |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lexpress\.fr\]?\]?)/gi, '|work=L\'Express |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LePoint\.fr\]?\]?)/gi, '|work=Le Point |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?marianne-en-ligne\.fr\]?\]?)/gi, '|work=Marianne |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?parismatch\.com\]?\]?)/gi, '|work=Paris-Match |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Telerama\.fr\]?\]?)/gi, '|work=Télérama |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Courrierinternational\.com\]?\]?)/gi, '|work=Courrier International |location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?minute-hebdo\.fr\]?\]?)/gi, '|work=Minute |location=France');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?haaretz\.(com|co\.il)\]?\]?)/gi, '|work=Haaretz |location=Israel');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?jpost\.(com|co\.il)\]?\]?)/gi, '|work=Jerusalem Post |location=Israel');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Telegraphindia.com\]?\]?)/gi, '|work=The Telegraph |location=Kolkota, India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Timesofindia.com\]?\]?)/gi, '|work=The Times of India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Hindustantimes.com\]?\]?)/gi, '|work=Hindustan Times |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(?:the)?hindu.com\]?\]?)/gi, '|work=The Hindu |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?deccanchronicle.com\]?\]?)/gi, '|work=The Deccan Chronicle |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Thestatesman.net\]?\]?)/gi, '|work=The Statesman |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?dailypioneer.com\]?\]?)/gi, '|work=The Pioneer |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?EconomicTimes.com\]?\]?)/gi, '|work=The Economic Times |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?tribuneindia.com\]?\]?)/gi, '|work=The tribune |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?IndianExpress.com\]?\]?)/gi, '|work=The Indian Express |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?deccanherald.com\]?\]?)/gi, '|work=Deccan Herald |location=India');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Expressbuzz.com\]?\]?)/gi, '|work=The New Indian Express |location=India');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?mingpao.com\]?\]?)/gi, '|work=Ming Pao |location=Hong Kong');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?newsday\.com\]?\]?)/gi, '|work=Newsday |location=New York ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?newsweek\.com\]?\]?)/gi, '|work=Newsweek ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nme\.com\]?\]?)/gi, '|work=NME |location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nydailynews\.com\]?\]?)/gi, '|work=Daily News |location=New York ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nypost.com\]?\]?)/gi, '|work=New York Post ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nytimes.com\]?\]?)/gi, '|work=The New York Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?people.com\]?\]?)/gi, '|work=People ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?rollingstone.com\]?\]?)/gi, '|work=Rolling Stone ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?scmp.com\]?\]?)/gi, '|work=South China Morning Post |location=Hong Kong');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?sfgate.com\]?\]?)/gi, '|work=San Francisco Chronicle ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?smh\.com\.au\]?\]?)/gi, '|work=Sydney Morning Herald ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?spectator\.com\]?\]?)/gi, '|work=The Spectator |location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?sportsIllustrated\.cnn\.com\]?\]?)/gi, '|work=Sports Illustrated ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?standard\.com\.hk\]?\]?)/gi, '|work=The Standard |location=Hong Kong ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thesun.co\.uk\]?\]?)/gi, '|work=The Sun |location=London');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?suntimes\.com\]?\]?)/gi, '|work=Chicago Sun-Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?telegraph\.co\.uk\]?\]?)/gi, '|work=The Daily Telegraph |location=London');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theage\.com\.au\]?\]?)/gi, '|work=The Age |location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theaustralian\.com\.au\]?\]?)/gi, '|work=The Australian ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thestar\.com\]?\]?)/gi, '|work=Toronto Star ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?time.com\]?\]?)/gi, '|work=TIME ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(Timesonline\.co\.uk|Times online)\]?\]?)/gi, '|work=The Times |location=London');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?usatoday\.com\]?\]?)/gi, '|work=USA Today ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?washingtonpost\.com\]?\]?)/gi, '|work=The Washington Post ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?washingtontimes\.com\]?\]?)/gi, '|work=The Washington Times ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}wsj\.com\]?\]?)/gi, '|work=The Wall Street Journal ');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}un\.org\]?\]?)/gi, '|publisher=United Nations ');

//returns 'work=' for traditional media; delinks and dabs location
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(the )?((Sunday )?Times|Daily (Mail|Mirror|Express)|Independent|Observer|Guardian|NME|New Musical Express|New Statesman|Scotsman|Spectator|Daily Telegraph)\]\])/gi, '|work=$1$2 |location=UK');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(apple daily|ming pao|The standard|south china morning post)\]\])/gi, '|work=$1 |location=Hong Kong');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[The standard\|[^\]]*\]\])/gi, '|work=The Standard |location=Hong Kong ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[the age\]\])/gi, '|work=The Age |location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(the |)irish times\]\])/gi, '|work=The Irish Times ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(La Croix|Le Figaro|L'Humanité|Libération|Le Monde|Le Parisien|La Tribune|France Soir|Direct Matin|Direct Soir|L'Équipe|Le Canard enchaîné|Le Nouvel Observateur|L'Express|Le Point|Paris-Match|Télérama|Courrier International)\]\])/gi, '|work=$1 |location=France');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(Avvenire|Corriere della Sera|Il Fatto Quotidiano|Il Foglio|il Giornale|Il Giorno|il manifesto|Il Mattino|Il Messaggero|il Resto del Carlino|il Riformista|Il Secolo XIX|Il Tempo|La Nazione|la Repubblica|La Stampa|L'espresso|Corriere del Mezzogiorno)\]\])/gi, '|work=$1 |location=Italy');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(The |)(Times of India|Hindustan Times|Hindu|Deccan Chronicle|Statesman|Daily News and Analysis|Economic Times|Tribune|Indian Express|Deccan Herald|New Indian Express|Asian Age)\]\])/gi, '|work=$1$2 |location=India');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?)(?:\[\[The Telegraph \(Kolkata\)\|(The Telegraph)\]\])/gi, '|work=$1 |location=Kolkota, India ');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?)(?:\[\[The Pioneer \(Indian newspaper\)\|(The Pioneer)\]\])/gi, '|work=$1 |location=India ');

txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(the |)((sunday )?Times|daily (mail|mirror|express)|independent|observer|guardian|NME|New Musical Express|New Statesman|Scotsman|Spectator|Daily Telegraph)[ ]*?\|)/gi, '|work=$1$2 |location=UK |');

txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(apple daily|ming pao|The standard|south china morning post)[ ]*?\|)/gi, '|work=$1 |location=Hong Kong |');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?The standard\|hk standard)/gi, '|work=The Standard |location=Hong Kong ');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?the age)/gi, '|work=The Age |location=Australia');

//returns 'work=' for traditional media not requiring location dab
txt.value=txt.value.replace(/(?:\|\s?(?:publisher|work)\s?\=\s?\[\[(the )?(Billboard|Billboard Magazine|boston globe|business\s?week|chicago tribune|china daily|people.s daily|Houston chronicle|denver post|der spiegel|The economist|Entertainment Weekly|forbes(\smagazine)?|Financial Times|FT|Guardian|Hello!|International Herald Tribune|iht|(?:los angeles|la) times|le figaro|le monde|lib[ée]ration|mojo|newsday|newsweek|nydailynews|new york(?: daily news| Post| Times|er)|Q magazine|rolling\sstone|scmp|south china morning post|(?:San Francisco|sf) Chronicle|Sports Illustrated|Sydney Morning Herald|smh|Chicago Sun.Times|the australian|toronto star|time magazine|time|usa today|washington (?:post|times)|Wall Street Journal)\]\])/gi, '|work=$1$2 ');

txt.value=txt.value.replace(/(?:\|\s?(?:publisher)\s?\=\s?(the )?(Billboard|Billboard Magazine|boston globe|business\s?week|chicago tribune|china daily|people.s daily|Houston chronicle|denver post|der spiegel|The economist|Entertainment Weekly|forbes(\smagazine)?|Financial Times|FT|Guardian|Hello!|International Herald Tribune|iht|(?:los angeles|la) times|le figaro|le monde|lib[ée]ration|mojo|newsday|newsweek|nydailynews|new york(?: daily news| Post| Times|er)|Q magazine|rolling\sstone|scmp|south china morning post|(?:San Francisco|sf) Chronicle|Sports Illustrated|Sydney Morning Herald|smh|Chicago Sun.Times|the australian|toronto star|time magazine|time|usa today|washington (?:post|times)|Wall Street Journal)[\s]*?([\|\}]))/gi, '|work=$1$2 $3');

//returns 'publisher=' for electronic media
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|publisher|work)\s?\=\[\[(Al\sjazeera( English)?|AMG|All\s?Music\s?Guide|Allmusic|Amazon\.com|British Broadcasting Corporation|bbc( news)?|Bloomberg|Cable News Network|cnn|Fox News|Fox News Channel|Google|MSN|MTV|Myspace|mlb\.com|xinhua( news agency)?|Yahoo!?|You\s?Tube)\]\])/gi, '|publisher=$1');
txt.value=txt.value.replace(/(?:\|\s?work\s?\=(Al\sjazeera( English)?|AMG|All\s?Music\s?Guide|Allmusic|Amazon\.com|British Broadcasting Corporation|bbc( news)?|Bloomberg|Cable News Network|cnn|Fox News|Fox News Channel|Google|MSN|MTV|Myspace|mlb\.com|xinhua( news agency)?|Yahoo!?|You\s?Tube))/gi, '|publisher=$1');

//returns 'publisher=' for electronic media stripped of domain suffices
txt.value=txt.value.replace(/(?:\|\s?(newspaper|publisher|work)\s?\=\s?\[?\[?ap\.org\]?\]?)/gi, '|agency=Associated Press |location=USA');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|publisher|work)\s?\=\s?\[?\[?afp\.com\]?\]?)/gi, '|agency=Agence France Presse |location=France');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|publisher|work)\s?\=\s?\[?\[?aljazeera\.com\]?\]?)/gi, '|publisher=Aljazeera');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}bbc\.co\.uk\]?\]?)/gi, '|publisher=BBC News');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?bloomberg\.com\]?\]?)/gi, '|publisher=Bloomberg ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}cnn\.com\]?\]?)/gi, '|publisher=CNN ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}espn(\.go)?.com\]?\]?)/gi, '|publisher=ESPN ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?foxnews\.com\]?\]?)/gi, '|publisher=Fox News');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?msnbc\.com\]?\]?)/gi, '|publisher=MSNBC');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}google\.com\]?\]?)/gi, '|publisher=Google ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?reuters\.com\]?\]?)/gi, '|publisher=Reuters ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?xinhuanet\.com\]?\]?)/gi, '|publisher=Xinhua News Agency ');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(mtv|twitter|vh1|youtube)\.com\]?\]?)/gi, '|publisher=$2');

 
// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "Refs style";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}
//   document.forms.editform.wpMinoredit.checked = true;
//   document.editform.wpDiff.click();
}


$(function () {
 if(document.forms.editform) {
//  mw.util.addPortletLink('p-tb', 'javascript:CommonTerms()', 'Delink common terms', 't-dmy', 'Regexp common terms', '', '');
//  mw.util.addPortletLink('p-tb', 'javascript:run_formatgeneral()', 'Add metric units', 'ca-unitfixer', 'Fixes some unit formatting', '', '');

  mw.util.addPortletLink('p-tb', 'javascript:news_sources()', 'Fix news sources', 't-citefix', 'format citations', '', '');
  }
});