PageSourceSearch

https://rimiti.com/content/js/btc.buy.js

js rimiti.com collected 2026-10-06 20:20:10 UTC 4,654 bytes, 163 lines download raw bytes

1var _currency = currency;
2$(document).ready(function () {
3    var amount = $("input[name=Amount]");
4    var receiveAmount = $("input[name=SendAmount]");
5    var bankBalance = $("input[name=bankBalance]");
6    var bitcoinAddress = $("input[name=BitcoinAddress]");
7    var fee = _currency.Fee;
8    function updateAmount() {
9        if (amount.val() !== "" && amount.val() !== "0") {
10            var money = _currency.SellRate * (parseFloat(amount.val()) + parseFloat(fee))  +1;
11            console.log(money);
12            receiveAmount.val(numeral(money).format("0,0"));
13        } else {
14            receiveAmount.val("");
15        }
16    }
17    amount.keypress(function (e) {
18        return isNumeric(e);
19    });
20    amount.keyup(function () {
21        updateAmount();
22    });    
23    // check lai
24    bankBalance.val(numeral(_currency.Balance).format("0,0.[000]"));
25    $("form").validate({
26        rules: {
27            Amount: {
28                required: true,
29                min: _currency.Min,
30                max: _currency.MaxBuy
31            },
32            BitcoinAddress: {
33                required: true
34            },
35            Email: { email: true }
36        },
37        messages: {
38            Amount: {
39                required: lang.FillAmount + " BTC",
40                min: lang.Min + " " + _currency.Min + " BTC)",
41                max: lang.Max + " " + _currency.Max + " BTC)"
42            },
43            BitcoinAddress: { required: lang.NotFillAddress + " BTC"}
44        },
45        submitHandler: function (form) {
46            if (!check($("#BitcoinAddress").val())) {
47                $("#BitcoinAddress-error").text(lang.AddressNotValid.replace("{0}","Bitcoin")).show();
48            }
49            else if (parseFloat(amount.val().replace(/,/g, "")) > _currency.Balance) {
50                showError(lang.LowReserve);
51            } else {
52                loading();
53                $.ajax({
54                    url: $(form).attr("action") + "?rand=" + Math.random(),
55                    type: "POST",
56                    dataType: "json",
57                    data: $(form).serialize(),
58                    success: function (d) {
59                        removeLoading();
60                        if (d.success) {
61                            form.reset();
62                            //showSuccess(d.msg);
63                            window.location.href = d.redirecturl;
64                        } else {
65                            showError(d.msg);
66                        }
67                    },
68                    error: function (xhr, status) {
69                        removeLoading();
70                        showError(status);
71                    }
72                });
73            }
74            return false;
75        }
76    });
77});
78function check(address) {
79    try {
80
81        var valid = WAValidator.validate(address, 'bitcoin');
82
83        return valid
84    }
85    catch{
86        return false;
87    }
88    
89}
90
91function base58_decode(string) {
92    var table = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
93    var table_rev = new Array();
94
95    var i;
96    for (i = 0; i < 58; i++) {
97        table_rev[table[i]] = int2bigInt(i, 8, 0);
98    }
99
100    var l = string.length;
101    var long_value = int2bigInt(0, 1, 0);
102
103    var num_58 = int2bigInt(58, 8, 0);
104
105    var c;
106    for (i = 0; i < l; i++) {
107        c = string[l - i - 1];
108        long_value = add(long_value, mult(table_rev[c], pow(num_58, i)));
109    }
110
111    var hex = bigInt2str(long_value, 16);
112
113    var str = hex2a(hex);
114
115    var nPad;
116    for (nPad = 0; string[nPad] == table[0]; nPad++);
117
118    var output = str;
119    if (nPad > 0) output = repeat("\0", nPad) + str;
120
121    return output;
122}
123
124function hex2a(hex) {
125    var str = '';
126    for (var i = 0; i < hex.length; i += 2)
127        str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
128    return str;
129}
130
131function a2hex(str) {
132    var aHex = "0123456789abcdef";
133    var l = str.length;
134    var nBuf;
135    var strBuf;
136    var strOut = "";
137    for (var i = 0; i < l; i++) {
138        nBuf = str.charCodeAt(i);
139        strBuf = aHex[Math.floor(nBuf / 16)];
140        strBuf += aHex[nBuf % 16];
141        strOut += strBuf;
142    }
143    return strOut;
144}
145
146function pow(big, exp) {
147    if (exp == 0) return int2bigInt(1, 1, 0);
148    var i;
149    var newbig = big;
150    for (i = 1; i < exp; i++) {
151        newbig = mult(newbig, big);
152    }
153
154    return newbig;
155}
156
157function repeat(s, n) {
158    var a = [];
159    while (a.length < n) {
160        a.push(s);
161    }
162    return a.join('');
163}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.