User:Trewyy/script/Sources.js

/************* mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript'); function Ohc_linkspam { var txt=document.editform.wpTextbox1;
 * Regex menu framework
 * by m:user:Pathoschild 
 * - adds a sidebar menu of user-defined scripts.

txt.value=txt.value.replace(/([^>\*][ ]*)\[https?:\/\/[^\s\]]*[ ]([\w\d][\w\d\s-'"]*)\]/gi, '$1$2'); }

function Ohc_news_sources { var txt=document.editform.wpTextbox1;

// removing external links within publisher/journal/work fields txt.value=txt.value.replace(/(\|\s?(?:newspaper|work|journal|publisher)\s?\=\s?)\[https?:\/\/[^\s\]]*[ ]([\w\d][^\]]*)\]/gi, '$1$2'); txt.value=txt.value.replace(/(\|\s?(?:newspaper|work|journal|publisher)\s?\=\s?)www\.([\w\d][^\|\}]*)(?=[\|\}])/gi, '$1$2');

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

//reflinks fixes //	txt.value=txt.value.replace(/&#\d{2,3}\;/g, ',');

//citation template fixes txt.value=txt.value.replace(/(?:\|[ ]*(?:first|agency|(?:co|)authors?|archive(?:url|date)|journal|publisher|newspaper|work|(?:access|)date|doi|month|year|location|format|first|language|last|publisher|authorlink|volume|issue|pages?))[ ]*=[\s]*(\}|\|)/gi, '$1'); txt.value=txt.value.replace(/(?:\|[ ]*(?:first|agency|(?:co|)authors?|archive(?:url|date)|journal|publisher|newspaper|work|(?:access|)date|doi|month|year|location|format|first|language|last|publisher|authorlink|volume|issue|pages?))[ ]*=[\s]*(\}|\|)/gi, '$1'); //repeat to catch neighbouring blank adjacent params 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(/\[\[Time\s\(magazine\)\|(Time|Time Magazine)\]\]/g, 'Time'); txt.value=txt.value.replace(/\[\[Billboard\s\(magazine\)\|(Billboard|Billboard Magazine)\]\]/g, '$1'); txt.value=txt.value.replace(/(The |)Globe & Mail/g, 'The Globe and Mail');

//returns 'work=' for traditional media; delinks and dabs location txt.value=txt.value.replace(/\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:(?:the |)(National Post|Le Devoir|Le Droit)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Canada '); txt.value=txt.value.replace(/\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:(?:the |)(Globe and Mail|Vancouver Sun)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Canada '); txt.value=txt.value.replace(/\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:the )?((?:Sunday )?Times|Independent|Observer|Guardian|Scotsman|Spectator|Daily Telegraph)(?:\]\])?(?=[\s\.]*[\|\}])/gi, '|work=The $1 |location=UK'); txt.value=txt.value.replace(/\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:the )?(Daily (?:Mail|Mirror|Express)|NME|New Musical Express|New Statesman)(?:\]\])?(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=UK'); txt.value=txt.value.replace(/\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:The Sun|Daily Star) \((?:United Kingdom|newspaper)\)\|(The Sun|Daily Star)(?:\]\])?(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=UK '); txt.value=txt.value.replace(/\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(apple daily|ming pao|The standard|south china morning post)(?:\]\])?(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Hong Kong'); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?The standard\|[^\]]*(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=The Standard |location=Hong Kong '); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(The Age|Herald Sun)(?:(?:\]\])?))(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Australia'); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(Asahi Shimbun|Yomiuri Shimbun)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Japan'); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:the |)(Irish |Japan |Taipei |Taiwan )Times(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=The $1Times '); 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)(?:\]\])?)(?=[\s\.]*[\|\}])/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)(?:\]\])?)(?=[\s\.]*[\|\}])/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)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1$2 |location=India'); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?)(?:\[\[The Telegraph \(Kolkata\)\|(The Telegraph)\]\])(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Kolkota, India '); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?)(?:\[\[The Pioneer \(Indian newspaper\)\|(The Pioneer)\]\])(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=India '); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(?:The |)((?:Indian|Financial) Express)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=The $1 '); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(Blesk|Hospodářské noviny|Lidové noviny|Mladá fronta DNES|Právo|(?:The |)Prague Post)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Czech Republic');

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

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(?:the |)jakarta post\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Jakarta Post '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(?:the |)jakarta globe\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Jakarta Globe '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?(?:\[\[)?(?:The |)Straits Times(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=Straits Times |location=Singapore '); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?(China Times|Liberty Times|(?:The |)China Post|United Daily News)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Taiwan (ROC)'); //	txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(apple daily|ming pao|(?:The |Hong Kong |hk ?)standard|south china morning post))(?=[\s\.]*[\|\}])/gi, '|work=$1 |location=Hong Kong |'); txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?\[\[The standard\|hk standard\]\])(?=[\s\.]*[\|\}])/gi, '|work=The Standard |location=Hong Kong '); //	txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?the age)(?=[\s\.]*[\|\}])/gi, '|work=The Age |location=Australia'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(?:nz |new zealand )herald\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The New Zealand Herald');

//returns 'work=' for traditional media with websites txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(wired\.com)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Wired '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(flightglobal\.com|Flight Global)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Flight International '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?playbill.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Playbill '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(variety.com|Variety \(magazine\)\|Variety)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Variety '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(vogue.com|Vogue \(magazine\)\|Vogue)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Vogue '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(vanityfair.com|Vanity Fair \(magazine\)\|Vanity Fair)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Vanity Fair '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?empireonline.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Empire '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nme\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=NME |location=UK '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?qthemusic\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Q |location=UK '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?billboard\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Billboard '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?rollingstone.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Rolling Stone ');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.(com\.au|net(?:\.au|))\]?\]?)(?=[\s\.]*[\|\}])/gi, '|publisher=ABC |location=Australia '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|publisher=ABC |location=USA '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?cbc\.ca\]?\]?)(?=[\s\.]*[\|\}])/gi, '|publisher=CBC |location=Canada '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?boston.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Boston Globe '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?businessweek\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Bloomberg BusinessWeek '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chicagotribune\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work= Chicago Tribune '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chinadaily\.com\.cn\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=China Daily '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chinatimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=China Times |location=Taiwan (ROC) '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?libertytimes\.com\.tw\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Liberty Times |location=Taiwan (ROC) '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?taipeitimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Taipei Times |location=Taiwan (ROC) '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?udn\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=United Daily News |location=Taiwan (ROC) '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?people(?:daily|)\.com\.cn\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=People\'s Daily '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?straitstimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Straits Times |location=Singapore '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?chron\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Houston Chronicle '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(dailymail.co\.uk|Mail Online)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Daily Mail |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(mirror.co\.uk)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Daily Mirror |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?denverpost\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Denver Post'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?((?:der|)spiegel\.de|spiegel online)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Der Spiegel '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?((?:die|)welt\.de|welt online)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Die Welt '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?economist\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Economist '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}\.ew.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Entertainment Weekly '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}forbes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Forbes'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?radiotimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Radio Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ft.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Financial Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Guardian(\.co\.uk|\sUnlimited)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Guardian |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(Hello|OK)magazine\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=$2! '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?iht\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=International Herald Tribune'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,7}independent\.co\.uk\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Independent |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?independent\.ie\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Irish Independent '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?irishtimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Irish Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,7}latimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Los Angeles Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lefigaro\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Le Figaro |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lemonde\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Le Monde |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?liberation.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Libération |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?La-Croix\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=La Croix |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LeParisien\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Le Parisien |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LaTribune\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=La Tribune |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lesechos\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Les Échos |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?FranceSoir\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=France Soir |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?20Minutes\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=20 Minutes |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lequipe\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=L\'Équipe |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Canardenchaîne\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Le Canard Enchaîné |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?NouvelObs\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Le Nouvel Observateur |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Lexpress\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=L\'Express |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?LePoint\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Le Point |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?marianne-en-ligne\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Marianne |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?parismatch\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Paris-Match |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Telerama\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Télérama |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?Courrierinternational\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Courrier International |location=France'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?minute-hebdo\.fr\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Minute |location=France');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?asahi\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Asahi Shimbun |location=Japan'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?yomiuri\.co\.jp\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Yomiuri Shimbun |location=Japan'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}japantimes\.co\.jp\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Japan Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?haaretz\.?(?:com|co\.il)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Haaretz |location=Israel'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thejakartapost\.(?:com|)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Jakarta Post '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thejakartaglobe\.(?:com|)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Jakarta Globe '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?jpost\.(com|co\.il)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Jerusalem Post ');

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

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?blesk.cz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Blesk |location=Czech Republic'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ihned.cz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Hospodářské noviny |location=Czech Republic'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lidovky.cz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Lidové noviny |location=Czech Republic'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?idnes.cz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Mladá fronta DNES |location=Czech Republic'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?pravo.novinky.cz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Právo |location=Czech Republic'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?praguepost.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Prague Post |location=Czech Republic');

txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?mingpao.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Ming Pao |location=Hong Kong'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?newsday\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Newsday |location=New York '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?newsweek\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Newsweek '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nydailynews\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Daily News |location=New York '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nypost.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=New York Post '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[\b\.]{0,20}nytimes.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The New York Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?people.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=People '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?scmp.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=South China Morning Post |location=Hong Kong'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?sfgate.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=San Francisco Chronicle '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?smh\.com\.au\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Sydney Morning Herald '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?spectator\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Spectator |location=UK '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}scotsman\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Scotsman |location=UK '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thisislondon\.co\.uk\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Evening Standard |location=London '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?sportsIllustrated\.cnn\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Sports Illustrated '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?standard\.com\.hk\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Standard |location=Hong Kong '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thesun.co\.uk\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Sun |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?suntimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Chicago Sun-Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?telegraph\.co\.uk\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Daily Telegraph |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?dailytelegraph\.com\.au\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Daily Telegraph |location=Australia'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theage\.com\.au\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Age |location=Australia'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theaustralian\.com\.au\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Australian '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?stuff\.co\.nz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Stuff |location=New Zealand '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nzherald\.co\.nz\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The New Zealand Herald'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?theglobeandmail\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Globe and Mail |location=Canada '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nationalpost\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=National Post |location=Canada '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?vancouversun\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Vancouver Sun '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thestar\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Toronto Star '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?torontosun\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Toronto Sun '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?time.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=Time '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(Timesonline\.co(?:\.uk|m)|Times ?online)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Times |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}usatoday\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=USA Today '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?washingtonpost\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Washington Post '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?washingtontimes\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Washington Times '); txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}wsj\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=The Wall Street Journal ');

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

//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|chicago tribune|china daily|people.s daily|Houston chronicle|denver post|der spiegel|The economist|Entertainment Weekly|forbes(?:\smagazine|)|Financial Times|FT|(?:The |)Globe and Mail|(?:The |)Vancouver Sun|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|Ottawa Citizen|Ottawa Sun|toronto (?:star|sun)|time magazine|time|usa today|washington (?:post|times)|Wall Street Journal)\]\])(?=[\s\.]*[\|\}])/gi, '|work=$1$2'); txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?((?:bloomberg |)business\s?week)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 ');

txt.value=txt.value.replace(/(?:\|\s?(?:publisher)\s?\=\s?(the |)(Billboard|Billboard Magazine|boston globe|chicago tribune|china daily|people.s daily|Houston chronicle|denver post|der spiegel|The economist|Entertainment Weekly|forbes(?:\smagazine|)|Financial Times|FT|(?:The |)Globe and Mail|(?:The |)Vancouver Sun|(?:The |)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|Ottawa Citizen|Ottawa Sun|toronto (?:star|sun)|time magazine|time|usa today|washington (?:post|times)|Wall Street Journal))(?=[\s\.]*[\|\}])/gi, '|work=$1$2');

//returns 'publisher=' for new media news magazines txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(Huffington Post)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=$1 '); txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(Digitalspy.co.uk)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|work=Digital Spy ');

//returns 'publisher=' for electronic media txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(bbc.co.uk)(?:\]\])?)(?=[\s\.]*[\|\}])/gi, '|publisher=BBC'); //	txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^\[]{0,10}(bbc\.co\.uk)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|publisher=BBC '); txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?(?:\[\[)(bbc( sports?| news(?: online|)|))(?:\]\]))(?=[\s\.]*[\|\}])/gi, '|$1=$2 '); txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?(bbc( sports?| news(?: online|)|)))(?=[\s\.]*[\|\}])/gi, '|$1=$2 '); txt.value=txt.value.replace(/(=[ ]?BBC News)( online|\.com)(?=[\s\.]*[\|\}])/gi, '$1'); txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|publisher|work)\s?\=\[\[(Al\sjazeera( English)?|AMG|All\s?Music\s?Guide|Allmusic|Amazon\.com|(?:American|Australian|Canadian|British) Broadcasting Corporation|Bloomberg|Cable News Network|cnn|Fox News|Fox News Channel|Google|MSN|MTV|Myspace|mlb\.com|xinhua( news agency)?|Yahoo!?|You\s?Tube)\]\])(?=[\s\.]*[\|\}])/gi, '|publisher=$1'); txt.value=txt.value.replace(/(?:\|\s?(?:work|newspaper)\s?\=(Al\sjazeera( English)?|AMG|All\s?Music\s?Guide|Allmusic|Amazon\.com|(?:American|Australian|Canadian|British) Broadcasting Corporation|Bloomberg[ ]*\||Cable News Network|cnn|Fox News|Fox News Channel|Google|MSN|MTV|Myspace|mlb\.com|VH1|xinhua( news agency)?|Yahoo!?|You\s?Tube))(?=[\s\.]*[\|\}])/gi, '|publisher=$1');

//Television media and networks txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(BBC (?:One|Two|Three|Four|Five|Six)|Channel [45])\]\])(?=[\s\.]*[\|\}])/gi, '|$1=$2 |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(?:Channel Five \(UK\)\||)(Channel Five|Channel 5)\]\])(?=[\s\.]*[\|\}])/gi, '|$1=Channel 5 |location=UK'); txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(Network Ten)\]\])(?=[\s\.]*[\|\}])/gi, '|$1=$2 |location=Australia'); txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(?:Ten|Eleven) \(TV channel\)\|(Ten|Eleven)\]\])(?=[\s\.]*[\|\}])/gi, '|$1=$2 |location=Australia');

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

txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?(mtv|twitter|vh1|youtube)\.com\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=\'\'$2\'\''); txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?((?:[\w]*\.|)Europa\.eu|Europa \(web portal\)\|Europa)\]?\]?)(?=[\s\.]*[\|\}])/gi, '|work=\'\'Europa (web portal)\'\'');

txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|publisher|work)\s?\=\s?(?:\[\[)(AF?P\b|Associated Press|Agence France-Presse|Kyodo ?News|Reuters)(?:\]\]))(?=[\s\.]*[\|\}])/g, '|agency=$1 '); txt.value=txt.value.replace(/\[\[(?:(?:Associated Press|Agence France-Presse)\||)(ABC|AP|AFP)\]\]/g, '$1'); txt.value=txt.value.replace(/\|\s?(?:newspaper|publisher|work)\s?\=\s?(AF?P\b|Associated Press|Agence France-Presse)(?=[\s\.]*[\|\}])/g, '|agency=$1 ');

// removing redundancies txt.value=txt.value.replace(/\|\s?location\s?\=\s?(?:London)\s*(\|[^}]*|)\|\s?location\s?\=\s?(?:London|UK)/g, '|location=London $1'); txt.value=txt.value.replace(/\|\s?location\s?\=\s?(?:London|UK)\s*(\|[^}]*|)\|\s?location\s?\=\s?(?:London)/g, '|location=London $1'); txt.value=txt.value.replace(/\|\s?location\s?\=\s?(?:UK)\s*(\|[^}]*|)\|\s?location\s?\=\s?(?:UK)/g, '|location=UK$1'); txt.value=txt.value.replace(/\|\s?location\s?\=\s?(?:Canada)\s*(\|[^}]*|)\|\s?location\s?\=\s?(?:Canada)/g, '|location=Canada$1'); txt.value=txt.value.replace(/\|\s?location\s?\=\s?(?:Australia)\s*(\|[^}]*|)\|\s?location\s?\=\s?(?:Australia)/g, '|location=Australia$1'); txt.value=txt.value.replace(/\|\s?location\s?\=\s?USA\s?(\|[^}]*|)\|\s?location\s?\=\s?USA/g, '|location=USA $1'); txt.value=txt.value.replace(/\|\s?location\s?\=\s?New York(?: City|)\s*(\|[^}]*|)\|\s?location\s?\=\s?(New York(?: City|)|USA)(?=[\s\.]*[\|\}])/g, '|location=New York $1'); txt.value=txt.value.replace(/\|[ ]?language[ ]?\=[ ]?English[ ]*?(?=[\|\}])/gi, ''); //note: adjusted for false positive in infoboxes books txt.value=txt.value.replace(/- [\w]*\.com[ ]*\|/gi, '|');

txt.value=txt.value.replace(/\|\s?publisher\s?\=\s?(?:BBC|BBC News(?: Online|))\s?(\|[^}]*|)\|\s?publisher\s?\=\s?(?:BBC|BBC News(?: Online|)|British Broadcasting Corporation)(?=[\s\.]*[\|\}])/g, '|publisher=BBC News $1'); txt.value=txt.value.replace(/\|\s?publisher\s?\=\s?(BBC Sports?)\s?(\|[^}]*|)\|\s?publisher\s?\=\s?(?:BBC|BBC News(?: Online|)|British Broadcasting Corporation)(?=[\s\.]*[\|\}])/g, '|publisher=$1$2'); txt.value=txt.value.replace(/\|\s?publisher\s?\=\s?CNN\s?(\|[^}]*|)\|\s?publisher\s?\=\s?CNN(?=[\s\.]*[\|\}])/g, '|publisher=CNN $1');

//rem linking within locations field regex(/(\|[ ]*?location=[ ]*?)\[\[([^\|\]]+?)\]\](?:(,? )\[\[([^\|\]]+?)\]\]|)([ ]{0,1})/gi, '$1$2$3$4$5'); regex(/(\|[ ]*?location=[ ]*?)\[\[(?:[^\|\]]+?\|)([\w\s\,]+?)\]\](?:(,? )\[\[([^\|\]]+?)\]\]|)([ ]{0,1})/gi, '$1$2$3$4$5');

}

function Ohc_Source_edit_summary{ // Add a tag to the summary box var txt=document.editform.wpSummary; var summary = "per WP:MOSTEXT"; 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 Ohc_ref_format { var txt=document.editform.wpTextbox1;

Ohc_news_sources; Ohc_Source_edit_summary; }

addOnloadHook(function { if(document.forms.editform) { //  mw.util.addPortletLink('p-tb', 'javascript:function_name', 'Button name', 't-dmy', 'Hover text', , );

mw.util.addPortletLink('p-tb', 'javascript:Ohc_linkspam', 'Linkspam', 'rm-linkspam', 'removes linkspam in running text', , ); mw.util.addPortletLink('p-tb', 'javascript:Ohc_ref_format', 'Fix news sources', 't-citefix', 'format citations', , ); } });