Created
November 30, 2014 15:32
-
-
Save julescarbon/254ded091efb714cd2f2 to your computer and use it in GitHub Desktop.
gangham style int overflow joke
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
(function(m) { | |
var window = this; | |
var bZ = function(a, b) { | |
m.Sa.call(this); | |
this.R = a; | |
this.J = 0; | |
this.H = 17 * a.length; | |
this.K = 0; | |
this.k = b || 5; | |
this.j = this.g = 17 * this.J; | |
this.C = this.F = this.D = this.da = null; | |
var c = window.document.createElement("div"); | |
m.B(c, "go-numberwheel-container"); | |
var d = window.document.createElement("div"); | |
m.B(d, "go-numberwheel"); | |
var e = this.R.join(" ") + " " + this.R[0]; | |
d.innerHTML = e; | |
c.appendChild(d); | |
this.D = d; | |
this.da = c; | |
cZ(this) | |
}; | |
var dZ = function(a, b) { | |
a.J = b; | |
a.j = 17 * b | |
}; | |
var eZ = function(a) { | |
return new m.be(function(a) { | |
this.g == this.j ? a() : this.F = a | |
}, a) | |
}; | |
var fZ = function(a) { | |
var b = 2 == a.K; | |
if (b || a.j != a.g) { | |
if (1 == a.K) a.g = a.j; | |
else { | |
a.g += a.k; | |
var c = Math.abs(a.k / 2), | |
d = a.j + c, | |
c = a.j - c; | |
!b && d >= a.g && c <= a.g ? a.g = a.j : 0 > a.k ? 0 > a.g - .1 && (a.g = a.H + a.g, a.C && a.C()) : 0 < a.k && a.g + .1 >= a.H && (a.g = 0 == a.j ? a.j : a.g - a.H, a.C && a.C()) | |
} | |
cZ(a); | |
!b && a.F && a.j == a.g && (a.F(), a.F = null) | |
} | |
}; | |
var cZ = function(a) { | |
a.D.style[Sma] = "translate3d(0, -" + a.g + "px, 0)" | |
}; | |
var gZ = function(a, b) { | |
m.Sa.call(this); | |
this.k = a; | |
this.C = m.Tk("div"); | |
m.B(this.C, "go-odometer"); | |
this.K = b; | |
this.R = -1; | |
this.D = new m.Hz(this.Bf, window, this); | |
m.Ta(this, this.D); | |
this.F = !0; | |
this.J = 0; | |
this.H = ""; | |
var c = "0123456789".split(""); | |
this.g = Array(10); | |
for (var d = 10; d--;) { | |
var e = new bZ(c); | |
this.g[d] = e; | |
m.Ta(this, e) | |
} | |
this.j = new bZ([" ", "-"]); | |
m.Ta(this, this.j); | |
this.O = [this.wq, hZ(this, 500), this.sq, hZ(this, 1500), this.vq, hZ(this, 2E3), this.uq, this.tq] | |
}; | |
var iZ = function(a, b, c) { | |
a.J = m.v((0, m.p)(b, a), c) | |
}; | |
var Tma = function(a) { | |
a = Math.abs(a); | |
for (var b = []; a;) { | |
var c = a % 10; | |
a = (a - c) / 10 | 0; | |
b.push(c) | |
} | |
return b | |
}; | |
var jZ = function(a, b) { | |
a.j.hc(b); | |
for (var c = 0, d = a.g.length; c < d; ++c) a.g[c].hc(b) | |
}; | |
var kZ = function(a, b) { | |
for (var c = Math.abs(b), d = [], e = 0, f = a.g.length; e < f; ++e) { | |
var h = c % 10, | |
c = (c - h) / 10 | 0, | |
k = a.g[e]; | |
dZ(k, h); | |
d.push(eZ(k)) | |
} | |
dZ(a.j, 0 > b ? 1 : 0); | |
d.push(eZ(a.j)); | |
return m.ak(d) | |
}; | |
var hZ = function(a, b) { | |
return (0, m.p)(function() { | |
return new m.be(function(a) { | |
iZ(this, function() { | |
this.De(); | |
a() | |
}, b) | |
}, this) | |
}, a, b) | |
}; | |
var Uma = function() { | |
lZ(); | |
var a = m.G("watch-view-count"), | |
b = m.G("real-view-count", a); | |
a && b && (b = (0, window.parseInt)(b.innerHTML, 0), 2147483947 > b || (m.D(a, "go-done"), m.B(a, "go-ready"), mZ = new gZ(a, b), m.Ua(mZ, lZ), mZ.run())) | |
}; | |
var Vma = function() { | |
lZ() | |
}; | |
var lZ = function() { | |
m.Va(mZ); | |
mZ = null; | |
var a = m.G("watch-view-count"); | |
a && m.B(a, "go-done") | |
}; | |
m.t(bZ, m.Sa); | |
var nZ; | |
t: { | |
for (var Wma = m.Tk("div"), oZ = ["transform", "webkitTransform", "mozTransform", "msTransform", "oTransform"], pZ = oZ.length; pZ--;) { | |
var qZ = oZ[pZ]; | |
if (void 0 !== Wma.style[qZ]) { | |
nZ = qZ; | |
break t | |
} | |
} | |
nZ = "transform" | |
} | |
var Sma = nZ; | |
bZ.prototype.N = function() { | |
m.Lh(this.D); | |
m.Lh(this.da); | |
this.C = this.D = this.da = null; | |
bZ.L.N.call(this) | |
}; | |
bZ.prototype.hc = function(a) { | |
this.K = a | |
}; | |
m.t(gZ, m.Sa); | |
m.g = gZ.prototype; | |
m.g.N = function() { | |
gZ.L.N.call(this); | |
this.D.stop(); | |
m.bb(this.J); | |
m.Lh(this.C); | |
m.D(this.k, "go-activate"); | |
m.N(this.H) | |
}; | |
m.g.Bf = function() { | |
if (!this.ha()) { | |
if (this.F) { | |
this.F = !1; | |
++this.R; | |
var a = this.O[this.R]; | |
a ? a.call(this) : this.end() | |
} | |
fZ(this.j); | |
for (var a = 0, b = this.g.length; a < b; ++a) fZ(this.g[a]); | |
this.D.start() | |
} | |
}; | |
m.g.run = function() { | |
this.Bf() | |
}; | |
m.g.pause = function() { | |
this.D.stop() | |
}; | |
m.g.end = function() { | |
this.pause(); | |
this.dispose() | |
}; | |
m.g.De = function() { | |
this.F = !0 | |
}; | |
m.g.wq = function() { | |
m.rc("/gen_204?go_init"); | |
jZ(this, 1); | |
this.k.appendChild(this.C); | |
this.C.appendChild(this.j.da); | |
for (var a = this.g.length; a--;) this.C.appendChild(this.g[a].da); | |
kZ(this, this.K).then(function() { | |
jZ(this, 0); | |
return new m.be(function(a) { | |
this.H = m.mk(this.k, m.Wp, a); | |
m.B(this.k, "go-activate") | |
}, this) | |
}, null, this).then(this.De, null, this) | |
}; | |
m.g.sq = function() { | |
this.j.k = .9; | |
this.j.hc(2); | |
for (var a = 1, b = this.g.length; b--;) { | |
var c = this.g[b], | |
d = .5 > Math.random() ? 1 : -1; | |
c.hc(2); | |
c.k = a * d; | |
++a | |
} | |
this.De() | |
}; | |
m.g.vq = function() { | |
var a = kZ(this, -4294967294 + this.K); | |
this.j.hc(0); | |
for (var b = m.de(), c = this.g.length; c--;) b = b.then(m.q(function(a) { | |
return new m.be(function(b) { | |
a.hc(0); | |
iZ(this, b, 100) | |
}, this) | |
}, this.g[c]), null, this); | |
m.ak([a, b]).then(this.De, null, this) | |
}; | |
m.g.uq = function() { | |
var a = Tma(this.K), | |
b = 2, | |
c = (0, m.p)(function(c) { | |
for (var d = b += .3; c--;) { | |
var e = this.g[c]; | |
e.hc(2); | |
e.k = d; | |
dZ(e, a[c]); | |
50 < d && (d = 50) | |
} | |
}, this), | |
d = this.g.length; | |
c(d); | |
this.j.k = 2; | |
dZ(this.j, 0); | |
this.j.hc(0); | |
for (var e = eZ(this.j); d--;) e = e.then((0, m.p)(function(a, b) { | |
c(b); | |
a.hc(0); | |
return eZ(a) | |
}, this, this.g[d], d)); | |
e.then(this.De, null, this) | |
}; | |
m.g.tq = function() { | |
m.rc("/gen_204?go_cleanup"); | |
this.H = m.mk(this.k, m.Wp, (0, m.p)(this.De, this)); | |
m.D(this.k, "go-activate") | |
}; | |
var mZ = null, | |
rZ = []; | |
m.Wc(m.Ck({ | |
name: "www/gangnam_overflow", | |
deps: ["www/watch"], | |
page: "watch", | |
init: function() { | |
var a = m.G("watch-view-count"); | |
a && (rZ.push(m.J(a, "mouseenter", Uma)), rZ.push(m.J(a, "mouseleave", Vma))) | |
}, | |
dispose: function() { | |
lZ(); | |
m.N(rZ); | |
rZ.length = 0 | |
} | |
})); | |
})(_yt_www); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment