// Taken from http://www.conficturaindustries.com/js/c.js

// Run through http://jsbeautifier.org/

// Notes added by jamiechong, read in order, NOTE 1, NOTE 2, etc.

"use strict" ;

$ ( function ( ) {

// NOTE 3

// This function makes a POST request to check.php to validate the

// counter code. It's expecting a=736565.

// In the success callback, the function checks for a.response==true.

// If so, it runs the handler function (see NOTE 4)

//

function t ( t ) {

i = ! 1 , $. ajax ( {

url : "check.php" ,

type : "POST" ,

data : {

a : t ,

b : ""

} ,

success : function ( a ) {

a. response && c ( t ) , i = ! 0

} ,

error : function ( t ) { }

} )

}

// NOTE 6

// This handles the submission of the textbox.

// Again, it's POSTing the values to check.php

// a=736565, b=<the value of the textbox>

// The success handler is the interesting part... See NOTE 7

//

function a ( t , a ) {

$. ajax ( {

url : "check.php" ,

type : "POST" ,

data : {

a : t ,

b : a

} ,

success : function ( t ) {

// NOTE 7

// First of all "success" doesn't mean our POST is correct, it just means

// we succesfully submitted our values.

// Upon submission, all this script does is refresh the page. Regardless of

// a correct entry or not!

//

// However, this doesn't mean it's a Rabbit Hole... It's possible that a correct

// submission sets a COOKIE and when the page refreshes, if the COOKIE is set,

// we get redirected to some other page with our next steps.

//

window. location = window. location . href

} ,

error : function ( t ) { }

} )

}

// NOTE 5

// This just grabs the value of the text box and

// calls another handler function with two values:

// t=736565, c=<the value in the textbox>

// Goto NOTE 6

//

function e ( t ) {

$ ( "#f" ) . submit ( function ( e ) {

e. preventDefault ( ) ;

var c = $ ( ".i" ) . val ( ) ;

a ( t , c )

} )

}

// NOTE 4

// Upon a successful check of the counter sequence, this function is executed.

// All it does is replace the counter with the HTML for the textbox.

// Submitting the textbox takes us to NOTE 5

//

function c ( t ) {

$ ( "#a" ) . replaceWith ( '<form id="f" method="POST"><input type="text" class="i" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></input><input type="submit" style="position: absolute; left: -9999px"/></form>' ) , $ ( ".i" ) . focus ( ) , e ( t )

}

var n = 500 ,

o = null ,

i = ! 1 ;

// NOTE 1

// This gets executed as soon as the page loads.

// It makes a request to c.php which grabs the HTML for the initial counter state.

//

$. ajax ( {

url : "c.php" ,

cache : ! 1 ,

type : "GET" ,

dataType : "html" ,

success : function ( t ) {

var a = t ;

$ ( "#a" ) . html ( a ) , i = ! 0

}

} ) ,

// NOTE 2

// This handles the clicking of the counter images.

// It just increments the counter value of the digit you clicked.

// After a 500ms delay, it executes the check function to see if your

// new sequence of digits is the right code. (See NOTE 3)

//

$ ( "#a" ) . on ( "touchstart click" , "> *" , function ( a ) {

if ( a. stopPropagation ( ) , a. preventDefault ( ) , i && ! a. handled ) {

var e = parseInt ( $ ( this ) . attr ( "src" ) [ 7 ] ) ,

c = "" ;

e = e < 9 ? e + 1 : 0 ;

var r = "images/" + e + ".gif" ;

$ ( this ) . attr ( "src" , r ) , o && clearTimeout ( o ) , o = setTimeout ( function ( ) {

for ( var a = 0 ; a < 7 ; a ++ ) {

var e = $ ( "#a" ) . children ( ) [ a ] ;

c += $ ( e ) . attr ( "src" ) [ 7 ]

}

t ( parseInt ( c ) )

} , n ) , a. handled = ! 0

}

} ) . on ( "dblclick" , function ( t ) {

t. preventDefault ( )

} )