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.
/**
* @fileOverview This file defines the lightweight Railgun server component,
* which processes localStorage requests issued by the Railgun client.
* This file is automatically loaded by the Railgun client.
*
* Railgun Wiki: http://railgunscript.wikia.com/wiki/Railgun_Wiki
* Contact Author: http://community.wikia.com/wiki/Message_Wall:Mathmagician
*
* @author © Jeff Bradford, 2012
* @version 1.1.3
*/
var Railgun={};Railgun.Server=(function(){var j=false;var f="1.1.2";var e="railgun_";var g="[Railgun]: Server Error. Key must be a string.";var a="[Railgun]: Server Error. Undefined value not permitted.";var h={};function c(k,l){if("string"!==typeof k){return g}else{if("undefined"===typeof l){return a}else{window.localStorage.setItem(e+k,JSON.stringify(l));h[k]=l;return 0}}}function i(k){if("string"!==typeof k){return g}else{window.localStorage.removeItem(e+k);delete h[k];return 0}}function b(){for(var k in window.localStorage){if(-1!==k.indexOf(e)){window.localStorage.removeItem(k)}}h={}}function d(){for(var k in window.localStorage){if(-1!==k.indexOf(e)){h[k.substr(e.length)]=JSON.parse(window.localStorage.getItem(k))}}}return{processRequest:function(m){if(-1===m.origin.indexOf(".wikia.com")){return}var l=JSON.parse(m.data);if("object"!==typeof l){l={}}l.status="success";if("string"!==typeof l.instruction){console.log("[Railgun]: Server Error. Cannot process non-string instruction:",l.instruction);return}switch(l.instruction){case"setItem":var k=c(l.key,l.value);if(0!==k){l.status=k}break;case"removeItem":var k=i(l.key);if(0!==k){l.status=k}break;case"clear":b();break;case"init":j=l.isDebug?true:false;d();l.serverStatus={isDebug:j,version:f};break;default:console.log("[Railgun]: Server Error. Instruction: "+l.instruction+" was not recognized by the server.")}l.storageState=h;if(j){console.log("[Railgun]: Server has finished processing "+l.instruction+" request:",l)}m.source.postMessage(JSON.stringify(l),m.origin)}}}());if(window.addEventListener){window.addEventListener("message",Railgun.Server.processRequest,false)}else{if(window.attachEvent){window.attachEvent("message",Railgun.Server.processRequest)}};