// $('.sec05-moblie-container').slick({ // arrows: false, // slidesToShow: 1, // slidesToScroll: 1, // infinite: false, // centerMode: true, // }); $(".sendbox").hide(); $(document).on("click", ".collectcontent", function (event) { $(".sendbox").show(500); $(this).addClass("select"); $(".select").siblings().removeClass('select'); }); $(document).on("click", ".close", function (event) { // $(this).siblings('.collectcard').removeClass('select'); $(".sendbox").hide(500); $(".collectcontent").removeClass("select"); }); // 收藏頁面 function collection(collectuserid='') { console.log('Call collection(' + collectuserid + ')'); // test var collectcontent = ''; $.ajax({ method: "GET", url: "https://ark.cards:8228/collection/" + collectuserid + "", dataType: "json", }) .done(function (msg) { for (var i in msg) { for(var j in msg[i]) { collectcontent += '\
※一次只能購買一則NFT收藏品
\ \ \
\
';
useraddress += '\
'+ msg.useraddress + '\
';
$('#Qrcode').html(Qrcodeimg);
$('#copy').html(useraddress);
});
}
// $(document).ready(function () {
// // 收藏頁面
// collection(collectuserid);
// // 購買頁面
// shop(collectuserid);
// // Qrcode頁面
// get_data(collectuserid);
// });
$(".buybox").hide();
$(document).on("click", ".nftmall", function (event) {
$(".buybox").show(500);
$(this).addClass("select");
$(".select").siblings().removeClass('select');
});
$(document).on("click", ".close", function (event) {
// $(this).siblings('.collectcard').removeClass('select');
$(".buybox").hide(500);
$(".nftmall").removeClass("select");
$(".nftname").prop("checked", false);
});
$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
// o["id"] = 0;
// o["time_stamp"] = "";
$.each(a, function () {
if (o[this.name]) {
console.log(o[this.name], o[this.value]); // test
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
// 確定發送按鈕處理
$(".collect-send").submit(function (e) {
/* var formRef = $('#form1').serializeArray();
var jsonString = JSON.stringify(formRef);*/
var jsonInfo = $('.collect-send').serializeObject();
var jsonString = JSON.stringify(jsonInfo);
console.log(jsonString);
$.ajax({
type: 'POST',
url: 'https://ark.cards:8228/send',
data: jsonString,
dataType: 'json',
async: false,
success: function (data) {
console.log('發送成功: ' + JSON.stringify(data));
alert("發送成功");
location.reload();
},
beforeSend: function () {
console.log('beforeSend');
},
complete: function () {
console.log('complete');
},
error: function (jqXHR, textStatus, errorThrown) {
console.log(JSON.stringify(jqXHR));
console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
console.log('送出失敗: ' + jqXHR.responseText);
}
});
return false;
});
$(".nft-buy").submit(function (e) {
/* var formRef = $('#form1').serializeArray();
var jsonString = JSON.stringify(formRef);*/
var jsonInfo = $('.nft-buy').serializeObject();
var jsonString = JSON.stringify(jsonInfo);
console.log(jsonString),
$.ajax({
type: 'POST',
url: 'https://ark.cards:8228/buy',
data: jsonString,
dataType: 'json',
success: function (data) {
console.log('購買成功: ' + data);
alert("購買成功");
location.reload();
},
beforeSend: function () {
console.log('beforeSend');
},
complete: function () {
console.log('complete');
},
error: function (jqXHR, textStatus, errorThrown) {
console.log(JSON.stringify(jqXHR));
console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
console.log('送出失敗: ' + jqXHR.responseText);
}
});
return false;
});
function copyEvent(id) {
var str = document.getElementById(id);
window.getSelection().selectAllChildren(str);
document.execCommand("Copy")
toastr.options = {
// 參數設定[註1]
"closeButton": false, // 顯示關閉按鈕
"debug": false, // 除錯
"newestOnTop": false, // 最新一筆顯示在最上面
"progressBar": false, // 顯示隱藏時間進度條
"positionClass": "toast-top-center", // 位置的類別
"preventDuplicates": false, // 隱藏重覆訊息
"onclick": null, // 當點選提示訊息時,則執行此函式
"showDuration": "300", // 顯示時間(單位: 毫秒)
"hideDuration": "1000", // 隱藏時間(單位: 毫秒)
"timeOut": "1000", // 當超過此設定時間時,則隱藏提示訊息(單位: 毫秒)
"extendedTimeOut": "1000", // 當使用者觸碰到提示訊息時,離開後超過此設定時間則隱藏提示訊息(單位: 毫秒)
"showEasing": "swing", // 顯示動畫時間曲線
"hideEasing": "linear", // 隱藏動畫時間曲線
"showMethod": "fadeIn", // 顯示動畫效果
"hideMethod": "fadeOut" // 隱藏動畫效果
}
toastr.success("複製成功");
}