User:Tks4Fish/contribsFooter.js

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
//Creates a footer on the contributions page for the wikis where it doesn't exist
//by [[User:Tks4Fish]]

(function () {
	if ( ( mw.config.get('wgCanonicalSpecialPageName') == 'Contributions' || mw.config.get('wgCanonicalSpecialPageName') == 'DeletedContributions' ) && document.getElementsByClassName("mw-contributions-footer")[0] === undefined ) {
		mw.util.addCSS(`
			table.fmbox {
				clear: both;
				margin: 0.2em 0;
				width: 100%;
				border: 1px solid #a2a9b1;
				background-color: #f8f9fa;
				box-sizing: border-box;
			}
			table.fmbox-system {
				background-color: #f8f9fa;
			}
		`);
		
		relUser = mw.config.get("wgRelevantUserName");
		
		if (!mw.util.isIPAddress(relUser)) {
			divfooter = document.createElement("div");
			divfooter.setAttribute("class", "mw-contributions-footer");
			divfooter.innerHTML = '<table id="sp-contributions-footer" class="plainlinks fmbox fmbox-system" role="presentation">'
				+ '<tbody>'
					+ '<tr>'
						+ '<td class="mbox-image">'
							+ '<a href="/wiki/File:User-info.svg" title="User info">'
								+ '<img alt="User info" src="//upload.wikimedia.org/wikipedia/en/thumb/c/ce/User-info.svg/40px-User-info.svg.png" decoding="async" width="40" height="40" srcset="//upload.wikimedia.org/wikipedia/en/thumb/c/ce/User-info.svg/60px-User-info.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/c/ce/User-info.svg/80px-User-info.svg.png 2x" data-file-width="48" data-file-height="48">'
							+ '</a>'
						+ '</td>'
						+ '<td class="mbox-text" style="font-size: 90%; text-align:center;">'
							+ '<div class="hlist inline">'
								+ '<ul>'
									+ '<li>'
										+ '<a href="/wiki/User:' + relUser + '" title="User:' + relUser + '" class="userlink">'
											+ relUser
										+ '</a>'
										+ ': '
										+ '<a href="/wiki/Special:PrefixIndex/User:' + relUser + '/" title="Special:PrefixIndex/User:' + relUser + '/">'
											+ 'Subpages'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a class="external text" href="' + mw.config.get("wgServer") + mw.config.get("wgScriptPath") + '/index.php?title=Special:ListUsers&limit=1&username=' + relUser + '">'
											+ 'User rights'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//xtools.wmflabs.org/ec/' + mw.config.get("wgServer").substring(2) + '/' + relUser + '" target="_blank">'
											+ 'Edit count'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a class="external text" href="//tools.wmflabs.org/sigma/summary.py?name=' + relUser + '" target="_blank" rel="nofollow noopener noreferrer">'
											+ 'Edit summary search'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//xtools.wmflabs.org/pages/' + mw.config.get("wgServer").substring(2) + '/' + relUser + '" target="_blank">'
											+ 'Articles created'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ 'Global: '
										+ '<a class="external text" href="//guc.toolforge.org/?user=' + relUser + '&blocks=true" target="_blank" rel="nofollow noopener noreferrer">'
											+ 'contributions'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a class="external text" href="//meta.wikimedia.org/w/index.php?title=Special:Log&type=globalauth&user=&page=User:' + relUser + '@global" target="_blank" rel="nofollow noopener noreferrer">'
											+ 'log'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a href="//meta.wikimedia.org/wiki/Special:CentralAuth/' + relUser + '" class="extiw" + title="m:Special:CentralAuth/' + relUser + '">'
											+ 'accounts'
										+ '</a>'
									+ '</li>'
								+ '</ul>'
							+ '</div>'
						+ '</td>'
					+ '</tr>'
				+ '</tbody>'
			+ '</table>';
			document.getElementById("mw-content-text").appendChild(divfooter);
		}
		else {
			divfooter = document.createElement("div");
			divfooter.setAttribute("class", "mw-contributions-footer");
			divfooter.innerHTML = '<table id="sp-contributions-footer-anon" class="plainlinks fmbox fmbox-system" role="presentation">'
				+ '<tbody>'
					+ '<tr>'
						+ '<td class="mbox-image">'
							+ '<a href="/wiki/File:User-info.svg" title="User info">'
								+ '<img alt="User info" src="//upload.wikimedia.org/wikipedia/en/thumb/c/ce/User-info.svg/40px-User-info.svg.png" decoding="async" width="40" height="40" srcset="//upload.wikimedia.org/wikipedia/en/thumb/c/ce/User-info.svg/60px-User-info.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/c/ce/User-info.svg/80px-User-info.svg.png 2x" data-file-width="48" data-file-height="48">'
							+ '</a>'
						+ '</td>'
						+ '<td class="mbox-text" style="font-size: 90%; text-align:center;">'
							+ '<div class="hlist inline">'
								+ '<ul>'
									+ '<li>'
										+ '('
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//whois-referral.toolforge.org/gateway.py?lookup=true&ip=' + relUser + '" target="_blank">'
											+ 'WHOIS'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//whatismyipaddress.com/ip/' + relUser + '" target="_blank">'
											+ 'Geolocate'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//ipcheck.toolforge.org/index.php?ip=' + relUser + '" target="_blank">'
											+ 'Proxy Checker'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a class="external text" href="/wiki/Special:BlockList/' + relUser + '">'
											+ 'Current local blocks'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a class="external text" href="/wiki/Special:GlobalBlockList/' + relUser + '">'
											+ 'Current global blocks'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a class="external text" href="//guc.toolforge.org/?user=' + relUser + '&blocks=true" target="_blank" rel="nofollow noopener noreferrer">'
											+ 'Global contributions'
										+ '</a>'
										+ ')'
									+ '</li>'
									+ '<li>'
										+ '('
										+ '<a class="external text" href="//en.wikipedia.org/wiki/Regional_Internet_registry" title="Regional Internet registry" target="_blank">'
											+ 'RIRs'
										+ '</a>'
										+ ': '
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//rdap.afrinic.net/rdap/ip/' + relUser + '" target="_blank">'
											+ 'Africa'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//whois.arin.net/rest/ip/' + relUser + '" target="_blank">'
											+ 'America'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//wq.apnic.net/apnic-bin/whois.pl?searchtext=' + relUser + '" target="_blank">'
											+ 'Asia-Pacific'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//apps.db.ripe.net/db-web-ui/query?searchtext=' + relUser + '" target="_blank">'
											+ 'Europe'
										+ '</a>'
									+ '</li>'
									+ '<li>'
										+ '<a rel="nofollow noopener noreferrer" class="external text" href="//lacnic.net/cgi-bin/lacnic/whois?lg=EN&query=' + relUser + '" target="_blank">'
											+ 'Latin America/Caribbean'
										+ '</a>'
										+ ')'
									+ '</li>'
								+ '</ul>'
							+ '</div>'
						+ '</td>'
					+ '</tr>'
				+ '</tbody>'
			+ '</table>';
			document.getElementById("mw-content-text").appendChild(divfooter);
		}
		return;
	}
	else {
		return;
	}
}());