User:Ovinus/common.js

// powered by  // full list of voices at https://docs.aws.amazon.com/polly/latest/dg/voicelist.html

function loadConfig { var config = window.ipareaderConfig; if (typeof config === 'undefined') { config = {}; }	if (typeof config.voice === 'undefined') { config.voice = 'Salli'; }	return config; }

function speak(text, voice) { var requestData = { text: text, voice: voice }; $.ajax({		url: "https://iawll6of90.execute-api.us-east-1.amazonaws.com/production",		method: "POST",		contentType: "application/json",		data: JSON.stringify(requestData),		success: function(data) {			var uri = "data:audio/mpeg;base64," + data;			(new Audio(uri)).play;		}	}); }

(function {	var config = loadConfig;	mw.util.addCSS('.ipareader-play { cursor:pointer; margin-left: 0.25em; }');	$('.IPA').each(function { var button = $(' 🔈 '); $(this).append(button); button.click(function {			var text = $(this).parent.text;			speak(text, config.voice);		}); }); });

//Write your own! See Wikipedia:WikiProject User scripts/Guide

addOnloadHook(contribstab); //means «execute func_start later» function contribstab {

if (mw.config.get('wgNamespaceNumber') == 2 || mw.config.get('wgNamespaceNumber') == 3) { //If we're in User or User talk namespace

var pagename; var name1; var name2;

name1=mw.config.get('wgPageName').indexOf(":"); //Find the colon to separate User: prefix

if (name1 != -1) { //Skip it if we didn't find a colon name1=name1+1; pagename=mw.config.get('wgPageName').substring(name1); } else { pagename=mw.config.get('wgPageName'); //if no colon, assume we have the user name already }

name2=pagename.indexOf("/"); //If it's a subpage, get root name

if (name2 > 0){ //if we found a slash earlier pagename=pagename.substring(0,name2); }

addPortletLink ('p-cactions', '/wiki/Special:Contributions/'+pagename, 'Contributions', 1, 'View this user\'s contributions'); //Add the button

} //resumes here for non-user/UT pages }

//Written by Jeremy McCracken April, 2008 //Original file location http://en.wikipedia.org/wiki/User:JeremyMcCracken/contribstab.js if(window.checkLinksToCitations === undefined) window.checkLinksToCitations = true;

mw.hook( 'wikipage.content' ).add( function( $content ) {   // first check: do links in Harvard citations point to a valid citation?    var href,    	links = $content.find( 'a[href^="#CITEREF"]' );

links.each( function (i, elem) {   	href = elem.getAttribute( 'href' ).substring(1); //skip the #    	// IDs can contain characters like . that have meaning in selectors    	// use $.escapeSelector to make sure they are escaped        if ( $content.find( '#' + $.escapeSelector(href) ).length < 1 && elem && elem.parentNode)            elem.parentNode.innerHTML +=                " Harv error: link from " +                href +                " doesn't point to any citation. ";    } );

// second check: do CITEREF IDs have Harvard citations pointing to them? if(window.checkLinksToCitations) { var cites = $content.find('.citation'); for(var i=0; i < cites.length; i++) { var id = cites[i].getAttribute('id'); // we only need to check citations with a           if(!id || id.indexOf('CITEREF') !== 0) continue; // don't do cites that are inside a ref var parentid = cites[i].parentNode.parentNode.getAttribute('id'); if(parentid && parentid.indexOf('cite_note') === 0) continue; // check for links to this citation var query = 'a[href|="#' + $.escapeSelector(id) + '"]'; if($content.find(query).length === 0) { cites[i].innerHTML += " Harv warning: There is no link pointing to this citation. The anchor is named " + id + ". "; }       }    } });

importScript("User:Ovinus/WeightedRandom.js");

(function { var up = document.getElementById('pt-userpage')  var e = document.createElement("p")  e.style = "font-size: 10px;"  up.parentElement.insertBefore(e, up)   var update = function  {    e.innerText = new Date.toUTCString  }  setInterval(update, 50) })

importScript('User:GeneralNotability/mark-locked.js');

importScript( 'User:Enterprisey/cv-revdel.js' ); // Backlink: User:Enterprisey/cv-revdel.js mw.loader.load( '/w/index.php?title=User:Evad37/MoveToDraft.js&action=raw&ctype=text/javascript' ); // Backlink: User:Evad37/MoveToDraft.js

/** * ProveIt is a powerful reference manager for Wikipedia * Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt * * This script sets the configuration options specific to this wiki * and loads the gadget code from Wikimedia Commons */ function loadProveIt { return mw.config.set({		'proveit-tag': 'ProveIt edit', // Revision tag defined at Special:Tags (optional)		'proveit-summary': 'Reference edited with ProveIt', // Automatic edit summary (optional)		'proveit-templates': [ // Citation templates (without namespace)			'Citation',			'Cite arXiv',			'Cite AV media',			'Cite AV media notes',			'Cite book',			'Cite bioRxiv',			'Cite conference',			'Cite comic',			'Cite encyclopedia',			'Cite episode',			'Cite interview',			'Cite journal',			'Cite magazine',			'Cite mailing list',			'Cite map',			'Cite news',			'Cite newsgroup',			'Cite paper',			'Cite podcast',			'Cite press release',			'Cite report',			'Cite serial',			'Cite sign',			'Cite speech',			'Cite techreport',			'Cite thesis',			'Cite tweet',			'Cite video',			'Cite video game',			'Cite ssrn',			'Cite web',		],		'proveit-namespaces': [ // Supported namespaces (see https://www.mediawiki.org/wiki/Manual:Namespace_constants) 0, // Main namespace 2, // User namespace 118, // Draft namespace ]	});	var sc = mw.config.get('wgScript')+'?title='+"User:Ovinus/proveit.js"+'&action=raw&ctype=text/javascript'	mw.loader.load( sc );	mw.loader.load( '//commons.wikimedia.org/w/load.php?modules=ext.gadget.ProveIt&only=styles', 'text/css' ); }

// Only load when editing mw.hook( 'wikipage.editform' ).add( loadProveIt ); mw.hook( 've.activationComplete' ).add( loadProveIt );