User:Ohconfucius/test/Sources.js: Difference between revisions

Content deleted Content added
new edit summary
syntax per jshints.com
Line 31:
 
//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(/(\|[ ]*(?:agency|author|journal|publisher|newspaper|work))[ ]*=[ ]*/gi, '$1=');
txt.value=txt.value.replace(/(?:\|\s?publisher\s?\=\s?\'\'\[\[([^\]]{1,40})\]\]\'\')/gi, '|work=[[$1]]');
Line 49:
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 ');
Line 73:
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 ');
Line 134:
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 ');
Line 150:
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
Line 193:
//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 ');
Line 214:
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\'\'');