Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var _createClass = function() {
- function _0xd578x4(_0xd578x5, _0xd578x6) {
- for(var i = 0; i < _0xd578x6["length"]; i++) {
- var _0xd578x8 = _0xd578x6[i];
- _0xd578x8["enumerable"] = _0xd578x8["enumerable"] || false;
- _0xd578x8["configurable"] = true;
- if("value" in _0xd578x8) {
- _0xd578x8["writable"] = true
- };
- Object["defineProperty"](_0xd578x5, _0xd578x8["key"], _0xd578x8)
- }
- }
- return function(_0xd578x9, _0xd578xa, _0xd578xb) {
- if(_0xd578xa) {
- _0xd578x4(_0xd578x9["prototype"], _0xd578xa)
- };
- if(_0xd578xb) {
- _0xd578x4(_0xd578x9, _0xd578xb)
- };
- return _0xd578x9
- }
- }();
- function _classCallCheck(_0xd578x19, _0xd578x9) {
- if(!(_0xd578x19 instanceof _0xd578x9)) {
- throw new TypeError("Cannot call a class as a function")
- }
- }
- var _typeof = typeof Symbol === "function" && typeof Symbol["iterator"] === "symbol" ? function(_0xd578x2) {
- return typeof _0xd578x2
- } : function(_0xd578x2) {
- return _0xd578x2 && typeof Symbol === "function" && _0xd578x2["constructor"] === Symbol && _0xd578x2 !== Symbol["prototype"] ? "symbol" : typeof _0xd578x2
- };
- "use strict";
- var chart = void(0);
- var Chart = function() {
- _createClass(Chart, [{
- key: "getMouseTimeout",
- value: function _0xd578x283() {
- var _0xd578x284 = this;
- return setTimeout(function() {
- _0xd578x284["mouse"]["t"] = false
- }, 1000)
- }
- }]);
- function Chart(WindowWidth, _0xd578x286, trades) {
- var newChatObject = this;
- _classCallCheck(this, Chart);
- document["addEventListener"]("visibilitychange", function() {
- switch(document["visibilityState"]) {
- case "visible":
- newChatObject["time_last"] = Date["now"]() - newChatObject["time"];
- break;
- case "hidden":
- newChatObject["time"] = Date["now"]() - newChatObject["time_last"];
- break
- }
- });
- this["mouse"] = {
- t: false,
- i: 0,
- timer: this["getMouseTimeout"](),
- x: 0,
- y: 0,
- px: 0,
- py: 0
- };
- this["timer_max"] = 1500;
- document["addEventListener"]("scroll", function() {
- if(js["hasClass"](js["get"]("#roll-panel"), "is-rolled")) {
- return
- };
- var thisNewInfo = 0;
- var positionYor = newChatObject["canvas"]["getBoundingClientRect"]()["Y"];
- if(positionYor + newChatObject["h"] > 0 && positionYor < window["innerHeight"] && !newChatObject["run"]) {
- newChatObject["play"]()
- } else {
- if((positionYor + newChatObject["h"] < 0 || positionYor > window["innerHeight"]) && newChatObject["run"]) {
- newChatObject["stop"]()
- }
- }
- });
- this["run"] = false;
- this["canvas"] = document["getElementById"]("canvas");
- this["ctx"] = this["canvas"]["getContext"]("2d");
- this["resize"](WindowWidth, _0xd578x286);
- this["updateColors"]();
- this["time_now"] = Date["now"]();
- this["time"] = this["time_now"] - this["timer_max"];
- this["points"] = [];
- this["last"] = null;
- this["draw"](trades);
- var thisNewInfo = 0;
- var positionYor = this["canvas"]["getBoundingClientRect"]()["Y"];
- if(positionYor + this["h"] > 0 && positionYor < window["innerHeight"] && !this["run"]) {
- this["play"]()
- } else {
- if((positionYor + this["h"] < 0 || positionYor > window["innerHeight"]) && this["run"]) {
- this["stop"]()
- }
- };
- this["canvas"]["addEventListener"]("mouseover", function() {
- newChatObject["mouse"]["t"] = true
- });
- this["canvas"]["addEventListener"]("mousemove", function(_0xd578x1e) {
- newChatObject["mouse"]["t"] = true;
- newChatObject["mouse"]["x"] = _0xd578x1e["offsetX"];
- newChatObject["mouse"]["Y"] = _0xd578x1e["offsetY"];
- newChatObject["mouse"]["px"] = _0xd578x1e["pageX"];
- newChatObject["mouse"]["py"] = _0xd578x1e["pageY"]
- });
- this["canvas"]["addEventListener"]("mouseout", function() {
- newChatObject["mouse"]["t"] = false
- });
- this["c"] = 0
- }
- _createClass(Chart, [{
- key: "updateColors",
- value: function _0xd578x28b() {
- this["grad"] = this["getThemeGradient"]();
- this["circ"] = {
- fill: this["getCircFill"](),
- stroke: this["getCircStroke"]()
- };
- this["stroke"] = this["getStroke"]()
- }
- }, {
- key: "stop",
- value: function _0xd578x28c() {
- this["canvas"]["style"]["visibility"] = "hidden";
- this["time"] = Date["now"]() - this["time_last"];
- this["run"] = false
- }
- }, {
- key: "play",
- value: function _0xd578x28d() {
- this["canvas"]["style"]["visibility"] = "visible";
- this["time_last"] = Date["now"]() - this["time"];
- this["run"] = true;
- this["render"]()
- }
- }, {
- key: "pauseFor",
- value: function _0xd578x28e(_0xd578x3d) {}
- }, {
- key: "renderTradePopover",
- value: function _0xd578x28f(_0xd578x290, positionYor) {
- var _0xd578x291 = arguments["length"] > 2 && arguments[2] !== undefined ? arguments[2] : "underCount";
- js["get"]("#trade-diff-popover-count")["innerHTML"] = "" + _0xd578x291;
- js["show"](js["get"]("#trade-diff-popover"));
- js["css"](js["get"]("#trade-diff-popover"), "left", _0xd578x290 - 106 + "px");
- js["css"](js["get"]("#trade-diff-popover"), "top", positionYor + (10 + this["circ_rad"] * 2) + "px")
- }
- }, {
- key: "render",
- value: function _0xd578x292() {
- var _0xd578x293 = this;
- if(!this["run"]) {
- return
- };
- this["ctx"]["clearRect"](0, 0, this["w"], this["h"]);
- this["time_now"] = Date["now"]();
- var _0xd578xe7 = 0;
- if(this["time_now"] - this["time"] < this["timer_max"]) {
- _0xd578xe7 = (this["time_now"] - this["time"]) / this["timer_max"]
- } else {
- _0xd578xe7 = 1
- };
- var _0xd578x294 = [];
- if(_0xd578xe7 == 1) {
- for(var i = 0; i < this["points"]["length"]; i++) {
- this["points"][i]["x"] = this["points"][i]["tx"];
- this["points"][i]["Y"] = this["points"][i]["ty"]
- }
- };
- this["points"] = this["points"]["filter"](function(_0xd578x155) {
- return _0xd578x155["x"] > -(_0xd578x293["step_width"] * 3) && _0xd578x155["x"] < _0xd578x293["canvas"]["width"] + _0xd578x293["step_width"] * 3
- });
- for(var _0xd578x295 = 0; _0xd578x295 < this["points"]["length"]; _0xd578x295++) {
- var _0xd578x290 = this["points"][_0xd578x295]["x"] + (this["points"][_0xd578x295]["tx"] - this["points"][_0xd578x295]["x"]) * _0xd578xe7;
- var positionYor = this["points"][_0xd578x295]["Y"] + (this["points"][_0xd578x295]["ty"] - this["points"][_0xd578x295]["Y"]) * _0xd578xe7;
- _0xd578x294["push"]({
- x: _0xd578x290,
- y: positionYor,
- t: this["points"][_0xd578x295]["t"]
- })
- };
- this["ctx"]["lineWidth"] = 2;
- if(_0xd578x294[0]) {
- this["ctx"]["beginPath"]();
- this["ctx"]["moveTo"](_0xd578x294[0]["x"], this["h"]);
- this["ctx"]["lineTo"](_0xd578x294[0]["x"], _0xd578x294[0]["Y"]);
- for(var _0xd578x296 = 1; _0xd578x296 < _0xd578x294["length"]; _0xd578x296++) {
- this["ctx"]["lineTo"](_0xd578x294[_0xd578x296]["x"], _0xd578x294[_0xd578x296]["Y"])
- };
- this["ctx"]["lineTo"](this["w"] + this["step_width"], this["h"] + 5);
- this["ctx"]["fillStyle"] = this["grad"];
- this["ctx"]["closePath"]();
- this["ctx"]["fill"]()
- };
- this["ctx"]["strokeStyle"] = this["stroke"];
- this["ctx"]["stroke"]();
- this["ctx"]["lineWidth"] = this["circ_width"];
- this["ctx"]["fillStyle"] = this["circ"]["fill"];
- this["ctx"]["strokeStyle"] = this["circ"]["stroke"];
- var _0xd578x297 = false;
- for(var _0xd578x298 = 0; _0xd578x298 < _0xd578x294["length"]; _0xd578x298++) {
- this["ctx"]["beginPath"]();
- this["ctx"]["arc"](_0xd578x294[_0xd578x298]["x"], _0xd578x294[_0xd578x298]["Y"], this["circ_rad"], 0, Math["PI"] * 2, true);
- if(Math["sqrt"](Math["pow"](this["mouse"]["x"] - _0xd578x294[_0xd578x298]["x"], 2) + Math["pow"](this["mouse"]["Y"] - _0xd578x294[_0xd578x298]["Y"], 2)) <= this["circ_rad"] * 2 && this["mouse"]["t"]) {
- var _0xd578x299 = this["canvas"]["getBoundingClientRect"]()["top"] + window["scrollY"] + _0xd578x294[_0xd578x298]["Y"];
- this["renderTradePopover"](_0xd578x294[_0xd578x298]["x"], _0xd578x299, _0xd578x294[_0xd578x298]["t"]);
- _0xd578x297 = true;
- this["mouse"]["t"] = true;
- this["mouse"]["i"] = _0xd578x298;
- this["ctx"]["fillStyle"] = "white";
- this["ctx"]["fill"]();
- this["ctx"]["fillStyle"] = this["circ"]["fill"]
- } else {
- this["ctx"]["fill"]()
- };
- this["ctx"]["stroke"]();
- this["ctx"]["closePath"]()
- };
- if(!_0xd578x297) {
- this["mouse"]["t"] = false;
- js["hide"](js["get"]("#trade-diff-popover"))
- };
- requestAnimationFrame(function() {
- _0xd578x293["render"]()
- })
- }
- }, {
- key: "draw",
- value: function _0xd578x29a() {
- var trades = arguments["length"] > 0 && arguments[0] !== undefined ? arguments[0] : [0, 1];
- if((typeof trades === "undefined" ? "undefined" : _typeof(trades)) !== "object" || !trades["length"]) {
- return
- };
- if(this["c"] < 1) {
- this["c"] ++;
- return
- };
- if(!this["getted"]) {
- this["getted"] = true;
- for(var i = 0; i < trades["length"]; i++) {
- this["draw"]([trades[i]])
- };
- return
- };
- var _0xd578x290 = -this["step_width"];
- var positionYor = this["h"];
- if(this["points"]["length"]) {
- _0xd578x290 = this["points"][this["points"]["length"] - 1]["x"] + this["step_width"]
- };
- if(!this["last"]) {
- this["last"] = trades[trades["length"] - 1]
- };
- var _0xd578x1b7 = trades[trades["length"] - 1] - this["last"];
- if(_0xd578x1b7 > 25) {
- _0xd578x1b7 = 25
- };
- this["points"]["push"]({
- t: _0xd578x1b7,
- x: _0xd578x290,
- y: positionYor,
- tx: _0xd578x290,
- ty: positionYor
- });
- var _0xd578x29b = 0;
- for(var _0xd578x29c = 0; _0xd578x29c < this["points"]["length"]; _0xd578x29c++) {
- if(_0xd578x29b < this["points"][_0xd578x29c]["t"]) {
- _0xd578x29b = this["points"][_0xd578x29c]["t"]
- }
- };
- if(_0xd578x29b > 25) {
- _0xd578x29b = 5
- };
- for(var _0xd578x29d = 0; _0xd578x29d < this["points"]["length"]; _0xd578x29d++) {
- if(this["time_now"] - this["time"] > this["timer_max"]) {
- this["points"][_0xd578x29d]["tx"] -= this["step_width"]
- };
- this["points"][_0xd578x29d]["ty"] = this["h"] - this["points"][_0xd578x29d]["t"] / _0xd578x29b * 0.9 * this["h"] - this["h"] * 0.05;
- if(this["points"][_0xd578x29d]["t"] < 0) {
- this["points"][_0xd578x29d]["t"] = 0
- } else {
- if(this["points"][_0xd578x29d]["t"] > 25) {
- this["points"][_0xd578x29d]["t"] = 25
- }
- }
- };
- this["last"] = trades["pop"]();
- this["drawing"] = true;
- this["time"] = Date["now"]();
- this["c"] ++
- }
- }, {
- key: "resize",
- value: function _0xd578x29e(WindowWidth, _0xd578x286) {
- if(!_0xd578x286) {
- _0xd578x286 = Math["floor"](WindowWidth / (1920 / 405))
- };
- this["canvas"]["width"] = this["w"] = WindowWidth;
- this["canvas"]["height"] = this["h"] = _0xd578x286;
- this["circle_radius"] = this["w"] / 192;
- this["circle_line_width"] = 2;
- this["step_width"] = parseInt(this["w"] / 8);
- this["circ_rad"] = this["w"] / 192;
- this["circ_width"] = 2
- }
- }, {
- key: "getThemeGradient",
- value: function _0xd578x29f() {
- var _0xd578x2a0 = this["ctx"]["createLinearGradient"](0, 0, 0, this["h"]);
- var _0xd578x182 = getCookie("theme");
- switch(_0xd578x182) {
- case "blueTheme":
- _0xd578x2a0["addColorStop"](0, "rgba(164, 169, 181, 1)");
- _0xd578x2a0["addColorStop"](0.3, "rgba(164, 169, 181, .3)");
- _0xd578x2a0["addColorStop"](1, "rgba(164, 169, 181, .0)");
- break;
- case "orangeTheme":
- _0xd578x2a0["addColorStop"](0, "rgba(90, 93, 86, 1)");
- _0xd578x2a0["addColorStop"](0.3, "rgba(96, 100, 89, 1)");
- _0xd578x2a0["addColorStop"](1, "rgba(122, 125, 114, .0)");
- break;
- case "darkTheme":
- _0xd578x2a0["addColorStop"](0, "rgba(232, 240, 255, .3)");
- _0xd578x2a0["addColorStop"](1, "rgba(23, 23, 25, .0)");
- break;
- default:
- _0xd578x2a0["addColorStop"](0, "rgba(88, 75, 111, .3)");
- _0xd578x2a0["addColorStop"](1, "rgba(25, 24, 28, .0)");
- break
- };
- return _0xd578x2a0
- }
- }, {
- key: "getCircStroke",
- value: function _0xd578x2a1() {
- switch(getCookie("theme")) {
- case "blueTheme":
- return "#969baa";
- case "orangeTheme":
- return "rgb(81, 82, 73)";
- case "darkTheme":
- return "#989898";
- default:
- "rgba(162, 165, 181, .3)"
- }
- }
- }, {
- key: "getCircFill",
- value: function _0xd578x2a2() {
- switch(getCookie("theme")) {
- case "blueTheme":
- return "#d2d4dc";
- case "orangeTheme":
- return "#9a9e97";
- case "darkTheme":
- return "#5c5d5e";
- default:
- return "#f4f2f4"
- }
- }
- }, {
- key: "getStroke",
- value: function _0xd578x2a3() {
- switch(getCookie("theme")) {
- case "blueTheme":
- return "#969baa";
- case "orangeTheme":
- return "rgb(81, 82, 73)";
- case "darkTheme":
- return "rgb(36, 37, 38)";
- default:
- return "rgba(162, 165, 181, .3)"
- }
- }
- }]);
- return Chart
- }();
- $('#canvas').css({
- "visibility": "visible"
- });
- var assetLast11 = [35375644, 35375659, 35375669, 35375679, 35375688, 35375690, 35375701, 35375713, 35375738, 35375751, 35375757];
- if(!chart) {
- console.log("Wstawia");
- chart = new Chart(window["innerWidth"], null, assetLast11)
- } else {
- console.log("Aktualizuje");
- chart["draw"](assetLast11)
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement