Eesh. This code is a mess. But, even not knowing ActionScript, I was able to guess it out.
But here's the weird thing. If this is the code that's actually on the site, then it will play the "cinnamon" movie
every time. I'm 99% sure about this. Either this is a huge bug or for some reason they intentionally changed it so only that movie would be played. Seriously weird.
Anyway, here's what the code is
supposed to do: First, it checks your referrer to see if you got to the page from within the secure ordering are of the H*R store. If you didn't, it will show you the "thought you could sneak in the back door?" Strong Bad clip and that's it. (This, by the way, can be easily bypassed with certain Firefox extensions.) Otherwise, this is what happens: Every time you visit the movie page, it stores too Flash "cookies" on your computer: one that says what time you visited, and one that says which movie you saw. Then it checks to see if you last visited less than 10 minutes ago. If it's been less than 10 minutes, it will show you the same movie you saw last time. This keeps you from seeing all the movies by reloading the page over and over again.
The script also does not have any code that changes the decision based on the time of day. There is a brief reference to something happening if it's before 5 a.m., but it's a dead end and does nothing. Between that and the fact that it will only ever play the "cinnamon" movie, something weird is definitely going on. It may be that TBC (or whomever wrote this script) found a bug and, while they figure out how to fix it, put up this lame code instead, or maybe TBC had to take down the other movies for reasons unknown.
Anyway, here's my annotated version of the code so even the non-coders can see what's going on. The lines that start with "//" are the ones you'll be able to understand. If you need any clarification for any part, lemme know.
Code:
function controllerLoaded () {
// Get the first 30 characters of the URL you came from.
var _local7 = _root.rf.substr(0,30)
// If the URL is in the secure ordering area of the H*R store, let you
// continue.
if (_local7 == "https://order.store.yahoo.com/") {
// These are the filenames for the different movies.
var _local6 = new Array (
"thankyou_celegante.swf",
"thankyou_bubsness.swf",
"thankyou_song.swf",
"thankyou_cinnamon.swf"
)
// Pick one of the above filenames at random and store the chosen number,
// which represents which file will be played, in local2.
var _local2 = sceneChoice = Math.floor(Math.random() * (_local6.length - 1))
// Store the current date/time (on the user's computer) in local4
var _local4 = new Date ()
// The next two lines access files that Flash has stored on your computer,
// like Cookies in your web browser or the savegame files for Peasant's
// Quest. The first one stores the date/time you last visited this page.
// The second one is equal to the whatever toon was played the last time
// you were here.
var _local5 = LocalData.load("ty","lt")
var _local3 = LocalData.load("ty","n")
// If either of the above is empty, do nothing right now.
if ((_local5 == undefined) || (_local3 == undefined)) { }
// Otherwise, make sure local3 and local5 are valid numbers so we can do
// math on them, and then...
else if ((!isNaN (_local5.getTime())) && (!isNaN (_local3))) {
// ...if less than ten minutes have passed since the last time you were
// here, choose the same file that you saw last time.
if ((_local4.getTime() - _local5.getTime()) / 60000 < 10) {
_local2 = Number(_local3)
// If it's before 5 a.m. right now, do nothing. I'm not sure what
// the point of this line is, since it doesn't affect the rest of
// the code.
if (_local4.getHours() < 5) { }
}
}
// Make local2 equal to 3. This basically tosses out everything from above
// and makes the "cinnamon" movie play every time. Why?? I don't know!
_local2 = 3
// Save the data that we'll need next time, i.e. what time it is when you
// visited the page and what file you saw.
LocalData.save("ty","lt",_local4)
LocalData.save("ty","n",_local2)
// Load and play the movie specified by local2.
_root.content_mc.loadMovie(_local6.[_local2])
} else {
// If they didn't come from an order page, show you the "bonus" file.
_root.content_mc.loadMovie("thankyou_bonus.swf")
}
}
_________________
StrongCanada wrote:
Jordan, you are THE SUCK at kissing! YAY! Just thought you should know! Rainbows! Sunshine!