Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.18 KB | None | 0 0
  1. var _createClass = function() {
  2. function _0xd578x4(_0xd578x5, _0xd578x6) {
  3. for(var i = 0; i < _0xd578x6["length"]; i++) {
  4. var _0xd578x8 = _0xd578x6[i];
  5. _0xd578x8["enumerable"] = _0xd578x8["enumerable"] || false;
  6. _0xd578x8["configurable"] = true;
  7. if("value" in _0xd578x8) {
  8. _0xd578x8["writable"] = true
  9. };
  10. Object["defineProperty"](_0xd578x5, _0xd578x8["key"], _0xd578x8)
  11. }
  12. }
  13. return function(_0xd578x9, _0xd578xa, _0xd578xb) {
  14. if(_0xd578xa) {
  15. _0xd578x4(_0xd578x9["prototype"], _0xd578xa)
  16. };
  17. if(_0xd578xb) {
  18. _0xd578x4(_0xd578x9, _0xd578xb)
  19. };
  20. return _0xd578x9
  21. }
  22. }();
  23. function _classCallCheck(_0xd578x19, _0xd578x9) {
  24. if(!(_0xd578x19 instanceof _0xd578x9)) {
  25. throw new TypeError("Cannot call a class as a function")
  26. }
  27. }
  28. var _typeof = typeof Symbol === "function" && typeof Symbol["iterator"] === "symbol" ? function(_0xd578x2) {
  29. return typeof _0xd578x2
  30. } : function(_0xd578x2) {
  31. return _0xd578x2 && typeof Symbol === "function" && _0xd578x2["constructor"] === Symbol && _0xd578x2 !== Symbol["prototype"] ? "symbol" : typeof _0xd578x2
  32. };
  33. "use strict";
  34. var chart = void(0);
  35. var Chart = function() {
  36. _createClass(Chart, [{
  37. key: "getMouseTimeout",
  38. value: function _0xd578x283() {
  39. var _0xd578x284 = this;
  40. return setTimeout(function() {
  41. _0xd578x284["mouse"]["t"] = false
  42. }, 1000)
  43. }
  44. }]);
  45.  
  46. function Chart(WindowWidth, _0xd578x286, trades) {
  47. var newChatObject = this;
  48. _classCallCheck(this, Chart);
  49. document["addEventListener"]("visibilitychange", function() {
  50. switch(document["visibilityState"]) {
  51. case "visible":
  52. newChatObject["time_last"] = Date["now"]() - newChatObject["time"];
  53. break;
  54. case "hidden":
  55. newChatObject["time"] = Date["now"]() - newChatObject["time_last"];
  56. break
  57. }
  58. });
  59. this["mouse"] = {
  60. t: false,
  61. i: 0,
  62. timer: this["getMouseTimeout"](),
  63. x: 0,
  64. y: 0,
  65. px: 0,
  66. py: 0
  67. };
  68. this["timer_max"] = 1500;
  69. document["addEventListener"]("scroll", function() {
  70. if(js["hasClass"](js["get"]("#roll-panel"), "is-rolled")) {
  71. return
  72. };
  73. var thisNewInfo = 0;
  74. var positionYor = newChatObject["canvas"]["getBoundingClientRect"]()["Y"];
  75. if(positionYor + newChatObject["h"] > 0 && positionYor < window["innerHeight"] && !newChatObject["run"]) {
  76. newChatObject["play"]()
  77. } else {
  78. if((positionYor + newChatObject["h"] < 0 || positionYor > window["innerHeight"]) && newChatObject["run"]) {
  79. newChatObject["stop"]()
  80. }
  81. }
  82. });
  83. this["run"] = false;
  84. this["canvas"] = document["getElementById"]("canvas");
  85. this["ctx"] = this["canvas"]["getContext"]("2d");
  86. this["resize"](WindowWidth, _0xd578x286);
  87. this["updateColors"]();
  88. this["time_now"] = Date["now"]();
  89. this["time"] = this["time_now"] - this["timer_max"];
  90. this["points"] = [];
  91. this["last"] = null;
  92. this["draw"](trades);
  93. var thisNewInfo = 0;
  94. var positionYor = this["canvas"]["getBoundingClientRect"]()["Y"];
  95. if(positionYor + this["h"] > 0 && positionYor < window["innerHeight"] && !this["run"]) {
  96. this["play"]()
  97. } else {
  98. if((positionYor + this["h"] < 0 || positionYor > window["innerHeight"]) && this["run"]) {
  99. this["stop"]()
  100. }
  101. };
  102. this["canvas"]["addEventListener"]("mouseover", function() {
  103. newChatObject["mouse"]["t"] = true
  104. });
  105. this["canvas"]["addEventListener"]("mousemove", function(_0xd578x1e) {
  106. newChatObject["mouse"]["t"] = true;
  107. newChatObject["mouse"]["x"] = _0xd578x1e["offsetX"];
  108. newChatObject["mouse"]["Y"] = _0xd578x1e["offsetY"];
  109. newChatObject["mouse"]["px"] = _0xd578x1e["pageX"];
  110. newChatObject["mouse"]["py"] = _0xd578x1e["pageY"]
  111. });
  112. this["canvas"]["addEventListener"]("mouseout", function() {
  113. newChatObject["mouse"]["t"] = false
  114. });
  115. this["c"] = 0
  116. }
  117. _createClass(Chart, [{
  118. key: "updateColors",
  119. value: function _0xd578x28b() {
  120. this["grad"] = this["getThemeGradient"]();
  121. this["circ"] = {
  122. fill: this["getCircFill"](),
  123. stroke: this["getCircStroke"]()
  124. };
  125. this["stroke"] = this["getStroke"]()
  126. }
  127. }, {
  128. key: "stop",
  129. value: function _0xd578x28c() {
  130. this["canvas"]["style"]["visibility"] = "hidden";
  131. this["time"] = Date["now"]() - this["time_last"];
  132. this["run"] = false
  133. }
  134. }, {
  135. key: "play",
  136. value: function _0xd578x28d() {
  137. this["canvas"]["style"]["visibility"] = "visible";
  138. this["time_last"] = Date["now"]() - this["time"];
  139. this["run"] = true;
  140. this["render"]()
  141. }
  142. }, {
  143. key: "pauseFor",
  144. value: function _0xd578x28e(_0xd578x3d) {}
  145. }, {
  146. key: "renderTradePopover",
  147. value: function _0xd578x28f(_0xd578x290, positionYor) {
  148. var _0xd578x291 = arguments["length"] > 2 && arguments[2] !== undefined ? arguments[2] : "underCount";
  149. js["get"]("#trade-diff-popover-count")["innerHTML"] = "" + _0xd578x291;
  150. js["show"](js["get"]("#trade-diff-popover"));
  151. js["css"](js["get"]("#trade-diff-popover"), "left", _0xd578x290 - 106 + "px");
  152. js["css"](js["get"]("#trade-diff-popover"), "top", positionYor + (10 + this["circ_rad"] * 2) + "px")
  153. }
  154. }, {
  155. key: "render",
  156. value: function _0xd578x292() {
  157. var _0xd578x293 = this;
  158. if(!this["run"]) {
  159. return
  160. };
  161. this["ctx"]["clearRect"](0, 0, this["w"], this["h"]);
  162. this["time_now"] = Date["now"]();
  163. var _0xd578xe7 = 0;
  164. if(this["time_now"] - this["time"] < this["timer_max"]) {
  165. _0xd578xe7 = (this["time_now"] - this["time"]) / this["timer_max"]
  166. } else {
  167. _0xd578xe7 = 1
  168. };
  169. var _0xd578x294 = [];
  170. if(_0xd578xe7 == 1) {
  171. for(var i = 0; i < this["points"]["length"]; i++) {
  172. this["points"][i]["x"] = this["points"][i]["tx"];
  173. this["points"][i]["Y"] = this["points"][i]["ty"]
  174. }
  175. };
  176. this["points"] = this["points"]["filter"](function(_0xd578x155) {
  177. return _0xd578x155["x"] > -(_0xd578x293["step_width"] * 3) && _0xd578x155["x"] < _0xd578x293["canvas"]["width"] + _0xd578x293["step_width"] * 3
  178. });
  179. for(var _0xd578x295 = 0; _0xd578x295 < this["points"]["length"]; _0xd578x295++) {
  180. var _0xd578x290 = this["points"][_0xd578x295]["x"] + (this["points"][_0xd578x295]["tx"] - this["points"][_0xd578x295]["x"]) * _0xd578xe7;
  181. var positionYor = this["points"][_0xd578x295]["Y"] + (this["points"][_0xd578x295]["ty"] - this["points"][_0xd578x295]["Y"]) * _0xd578xe7;
  182. _0xd578x294["push"]({
  183. x: _0xd578x290,
  184. y: positionYor,
  185. t: this["points"][_0xd578x295]["t"]
  186. })
  187. };
  188. this["ctx"]["lineWidth"] = 2;
  189. if(_0xd578x294[0]) {
  190. this["ctx"]["beginPath"]();
  191. this["ctx"]["moveTo"](_0xd578x294[0]["x"], this["h"]);
  192. this["ctx"]["lineTo"](_0xd578x294[0]["x"], _0xd578x294[0]["Y"]);
  193. for(var _0xd578x296 = 1; _0xd578x296 < _0xd578x294["length"]; _0xd578x296++) {
  194. this["ctx"]["lineTo"](_0xd578x294[_0xd578x296]["x"], _0xd578x294[_0xd578x296]["Y"])
  195. };
  196. this["ctx"]["lineTo"](this["w"] + this["step_width"], this["h"] + 5);
  197. this["ctx"]["fillStyle"] = this["grad"];
  198. this["ctx"]["closePath"]();
  199. this["ctx"]["fill"]()
  200. };
  201. this["ctx"]["strokeStyle"] = this["stroke"];
  202. this["ctx"]["stroke"]();
  203. this["ctx"]["lineWidth"] = this["circ_width"];
  204. this["ctx"]["fillStyle"] = this["circ"]["fill"];
  205. this["ctx"]["strokeStyle"] = this["circ"]["stroke"];
  206. var _0xd578x297 = false;
  207. for(var _0xd578x298 = 0; _0xd578x298 < _0xd578x294["length"]; _0xd578x298++) {
  208. this["ctx"]["beginPath"]();
  209. this["ctx"]["arc"](_0xd578x294[_0xd578x298]["x"], _0xd578x294[_0xd578x298]["Y"], this["circ_rad"], 0, Math["PI"] * 2, true);
  210. 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"]) {
  211. var _0xd578x299 = this["canvas"]["getBoundingClientRect"]()["top"] + window["scrollY"] + _0xd578x294[_0xd578x298]["Y"];
  212. this["renderTradePopover"](_0xd578x294[_0xd578x298]["x"], _0xd578x299, _0xd578x294[_0xd578x298]["t"]);
  213. _0xd578x297 = true;
  214. this["mouse"]["t"] = true;
  215. this["mouse"]["i"] = _0xd578x298;
  216. this["ctx"]["fillStyle"] = "white";
  217. this["ctx"]["fill"]();
  218. this["ctx"]["fillStyle"] = this["circ"]["fill"]
  219. } else {
  220. this["ctx"]["fill"]()
  221. };
  222. this["ctx"]["stroke"]();
  223. this["ctx"]["closePath"]()
  224. };
  225. if(!_0xd578x297) {
  226. this["mouse"]["t"] = false;
  227. js["hide"](js["get"]("#trade-diff-popover"))
  228. };
  229. requestAnimationFrame(function() {
  230. _0xd578x293["render"]()
  231. })
  232. }
  233. }, {
  234. key: "draw",
  235. value: function _0xd578x29a() {
  236. var trades = arguments["length"] > 0 && arguments[0] !== undefined ? arguments[0] : [0, 1];
  237. if((typeof trades === "undefined" ? "undefined" : _typeof(trades)) !== "object" || !trades["length"]) {
  238. return
  239. };
  240. if(this["c"] < 1) {
  241. this["c"] ++;
  242. return
  243. };
  244. if(!this["getted"]) {
  245. this["getted"] = true;
  246. for(var i = 0; i < trades["length"]; i++) {
  247. this["draw"]([trades[i]])
  248. };
  249. return
  250. };
  251. var _0xd578x290 = -this["step_width"];
  252. var positionYor = this["h"];
  253. if(this["points"]["length"]) {
  254. _0xd578x290 = this["points"][this["points"]["length"] - 1]["x"] + this["step_width"]
  255. };
  256. if(!this["last"]) {
  257. this["last"] = trades[trades["length"] - 1]
  258. };
  259. var _0xd578x1b7 = trades[trades["length"] - 1] - this["last"];
  260. if(_0xd578x1b7 > 25) {
  261. _0xd578x1b7 = 25
  262. };
  263. this["points"]["push"]({
  264. t: _0xd578x1b7,
  265. x: _0xd578x290,
  266. y: positionYor,
  267. tx: _0xd578x290,
  268. ty: positionYor
  269. });
  270. var _0xd578x29b = 0;
  271. for(var _0xd578x29c = 0; _0xd578x29c < this["points"]["length"]; _0xd578x29c++) {
  272. if(_0xd578x29b < this["points"][_0xd578x29c]["t"]) {
  273. _0xd578x29b = this["points"][_0xd578x29c]["t"]
  274. }
  275. };
  276. if(_0xd578x29b > 25) {
  277. _0xd578x29b = 5
  278. };
  279. for(var _0xd578x29d = 0; _0xd578x29d < this["points"]["length"]; _0xd578x29d++) {
  280. if(this["time_now"] - this["time"] > this["timer_max"]) {
  281. this["points"][_0xd578x29d]["tx"] -= this["step_width"]
  282. };
  283. this["points"][_0xd578x29d]["ty"] = this["h"] - this["points"][_0xd578x29d]["t"] / _0xd578x29b * 0.9 * this["h"] - this["h"] * 0.05;
  284. if(this["points"][_0xd578x29d]["t"] < 0) {
  285. this["points"][_0xd578x29d]["t"] = 0
  286. } else {
  287. if(this["points"][_0xd578x29d]["t"] > 25) {
  288. this["points"][_0xd578x29d]["t"] = 25
  289. }
  290. }
  291. };
  292. this["last"] = trades["pop"]();
  293. this["drawing"] = true;
  294. this["time"] = Date["now"]();
  295. this["c"] ++
  296. }
  297. }, {
  298. key: "resize",
  299. value: function _0xd578x29e(WindowWidth, _0xd578x286) {
  300. if(!_0xd578x286) {
  301. _0xd578x286 = Math["floor"](WindowWidth / (1920 / 405))
  302. };
  303. this["canvas"]["width"] = this["w"] = WindowWidth;
  304. this["canvas"]["height"] = this["h"] = _0xd578x286;
  305. this["circle_radius"] = this["w"] / 192;
  306. this["circle_line_width"] = 2;
  307. this["step_width"] = parseInt(this["w"] / 8);
  308. this["circ_rad"] = this["w"] / 192;
  309. this["circ_width"] = 2
  310. }
  311. }, {
  312. key: "getThemeGradient",
  313. value: function _0xd578x29f() {
  314. var _0xd578x2a0 = this["ctx"]["createLinearGradient"](0, 0, 0, this["h"]);
  315. var _0xd578x182 = getCookie("theme");
  316. switch(_0xd578x182) {
  317. case "blueTheme":
  318. _0xd578x2a0["addColorStop"](0, "rgba(164, 169, 181, 1)");
  319. _0xd578x2a0["addColorStop"](0.3, "rgba(164, 169, 181, .3)");
  320. _0xd578x2a0["addColorStop"](1, "rgba(164, 169, 181, .0)");
  321. break;
  322. case "orangeTheme":
  323. _0xd578x2a0["addColorStop"](0, "rgba(90, 93, 86, 1)");
  324. _0xd578x2a0["addColorStop"](0.3, "rgba(96, 100, 89, 1)");
  325. _0xd578x2a0["addColorStop"](1, "rgba(122, 125, 114, .0)");
  326. break;
  327. case "darkTheme":
  328. _0xd578x2a0["addColorStop"](0, "rgba(232, 240, 255, .3)");
  329. _0xd578x2a0["addColorStop"](1, "rgba(23, 23, 25, .0)");
  330. break;
  331. default:
  332. _0xd578x2a0["addColorStop"](0, "rgba(88, 75, 111, .3)");
  333. _0xd578x2a0["addColorStop"](1, "rgba(25, 24, 28, .0)");
  334. break
  335. };
  336. return _0xd578x2a0
  337. }
  338. }, {
  339. key: "getCircStroke",
  340. value: function _0xd578x2a1() {
  341. switch(getCookie("theme")) {
  342. case "blueTheme":
  343. return "#969baa";
  344. case "orangeTheme":
  345. return "rgb(81, 82, 73)";
  346. case "darkTheme":
  347. return "#989898";
  348. default:
  349. "rgba(162, 165, 181, .3)"
  350. }
  351. }
  352. }, {
  353. key: "getCircFill",
  354. value: function _0xd578x2a2() {
  355. switch(getCookie("theme")) {
  356. case "blueTheme":
  357. return "#d2d4dc";
  358. case "orangeTheme":
  359. return "#9a9e97";
  360. case "darkTheme":
  361. return "#5c5d5e";
  362. default:
  363. return "#f4f2f4"
  364. }
  365. }
  366. }, {
  367. key: "getStroke",
  368. value: function _0xd578x2a3() {
  369. switch(getCookie("theme")) {
  370. case "blueTheme":
  371. return "#969baa";
  372. case "orangeTheme":
  373. return "rgb(81, 82, 73)";
  374. case "darkTheme":
  375. return "rgb(36, 37, 38)";
  376. default:
  377. return "rgba(162, 165, 181, .3)"
  378. }
  379. }
  380. }]);
  381. return Chart
  382. }();
  383.  
  384.  
  385.  
  386.  
  387.  
  388. $('#canvas').css({
  389. "visibility": "visible"
  390. });
  391. var assetLast11 = [35375644, 35375659, 35375669, 35375679, 35375688, 35375690, 35375701, 35375713, 35375738, 35375751, 35375757];
  392. if(!chart) {
  393. console.log("Wstawia");
  394. chart = new Chart(window["innerWidth"], null, assetLast11)
  395. } else {
  396. console.log("Aktualizuje");
  397. chart["draw"](assetLast11)
  398. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement