Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JSNice results from https://s.ytimg.com/yts/jsbin/www-en_US-vflBNYrhc/watch_gangnam_overflow.js
- (function(self) {
- var window = this;
- /**
- * @param {(Object|number|string)} r
- * @param {number} dataType
- * @return {undefined}
- */
- var run = function(r, dataType) {
- self.Sa.call(this);
- /** @type {(Object|number|string)} */
- this.R = r;
- /** @type {number} */
- this.J = 0;
- /** @type {number} */
- this.H = 17 * r.length;
- /** @type {number} */
- this.K = 0;
- this.k = dataType || 5;
- /** @type {number} */
- this.j = this.g = 17 * this.J;
- /** @type {null} */
- this.C = this.F = this.D = this.da = null;
- var info = window.document.createElement("div");
- self.B(info, "go-numberwheel-container");
- var d = window.document.createElement("div");
- self.B(d, "go-numberwheel");
- var html = this.R.join(" ") + " " + this.R[0];
- d.innerHTML = html;
- info.appendChild(d);
- this.D = d;
- this.da = info;
- join(this);
- };
- /**
- * @param {?} msg
- * @param {number} key
- * @return {undefined}
- */
- var callback = function(msg, key) {
- /** @type {number} */
- msg.J = key;
- /** @type {number} */
- msg.j = 17 * key;
- };
- /**
- * @param {Object} arg
- * @return {?}
- */
- var fn = function(arg) {
- return new self.be(function(cb) {
- if (this.g == this.j) {
- cb();
- } else {
- /** @type {boolean} */
- this.F = cb;
- }
- }, arg);
- };
- /**
- * @param {Object} options
- * @return {undefined}
- */
- var move = function(options) {
- /** @type {boolean} */
- var b = 2 == options.K;
- if (b || options.j != options.g) {
- if (1 == options.K) {
- options.g = options.j;
- } else {
- options.g += options.k;
- /** @type {number} */
- var value = Math.abs(options.k / 2);
- var tval = options.j + value;
- /** @type {number} */
- value = options.j - value;
- if (!b && (tval >= options.g && value <= options.g)) {
- options.g = options.j;
- } else {
- if (0 > options.k) {
- if (0 > options.g - 0.1) {
- options.g = options.H + options.g;
- if (options.C) {
- options.C();
- }
- }
- } else {
- if (0 < options.k) {
- if (options.g + 0.1 >= options.H) {
- options.g = 0 == options.j ? options.j : options.g - options.H;
- if (options.C) {
- options.C();
- }
- }
- }
- }
- }
- }
- join(options);
- if (!b) {
- if (options.F) {
- if (options.j == options.g) {
- options.F();
- /** @type {null} */
- options.F = null;
- }
- }
- }
- }
- };
- /**
- * @param {Object} obj
- * @return {undefined}
- */
- var join = function(obj) {
- /** @type {string} */
- obj.D.style[vendorProp] = "translate3d(0, -" + obj.g + "px, 0)";
- };
- /**
- * @param {number} n
- * @param {number} r
- * @return {undefined}
- */
- var e = function(n, r) {
- self.Sa.call(this);
- /** @type {number} */
- this.k = n;
- this.C = self.Tk("div");
- self.B(this.C, "go-odometer");
- /** @type {number} */
- this.K = r;
- /** @type {number} */
- this.R = -1;
- this.D = new self.Hz(this.Bf, window, this);
- self.Ta(this, this.D);
- /** @type {boolean} */
- this.F = true;
- /** @type {number} */
- this.J = 0;
- /** @type {string} */
- this.H = "";
- /** @type {Array.<string>} */
- var pattern = "0123456789".split("");
- /** @type {Array} */
- this.g = Array(10);
- /** @type {number} */
- var pix1 = 10;
- for (;pix1--;) {
- var g = new run(pattern);
- this.g[pix1] = g;
- self.Ta(this, g);
- }
- this.j = new run([" ", "-"]);
- self.Ta(this, this.j);
- /** @type {Array} */
- this.O = [this.wq, test(this, 500), this.sq, test(this, 1500), this.vq, test(this, 2E3), this.uq, this.tq];
- };
- /**
- * @param {?} bind
- * @param {Function} scope
- * @param {number} opt_attributes
- * @return {undefined}
- */
- var forEach = function(bind, scope, opt_attributes) {
- bind.J = self.v((0, self.p)(scope, bind), opt_attributes);
- };
- /**
- * @param {number} offset
- * @return {?}
- */
- var extractStacktrace = function(offset) {
- /** @type {number} */
- offset = Math.abs(offset);
- /** @type {Array} */
- var eventPath = [];
- for (;offset;) {
- /** @type {number} */
- var cur = offset % 10;
- /** @type {number} */
- offset = (offset - cur) / 10 | 0;
- eventPath.push(cur);
- }
- return eventPath;
- };
- /**
- * @param {Object} args
- * @param {number} recurring
- * @return {undefined}
- */
- var each = function(args, recurring) {
- args.j.hc(recurring);
- /** @type {number} */
- var i = 0;
- var valuesLen = args.g.length;
- for (;i < valuesLen;++i) {
- args.g[i].hc(recurring);
- }
- };
- /**
- * @param {Object} options
- * @param {number} y
- * @return {?}
- */
- var build = function(options, y) {
- /** @type {number} */
- var a = Math.abs(y);
- /** @type {Array} */
- var r = [];
- /** @type {number} */
- var i = 0;
- var valuesLen = options.g.length;
- for (;i < valuesLen;++i) {
- /** @type {number} */
- var b = a % 10;
- /** @type {number} */
- a = (a - b) / 10 | 0;
- var e = options.g[i];
- callback(e, b);
- r.push(fn(e));
- }
- callback(options.j, 0 > y ? 1 : 0);
- r.push(fn(options.j));
- return self.ak(r);
- };
- /**
- * @param {?} cond
- * @param {number} opt_attributes
- * @return {?}
- */
- var test = function(cond, opt_attributes) {
- return(0, self.p)(function() {
- return new self.be(function($sanitize) {
- forEach(this, function() {
- this.De();
- $sanitize();
- }, opt_attributes);
- }, this);
- }, cond, opt_attributes);
- };
- /**
- * @return {undefined}
- */
- var y = function() {
- match();
- var interval = self.G("watch-view-count");
- var timer = self.G("real-view-count", interval);
- if (interval) {
- if (timer) {
- timer = (0, window.parseInt)(timer.innerHTML, 0);
- if (!(2147483947 > timer)) {
- self.D(interval, "go-done");
- self.B(interval, "go-ready");
- tester = new e(interval, timer);
- self.Ua(tester, match);
- tester.run();
- }
- }
- }
- };
- /**
- * @return {undefined}
- */
- var i = function() {
- match();
- };
- /**
- * @return {undefined}
- */
- var match = function() {
- self.Va(tester);
- /** @type {null} */
- tester = null;
- var onComplete = self.G("watch-view-count");
- if (onComplete) {
- self.B(onComplete, "go-done");
- }
- };
- self.t(run, self.Sa);
- var transformProperty;
- t: {
- var elem = self.Tk("div");
- /** @type {Array} */
- var props = ["transform", "webkitTransform", "mozTransform", "msTransform", "oTransform"];
- /** @type {number} */
- var idx = props.length;
- for (;idx--;) {
- var prop = props[idx];
- if (void 0 !== elem.style[prop]) {
- transformProperty = prop;
- break t;
- }
- }
- /** @type {string} */
- transformProperty = "transform";
- }
- var vendorProp = transformProperty;
- /**
- * @return {undefined}
- */
- run.prototype.N = function() {
- self.Lh(this.D);
- self.Lh(this.da);
- /** @type {null} */
- this.C = this.D = this.da = null;
- run.L.N.call(this);
- };
- /**
- * @param {number} outstandingDataSize
- * @return {undefined}
- */
- run.prototype.hc = function(outstandingDataSize) {
- /** @type {number} */
- this.K = outstandingDataSize;
- };
- self.t(e, self.Sa);
- self.g = e.prototype;
- /**
- * @return {undefined}
- */
- self.g.N = function() {
- e.L.N.call(this);
- this.D.stop();
- self.bb(this.J);
- self.Lh(this.C);
- self.D(this.k, "go-activate");
- self.N(this.H);
- };
- /**
- * @return {undefined}
- */
- self.g.Bf = function() {
- if (!this.ha()) {
- if (this.F) {
- /** @type {boolean} */
- this.F = false;
- ++this.R;
- var i = this.O[this.R];
- if (i) {
- i.call(this);
- } else {
- this.end();
- }
- }
- move(this.j);
- /** @type {number} */
- i = 0;
- var valuesLen = this.g.length;
- for (;i < valuesLen;++i) {
- move(this.g[i]);
- }
- this.D.start();
- }
- };
- /**
- * @return {undefined}
- */
- self.g.run = function() {
- this.Bf();
- };
- /**
- * @return {undefined}
- */
- self.g.pause = function() {
- this.D.stop();
- };
- /**
- * @return {undefined}
- */
- self.g.end = function() {
- this.pause();
- this.dispose();
- };
- /**
- * @return {undefined}
- */
- self.g.De = function() {
- /** @type {boolean} */
- this.F = true;
- };
- /**
- * @return {undefined}
- */
- self.g.wq = function() {
- self.rc("/gen_204?go_init");
- each(this, 1);
- this.k.appendChild(this.C);
- this.C.appendChild(this.j.da);
- var spaces = this.g.length;
- for (;spaces--;) {
- this.C.appendChild(this.g[spaces].da);
- }
- build(this, this.K).then(function() {
- each(this, 0);
- return new self.be(function(millis) {
- this.H = self.mk(this.k, self.Wp, millis);
- self.B(this.k, "go-activate");
- }, this);
- }, null, this).then(this.De, null, this);
- };
- /**
- * @return {undefined}
- */
- self.g.sq = function() {
- /** @type {number} */
- this.j.k = 0.9;
- this.j.hc(2);
- /** @type {number} */
- var a1 = 1;
- var line = this.g.length;
- for (;line--;) {
- var value = this.g[line];
- /** @type {number} */
- var b4 = 0.5 > Math.random() ? 1 : -1;
- value.hc(2);
- /** @type {number} */
- value.k = a1 * b4;
- ++a1;
- }
- this.De();
- };
- /**
- * @return {undefined}
- */
- self.g.vq = function() {
- var uri = build(this, -4294967294 + this.K);
- this.j.hc(0);
- var result = self.de();
- var f = this.g.length;
- for (;f--;) {
- result = result.then(self.q(function(e) {
- return new self.be(function(next_scope) {
- e.hc(0);
- forEach(this, next_scope, 100);
- }, this);
- }, this.g[f]), null, this);
- }
- self.ak([uri, result]).then(this.De, null, this);
- };
- /**
- * @return {undefined}
- */
- self.g.uq = function() {
- var iteratee = extractStacktrace(this.K);
- /** @type {number} */
- var requestId = 2;
- var jQuery = (0, self.p)(function(index) {
- var id = requestId += 0.3;
- for (;index--;) {
- var e = this.g[index];
- e.hc(2);
- e.k = id;
- callback(e, iteratee[index]);
- if (50 < id) {
- /** @type {number} */
- id = 50;
- }
- }
- }, this);
- var sel = this.g.length;
- jQuery(sel);
- /** @type {number} */
- this.j.k = 2;
- callback(this.j, 0);
- this.j.hc(0);
- var outcome = fn(this.j);
- for (;sel--;) {
- outcome = outcome.then((0, self.p)(function(e, option) {
- jQuery(option);
- e.hc(0);
- return fn(e);
- }, this, this.g[sel], sel));
- }
- outcome.then(this.De, null, this);
- };
- /**
- * @return {undefined}
- */
- self.g.tq = function() {
- self.rc("/gen_204?go_cleanup");
- this.H = self.mk(this.k, self.Wp, (0, self.p)(this.De, this));
- self.D(this.k, "go-activate");
- };
- /** @type {null} */
- var tester = null;
- /** @type {Array} */
- var out = [];
- self.Wc(self.Ck({
- name : "www/gangnam_overflow",
- deps : ["www/watch"],
- page : "watch",
- /**
- * @return {undefined}
- */
- init : function() {
- var statements = self.G("watch-view-count");
- if (statements) {
- out.push(self.J(statements, "mouseenter", y));
- out.push(self.J(statements, "mouseleave", i));
- }
- },
- /**
- * @return {undefined}
- */
- dispose : function() {
- match();
- self.N(out);
- /** @type {number} */
- out.length = 0;
- }
- }));
- })(_yt_www);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement