// ***************************************************************************************************************
//This is a test (non-production)script and may have untested errors. Please exercise due care should you decide to use it.
// ***************************************************************************************************************
function Ohc_linkspam() {
var txt=document.editform.wpTextbox1;
txt.value=txt.value.replace(/([^>\*][ ]*)\[http:\/\/[^\s\]]*[ ]([\w\d][\w\d\s-'"]*)\]/gi, '$1$2');
}
function Ohc_news_sources() {
var txt=document.editform.wpTextbox1;
// txt.value=txt.value.replace(/(\n)<(\/references|references\/)>/g, '$1{{reflist}}'); - disabled per false positive at Paul Simenon
// txt.value=txt.value.replace(/\{\{[ ]*cite /g, '{{Cite ');
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, '');
//reflinks fixes
txt.value=txt.value.replace(/&#\d{2,3}\;/g, ',');
//citation template fixes
txt.value=txt.value.replace(/(?:\|[ ]*(?:first|agency|(?:co|)author|archive(?:url|date)|journal|publisher|newspaper|work|(?:access|)date|month|year|___location|format|language|last|authorlink|pages?))[ ]*=[\s]*(}|\|)/gi, '$1');
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');
//returns 'work=' for traditional media with websites
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(flightglobal\.com|Flight Global)\]?\]?)/gi, '|work=Flight International ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?playbill.com\]?\]?)/gi, '|work=Playbill ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(variety.com|Variety \(magazine\)\|Variety)\]?\]?)/gi, '|work=Variety ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?empireonline.com\]?\]?)/gi, '|work=Empire ');
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?\[?\[?qthemusic\.com\]?\]?)/gi, '|work=Q |___location=UK ');
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?\[?\[?rollingstone.com\]?\]?)/gi, '|work=Rolling Stone ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.(com\.au|net(?:\.au|))]?\]?)/gi, '|publisher=Australian Broadcasting Corporation ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?abc\.com\]?\]?)/gi, '|publisher=American Broadcasting Company ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?cbc\.ca\]?\]?)/gi, '|publisher=Canadian Broadcasting Corporation ');
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=Bloomberg 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?\[?\[?chinatimes\.com\]?\]?)/gi, '|work=China Times |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?libertytimes\.com\.tw\]?\]?)/gi, '|work=Liberty Times |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?taipeitimes\.com\]?\]?)/gi, '|work=Taipei Times |___location=Taiwan (ROC) ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?udn\.com\]?\]?)/gi, '|work=United Daily News |___location=Taiwan (ROC) ');
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?\[?\[?straitstimes\.com\]?\]?)/gi, '|work=Straits Times |___location=Singapore ');
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|Mail Online)\]?\]?)/gi, '|work=The Daily Mail |___location=UK');
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?\[?\[?((?:der|)spiegel\.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?\[?\[?[^\[\|]{0,10}ew.com\]?\]?)/gi, '|work=Entertainment Weekly ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}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=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?(Hello|OK)magazine\.com\]?\]?)/gi, '|work=$2! ');
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=UK');
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=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lemonde\.fr\]?\]?)/gi, '|work=Le Monde |___location=France');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?liberation.fr\]?\]?)/gi, '|work=Libération |___location=France');
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?\[?\[?asahi\.com\]?\]?)/gi, '|work=Asahi Shimbun |___location=Japan');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?yomiuri\.co\.jp\]?\]?)/gi, '|work=Yomiuri Shimbun |___location=Japan');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^\[\|]{0,10}japantimes\.co\.jp\]?\]?)/gi, '|work=Japan Times ');
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 ');
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?\[?\[?blesk.cz\]?\]?)/gi, '|work=Blesk |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?ihned.cz\]?\]?)/gi, '|work=Hospodářské noviny |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?lidovky.cz\]?\]?)/gi, '|work=Lidové noviny |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?idnes.cz\]?\]?)/gi, '|work=Mladá fronta DNES |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?pravo.novinky.cz\]?\]?)/gi, '|work=Právo |___location=Czech Republic');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?praguepost.com\]?\]?)/gi, '|work=The Prague Post |___location=Czech Republic');
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?\[?\[?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?\[?\[?[\b\.]{0,20}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?\[?\[?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?\[?\[?[^[]{0,10}scotsman\.com\]?\]?)/gi, '|work=The Scotsman |___location=UK ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?thisislondon\.co\.uk\]?\]?)/gi, '|work=Evening Standard |___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=UK');
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=UK');
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?\[?\[?theglobeandmail\.com\]?\]?)/gi, '|work=The Globe and Mail |___location=Canada ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?nationalpost\.com\]?\]?)/gi, '|work=National Post |___location=Canada ');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?vancouversun\.com\]?\]?)/gi, '|work=The Vancouver Sun ');
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?\[?\[?torontosun\.com\]?\]?)/gi, '|work=Toronto Sun ');
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=UK');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[?\[?[^[]{0,10}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 |)(Globe and Mail|National Post|Vancouver Sun|Le Devoir|Le Droit))\]\])/gi, '|work=$1 |___location=Canada ');
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?\[\[(?:The Sun|Daily Star) \((?:United Kingdom|newspaper)\)\|(The Sun|Daily Star)\]\])/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)\]\])/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|Herald Sun)\]\])/gi, '|work=$1 |___location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(Asahi Shimbun|Yomiuri Shimbun)\]\])/gi, '|work=$1 |___location=Japan');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?\[\[(?:the |)(Irish |Japan |Taipei |Taiwan )Times\]\])/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)\]\])/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?(?:work|publisher)\s?\=\s?\[\[(Blesk|Hospodářské noviny|Lidové noviny|Mladá fronta DNES|Právo|(?:The |)Prague Post)\]\])/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)[ ]*?\|)/gi, '|work=$1$2 |___location=UK |');
txt.value=txt.value.replace(/(?:\|\s?(work|publisher)\s?\=\s?\[\[(?:The |)Straits Times\]\])/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)\]\])/gi, '|work=$1 |___location=Taiwan (ROC)');
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|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)\]\][ ]*\|)/gi, '|work=$1$2 |');
txt.value=txt.value.replace(/(?:\|\s?(?:work|publisher)\s?\=\s?(?:\[\[)?((?:bloomberg |)business\s?week)\b(?:\]\])?[ ]*\|)/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 $3');
//returns 'publisher=' for new media news magazines
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(Huffington Post)(?:\]\])?)/gi, '|work=$1 |___location=USA');
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(Digitalspy.co.uk)(?:\]\])?)/gi, '|work=Digital Spy |___location=UK');
//returns 'publisher=' for electronic media
txt.value=txt.value.replace(/(?:\|\s?(?:newspaper|work|publisher)\s?\=\s?(?:\[\[)?(bbc.co.uk)(?:\]\])?)/gi, '|publisher=BBC');
// txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^[]{0,10}(bbc\.co\.uk)\]?\]?)/gi, '|publisher=BBC ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?(?:\[\[)(bbc( sports?| news(?: online|)|))(?:\]\]))/gi, '|$1=$2 ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?(bbc( sports?| news(?: online|)|)))/gi, '|$1=$2 ');
txt.value=txt.value.replace(/(=[ ]?BBC News)( online|\.com)/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)\]\])/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|xinhua( news agency)?|Yahoo!?|You\s?Tube))/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])\]\])/gi, '|$1=$2 |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(?:Channel Five \(UK\)\||)(Channel Five|Channel 5)\]\])/gi, '|$1=Channel 5 |___location=UK');
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(Network Ten)\]\])/gi, '|$1=$2 |___location=Australia');
txt.value=txt.value.replace(/(?:\|\s?(publisher|station)\s?\=\[\[(?:Ten|Eleven) \(TV channel\)\|(Ten|Eleven)\]\])/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\]?\]?)/gi, '|agency=Associated Press ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?afp\.com\]?\]?)/gi, '|agency=Agence France-Presse ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?reuters\.com\]?\]?)/gi, '|agency=Reuters ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?kyodonews\.jp\]?\]?)/gi, '|agency=Kyodo News ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?xinhuanet\.com\]?\]?)/gi, '|agency=Xinhua News Agency ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?aljazeera\.com\]?\]?)/gi, '|publisher=Aljazeera');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?bloomberg\.com\]?\]?)/gi, '|publisher=Bloomberg ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^[]{0,10}cnn\.com\]?\]?)/gi, '|publisher=CNN ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^[]{0,10}espn(\.go)?.com\]?\]?)/gi, '|publisher=ESPN ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?foxnews\.com\]?\]?)/gi, '|publisher=Fox News');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?huffingtonpost\.com\]?\]?)/gi, '|work=Huffington Post ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?msnbc\.com\]?\]?)/gi, '|publisher=MSNBC');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?books.google\.com\]?\]?)/gi, '|publisher=Google Books');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?[^[]{0,10}google\.com\]?\]?)/gi, '|publisher=Google ');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?(mtv|twitter|vh1|youtube)\.com\]?\]?)/gi, '|work=\'\'$2\'\'');
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?((?:[\w]*\.|)Europa\.eu|Europa \(web portal\)\|Europa)\]?\]?)/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)(?:\]\]|))/g, '|agency=$1 ');
txt.value=txt.value.replace(/\[\[(ABC|AP|AFP)\]\]/g, '$1');
//linked publishing houses
txt.value=txt.value.replace(/(?:\|\s?(newspaper|work|publisher)\s?\=\s?\[?\[?Hachette Filipacchi Médias\|(Hachette Filipacchi) \(UK\) Ltd\]?\]?)/gi, '|publisher=$2');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?(\[\[|)(Associated Newspapers|Fairfax Media|(Guardian|Telegraph) Media Group|IPC Media|(The |)New York Times Company|News International|Trinity Mirror)(\]\]|))/gi, '');
txt.value=txt.value.replace(/\|\s?___location\s?\=\s?(?:London|UK)\s?(\|[^}]*|)\|\s?___location\s?\=\s?(?:London|UK)/g, '|___location=UK $1');
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)/g, '|publisher=BBC News $1');
// removing redundancies
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)/g, '|___location=New York $1');
// txt.value=txt.value.replace(/\|\s?language\s?\=\s?English/gi, ''); //false positive in infoboxes for books
txt.value=txt.value.replace(/- [\w]*\.com \|/gi, '|');
}
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) {
// addPortletLink('p-tb', 'javascript:function_name()', 'Button name', 't-dmy', 'Hover text', '', '');
addPortletLink('p-tb', 'javascript:Ohc_linkspam()', 'Linkspam', 'rm-linkspam', 'removes linkspam in running text', '', '');
addPortletLink('p-tb', 'javascript:Ohc_ref_format()', 'Fix news sources', 't-citefix', 'format citations', '', '');
}
});