Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
171 lines (145 loc) · 4.59 KB
/
Copy pathscript.js
File metadata and controls
171 lines (145 loc) · 4.59 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
jQuery(document).ready(function() {
var QRBox = $('#QRBox');
var MainBox = $('#MainBox');
var BTCQR = 'images/BTCQR.png'; // 二维码路径
var AliPayQR = 'images/AliPayQR.png';
var WeChatQR = 'images/WeChatQR.png';
// PayPal 账户建议使用 Unicode
var ppbusiness = "\u004c\u0044\u0059\u004a\u0059\u0045\u0054\u0056\u0033\u004a\u0059\u004b\u0057";
if (!ppitem_name) { ppitem_name = "Donate"; }
// if (!donatrNo) { donatrNo = 1; }
//创建 Paypal 表单
// 捐赠方式,仅适用于国外账户!
function ppDonate() {
var tempForm = document.createElement("form");
tempForm.id = "paypal";
tempForm.method = "post";
tempForm.action = "https://www.paypal.com/cgi-bin/webscr";
tempForm.target = "paypal";
var cmd = document.createElement("input");
cmd.type = "hidden";
cmd.name = "cmd"
cmd.value = "_donations";
tempForm.appendChild(cmd);
var business = document.createElement("input");
business.type = "hidden";
business.name = "business"
business.value = ppbusiness;
tempForm.appendChild(business);
var lc = document.createElement("input");
lc.type = "hidden";
lc.name = "lc"
lc.value = "US";
tempForm.appendChild(lc);
var item_name = document.createElement("input");
item_name.type = "hidden";
item_name.name = "item_name"
item_name.value = ppitem_name;
tempForm.appendChild(item_name);
var no_note = document.createElement("input");
no_note.type = "hidden";
no_note.name = "no_note"
no_note.value = "0";
tempForm.appendChild(no_note);
var currency_code = document.createElement("input");
currency_code.type = "hidden";
currency_code.name = "currency_code"
currency_code.value = "USD";
tempForm.appendChild(currency_code);
var bn = document.createElement("input");
bn.type = "hidden";
bn.name = "bn"
bn.value = "PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest";
tempForm.appendChild(bn);
document.body.appendChild(tempForm);
tempForm.submit();
document.body.removeChild(tempForm);
}
// 立即购买,适用于中国账户
function ppBuy() {
var tempForm = document.createElement("form");
tempForm.id = "paypal";
tempForm.method = "post";
tempForm.action = "https://www.paypal.com/cgi-bin/webscr";
tempForm.target = "paypal";
var cmd = document.createElement("input");
cmd.type = "hidden";
cmd.name = "cmd"
cmd.value = "_xclick";
tempForm.appendChild(cmd);
var business = document.createElement("input");
business.type = "hidden";
business.name = "business"
business.value = ppbusiness;
tempForm.appendChild(business);
var lc = document.createElement("input");
lc.type = "hidden";
lc.name = "lc"
lc.value = "US";
tempForm.appendChild(lc);
var item_name = document.createElement("input");
item_name.type = "hidden";
item_name.name = "item_name"
item_name.value = ppitem_name;
tempForm.appendChild(item_name);
var no_note = document.createElement("input");
no_note.type = "hidden";
no_note.name = "no_note"
no_note.value = "0";
tempForm.appendChild(no_note);
var amount = document.createElement("input");
amount.type = "hidden";
amount.name = "amount"
amount.value = donatrNo;
tempForm.appendChild(amount);
var currency_code = document.createElement("input");
currency_code.type = "hidden";
currency_code.name = "currency_code"
currency_code.value = "USD";
tempForm.appendChild(currency_code);
var bn = document.createElement("input");
bn.type = "hidden";
bn.name = "bn"
bn.value = "PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest";
tempForm.appendChild(bn);
document.body.appendChild(tempForm);
tempForm.submit();
document.body.removeChild(tempForm);
}
function showQR(QR) {
if (QR) {
MainBox.css('background-image','url('+QR+')');
}
$('#DonateText,#donateBox,#github').addClass('blur');
QRBox.fadeIn(300,function(argument) {
MainBox.addClass('showQR');
});
}
// Buttons
// $('body').on('click', '#PayPal', function() {
// ppBuy(); // 购买按钮适用于国内的 Paypal 账户
// // ppDonate(); // 捐赠按钮仅适合国外的 PayPal 账户
// });
$('#donateBox>li').click(function(event) {
var thisID = $(this).attr('id');
if (thisID === 'PayPal') {
ppBuy();
} else if (thisID === 'BTC') {
showQR(BTCQR);
new Clipboard('#BTCBn');
} else if (thisID === 'AliPay') {
showQR(AliPayQR);
} else if (thisID === 'WeChat') {
showQR(WeChatQR);
}
});
MainBox.click(function(event) {
MainBox.removeClass('showQR').addClass('hideQR');
setTimeout (function(a) {
QRBox.fadeOut(300,function(argument) {
MainBox.removeClass('hideQR');
});
$('#DonateText,#donateBox,#github').removeClass('blur');
},600);
});
});