Advertisement
Guest User

Untitled

a guest
Apr 14th, 2016
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var popup = !1,
  2.     IS_PRODUCTION = 1,
  3.     notifId = 0,
  4.     tabActive = 0,
  5.     msgLoading = 0,
  6.     otp = 0,
  7.     success_login = !1,
  8.     MAIN_UPDATE_TIME = 6E4,
  9.     bCode = {
  10.         usd: 21,
  11.         rur: 22,
  12.         eur: 90,
  13.         cnh: 91,
  14.         gbp: 92
  15.     };
  16. $(window).focus(focusEvent);
  17. $(window).blur(blurEvent);
  18. $(document).mousemove(mmEvent);
  19. $(document).click(clickEvent);
  20.  
  21. function focusEvent() {
  22.     tabActive = 1
  23. }
  24.  
  25. function blurEvent() {
  26.     tabActive = 0
  27. }
  28.  
  29. function mmEvent() {
  30.     tabActive = 1
  31. }
  32.  
  33. function clickEvent() {
  34.     popup && $(".popup").hide()
  35. }
  36. $(document).ready(function() {
  37.     "https://btc-e.com" != domain && "https://btc-e.nz" != domain && "http://dev.btc-e.com" != domain && (IS_PRODUCTION = 0);
  38.     loading = "<div class='mcenter'><img src='" + domain + "/images/loading.gif' alt='' class='center' style='padding-top: 60%;'/></div>";
  39.     loadingnorm = "<div class='mcenter'><img src='" + domain + "/images/loading.gif' alt='' class='center' /></div>";
  40.     icLoading = "<img src='" + domain + "/images/loading.gif' alt='loading' class='center' />";
  41.     icLoading2 = "<img src='" + domain + "/images/loading.gif' alt='loading' />";
  42.     icLoadingH = "<img src='" + domain + "/images/loadh.gif' alt='loading' class='center' />";
  43.     icLoadingButton = "<img src='" + domain + "/images/loading.gif' alt='loading' style='padding-top: 7px;' class='center' />";
  44.     icOK = "<img src='" + domain + "/images/yes.png' alt='' />";
  45.     icErr = "<img src='" + domain + "/images/no.png' alt='' />";
  46.     0 < $("#nChatCon").size() && ($("#nChatInput").focus(), $("#nChat").scrollTop(9999999), chatRefresh = getCookie("chatRefresh"), void 0 == chatRefresh && (setCookie("chatRefresh", 0, {
  47.             path: "/",
  48.             expires: 31104E3
  49.         }),
  50.         chatRefresh = 0), auth && chatRefresh && pusherChatSub(), AFK_min = 0, setInterval(checkForAFK, 6E4), $("#nChat").scroll(nChatScrollEvent));
  51.     0 < $("#orders-b-list").size() && 1 == auth && setTimeout(orders_update, MAIN_UPDATE_TIME);
  52.     csrfToken = "";
  53.     auth && (csrfToken = $("#csrf-token").val());
  54.     $.ajaxSetup({
  55.         type: "POST",
  56.         cache: !1,
  57.         beforeSend: showLoader,
  58.         error: showReqError,
  59.         complete: hideLoader,
  60.         data: {
  61.             csrfToken: csrfToken
  62.         }
  63.     })
  64. });
  65.  
  66. function checkForAFK() {
  67.     1 != auth && 3 != auth && AFK_min++;
  68.     30 <= AFK_min && 1 == chatRefresh && nChatDisableRefresh()
  69. }
  70. document.onmousemove = userActive;
  71.  
  72. function userActive() {
  73.     AFK_min = 0
  74. }
  75.  
  76. function showLoader() {
  77.     $("#mainLoader").fadeTo(1, 1);
  78.     $("#loaderFade").fadeTo(1, 0.1)
  79. }
  80.  
  81. function hideLoader() {
  82.     $("#mainLoader").hide();
  83.     $("#loaderFade").hide()
  84. }
  85.  
  86. function showReqError() {
  87.     var a = "\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0434\u043d\u0435\u0435.";
  88.     "ru" != locale && (a = "Request error. Please try again later.");
  89.     alert(a)
  90. }
  91.  
  92. function _url(a) {
  93.     return domain + "/ajax/" + a
  94. }
  95.  
  96. function spoiler(a) {
  97.     $(a).next("div").slideToggle("fast")
  98. }
  99.  
  100. function msgDel(a, b) {
  101.     $(b).html(icLoading2);
  102.     $.post(_url("messages"), {
  103.         task: "del",
  104.         id: a
  105.     }, function(c) {
  106.         -1 < c && ($("#msg-" + a).fadeOut("fast"), $(b).html(icOK), $("#mc").html(c), 0 == c && $("#msgbody").html("<h3 class='tcenter' style='margin: 15px;'>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0435\u0442.</h3>"))
  107.     })
  108. }
  109.  
  110. function msgSend(a) {
  111.     var b = $("#to").val(),
  112.         c = $("#text").val();
  113.     showLoader();
  114.     $.post(_url("messages"), {
  115.         task: "send",
  116.         to: b,
  117.         message: c,
  118.         captcha: a,
  119.         token: getCSRFToken()
  120.     }, function(a) {
  121.         hideLoader();
  122.         "y" == a.error ? (nPopReady(430, 70), $("#nPopupCon").html(a.errortext)) : "y" == a.captcha ? (nPopReady(180, 145), $("#nPopupCon").html(a.captchatext)) : "n" == a.error && ($("#msgbody").html(a.message), npopHide())
  123.     }, "json")
  124. }
  125.  
  126. function getCSRFToken() {
  127.     return $("#csrf-token").val()
  128. }
  129.  
  130. function pusherStart() {
  131.     "undefined" == typeof pusher && (pusher = new Pusher("4e0ebd7a8b66fa3554a4", {
  132.         encrypted: !0
  133.     }))
  134. }
  135.  
  136. function pusherEnd() {
  137.     "undefined" != typeof pusher && (pusher.disconnect(), delete pusher)
  138. }
  139.  
  140. function pusherChatChannel() {
  141.     prefix = IS_PRODUCTION ? "chat_" : "test_chat_";
  142.     return prefix + locale
  143. }
  144.  
  145. function pusherChatSub() {
  146.     pusherStart();
  147.     chatChannel = pusher.subscribe(pusherChatChannel());
  148.     chatChannel.bind("msg", nChatPutMsg);
  149.     chatChannel.bind("msg_del", nChatDelMsg)
  150. }
  151.  
  152. function pusherChatUnSub() {
  153.     chatChannel = pusher.unsubscribe(pusherChatChannel())
  154. }
  155.  
  156. function nChatEnableRefresh() {
  157.     pusherChatSub();
  158.     chatRefresh = 1;
  159.     setCookie("chatRefresh", 1, {
  160.         path: "/",
  161.         expires: 31104E3
  162.     });
  163.     $("#nChatRefreshBtn").fadeOut(100)
  164. }
  165.  
  166. function nChatDisableRefresh() {
  167.     pusherEnd();
  168.     chatRefresh = 0;
  169.     setCookie("chatRefresh", 0, {
  170.         path: "/",
  171.         expires: 31104E3
  172.     });
  173.     $("#nChatRefreshBtn").fadeIn(100)
  174. }
  175.  
  176. function nChatScrollEvent() {
  177.     return nChatScroll(0, 0, !0)
  178. }
  179.  
  180. function nChatScroll(a, b, c) {
  181.     scroll = $("#nChat").scrollTop();
  182.     cur_scroll = scroll + $("#nChat").innerHeight();
  183.     scroll_height = $("#nChat")[0].scrollHeight;
  184.     cur_scroll > scroll_height - 30 - a ? c ? $("#nChatLockIcon").fadeOut(150) : $("#nChat").scrollTop(scroll_height) : c ? $("#nChatLockIcon").fadeIn(150) : 0 < b && $("#nChat").scrollTop(scroll - b)
  185. }
  186.  
  187. function nChatSay() {
  188.     message = $("#nChatInput").val();
  189.     if ("" == message) return !1;
  190.     $("#nCiLoading").html(icLoading).fadeIn(50);
  191.     0 == chatRefresh ? (nChatEnableRefresh(), setTimeout('nChatSendMsg("' + message + '")', 1E3)) : nChatSendMsg(message);
  192.     $("#nChatInput").val("");
  193.     return !1
  194. }
  195.  
  196. function nChatSendMsg(a) {
  197.     $("#chat-token").val();
  198.     $.ajax({
  199.         url: _url("chat"),
  200.         data: {
  201.             task: "say",
  202.             msg: a,
  203.             locale: locale
  204.         },
  205.         beforeSend: "",
  206.         success: function(b) {
  207.             1 == b.error && (nChatError(b.errorText), $("#nChatInput").val(a))
  208.         },
  209.         error: function() {
  210.             nChatError("request error")
  211.         },
  212.         complete: function() {
  213.             $("#nCiLoading").fadeOut()
  214.         },
  215.         dataType: "json"
  216.     })
  217. }
  218.  
  219. function nChatError(a) {
  220.     $("#nChatErrors").html(a).fadeIn();
  221.     setTimeout('$("#nChatErrors").fadeOut();', 2E3)
  222. }
  223.  
  224. function nChatBan(a) {
  225.     $(a).hide();
  226.     $("#fade").fadeOut();
  227.     $("#nChatBanMenu").fadeOut();
  228.     showLoader();
  229.     $.post(_url("chat"), {
  230.         admtools: "nChatBanUser",
  231.         id: $("#mid").val(),
  232.         ttype: $("#ttype").val(),
  233.         time: $("#time").val(),
  234.         reason: $("#reason").val()
  235.     }, function(a) {
  236.         hideLoader()
  237.     })
  238. }
  239.  
  240. function nChatBanPopup(a) {
  241.     $("#fade").fadeTo(100, 0.3);
  242.     $("#nChatBanMenu").fadeIn(500);
  243.     $("#cbm").html("<p style='text-align: center; height: 100%; line-height: 200px;'><img src='" + domain + "/images/loading.gif' alt='' /></p>");
  244.     $.post(_url("chat"), {
  245.         admtools: "nBanTable",
  246.         id: a
  247.     }, function(b) {
  248.         $("#cbm").html(b);
  249.         $("#mid").val(a)
  250.     })
  251. }
  252.  
  253. function nChatMenu(a, b, c, d) {
  254.     var e = d.pageX ? d.pageX : d.clientX;
  255.     d = d.pageY ? d.pageY : d.clientY;
  256.     $("#cMenu").css("left", e).css("top", d).fadeIn(150);
  257.     $("#cMenuH").html(b);
  258.     0 != a ? ($("#cMenuPM").show().html("<a href='" + domain + "/messages/new/" + b + "/' class='profileBtn'>" + $("#cMenuPM-text").html() + "</a>"), $("#cMenuProfile").show().html("<a href='" + domain + "/profile/" + a + "' class='profileBtn'>" + $("#cMenuProfile-text").html() + "</a>")) : ($("#cMenuPM").hide(), $("#cMenuProfile").hide(), $("#cMenuBan").hide());
  259.     $("#cMenuInChat").show().html("<a href='javascript:void(0)' onclick='nInChat(\"" +
  260.         b + "\")' class='profileBtn '>" + $("#cMenuInChat-text").html() + "</a>");
  261.     0 != a && $("#cMenuBan").show().html("<a href='javascript:void(0)' onclick='nChatBanPopup(" + c + ")' class='profileBtn '>" + $("#cMenuBan-text").html() + "</a>");
  262.     $("#cMenuDel").show().html("<a href='javascript:void(0)' onclick='nChatMdel(" + c + ")' class='profileBtn '>" + $("#cMenuDel-text").html() + "</a>");
  263.     popup = !1;
  264.     setTimeout(function() {
  265.         popup = !0
  266.     }, 1)
  267. }
  268.  
  269. function nInChat(a) {
  270.     $("#nChatInput").val(a + ", ").focus()
  271. }
  272.  
  273. function nChatMdel(a) {
  274.     $.post(_url("chat"), {
  275.         admtools: "nDelMessage",
  276.         id: a
  277.     }, function(a) {})
  278. }
  279.  
  280. function nChatDelMsg(a) {
  281.     $("#msg" + a).hide()
  282. }
  283.  
  284. function nChatInsert(a) {
  285.     $("#nChatInput").val($("#nChatInput").val() + " " + a).focus();
  286.     $("#nChatSmiles").fadeToggle(50)
  287. }
  288.  
  289. function nChatSmilesToggle() {
  290.     $("#nChatSmiles").fadeToggle(50)
  291. }
  292.  
  293. function nChatPutMsg(a) {
  294.     a = JSON.parse(a);
  295.     var b = new RegExp("\\b" + auth_login + "\\b", "ig");
  296.     u_style = a.login == auth_login ? "color: #193477 !important;" : "color: " + a.usr_clr;
  297.     m_style = a.msg.match(b) ? "font-weight:bold;" : "";
  298.     b = "<p id='msg" + a.msg_id + "' class='chatmessage' style='" + m_style + "display:none'>" + ("<a title='" + a.date + "' style='" + u_style + " !important; font-weight: bold;' href='javascript:void(0)' onclick='nChatMenu(" + a.uid + ', "' + a.login + '", ' + a.msg_id + ", event)'>" + a.login + "</a>") + ": <span>" + a.msg + "</span></p>";
  299.     $("#nChat").append(b);
  300.     old_msg_size = 0;
  301.     512 < $("#nChat p").length && (old_msg_size = $("#nChat p").first().outerHeight(!0), $("#nChat p").first().remove());
  302.     $("#msg" + a.msg_id).fadeIn(100);
  303.     new_msg_size = $("#msg" + a.msg_id).outerHeight(!0);
  304.     nChatScroll(new_msg_size, old_msg_size)
  305. }
  306.  
  307. function nChatPutMsgTest() {
  308.     json = '{"login":"test","date":"now","msg_id":"' + Math.floor(1E5 * Math.random()) + '","msg":"test message test message test message test message test message"}';
  309.     nChatPutMsg(json)
  310. }
  311.  
  312. function parseTimestamp(a) {
  313.     a = new Date(1E3 * a + 144E5);
  314.     var b = a.getUTCDate();
  315.     10 > b && (b = "0" + b);
  316.     var c = a.getUTCMonth() + 1;
  317.     10 > c && (c = "0" + c);
  318.     var d = a.getUTCFullYear().toString().substr(2, 2),
  319.         e = a.getUTCHours();
  320.     10 > e && (e = "0" + e);
  321.     var f = a.getUTCMinutes();
  322.     10 > f && (f = "0" + f);
  323.     a.getUTCSeconds();
  324.     return b + "." + c + "." + d + " " + e + ":" + f
  325. }
  326. tId = 0;
  327.  
  328. function mpPutTrades(a) {
  329.     $.each(a, mpPutTrade)
  330. }
  331.  
  332. function mpPutTrade(a, b) {
  333.     color = "Buy" == b.type ? "green" : "red";
  334.     $("#trade_history tr:first").after('<tr id="t' + tId + '"><td>' + parseTimestamp(b.timestamp) + '</td><td style="color:' + color + '"><b>' + b.type + "</b></td><td>" + b.price + " " + mpCur1 + "</td><td>" + b.amount + " " + mpCur0 + "</td><td>" + b.total + " " + mpCur1 + "</td></tr>");
  335.     1024 <= $("#trade_history tr").size() && $("#trade_history tr").last().remove();
  336.     lBlink("#t" + tId, "#feffcd");
  337.     tId++
  338. }
  339.  
  340. function lBlink(a, b) {
  341.     $(a).css("background", b);
  342.     setTimeout("$('" + a + "').css('background', '');", 1500)
  343. }
  344.  
  345. function reg_check(a, b, c) {
  346.     b = b.value;
  347.     $(document).ready(function() {
  348.         "" != b && ($("#" + a + "-regcheck").html(icLoading), $.post(_url("reg?check=" + a), {
  349.             data: b,
  350.             data2: c
  351.         }, function(b) {
  352.             $("#" + a + "-regcheck").html(b);
  353.             "psw" == a && "" != c && $("#psw2-regcheck").html(b);
  354.             reg_all_check()
  355.         }))
  356.     })
  357. }
  358.  
  359. function reg_input_check(a) {
  360.     if (!1 != reg_button_pressed || !1 != a) {
  361.         var b = [],
  362.             c = $("#reg_login"),
  363.             d = $("#reg_email"),
  364.             e = $("#reg_eula");
  365.         !1 == /^[a-z0-9\-\_\.\+]{2,}\@([a-z0-9\-\_]{2,}\.)+[a-z0-9]{2,14}$/i.test(d.val()) ? (d.addClass("reg_input_error"), b.push(LOC_REG_ERROR_EMAIL)) : clear_class(d);
  366.         !1 == /^[a-z0-9_]{3,16}$/i.test(c.val()) ? (c.addClass("reg_input_error"), b.push(LOC_REG_ERROR_LOGIN)) : clear_class(c);
  367.         !1 == e.prop("checked") ? ($("#reg_eula_label").addClass("reg_input_error"), b.push(LOC_REG_ERROR_EULA_NOT_CHECKED)) :
  368.             clear_class(reg_eula_label);
  369.         0 < b.length ? (reg_button_pressed = !0, $(".reg_error").hide(), $("#reg_error_list").html("").show(), $.each(b, function(a, b) {
  370.             $("#reg_error_list").html($("#reg_error_list").html() + "<p>" + b + "</p>")
  371.         })) : 0 == b.length && !1 == a ? $("#reg_error_list").html("").hide() : a && $("#reg_form").submit()
  372.     }
  373. }
  374.  
  375. function eula_ch() {
  376.     0 == $("#eulach").val() ? $("#eulach").val(1) : $("#eulach").val(0)
  377. }
  378.  
  379. function clear_class(a) {
  380.     $(a).removeClass("reg_input_error")
  381. }
  382.  
  383. function reg_all_check() {
  384.     return !1
  385. }
  386.  
  387. function getCookie(a) {
  388.     return (a = document.cookie.match(new RegExp("(?:^|; )" + a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)"))) ? decodeURIComponent(a[1]) : void 0
  389. }
  390.  
  391. function setCookie(a, b, c) {
  392.     c = c || {};
  393.     var d = c.expires;
  394.     if ("number" == typeof d && d) {
  395.         var e = new Date;
  396.         e.setTime(e.getTime() + 1E3 * d);
  397.         d = c.expires = e
  398.     }
  399.     d && d.toUTCString && (c.expires = d.toUTCString());
  400.     b = encodeURIComponent(b);
  401.     a = a + "=" + b;
  402.     for (var f in c) a += "; " + f, b = c[f], !0 !== b && (a += "=" + b);
  403.     document.cookie = a
  404. }
  405.  
  406. function hide_popups() {
  407.     $(".popup").hide()
  408. }
  409.  
  410. function slider(a) {
  411.     var b = 650 * a - 650,
  412.         c = b + 15;
  413.     $(".ex_button").removeAttr("class");
  414.     $("#ex_but" + a).attr("class", "buttons_selected ex_button");
  415.     $("#sliders").animate({
  416.         left: "-" + c
  417.     }, "slow");
  418.     $("#sliders").animate({
  419.         left: "-" + b
  420.     }, "fast")
  421. }
  422.  
  423. function login_md5(a) {
  424.     d1 = a.substr(0, 16);
  425.     d2 = a.substr(16, 16);
  426.     return d2 + d1
  427. }
  428.  
  429. function profile(a, b, c, d) {
  430.     $(document).ready(function() {
  431.         if (0 == $("#profile_uid").length) return !1;
  432.         $("#loading").html(icLoadingH);
  433.         $(".profileBtnHover").attr("class", "profileBtn");
  434.         $(d).attr("class", "profileBtnHover profileBtn");
  435.         "" != window.location.hash && 1 == c && (a = window.location.hash.substr(1));
  436.         $.ajax({
  437.             url: _url("profile"),
  438.             data: {
  439.                 task: a,
  440.                 data: b
  441.             },
  442.             beforeSend: "",
  443.             success: function(a) {
  444.                 $("#profile").html(a);
  445.                 $("#loading").html("")
  446.             }
  447.         })
  448.     })
  449. }
  450.  
  451. function npopHide() {
  452.     $(".npop").fadeOut("fast");
  453.     $("#fade").fadeOut("fast")
  454. }
  455.  
  456. function pe_check(a, b, c, d) {
  457.     c = c.value;
  458.     $(document).ready(function() {
  459.         "" != c && ($("#" + b + "-check").html(icLoading2), $.post(_url("reg?check=" + b), {
  460.             data: c,
  461.             data2: d
  462.         }, function(a) {
  463.             $("#" + b + "-check").html(a);
  464.             "psw" == b && "" != d && $("#psw2-check").html(a)
  465.         }))
  466.     })
  467. }
  468.  
  469. function pe_edit(a) {
  470.     $(".profile-edit").hide();
  471.     $("#tab-table td").removeAttr("class").attr("class", "pe-tab");
  472.     $("#tab-table td:last").removeAttr("class");
  473.     $("#" + a + "-tab").addClass("pe-selected-tab");
  474.     $("#" + a + "-con").show()
  475. }
  476.  
  477. function pe_passedit(a) {
  478.     showLoader();
  479.     $.post(_url("profile_edit"), {
  480.         edit: "pass",
  481.         psw: $("#psw").val(),
  482.         psw2: $("#psw2").val(),
  483.         oldpsw: $("#oldpass").val()
  484.     }, function(a) {
  485.         $("#pass-errors").html(a);
  486.         hideLoader()
  487.     })
  488. }
  489.  
  490. function pe_mainedit(a) {
  491.     showLoader();
  492.     $.post(_url("profile_edit"), {
  493.         edit: "main",
  494.         skype: $("#skp").val(),
  495.         email: $("#email").val(),
  496.         token: $("#token").val()
  497.     }, function(a) {
  498.         $("#main-errors").html(a);
  499.         hideLoader()
  500.     })
  501. }
  502.  
  503. function pe_secedit(a) {
  504.     a = $('input[id="s_email"]').prop("checked");
  505.     showLoader();
  506.     $.post(_url("profile_edit"), {
  507.         edit: "security",
  508.         s_email: a
  509.     }, function(a) {
  510.         nPopReady(600, 70);
  511.         $("#nPopupCon").html(a);
  512.         hideLoader()
  513.     })
  514. }
  515.  
  516. function pe_confirm_email() {
  517.     showLoader();
  518.     $.post(_url("profile_edit"), {
  519.         act: "confirm_email"
  520.     }, function(a) {
  521.         nPopReady(430, 85);
  522.         $("#nPopupCon").html(a);
  523.         hideLoader()
  524.     })
  525. }
  526.  
  527. function billing_profile(a, b, c) {
  528.     $("#billing").html(icLoadingButton);
  529.     "" != window.location.hash && 1 == c && (a = window.location.hash.substr(1));
  530.     $.post(_url("billing"), {
  531.         act: a,
  532.         id: b
  533.     }, function(a) {
  534.         $("#billing").html(a);
  535.         window.scrollBy(0, document.body.offsetHeight)
  536.     })
  537. }
  538.  
  539. function trans_history(a, b, c, d, e) {
  540.     showLoader();
  541.     "" != window.location.hash && 1 == e && (act = window.location.hash.substr(1));
  542.     $.post(_url("billing"), {
  543.         act: "history",
  544.         id: a,
  545.         page: b,
  546.         view: c,
  547.         type: d
  548.     }, function(a) {
  549.         hideLoader();
  550.         $("#billing").html(a)
  551.     })
  552. }
  553.  
  554. function switch_pay(a) {
  555.     $(".payform").hide();
  556.     $(".banners-pay").hide();
  557.     $("#pay" + a).show();
  558.     $("#banners" + a).show()
  559. }
  560.  
  561. function unpay() {
  562.     var a = $("#purse").val(),
  563.         b = $("#summ").val();
  564.     $("#unpay").html(loadingnorm);
  565.     $.post(_url("billing"), {
  566.         act: "tryunpay",
  567.         purse: a,
  568.         summ: b
  569.     }, function(a) {
  570.         $("#unpay").html(a)
  571.     })
  572. }
  573.  
  574. function nPopReady(a, b) {
  575.     margin_t = b / 2;
  576.     margin_l = a / 2;
  577.     $("#nPopupCon").css("width", a);
  578.     $("#nPopupCon").css("height", b);
  579.     $("#nPopupCon").css("margin-top", -margin_t);
  580.     $("#nPopupCon").css("margin-left", -margin_l);
  581.     $("#fade").fadeTo(50, 0.7);
  582.     $("#nPopupCon").fadeIn(200)
  583. }
  584.  
  585. function withdraw_coin(a) {
  586.     var b = $("#sum").val(),
  587.         c = $("#address").val(),
  588.         d = $("#token").val();
  589.     sec_ask_otp(1);
  590.     showLoader();
  591.     $.post(_url("coins"), {
  592.         act: "withdraw",
  593.         sum: b,
  594.         address: c,
  595.         coin_id: a,
  596.         token: d,
  597.         otp: otp
  598.     }, function(a) {
  599.         nPopReady(430, 70);
  600.         $("#nPopupCon").html(a);
  601.         hideLoader()
  602.     })
  603. }
  604.  
  605. function withdraw_method_change() {
  606.     var a = $("#type option:selected").val(),
  607.         b = $("#desc" + a);
  608.     a == bCode.usd || a == bCode.rur || a == bCode.eur || a == bCode.cnh || a == bCode.gbp ? $(".purse_block").hide() : $(".purse_block").show();
  609.     "" == b.html() ? $("#desc_container").hide() : ($("#desc_container").show(), $(".desc").hide(), b.show());
  610.     withdraw_calc()
  611. }
  612.  
  613. function withdraw() {
  614.     var a = $("#sum").val(),
  615.         b = $("#purse").val(),
  616.         c = $("#type option:selected").val(),
  617.         d = $("#token").val();
  618.     sec_ask_otp(1);
  619.     showLoader();
  620.     if (c == bCode.usd || c == bCode.rur || c == bCode.eur || c == bCode.cnh || c == bCode.gbp) {
  621.         if (c == bCode.usd) var e = 1;
  622.         else c == bCode.rur ? e = 14 : c == bCode.eur ? e = 15 : c == bCode.cnh ? e = 22 : c == bCode.gbp && (e = 23);
  623.         withdraw_code(e, 1)
  624.     } else $.post(_url("billing"), {
  625.         act: "withdraw_request",
  626.         cur: $("#cur").val(),
  627.         sum: a,
  628.         purse: b,
  629.         type: c,
  630.         token: d,
  631.         otp: otp
  632.     }, function(a) {
  633.         nPopReady(430, 80);
  634.         $("#nPopupCon").html(a);
  635.         hideLoader()
  636.     })
  637. }
  638.  
  639. function withdraw_calc(a) {
  640.     var b = /^[0-9.]{1,}$/i,
  641.         c = $("#type option:selected").val(),
  642.         d = $("#sum"),
  643.         e = $("#wd_sum"),
  644.         f = Number(d.val()),
  645.         g = Number(e.val()),
  646.         h = $("#system_" + c + "_fee").val();
  647.     if (!b.test(f) || !b.test(g)) return a ? d.val("0") : e.val("0"), !1;
  648.     1 == a ? (sum = g / (100 - h) * 100, input = d) : (sum = f - f / 100 * h, input = e);
  649.     11 == c && 100 < f && 1E4 > f && (sum = f - 100);
  650.     53 == c && 100 < f && 1E4 > f && (sum = f - 100);
  651.     input.val(Math.floor(1E8 * sum) / 1E8)
  652. }
  653.  
  654. function withdraw_code(a, b) {
  655.     var c = $("#sum").val(),
  656.         d = $("#token").val();
  657.     b || sec_ask_otp(1);
  658.     $.post(_url("billing"), {
  659.         act: "withdraw_code",
  660.         sum: c,
  661.         currency: a,
  662.         token: d,
  663.         otp: otp
  664.     }, function(a) {
  665.         nPopReady(490, 90);
  666.         $("#nPopupCon").html(a);
  667.         hideLoader()
  668.     })
  669. }
  670.  
  671. function redeemCode() {
  672.     var a = $("#code").val();
  673.     showLoader();
  674.     $.post(_url("billing"), {
  675.         act: "redeem_code_2",
  676.         code: a
  677.     }, function(a) {
  678.         nPopReady(430, 70);
  679.         $("#nPopupCon").html(a);
  680.         hideLoader()
  681.     })
  682. }
  683.  
  684. function coins_withdraw_calc(a) {
  685.     var b = /^[0-9.]{1,}$/i,
  686.         c = Number($("#sum").val()),
  687.         d = Number($("#wd_sum").val()),
  688.         e = $("#coin_fee").html();
  689.     b.test(d) && 1 == a ? (a = d + e, 0 > a && (a = 0), $("#sum").val(1 * a.toFixed(8))) : b.test(c) && b.test(d) ? (a = c - e, 0 > a && (a = 0), $("#wd_sum").val(1 * a.toFixed(8))) : a ? $("#sum").val("0") : $("#wd_sum").val("0")
  690. }
  691.  
  692. function usd_calc(a, b, c) {
  693.     var d = /^[0-9.]{1,}$/i;
  694.     d.test($("#" + a).val()) ? d.test($("#" + b).val()) ? (a = $("#" + a).val() * $("#" + b).val(), $("#" + c).html(a.toFixed(2))) : $("#" + c).html("0") : $("#" + c).html("0")
  695. }
  696.  
  697. function ex_trade(a, b) {
  698.     "buy" == a && (tr = "b");
  699.     "sell" == a && (tr = "s");
  700.     var c = $("#token").val(),
  701.         d = $("#" + tr + "_btc").val(),
  702.         e = $("#" + tr + "_price").val();
  703.     showLoader();
  704.     $.post(_url("order"), {
  705.         trade: a,
  706.         btc_count: d,
  707.         btc_price: e,
  708.         pair: b,
  709.         token: c
  710.     }, function(a) {
  711.         "n" == a.error ? nPopReady(510, 240) : nPopReady(430, 70);
  712.         $("#nPopupCon").html(a.data);
  713.         hideLoader()
  714.     }, "json")
  715. }
  716.  
  717. function ex_calculate(a, b) {
  718.     "buy" == a && (tr = "b");
  719.     "sell" == a && (tr = "s");
  720.     var c = $("#" + tr + "_btc").val(),
  721.         d = $("#" + tr + "_price").val();
  722.     $("#" + tr + "_loading").html(loadingnorm);
  723.     $.post(_url("order"), {
  724.         calculate: a,
  725.         btc_count: c,
  726.         btc_price: d,
  727.         pair: b
  728.     }, function(a) {
  729.         $("#" + tr + "_all").html(a.all);
  730.         $("#" + tr + "_fee").html(a.fee);
  731.         $("#" + tr + "_comm").html(a.comm);
  732.         "y" == a.error ? $("#" + tr + "_error").show() : $("#" + tr + "_error").hide();
  733.         $("#" + tr + "_loading").html("")
  734.     }, "json")
  735. }
  736.  
  737. function cancel_order(a, b) {
  738.     showLoader();
  739.     $.post(_url("order"), {
  740.         act: "cancel",
  741.         id: a,
  742.         pair: b
  743.     }, function(b) {
  744.         "OK" == b ? ($("#sorder_link_" + a).html("<b>success</b>"), setTimeout(function() {
  745.             $("#sorder_" + a).fadeOut("fast")
  746.         }, 300)) : $("#sorder_link_" + a).html("<b>error (" + b + ")</b>");
  747.         hideLoader()
  748.     })
  749. }
  750.  
  751. function orders_update() {
  752.     var a = $("#pair").val();
  753.     $(".orders-loading").fadeTo(50, 0.3);
  754.     $.ajax({
  755.         url: _url("order"),
  756.         cache: !1,
  757.         type: "POST",
  758.         data: {
  759.             act: "orders_update",
  760.             pair: a
  761.         },
  762.         beforeSend: "",
  763.         success: main_update,
  764.         error: function() {
  765.             setTimeout(orders_update, 2 * MAIN_UPDATE_TIME)
  766.         },
  767.         dataType: "json"
  768.     })
  769. }
  770.  
  771. function main_update(a) {
  772.     var b = $("#orders_1").scrollTop(),
  773.         c = $("#orders_2").scrollTop();
  774.     $("#orders-b-list").html(a.buy);
  775.     $("#orders-s-list").html(a.sell);
  776.     setTimeout("ordersScroll(1, " + b + ")", 10);
  777.     setTimeout("ordersScroll(2, " + c + ")", 10);
  778.     $("#orders-self-list").html(a.self);
  779.     $(".orders-loading").fadeOut();
  780.     0 < $("#users-online").size() && $("#users-online").html(a.users_online);
  781.     $("#cur1").html(a.auth_cur1);
  782.     $("#cur2").html(a.auth_cur2);
  783.     $("#cur1_full").val(a.auth_cur1_full);
  784.     $("#cur2_full").val(a.auth_cur2_full);
  785.     $(".money_usd").html(a.money_usd);
  786.     $(".money_btc").html(a.money_btc);
  787.     $("#orders-stats").html(a.stats);
  788.     $("#min_price").html(a.min);
  789.     $("#max_price").html(a.max);
  790.     a.mes_count != $("#mes_count").html() && $("#mes_count").html(a.mes_count);
  791.     a.not_count != $("#not_count").html() && $("#not_count").html(a.not_count);
  792.     0 < a.mes_count && $("#mes_count").attr("style", "font-weight: bold").addClass("red");
  793.     0 < a.not_count && $("#not_count").attr("style", "font-weight: bold");
  794.     scroll_state = $("#trade_history").scrollTop();
  795.     $("#trade_history").html(a.trade_history).scrollTop(scroll_state);
  796.     "undefined" !== typeof a.notifs && $.each(a.notifs, function(a, b) {
  797.         notify(b.text, b.sound)
  798.     });
  799.     $.each(a.last, last_price_blink);
  800.     setTimeout("$('ul.pairs span').removeAttr('class');", 2E3);
  801.     "undefined" != typeof chart && (chart.clearChart(), data = google.visualization.arrayToDataTable(a.chart_data, !0), chart.draw(data, options));
  802.     setTimeout(orders_update, MAIN_UPDATE_TIME)
  803. }
  804.  
  805. function ordersScroll(a, b) {
  806.     $("#orders_" + a).scrollTop(b)
  807. }
  808.  
  809. function last_price_blink(a, b) {
  810.     last = $("#last" + a);
  811.     change = 1;
  812.     last.html() < b ? (last.attr("class", "greenbg"), icon = "\u2191") : last.html() > b ? (last.attr("class", "redbg"), icon = "\u2193") : change = 0;
  813.     1 == change && (last.html(b), a == $("#pair").val() && (document.title = "[" + icon + b + "] BTC-E"))
  814. }
  815.  
  816. function all_money(a, b) {
  817.     var c = $("#" + a).html();
  818.     "" == c && (c = $("#" + a).val());
  819.     $("#" + b).val(c)
  820. }
  821.  
  822. function a_calc(a) {
  823.     a = $("#cur1_full").val();
  824.     var b = $("#b_price").val();
  825.     0 < a && 0 < b && (result = a / b - 1E-7);
  826.     $("#b_btc").val(result.toFixed(8))
  827. }
  828.  
  829. function captcha_refresh() {
  830.     $("#captcha-refresh").html(icLoading2);
  831.     $("#captcha").attr("src", domain + "/getcaptcha?" + Math.random());
  832.     $("#captcha_input").val("")
  833. }
  834.  
  835. function a_deposit() {
  836.     var a = $("#sum").val(),
  837.         b = $("#text").val(),
  838.         c = $("#uid").val(),
  839.         d = $("#manual_uid").val(),
  840.         e = $("#login").val(),
  841.         f = $("#cur").val(),
  842.         g = $("#type").val(),
  843.         h = $('input[id="notify"]').prop("checked"),
  844.         k = $("#hold").val();
  845.     showLoader();
  846.     $.post(_url("profile"), {
  847.         task: "add_funds",
  848.         task2: "deposit",
  849.         sum: a,
  850.         text: b,
  851.         uid: c,
  852.         manual_uid: d,
  853.         login: e,
  854.         cur: f,
  855.         type: g,
  856.         notify: h,
  857.         hold: k
  858.     }, function(a) {
  859.         hideLoader();
  860.         "ok" == a ? alert("\u0423\u0441\u043f\u0435\u0448\u043d\u043e") : alert("\u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u0432\u0435\u0440\u043d\u043e")
  861.     })
  862. }
  863.  
  864. function a_edit() {
  865.     var a = $("#user_email").val(),
  866.         b = $("#user_id").val();
  867.     showLoader();
  868.     $.post(_url("profile"), {
  869.         task: "a_edit",
  870.         save: 1,
  871.         new_email: a,
  872.         data: b
  873.     }, function(a) {
  874.         hideLoader();
  875.         0 == a.success ? alert(a.error) : alert("\u0443\u0441\u043f\u0435\u0448\u043d\u043e")
  876.     }, "json")
  877. }
  878.  
  879. function orders_history(a) {
  880.     pair = $("#pair option:selected").val();
  881.     status = $("#view option:selected").val();
  882.     type = $("#type option:selected").val();
  883.     $("#loading").html(icLoadingH);
  884.     $.post(_url("orders_history"), {
  885.         pair: pair,
  886.         status: status,
  887.         type: type,
  888.         page: a
  889.     }, function(a) {
  890.         $("#orders_history").html(a);
  891.         $("#loading").html("")
  892.     })
  893. }
  894.  
  895. function set_price(a, b, c, d) {
  896.     buy_price = $("#b_price");
  897.     buy_amount = $("#b_btc");
  898.     sell_price = $("#s_price");
  899.     sell_amount = $("#s_btc");
  900.     buy_price.val(b);
  901.     sell_price.val(b);
  902.     1 == a && buy_amount.val(c);
  903.     2 == a && sell_amount.val(c)
  904. }
  905.  
  906. function api_key_create() {
  907.     var a = $("#key_desc").val(),
  908.         b = $("#key_ips").val();
  909.     showLoader();
  910.     $.post(_url("api_keys"), {
  911.         task: "create",
  912.         desc: a,
  913.         ips: b
  914.     }, function(a) {
  915.         a.success ? profile("api_keys") : alert(a.error);
  916.         hideLoader()
  917.     }, "json")
  918. }
  919.  
  920. function api_key_delete(a) {
  921.     showLoader();
  922.     $.post(_url("api_keys"), {
  923.         task: "delete",
  924.         id: a
  925.     }, function(a) {
  926.         profile("api_keys");
  927.         hideLoader()
  928.     })
  929. }
  930.  
  931. function api_key_save(a) {
  932.     var b = $('input[id="k_' + a + '_0"]').prop("checked"),
  933.         c = $('input[id="k_' + a + '_1"]').prop("checked"),
  934.         d = $('input[id="k_' + a + '_2"]').prop("checked"),
  935.         e = $('input[id="k_' + a + '_3"]').prop("checked");
  936.     showLoader();
  937.     $.post(_url("api_keys"), {
  938.         task: "save",
  939.         id: a,
  940.         k0: b,
  941.         k1: c,
  942.         k2: d,
  943.         k3: e
  944.     }, function(a) {
  945.         hideLoader()
  946.     })
  947. }
  948.  
  949. function api_key_addpriv(a, b, c) {
  950.     showLoader();
  951.     $.post(_url("profile"), {
  952.         task: "api_keys_admin",
  953.         keyId: a,
  954.         rId: b,
  955.         rValue: c
  956.     }, function(a) {
  957.         profile("api_keys_admin", $("#profile_uid").val());
  958.         hideLoader()
  959.     })
  960. }
  961.  
  962. function api_key_addIP(a) {
  963.     ip = $("#iIP" + a).val();
  964.     showLoader();
  965.     $.post(_url("profile"), {
  966.         task: "api_keys_addIP",
  967.         keyId: a,
  968.         ip: ip
  969.     }, function(a) {
  970.         a.success ? profile("api_keys_admin", $("#profile_uid").val()) : alert(a.error);
  971.         hideLoader()
  972.     }, "json")
  973. }
  974.  
  975. function autoSend_funds(a, b) {
  976.     1 == b ? act = "query" : (act = "send", $("#tid" + a).hide(), npopHide());
  977.     showLoader();
  978.     $.post(_url("autosend_funds"), {
  979.         act: act,
  980.         tid: a
  981.     }, function(a) {
  982.         nPopReady(480, 90);
  983.         $("#nPopupCon").html(a);
  984.         hideLoader()
  985.     })
  986. }
  987.  
  988. function lq_deposit() {
  989.     showLoader();
  990.     $.post(_url("liqpay"), {
  991.         amount: $("#lq_amount").val()
  992.     }, function(a) {
  993.         $("#operation_xml").val(a.xml);
  994.         $("#signature").val(a.sign);
  995.         $("#lq_form").submit();
  996.         hideLoader()
  997.     }, "json");
  998.     return !1
  999. }
  1000.  
  1001. function qiwi_deposit() {
  1002.     var a = $("#qiwi_amount").val(),
  1003.         b = $("#qiwi_to").val();
  1004.     showLoader();
  1005.     $.post(_url("qiwi"), {
  1006.         amount: a,
  1007.         to: b
  1008.     }, function(c) {
  1009.         !1 == c.error && (document.location = "http://w.qiwi.ru/setInetBill.do?txn_id=" + c.txn_id + "&from=" + c.from + "&to=" + b + "&summ=" + a + "&com=" + c.com + "&lifetime=72&check_agt=false");
  1010.         !0 == c.error && alert(c.errorText);
  1011.         hideLoader()
  1012.     }, "json")
  1013. }
  1014.  
  1015. function payeer_deposit() {
  1016.     var a = $("#m_amount").val(),
  1017.         b = $("#m_curr").val();
  1018.     $.post(_url("billing"), {
  1019.         act: "get_payeer_sign",
  1020.         amount: a,
  1021.         currency: b
  1022.     }, function(a) {
  1023.         a.success ? ($("#m_amount").val(a.data.amount), $("#m_sign").val(a.data.sign), $("#payeer_form").submit()) : alert(a.error)
  1024.     }, "json")
  1025. }
  1026.  
  1027. function egopay_deposit() {
  1028.     var a = $("#egopay_amount").val(),
  1029.         b = $("#egopay_currency").val();
  1030.     $.post(_url("billing"), {
  1031.         act: "get_egopay_sign",
  1032.         amount: a,
  1033.         currency: b
  1034.     }, function(a) {
  1035.         a.success ? ($("#egopay_sign").val(a.data), $("#egopay_form").submit()) : alert(a.error)
  1036.     }, "json")
  1037. }
  1038.  
  1039. function mpolo_deposit() {
  1040.     var a = $("#mpolo_currency").val(),
  1041.         b = $("#mpolo_amount").val(),
  1042.         c = $("#mpolo_docId").val();
  1043.     $.post(_url("billing"), {
  1044.         act: "get_mpolo_sign",
  1045.         amount: b,
  1046.         docId: c,
  1047.         currency: a
  1048.     }, function(a) {
  1049.         a.success ? ($("#mpolo_sign").val(a.data), $("#mpolo_form").submit()) : alert(a.error)
  1050.     }, "json")
  1051. }
  1052.  
  1053. function accpay_deposit(a) {
  1054.     var b = $("#_accpay_amount" + a).val(),
  1055.         c = $("#accpay_curr" + a).val(),
  1056.         d = $("#accpay_ext_id" + a).val();
  1057.     phone = "";
  1058.     if (6 == a || 7 == a || 29 == a) phone = $("#accpay_phone" + a).val();
  1059.     $.post(_url("billing"), {
  1060.         act: "get_accpay_sign",
  1061.         amount: b,
  1062.         currency: c,
  1063.         ext_id: d,
  1064.         pgi: a,
  1065.         phone: phone
  1066.     }, function(b) {
  1067.         b.success ? ($("#accpay_sign" + a).val(b.data.sign), $("#accpay_amount" + a).val(b.data.amount), $("#accpay_form" + a).submit()) : alert(b.error)
  1068.     }, "json")
  1069. }
  1070.  
  1071. function coin_new_address(a) {
  1072.     $.post(_url("coins"), {
  1073.         act: "new_address",
  1074.         coin_id: a
  1075.     }, function(a) {
  1076.         0 == a.success ? (nPopReady(510, 80), $("#nPopupCon").html(a.error)) : ($("#coin_addr_qr").attr("src", domain + "/qr?text=" + a.new_address), $("#coin_address").html(a.new_address), $("#coin_address").fadeTo("slow", 0.1, function() {
  1077.             $("#coin_address").fadeTo("slow", 1)
  1078.         }))
  1079.     }, "json")
  1080. }
  1081.  
  1082. function coin_depo_credit(a) {
  1083.     $.post(_url("profile"), {
  1084.         task: "coin_deposits",
  1085.         credit: a
  1086.     }, function(a) {
  1087.         a.success ? (alert("\u0437\u0430\u0447\u0438\u0441\u043b\u0435\u043d\u043e"), profile("coin_deposits")) : alert(a.error)
  1088.     }, "json")
  1089. }
  1090.  
  1091. function notifToggleCh(a) {
  1092.     !1 == $('input[id="' + a + '0"]').prop("checked") ? ($("#" + a + "1").removeAttr("checked").attr("disabled", "disabled"), $("#" + a + "2").removeAttr("checked").attr("disabled", "disabled")) : ($("#" + a + "1").removeAttr("disabled"), $("#" + a + "2").removeAttr("disabled"))
  1093. }
  1094.  
  1095. function notifSettings() {
  1096.     showLoader();
  1097.     $.post(_url("notifications"), {
  1098.         act: "settings"
  1099.     }, function(a) {
  1100.         nPopReady(480, 210);
  1101.         $("#nPopupCon").html(a);
  1102.         hideLoader()
  1103.     })
  1104. }
  1105.  
  1106. function notifSaveSettings() {
  1107.     var a = $('input[id="c00"]').prop("checked"),
  1108.         b = $('input[id="c01"]').prop("checked"),
  1109.         c = $('input[id="c02"]').prop("checked"),
  1110.         d = $('input[id="c10"]').prop("checked"),
  1111.         e = $('input[id="c11"]').prop("checked"),
  1112.         f = $('input[id="c12"]').prop("checked"),
  1113.         g = $('input[id="c20"]').prop("checked"),
  1114.         h = $('input[id="c21"]').prop("checked"),
  1115.         k = $('input[id="c22"]').prop("checked"),
  1116.         l = $('input[id="c30"]').prop("checked"),
  1117.         m = $('input[id="c31"]').prop("checked"),
  1118.         n = $('input[id="c32"]').prop("checked"),
  1119.         p = $('input[id="c40"]').prop("checked"),
  1120.         q = $('input[id="c41"]').prop("checked"),
  1121.         r = $('input[id="c42"]').prop("checked");
  1122.     showLoader();
  1123.     $.post(_url("notifications"), {
  1124.         act: "saveSettings",
  1125.         c00: a,
  1126.         c01: b,
  1127.         c02: c,
  1128.         c10: d,
  1129.         c11: e,
  1130.         c12: f,
  1131.         c20: g,
  1132.         c21: h,
  1133.         c22: k,
  1134.         c30: l,
  1135.         c31: m,
  1136.         c32: n,
  1137.         c40: p,
  1138.         c41: q,
  1139.         c42: r
  1140.     }, function(a) {
  1141.         npopHide();
  1142.         hideLoader()
  1143.     })
  1144. }
  1145.  
  1146. function notify(a, b) {
  1147.     notifId++;
  1148.     1 == b && $("#audioPM").get(0).play();
  1149.     $("#notif-containter").show().append("<div id='notif" + notifId + "' class='notification'><a style='float:right;' href='javascript:void(0)' onclick='$(\"#notif" + notifId + '").fadeOut("slow", function(){$("#notif' + notifId + '").remove();$("#notif-containter").hide();});\'><img src=\'' + domain + "/images/1px.png' class='main-s main-s-close' /></a><div style='height:100%' onclick='window.location=\"" + domain + "/notifications\"'>" + a + "</div></div>");
  1150.     $("#notif" + notifId).fadeIn("fast");
  1151.     1 == tabActive && setInterval('$("#notif' + notifId + '").fadeOut("slow", function(){$("#notif' + notifId + '").remove();$("#notif-containter").hide();});', 1E4)
  1152. }
  1153.  
  1154. function notifHide(a) {
  1155.     $.post(_url("notifications"), {
  1156.         act: "hideNotif",
  1157.         id: a
  1158.     }, function(b) {
  1159.         0 == a ? profile("notifications") : $("#n" + a).hide()
  1160.     })
  1161. }
  1162.  
  1163. function sw_act(a, b) {
  1164.     showLoader();
  1165.     $.post(_url("billing"), {
  1166.         act: "sw_act",
  1167.         task: a,
  1168.         id: b
  1169.     }, function(a) {
  1170.         nPopReady(430, 80);
  1171.         $("#nPopupCon").html(a);
  1172.         hideLoader()
  1173.     })
  1174. }
  1175.  
  1176. function tryLogin() {
  1177.     if (success_login) return !0;
  1178.     $.ajax({
  1179.         url: _url("login"),
  1180.         cache: !1,
  1181.         type: "POST",
  1182.         data: {
  1183.             email: $("#email").val(),
  1184.             password: $("#password").val(),
  1185.             otp: $("#login-otp").val(),
  1186.             PoW_nonce: $("#PoW_nonce").val()
  1187.         },
  1188.         success: userLogin,
  1189.         error: function() {
  1190.             alert("server error")
  1191.         },
  1192.         complete: function() {
  1193.             hideLoader()
  1194.         },
  1195.         dataType: "json"
  1196.     });
  1197.     return !1
  1198. }
  1199.  
  1200. function userLogin(a) {
  1201.     a.success ? (a.data.PoW && $("#PoW_working").fadeTo(0, 0.1, function() {
  1202.         setTimeout(function() {
  1203.             $("#PoW_nonce").val(getPoW(a.data.work.target, a.data.work.data));
  1204.             $("#PoW_working").hide()
  1205.         }, 30)
  1206.     }), setTimeout(function() {
  1207.         a.data.otp ? ($("#login_con").hide(), $("#otp_con").fadeIn(100), $("#login-otp").val("").focus()) : (a.data.login_success && (success_login = !0, $("#login").attr("action", window.location.href)), $("#login").submit())
  1208.     }, 100)) : (alert(a.error), "-" != $("#login-otp").val() && $("#login-otp").val(""));
  1209.     $("#PoW_nonce").val("")
  1210. }
  1211.  
  1212. function getPoW(a, b) {
  1213.     var c = 0;
  1214.     do hash = eval("(0x" + login_md5(md5(md5(b + c))) + ")"), ++c; while (hash >= a);
  1215.     return c
  1216. }
  1217.  
  1218. function comm_replace(a) {
  1219.     ~a.value.indexOf(",") && (a.value = a.value.replace(",", "."))
  1220. }
  1221.  
  1222. function ac_add_comm_butt() {
  1223.     $("#add_comm_butt").hide();
  1224.     $("#add_comm_con").fadeIn(300)
  1225. }
  1226.  
  1227. function ac_add_comment() {
  1228.     var a = $("#profile_uid").val();
  1229.     ac_add_comment_request(a, $("#comment_text").val())
  1230. }
  1231.  
  1232. function ac_add_comment_request(a, b) {
  1233.     showLoader();
  1234.     $.post(_url("profile"), {
  1235.         task: "add_admin_comment",
  1236.         uid: a,
  1237.         comment_text: b
  1238.     }, function(b) {
  1239.         b.success ? profile("admin_comments", a) : alert(b.error);
  1240.         hideLoader()
  1241.     }, "json")
  1242. }
  1243.  
  1244. function pTradeHistory(a) {
  1245.     pair = $("#pair option:selected").val();
  1246.     $.post(_url("profile"), {
  1247.         task: "trade_history",
  1248.         ajax: 1,
  1249.         pair: pair,
  1250.         page: a
  1251.     }, function(a) {
  1252.         $("#trade_list_con").html(a)
  1253.     })
  1254. }
  1255.  
  1256. function a_ban(a, b, c) {
  1257.     showLoader();
  1258.     $.post(_url("profile"), {
  1259.         task: "ban",
  1260.         type: a,
  1261.         status: b,
  1262.         uid: c
  1263.     }, function(d) {
  1264.         d.success ? (profile("info", c), 1 == b && ((comment = prompt("\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439:")) ? (1 == a && (prefix = ":ban:"), 2 == a && (prefix = ":withdraw_ban:"), ac_add_comment_request(c, prefix + " " + comment)) : alert("\u043a\u043e\u043c\u043c\u0435\u043d\u0442 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d"))) :
  1265.             alert(d.error);
  1266.         hideLoader()
  1267.     }, "json")
  1268. }
  1269.  
  1270. function a_fdm_change(a, b) {
  1271.     "none" == $("#" + a + "_" + b).css("display") ? ($("#" + a + "_" + b).show(), $("#i" + a + "_" + b).hide()) : ($("#" + a + "_" + b).hide(), $("#i" + a + "_" + b).show().focus())
  1272. }
  1273.  
  1274. function a_cwl_save() {
  1275.     uid = $("#profile_uid").val();
  1276.     var a = {
  1277.         task: "coin_limits",
  1278.         save: 1,
  1279.         uid: uid
  1280.     };
  1281.     $(".cwl_data").each(function() {
  1282.         a[this.name] = this.value
  1283.     });
  1284.     showLoader();
  1285.     $.post(_url("profile"), a, function(a) {
  1286.         profile("coin_limits", uid);
  1287.         hideLoader()
  1288.     }, "json")
  1289. }
  1290.  
  1291. function mt_open_account(a) {
  1292.     leverage = $("#mt_leverages_open" + a).val();
  1293.     curr = $("#mtCurrency").val();
  1294.     $.post(_url("meta_trader"), {
  1295.         act: "open_account",
  1296.         accType: a,
  1297.         leverage: leverage,
  1298.         curr: curr
  1299.     }, function(a) {
  1300.         a.success ? (profile("meta_trader"), nPopReady(350, 160), $("#nPopupCon").html(a.data)) : alert(a.error)
  1301.     }, "json")
  1302. }
  1303.  
  1304. function mt_update_balances(a) {
  1305.     $.post(_url("meta_trader"), {
  1306.         act: "update_balances",
  1307.         mt_acc: a
  1308.     }, function(a) {
  1309.         a.success ? ($.each(a.data.balances, function(a, b) {
  1310.             $(".mt_balance" + a).html(b)
  1311.         }), $("#usd_balance").html(a.data.usd_balance), $("#mt_update_timestamp").html(a.data.update_time)) : alert(a.error)
  1312.     }, "json")
  1313. }
  1314.  
  1315. function mt_change_account(a) {
  1316.     a ? (mt_acc = $("#mt_from_acc").val(), $(".mt_balance").hide(), $("#mt_balance_con" + mt_acc).show(), $(".mtFromCurr").html($("#mtAccCurr" + mt_acc).val()), mt_update_balances(mt_acc)) : (mt_acc = $("#mt_to_acc").val(), currName = $("#mtAccCurr" + mt_acc).val(), $(".mtToCurr").html(currName), $("#mtToBalance").html($("#userBal" + currName).val()))
  1317. }
  1318.  
  1319. function mt_move_funds(a) {
  1320.     amount_input = $("#" + a + "_amount");
  1321.     amount = amount_input.val();
  1322.     mt_acc = $("#mt_" + a + "_acc").val();
  1323.     $.post(_url("meta_trader"), {
  1324.         act: "move_funds",
  1325.         where: a,
  1326.         mt_acc: mt_acc,
  1327.         amount: amount
  1328.     }, function(b) {
  1329.         b.success ? (amount_input.val(0), mt_update_balances(mt_acc), "from" == a && alert("\u0417\u0430\u044f\u0432\u043a\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0430, \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435 \u0430\u043a\u0446\u0435\u043f\u0442\u0430")) : alert(b.error)
  1330.     }, "json")
  1331. }
  1332.  
  1333. function mt_change_leverage(a) {
  1334.     $("#mt_leverage" + a).hide();
  1335.     $("#mt_leverage_change_btn" + a).hide();
  1336.     $("#mt_leverages" + a).show();
  1337.     $("#mt_leverage_save_btn" + a).show()
  1338. }
  1339.  
  1340. function mt_save_leverage(a) {
  1341.     leverage = $("#mt_leverages" + a).val();
  1342.     $.post(_url("meta_trader"), {
  1343.         act: "change_leverage",
  1344.         mt_acc: a,
  1345.         leverage: leverage
  1346.     }, function(b) {
  1347.         b.success ? ($("#mt_leverage" + a).html("1:" + leverage), $("#mt_leverages" + a).hide(), $("#mt_leverage_save_btn" + a).hide(), $("#mt_leverage" + a).show(), $("#mt_leverage_change_btn" + a).show()) : alert(b.error)
  1348.     }, "json")
  1349. }
  1350.  
  1351. function sec_create_otp_key() {
  1352.     showLoader();
  1353.     $.post(_url("security_center"), {
  1354.         act: "create_OTP_Key",
  1355.         token: $("#token").val()
  1356.     }, function(a) {
  1357.         a.success ? (nPopReady(610, 150), $("#nPopupCon").html(a.data), $("#otp").focus()) : alert(a.error);
  1358.         hideLoader()
  1359.     }, "json");
  1360.     return !1
  1361. }
  1362.  
  1363. function sec_confirm_otp_key() {
  1364.     if (!1 == /^[0-9]{6}$/i.test($("#otp").val())) return $("#otp_error").show(), !1;
  1365.     showLoader();
  1366.     $.post(_url("security_center"), {
  1367.         act: "confirm_OTP_Key",
  1368.         keyId: $("#keyId").val(),
  1369.         otp: $("#otp").val(),
  1370.         token: $("#token").val()
  1371.     }, function(a) {
  1372.         a.success ? (npopHide(), profile("security/2fa")) : $("#otp_error").css({
  1373.             "font-weight": "bold"
  1374.         }).show().attr("title", a.error);
  1375.         hideLoader()
  1376.     }, "json")
  1377. }
  1378.  
  1379. function sec_del_otp_key() {
  1380.     if (confirmed = confirm(LOC_ARE_YOU_SURE)) sec_ask_otp(0), showLoader(), $.post(_url("security_center"), {
  1381.         act: "delete_OTP_Key",
  1382.         otp: otp,
  1383.         token: $("#token").val()
  1384.     }, function(a) {
  1385.         a.success ? profile("security/2fa") : alert(a.error);
  1386.         hideLoader()
  1387.     }, "json")
  1388. }
  1389.  
  1390. function sec_save_otp_key() {
  1391.     var a = $('input[id="s0"]').prop("checked"),
  1392.         b = $('input[id="s1"]').prop("checked"),
  1393.         c = $('input[id="s2"]').prop("checked");
  1394.     sec_ask_otp(0);
  1395.     showLoader();
  1396.     $.post(_url("security_center"), {
  1397.         act: "save_OTP_Key",
  1398.         s0: a,
  1399.         s1: b,
  1400.         s2: c,
  1401.         otp: otp,
  1402.         token: $("#token").val()
  1403.     }, function(a) {
  1404.         a.success || alert(a.error);
  1405.         profile("security/2fa");
  1406.         hideLoader()
  1407.     }, "json")
  1408. }
  1409.  
  1410. function sec_ask_otp(a) {
  1411.     otp = 0 == a && secure_sc || 1 == a && secure_wd ? prompt(LOC_CONFIRM_OTP, defaultText = "") : 0
  1412. }
  1413.  
  1414. function ipw_replace(a) {
  1415.     ~a.value.indexOf("\u044e") && (a.value = a.value.replace("\u044e", "."))
  1416. }
  1417.  
  1418. function ipw_add() {
  1419.     ip_address = $("#ip_address").val();
  1420.     $.post(_url("security_center"), {
  1421.         act: "ipw_add",
  1422.         ip_address: ip_address
  1423.     }, function(a) {
  1424.         a.success ? ($("#ip_address").val(""), $("#ipw_noaddr").remove(), $("#ipw_list").append('<tr id="ipw_r' + a.data.id + '" style="display:none"><td>' + ip_address + '</td><td><a href="javascript:void(0)" onclick="ipw_delete(' + a.data.id + ')">' + LOC_DELETE + "</a></td></tr>"), $("#ipw_r" + a.data.id).fadeIn(150)) : alert(a.error)
  1425.     }, "json")
  1426. }
  1427.  
  1428. function ipw_delete(a) {
  1429.     $.post(_url("security_center"), {
  1430.         act: "ipw_delete",
  1431.         id: a
  1432.     }, function(b) {
  1433.         b.success ? $("#ipw_r" + a).fadeOut(150, function() {
  1434.             $("#ipw_r" + a).remove();
  1435.             1 >= $("#ipw_list tr").length && $("#ipw_list").append('<tr id="ipw_noaddr"><td colspan="2">' + LOC_IPW_NOADDR + "</td></tr>")
  1436.         }) : alert(b.error)
  1437.     }, "json")
  1438. }
  1439.  
  1440. function sec_session_close(a) {
  1441.     $.post(_url("security_center"), {
  1442.         act: "session_close",
  1443.         skey: a
  1444.     }, function(b) {
  1445.         b.success ? (id = -1 == a ? ".skey" : "#skey_" + a, $(id).fadeOut(150, function() {
  1446.             $(id).remove()
  1447.         })) : alert(b.error)
  1448.     }, "json")
  1449. }
  1450.  
  1451. function api_doc_show_content(a) {
  1452.     $(".api_doc-content_item").hide();
  1453.     $("#api_doc_" + a).show();
  1454.     $(".api_doc-nav_item").removeClass("api_doc-content_item-selected");
  1455.     $("#api_doc-nav-" + a).addClass("api_doc-content_item-selected")
  1456. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement