Jump to content

User:SD0001/unreliable.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 09:27, 16 February 2020 (club the regex and the css together for each category; should make maintenance easier). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Instructions available at [[User:Headbomb/unreliable]]
// This is still in development, but it works well enough to be useful
// Feel free to request tweaks or for additional sources to be covered on the talk page

// Adapted from https://en.wikipedia.org/w/index.php?title=Wikipedia:User_scripts/Requests&diff=939432100&oldid=939403363 by [[User:SD0001]]
// Updated from https://en.wikipedia.org/w/index.php?title=User:Jorm/unreliable.js&oldid=940556311 by [[User:Jorm]]

// Unreliable websites based on [[WP:RSPSOURCES]] (mostly)
// Unreliable publishers/journals based on [[WP:CITEWATCH]] (mostly)

$( function() {

	const rules = [
	
		// Blacklisted sources
		{
			regex: /\b(?:test\.blacklist\.org|112\.ua|112\.international|breitbart\.com|dan-news\.info|infowars\.com|lenta\.ru|news-front\.info|rusdialog\.ru|southfront\.org|topwar\.ru|ukraina\.ru|veteranstoday\.com|veteransnewsnow\.com|city-data\.com|globalresearch\.ca|examiner\.com|famousbirthdays\.com|liveleak\.com|lulu\.com|mylife\.com|naturalnews\.com|thepointsguy\.com|zoominfo\.com|newswar\.com|\reunion\.com)/,
			css:  { "background-color": "#000000", "color":"red", "border": "2px solid #ff0000"}
		},

		// Depreacted sources
		{
			regex: /\b(?:test\.deprecated\.org|crunchbase\.com|dailycaller\.com|dailymail\.co\.uk|theepochtimes\.com|thegatewaypundit\.com|hispantv\.com|hispantv\.ir|last\.fm|lifesitenews\.com|campaignlifecoalition\.com|mintpressnews\.com|nationalenquirer\.com|newsoftheworld\.co\.uk|nndb\.com|occupydemocrats\.com|oann\.com|rateyourmusic\.com|thesun\.co\.uk|takimag\.com|telesurtv\.net|telesurenglish\.net|vdare\.com|wnd\.com)/,
			css: { "background-color": "#ffbbbb" },
		},

		// Generally unreliable sources
		{
			regex: /\b(?:test\.generallyunreliable\.org|alternet\.org|amazon\.com|ancestry\.com|answers\.com|baike\.baidu\.com|bild\.de|theblaze\.com|conservativereview\.com|blogger\.com|celebritynetworth\.com|cesnur\.org|cnsnews\.com|coindesk\.com|cracked\.com|express\.co\.uk|dailykos\.com|dailystar\.co\.uk|discogs\.com|electronicintifada\.net|fb\.com|facebook\.com|familysearch\.org|fandom\.com|wikia\.org|wikia\.com|findagrave\.com|findmypast\.co\.uk|gawker\.com|geni\.com|goodreads\.com|heatst\.com|imdb\.com|indymedia\.org|instagram\.com|ibtimes\.com|jezebel\.com|linkedin\.com|livejournal\.com|marquiswhoswho\.com|mediabiasfactcheck\.com|medium\.com|metro\.news|thenewamerican\.com|theonion\.com|patheos\.com|pinterest\.com|presstv\.com|quadrant\.org\.au|quillette\.com|quora\.com|reddit\.com|rt\.com|scribd\.com|sputniknews\.com|stackexchange\.com|stackoverflow\.com|mathoverflow\.net|askubuntu\.com|thetruthaboutguns\.com|tunefind\.com|tvtropes\.org|twitter\.com|urbandictionary\.com|venezuelanalysis\.com|vgchartz\.com|vixra\.org|westernjournal\.com|whosampled\.com|wordpress\.com|youtube\.com|zerohedge\.com)/,
			css:  { "background-color": "#ffdddd" },
		},

		// Wikimedia-related websites
		{
			filter: mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118,
			regex: /\b(?:test\.wiki\.org|wikidata\.org|wikileaks\.org|wikinews\.org|wikipedia\.org)/,
			css: { "background-color": "#ffdddd" },
		},

		// Predatory. See [[Special:AbuseFilter/891]], [[WP:CITEWATCH/SETUP]], [[User:JzG/Predatory]] and https://beallslist.net/
		{
			regex: /\b(?:test\.predatory\.org|academicjournals\.com|academicjournals\.net|academicjournals\.org|academicpub\.org|academicresearchjournals\.org|aiac\.org\.au|aicit\.org|alliedacademies\.org|arcjournals\.org|ashdin\.com|aspbs\.com|avensonline\.org|biomedres\.info|biopublisher\.ca|bowenpublishing\.com|ccsenet\.org|cennser\.org|clinmedjournals\.org|cluteinstitute\.com|cpinet\.info|cscanada\.net|davidpublisher\.org|etpub\.com|eujournal\.org|growingscience\.com|grdspublishing\.org|hanspub\.org|hoajonline\.com|hrmars\.com|iacsit\.org|iamure\.com|idosi\.org|igi-global\.com|iises\.net|iiste\.org|\.iiis\.org|imedpub\.com|informaticsjournals\.com|innspub\.net|intechopen\.com|intechweb\.org|interesjournals\.org|internationaljournalssrg\.org|ispacs\.com|ispub\.com|jaypeejournals\.com|jpmedpub\.com|jaypeebrothers\.com|julypress\.com|juniperpublishers\.com|kowsarpub\.com|kspjournals\.org|m-hikari\.com|macrothink\.org|mecs-press\.org|medwelljournals\.com|oapublishinglondon\.com|oatext\.com|omicsonline\.org|ospcindia\.org|researchleap\.com|sapub\.org|scholink\.org|scialert\.net|scidoc\.org|sciencedomain\.org|sciencedomains\.org|sciedu\.ca|sciencepg\.com|sciencepub\.net|sciepub\.com|sciencepubco\.com|sciencepublication\.org|sciencepublishinggroup\.com|scipg\.net|scipress\.com|scirp\.org|scopemed\.com|sersc\.org|sphinxsai\.com|\.ssjournals\.com|thesai\.org|waset\.org|witpress\.com|worldwidejournals\.com|zantworldpress\.com|journalofcosmology\.com|cosmology\.com)/,
			css: { "background-color": "#ffbbbb" },
		},
		{ 
			regex: /10\.(?:0001|11648|1166|1234|12677|12692|12720|12988|13005|13172|13188|14257|14303|14419|14445|1453|14569|14662|15415|15373|15680|15761|17265|18005|18052|18311|18775|19030|19044|19070|19080|1999|20319|20431|20472|20849|20902|21102|21767|22158|23937|2495|30845|35841|36648|3844|3923|3968|4066|4018|4156|4172|4236|4303|5005|5267|5296|5376|5430|5455|5539|5567|5580|5772|5812|5815|5829|5897|5899|5923|5963|6007|7243|7439|7537|7575|7718|7763|9734)\b/,
			css: { "background-color": "#ffbbbb" },
		},

		// Sources that traditionally fail [[WP:MEDRS]], but which could be used for other more routine claims
		{
			regex: /\b(?:test\.medrs\.org|mdpi\.com|frontiersin\.org|f1000\.com|benthamopen\.com)/,
			css: { "background-color": "#fffdd0" }
		},
		{
			regex: /10\.(?:0002|2174|3389|3390|3410|4089|4175|7490|12688|12703|20944|32545|35995)\b/,
			css:  { "background-color": "#fffdd0" }
		},

		// May or may not contain preprints, predatory, or self-published materials
		{
			regex: /\b(?:test\.warn\.org|academia\.edu|arxiv\.org|citeseerx\.ist\.psu\.edu|researchgate\.net|peerj\.com\/preprints|biorxiv\.org|medrxiv\.org|eartharxiv\.org|psyarxiv\.com|osf\.io\/preprints|ssrn\.com|chemrxiv\.org|docs\.google\.com|pulsus\.com|e-century\.org)/,
			css: { "background-color": "#fffdd0" },
		},
		{
			regex: /10\.(?:0003|1101%2F\d+|2139|7287|13140|19144|20935|21282|31223|31227|31234|31235)\b/,
			css: { "background-color": "#fffdd0" },
		}, 

		// Varies with the contributor or topic
		{
			regex: /\b(?:test\.contributors\.org|forbes\.com|huffpost\.com|aa\.com\.tr|foxnews\.com)/,
			css:  { "background-color": "#fffdd0" },
		}
	];

	$('.mw-parser-output a.external').each(function(_, link) {
		$.each(rules, function(_, rule) {
			if (typeof rule.filter !== 'undefined' && !rule.filter) {
				return true;
			}
			if (rule.regex.test(link.href)) {
				$(link).css(rule.css);
				return false;
			}
		});
	});

} );