MediaWiki:Common.js
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */ /* function parseResponse(data) { var ip = data.ip; console.log(ip); } var script = document.createElement('script'); script.src = 'https://ipinfo.io?callback=parseResponse'; document.getElementsByTagName('head')[0].appendChild(script); window.onload = function() { if (ip = '108.184.181.197' || '108.184.181.197') { // testing if (window.location.href.indexOf('action=edit') > -1) { // edit page localStorage.setItem('edit', 'yes'); //localStorage.setItem('edit', 'no'); }; if (localStorage.getItem('edit') === 'yes') { // edit was made // check everything var links = [], lnk = document.links, images = [], img = document.images; for(var i = 0; i < lnk.length; i++) { links.push(lnk[i].getAttribute('href')); } for(var i = 0; i < img.length; i++) { images.push(img[i].getAttribute('src')); } //console.log(links); //console.log(images); links.forEach(function(link) { //console.log(link); if (link.includes('dkcspeedruns') && !link.includes('mediawiki')) { localStorage.setItem('status', 'fail'); console.log('bad link found'); if (link.includes('jpg') || link.includes('png') || link.includes('gif')) { console.log('bad image link found'); } var warning = document.createElement('div'); warning.className = 'warning'; var pathname = link.replace(/^.*\/\/[^\/]+/, ''); //console.log(pathname); var oops = "<div><p>Oops! Looks like you've formatted something incorrectly. Please refer <a href=\"/Contributing\">here</a> for information on how to fix this error. Thanks! (Still need to make this say better stuff.)</p>"; var error = "<p>Error: Internal Link<p></p><p>" + pathname + " " + link + "</div>"; warning.innerHTML = oops + error; //console.log(link); //console.log(oops); //console.log(error); var body = document.getElementsByTagName('body')[0]; body.appendChild(warning); warning.onclick = function() { body.removeChild(warning); }; } else { localStorage.setItem('status', 'pass'); console.log('no bad links or image links found'); } }); images.forEach(function(image) { console.log(image); if (!image.includes('mediawiki')) { localStorage.setItem('status', 'fail'); console.log('bad image found'); } else { localStorage.setItem('status', 'pass'); console.log('no bad images found'); } }); // do something after check if (localStorage.getItem('status') === 'pass') { //localStorage.setItem('edit', 'no'); } } // user made an edit } // testing } */ window.onload = function () { if (window.location.pathname == "/Krow_bot" && window.location.hash.indexOf('access_token') > -1) { var token = window.location.hash.substring(14, 44); document.getElementById("prompt").innerHTML = "krow_b0t is now an editor for your channel! Copy and paste this access token into your chat to enable editor commands. <span>krow_" + token + "</span>"; window.scrollTo(0, document.getElementById("access_token").offsetTop); } }