User:Timeshifter/addnavigationback.js

function createCookie(name, value, days) { if(days) { var date = new Date; date.setTime(date.getTime + (days * 24 * 60 * 60 * 1000)); var expires = '; expires=' + date.toGMTString; }	else {var expires = '';} document.cookie = name + '=' + value + expires + '; path=/'; } function readCookie(name) { var nameEQ = name + '='; var ca = document.cookie.split(';'); for(var i=0; i < ca.length; i++) { var c = ca[i]; while(c.charAt(0) == ' ') {c = c.substring(1,c.length);} if(c.indexOf(nameEQ) == 0) {return c.substring(nameEQ.length, c.length);} }	return null; } function eraseCookie(name) { createCookie(name, '', -1); } function WikiNavCheck { if(document.getElementById('WikiHeader')) { var header = document.getElementById('WikiHeader').outerHTML.replace(/\n/g, ).replace(/\t/g, ).replace(/;/g, '&#59'); createCookie('whead', header.substring(0, 3000), 9999); for(var i = 1; i < Math.ceil(header.length / 3000); i++) { createCookie('wheadCont' + i, header.substring(i * 3000, (i * 3000) + 3000), 9999); }	}	else if(wgNamespaceNumber != -1) { createCookie('whead', '', -1); } } addOnloadHook(WikiNavCheck); function addOldSpecials { if(readCookie('whead') != null) { var str = readCookie('whead'); var i = 1; while(readCookie('wheadCont' + i) != null) {str += readCookie('wheadCont' + i); i++;} $(str.replace(/&#59/g, ';')).insertBefore('.AdminDashboardHeader'); } } if(wgNamespaceNumber == -1) {addOnloadHook(addOldSpecials);}