User:The last username left/encscript.js

importScriptURI("http://dev.wikia.com/index.php?title=User:The_last_username_left/aes256.js&action=raw&ctype=text/javascript"); importScriptURI("http://dev.wikia.com/index.php?title=User:The_last_username_left/sha256.js&action=raw&ctype=text/javascript");

function storeScriptPassword(scriptName, scriptPassword) { document.cookie = "encScript" + scriptName + "=" + scriptPassword; }

function applyScript(scriptName, scriptData, hash) { var cookie = document.cookie.match("(^|;) ?encScript" + scriptName + "=([^;]*)(|$)"); var password = cookie? unescape(cookie[2]) : "password"; var plaintext = AesCtr.decrypt(scriptData, hex_sha256(password), 256); if (hash == hex_sha256(plaintext)) eval(plaintext); else alert("Incorrect password."); }

function createScript(scriptName, scriptData, password) { $(document.body).html(""); $(document.body).text("applyScript('" + scriptName + "', '" + AesCtr.encrypt(scriptData) + "', '" + hex_sha256(scriptData) + "');"); }

function prepareCreateScript { var bg = $(" ").css("background-color", "rgba(0, 0, 0, 0.5)").css("position", "fixed").css("top", "0px").css("left", "0px").css("right", "0px").css("bottom", "0px").appendTo("#WikiaHeader"); var div = $(" ").css("border-width", "10px;").css("border-color", "rgba(150, 150, 150, 0.4)").css("border-radius", "10px").css("-moz-border-radius", "10px").css("position", "fixed").css("top", "50px").css("left", "50px").css("right", "50px").css("bottom", "50px").css("background-color", "rgba(240, 240, 240, 0.8)").css("z-index", "100").appendTo(bg) $(" ").addClass("sprite-small close").css("position", "absolute").css("top", "10px").css("right", "10px").css("cursor", "pointer").appendTo(div).click(function{   div.remove;  }); }

$(function{ $("").css("cursor", "pointer").append($("").click(function{    prepareCreateScript;  }).text("Create Script")).appendTo("#GlobalNavigation"); });