Skip to content

Instantly share code, notes, and snippets.

@adiov
Last active August 30, 2016 14:27
Show Gist options
  • Save adiov/6dce6df8b96de78e3a434e36d1e6037b to your computer and use it in GitHub Desktop.
Save adiov/6dce6df8b96de78e3a434e36d1e6037b to your computer and use it in GitHub Desktop.
<!--
Disarmed version of http://superlogout.com
https://gist.github.com/adiov/6dce6df8b96de78e3a434e36d1e6037b/
-->
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Super Logout</title>
<style>
body {
font-family: sans-serif;
margin-top: 5em;
}
h1 {
margin: 0 auto;
text-align: center;
font-size: 4em;
}
ul {
width: 500px;
margin: 2em auto;
}
.hidden {
position: fixed;
width: 1px;
height: 1px;
overflow: hidden;
top: -10px;
left: -10px;
}
.success {
font-weight: bold;
color: #0a0;
}
.error {
color: #a00;
}
</style>
<script>
function cleanup(func, el, delayCleanup) {
return function() {
if (delayCleanup) {
delayCleanup = false;
return;
}
func();
el.parentNode.removeChild(el);
};
}
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
function get(url) {
return function(success, error) {
sleep(getRandomIntInclusive(500, 6000)).then(() => {
success();
});
};
}
var numPostFrames = 0;
function post(url, params, fakeOk) {
return function(success, error) {
sleep(getRandomIntInclusive(500, 6000)).then(() => {
success();
});
};
}
function and(one, two) {
return function(success, error) {
var oneSuccess = false;
var twoSuccess = false;
var oneSuccessFunc = function() {
oneSuccess = true;
if (twoSuccess) {
success();
}
};
var twoSuccessFunc = function() {
twoSuccess = true;
if (oneSuccess) {
success();
}
};
one(oneSuccessFunc, error);
two(twoSuccessFunc, error);
}
}
function doSites(list, sites) {
sites.forEach(function(site) {
if (!site.length) {
return;
}
var name = site[0];
var action = site[1];
var li = document.createElement("li");
var nameNode = document.createElement("strong");
nameNode.appendChild(document.createTextNode(name));
var statusNode = document.createElement("span");
statusNode.innerHTML = "...";
li.appendChild(nameNode);
li.appendChild(document.createTextNode(': '));
li.appendChild(statusNode);
var success = function() {
statusNode.innerHTML = "OK";
statusNode.className = "success";
};
var error = function() {
statusNode.innerHTML = "error";
statusNode.className = "error";
};
action(success, error);
list.appendChild(li);
});
}
window.onload = function() {
doSites(document.getElementById("sitelist"), [
["AOL", and(get("https://fakeURL"), get("https://fakeURL" + Math.random()))],
["Amazon", get("https://fakeURL")],
["Blogger", get("https://fakeURL")],
["Delicious", get("https://fakeURL")],
["DeviantART", post("https://fakeURL")],
["DreamHost", get("https://fakeURL")],
["Dropbox", get("https://fakeURL")],
["eBay", get("https://fakeURL")],
["Gandi", get("https://fakeURL")],
["GitHub", get("https://fakeURL")],
["GMail", get("https://fakeURL")],
["Google", get("https://fakeURL")],
["Hulu", get("https://fakeURL")],
["Instapaper", get("https://fakeURL")],
["Linode", get("https://fakeURL")],
["LiveJournal", post("https://fakeURL", {"action:killall": "1"})],
["MySpace", get("https://fakeURL")],
["NetFlix", get("https://fakeURL")],
["New York Times", get("https://fakeURL")],
["Newegg", get("https://fakeURL")],
["Photobucket", get("https://fakeURL")],
["Skype", get("https://fakeURL")],
["Slashdot", get("https://fakeURL")],
["SoundCloud", get("https://fakeURL")],
["Steam Community", get("https://fakeURL")],
["Steam Store", get("https://fakeURL")],
["ThinkGeek", get("https://fakeURL")],
["Threadless", get("https://fakeURL")],
["Tumblr", get("https://fakeURL")],
["Vimeo", get("https://fakeURL")],
["Wikipedia", get("https://fakeURL")],
["Windows Live", get("https://fakeURL")],
["Woot", get("https://fakeURL")],
["Wordpress", get("https://fakeURL")],
["Yahoo!", get("https://fakeURL")],
["YouTube", post("https://fakeURL", {"action_logout": "1"}, true)],
[]
])
};
</script>
</head>
<body>
<h1>SUPER LOGOUT</h1>
<ul id="sitelist">
</ul>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment