User:InvalidOS/unicodeRedirect.js

$(document).ready( function {

var config = {};

config.mw = mw.config.get( [	'wgPageName' ] );

if (config.mw.wgPageName.length == 1) {	var hex = config.mw.wgPageName.charCodeAt(0).toString(16); var result; if (hex.length <= 4) {		result = "U%2B" + ("0000".substring(0, 4 - hex.length) + hex).toUpperCase; }	else {		result = "U%2B" + hex.toUpperCase; }	mw.loader.using(['mediawiki.util']), mw.util.addPortletLink(		'p-views',		'index.php?title=' + result + '&action=view&redirect=no',		'Codepoint',		'ca-unicode',		'Corresponding Codepoint Page',		'-',		document.getElementById('ca-history')	); }

if (config.mw.wgPageName.startsWith("U+") === true) {	var result2; var pass = true; try {		result2 = String.fromCharCode(parseInt(config.mw.wgPageName.substring(2, config.mw.wgPageName.length), 16)); }	catch (err) {		pass = false; }	if (pass === true) {		mw.loader.using(['mediawiki.util']), mw.util.addPortletLink(			'p-views',			'index.php?title=' + result2 + '&action=view&redirect=no',			'Character',			'ca-unicode',			'Corresponding Character Page',			'-',			document.getElementById('ca-history')		); } }

} );