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 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"); $(document.body).append(div); }

$(function{ var li = $("");  li.append($("").click(prepareCreateScript).text("Create Script"));  $("#GlobalNavigation").append(li); });