MediaWiki:Common.js

/* Autoplay videos with autoplay class */ var vids = document.getElementsByClassName("autoplay"); for(var i = 0; i < vids.length; i++){ vids[i].controls = true; vids[i].setAttribute("playsinline", ""); vids[i].muted = true; vids[i].autoplay = true; vids[i].loop = true; vids[i].play; }

/* Customize audio players */ var audio = document.getElementsByTagName("audio"); for(var i = 0; i < audio.length; i++){ audio[i].setAttribute("controlslist", "nodownload"); }

/* Automatically purge page cache after saving page. This is to help resolve issues with Cargo templates not rendering HTML after editing a page. if(mw.config.get('wgPostEdit') === 'saved') { mw.loader.using(['mediawiki.api'], function {		var api = new mw.Api;		api.post({ action: 'purge', titles: mw.config.get('wgPageName') }).done(function(data) { console.log('Page cache purged.'); });	}); }

/* Log warning + links to Discord and API for developers */ setTimeout(function {   console.log("%cHold up!", "color: #67AD42; font-family: Coustard, sans-serif; font-size: 40px;");    console.log("%cIf someone told you to paste something here and you're not 100% sure of what you're doing, you may be getting scammed!", "font-family: sans-serif; font-size: 15px;");    console.log("%cPasting anything here could give scammers access to your account.", "font-family: sans-serif; font-size: 15px;");    console.log("%cAre you a developer?", "color: #67AD42; font-family: Coustard, sans-serif; font-size: 35px;");	console.log("%cJoin our Discord for help and questions: https://nookipedia.com/wiki/Nookipedia:Discord", "font-family: sans-serif; font-size: 15px;");	console.log("%cIf you're looking to scrape the site for data, check out our API: https://api.nookipedia.com/", "font-family: sans-serif; font-size: 15px;"); }, 2000)