-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdonate.js
78 lines (75 loc) · 2.11 KB
/
donate.js
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
(function($) {
$.getUrlParam = function(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r && r[2] && r[2] != 'null' && r[2] != 'undefined' && r[2] != '') {
return unescape(r[2]);
} else {
return null;
}
}
})(jQuery);
jQuery(document).ready(function() {
$("#github").attr('href', $.getUrlParam('GitHub') || "https://github.com/" + window.location.href.split(".github.io")[0].split("/").pop())
var QRBox = $('#QRBox');
var MainBox = $('#MainBox');
var count = 0;
$("li").hide();
if($.getUrlParam('BTCQR') && $.getUrlParam('BTCKEY')) {
var BTCQR = $.getUrlParam('BTCQR'); // 二维码路径
var BTCKEY = $.getUrlParam('BTCKEY');
count++;
$("#BTC").show();
$("#BTC").addClass('yc')
$("#btc-key").attr("value",BTCKEY)
}
if($.getUrlParam('AliPayQR')) {
var AliPayQR = $.getUrlParam('AliPayQR');
count++;
$("#AliPay").show();
}
if($.getUrlParam('WeChatQR')) {
var WeChatQR = $.getUrlParam('WeChatQR');
count++;
$("#WeChat").show();
}
if($.getUrlParam('PayPal')) {
var PayPal = $.getUrlParam('PayPal');
count++;
$("#PayPal a").attr("href",PayPal)
$("#PayPal").show();
}
if(count == 0){
$("#WeChat").after('<div id="ps">没有开启任何Donate选项!</div>');
}
$("#donateBox li,#donateBox li a").css("width", Math.ceil(74+(74*(4-count)/count))+"px");
function showQR(QR) {
if(QR) {
MainBox.css('background-image', 'url(' + QR + ')');
}
$('#DonateText,#donateBox,#github').addClass('blur');
QRBox.fadeIn(300, function(argument) {
MainBox.addClass('showQR');
});
}
$('#donateBox>li').click(function(event) {
var thisID = $(this).attr('id');
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);
});
});