-
-
Save blewert/e83cdea2d7934d007aa498cbd5c1cde4 to your computer and use it in GitHub Desktop.
My stupid signature for littlewhitey's forum, which confuses the hell out of people.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* blewert | |
* ----- | |
* sig.src.js | |
*/ | |
//Find the element containing the name of the person | |
var greetings = document.getElementsByClassName("greeting"); | |
var username = ""; | |
if(typeof(greetings) === "undefined" || greetings.length === 0) | |
{ | |
//If we cannot find it, or it doesn't exist, then find existing instances of signatures on one page | |
var sigs = document.getElementsByClassName("blew-sig"); | |
for(var sig in sigs) | |
{ | |
//Run through them and set them to "I love [JOKER]SKY" | |
if(typeof sigs[sig] === "object") | |
sigs[sig].textContent = "I love [JOKER]SKY"; | |
} | |
} | |
else | |
{ | |
//Remove "Hello" | |
username = greetings[0].textContent.replace("Hello ", ""); | |
//Get all signatures again | |
var sigs = document.getElementsByClassName("blew-sig"); | |
//Are they a guest? If so, show default text | |
if(username === "Guest") | |
username = "[JOKER]SKY"; | |
for(var sig in sigs) | |
{ | |
//Run through all signatures and set content to a random signature otherwise | |
if(typeof sigs[sig] === "object") | |
sigs[sig].textContent = randomSignature(); | |
} | |
} | |
function randomSignature() | |
{ | |
//A bunch of random signatures | |
var randSigs = | |
[ | |
username + " sucks", username + " is a noob", username + " is ez", username + " is easy", | |
username + "?", username + "? you there?", "I wish " + username + " was here.", username + "!", | |
username + "..." | |
]; | |
//Just return a random one | |
return randSigs[Math.floor(Math.random() * randSigs.length)]; | |
} | |
//Print out a message | |
console.log("blewert was here! (" + (new Date()).toGMTString() + ")"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment