Created
July 13, 2015 21:40
-
-
Save anonymous/d83b28f8b93badbf5b99 to your computer and use it in GitHub Desktop.
TideKit's misleading "latest reservations"
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
// Deobfuscated with Chrome DevTools + some manual formatting | |
// from https://web.archive.org/web/20150317094608/https://www.tidekit.com/reservations | |
require.register("_cf-tidekit-website-998-reservations/index.js", function(e, t, i) { | |
"use strict"; | |
var n = t("class"), | |
s = t("each"), | |
r = document.querySelector("#reservations-latest"), | |
a = document.querySelector("#email-reserve-form"), | |
o = (document.querySelector("#duplicate-signup-modal"), | |
function() { | |
var e = document.querySelector("#duplicate-signup-modal .duplicate-signup-message"); | |
if (e && $("#duplicate-signup-modal").foundation("reveal", "open"), a) { | |
var t = document.querySelector("#email"), i = document.querySelector(".email-error"), n = !1, s = function(e, t) { | |
$.getJSON("/account/validate", e).done(function(e) { | |
console.log(e), t(null, e) | |
}).fail(function(e, i, n) { | |
console.log(n), t(n, null) | |
}) | |
}, r = function() { | |
var e = 0; | |
return function(t, i) { | |
clearTimeout(e), e = setTimeout(t, i) | |
} | |
}(), o = function() { | |
var e = {email: this.value}, t = /(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))/, a = t.test(e.email); | |
r(function() { | |
s(e, function(e, t) { | |
n = t.exists ? !1 : !0, a && !t.exists && (i.classList.remove("error"), i.style.display = "none", i.innerText = ""), a && t.exists && (i.classList.add("error"), i.style.display = "block", i.innerText = "Email already exists."), a || t.exists || (i.classList.add("error"), i.style.display = "block", i.innerText = "That does not look like an email address") | |
}) | |
}, 1e3) | |
}; | |
t.onkeyup = o | |
} | |
}); | |
if (r) | |
var d = n.extend({ | |
constructor: function() { | |
this.children = [], this.maxChildren = 30, this.visibleChildren = 6, this.frame = 0, this.duration = 2400, this.fadeDuration = this.duration / 1e3 | |
}, | |
animate: function() { | |
var e = this; | |
null !== r && e.createChildElements(function() { | |
var t = document.querySelector("ul.customers li:nth-child(" + e.maxChildren + ")"), i = "pause-fade " + e.fadeDuration + "s"; | |
t.style["-webkit-animation"] = i, t.style["-moz-animation"] = i, t.style["-o-animation"] = i, t.style.animation = i, e.firstLoop = !0, e.loop = setInterval(function() { | |
e.rotate() | |
}, e.duration) | |
}) | |
}, | |
createChildElements: function(e) { | |
for (var t = this, i = 1; i <= t.maxChildren; i++) { | |
var n = document.querySelector("ul.customers li:nth-child(" + i + ")"); | |
n.style["-webkit-animation"] = "none", n.style["-moz-animation"] = "none", n.style["-o-animation"] = "none", n.style.animation = "none", t.children.push(n), i === t.maxChildren && e() | |
} | |
}, | |
rotate: function() { | |
var e = this; | |
if (e.firstLoop) { | |
var t = e.maxChildren - e.visibleChildren - 1 - e.frame, i = e.maxChildren - 2 - e.frame; | |
e.firstloop = !1 | |
} else | |
var t = e.maxChildren - e.visibleChildren - e.frame, i = e.maxChildren - 1 - e.frame; | |
e.frame++, 24 === e.frame && (clearInterval(e.loop), e.children = [], e.frame = 0, e.firstLoop = !0, e.animate()), e.frame < 24 && s(e.children, function(n, s) { | |
if (s >= t && i >= s) { | |
if (e.children[s].style.display = "block", e.children[s].style["-webkit-animation"] = "none", e.children[s].style["-moz-animation"] = "none", e.children[s].style["-o-animation"] = "none", e.children[s].style.animation = "none", s === i) { | |
var r = "pause-fade " + e.fadeDuration + "s"; | |
e.children[s].style["-webkit-animation"] = r, e.children[s].style["-moz-animation"] = r, e.children[s].style["-o-animation"] = r, e.children[s].style.animation = r | |
} | |
} else | |
e.children[s].style.display = "none", e.children[s].style["-webkit-animation"] = "none", e.children[s].style["-moz-animation"] = "none", e.children[s].style["-o-animation"] = "none", e.children[s].style.animation = "none" | |
}) | |
}}); | |
else | |
var d = n.extend({}); | |
i.exports = {LatestReservations: new d,reserveValidate: o} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment