goto.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // $('.sec05-moblie-container').slick({
  2. // arrows: false,
  3. // slidesToShow: 1,
  4. // slidesToScroll: 1,
  5. // infinite: false,
  6. // centerMode: true,
  7. // });
  8. // 收藏頁面
  9. $(document).ready(function () {
  10. collecturl = location.search;
  11. getcollect = collecturl.split("?")
  12. console.log(getcollect[0]);
  13. console.log(getcollect[1]);
  14. var collectuserid = getcollect[1];
  15. $.ajax({
  16. method: "GET",
  17. url: "https://api.ptt.cx:8228/collection/" + collectuserid + "",
  18. // url:"https://api.ptt.cx:8228/collection/Uf161c92b16f84357987a78c2b4b47719",
  19. dataType: "json",
  20. })
  21. .done(function (msg) {
  22. console.log(msg);
  23. // console.log(Object.keys(msg).length);
  24. let msgLen =Object.keys(msg).length;
  25. console.log(msgLen)
  26. var collectcontent = '';
  27. for(var i = 0; i < msgLen; i++){
  28. collectcontent+='\
  29. <div class="col">\
  30. <div class="card h-100">\
  31. <a target="_blank" href="">\
  32. <img src="'+msg[i].imgurl+'"class="card-img-top" alt="...">\
  33. </a>\
  34. <div class="card-body p-2">\
  35. <a target="_blank" href="">\
  36. <h5 class="card-title pt-3">'+msg[i].title+'</h5>\
  37. </a>\
  38. <p class="card-text">\
  39. '+msg[i].context+' \
  40. </p>\
  41. <p class="card-text row">\
  42. <small class="text-muted col-6 px-1">\
  43. <img class="mb-1 mx-1 d-inline" style="width: 10px; object-fit: cover; "\
  44. src="./img/sec05/Icon awesome-ethereum.png" alt=""><span>'+msg[i].cost+'</span>\
  45. </small>\
  46. <small class="price col-6 px-0 text-center">\
  47. <img class="mb-1 mx-1 d-inline" style="width: 12px; object-fit: cover; " src="./img/sec05/like.png" alt=""><span>'+msg[i].likes+'</span></small>\
  48. </p>\
  49. </div>\
  50. </div>\
  51. </div>';
  52. }
  53. $('.sec05-moblie-container').html(collectcontent);
  54. });
  55. });
  56. console.log(1);
  57. // $(document).ready(function () {
  58. // function get_data(){
  59. // $.ajax({
  60. // method: "GET",
  61. // // url:"https://api.ptt.cx:8228/collection/""+userid+",
  62. // url:"https://api.ptt.cx:8228/collection/U176663ce100ebb1f4c404d48749decb1_test_000_000_000",
  63. // dataType: "json",
  64. // })
  65. // .done(function (msg) {
  66. // console.log(msg);
  67. // });
  68. // }
  69. // get_data();
  70. // });
  71. // console.log(location.href);
  72. $(document).ready(function () {
  73. url = location.search;
  74. getSearch = url.split("?")
  75. console.log(getSearch[0]);
  76. console.log(getSearch[1]);
  77. var userid = getSearch[1];
  78. function get_data() {
  79. $.ajax({
  80. method: "GET",
  81. url: "https://api.ptt.cx:8228/receive/" + userid + "",
  82. dataType: "json",
  83. })
  84. .done(function (msg) {
  85. console.log(msg);
  86. console.log(msg.base)
  87. var Qrcodeimg = '';
  88. var useraddress = '';
  89. Qrcodeimg += '\
  90. <img src="data:image/png;base64,'+ msg.base + '" alt="">\
  91. ';
  92. useraddress += '\
  93. '+ msg.useraddress + '\
  94. ';
  95. $('#Qrcode').html(Qrcodeimg);
  96. $('#copy').html(useraddress);
  97. });
  98. }
  99. get_data();
  100. });
  101. function copyEvent(id) {
  102. var str = document.getElementById(id);
  103. window.getSelection().selectAllChildren(str);
  104. document.execCommand("Copy")
  105. toastr.options = {
  106. // 參數設定[註1]
  107. "closeButton": false, // 顯示關閉按鈕
  108. "debug": false, // 除錯
  109. "newestOnTop": false, // 最新一筆顯示在最上面
  110. "progressBar": false, // 顯示隱藏時間進度條
  111. "positionClass": "toast-top-center", // 位置的類別
  112. "preventDuplicates": false, // 隱藏重覆訊息
  113. "onclick": null, // 當點選提示訊息時,則執行此函式
  114. "showDuration": "300", // 顯示時間(單位: 毫秒)
  115. "hideDuration": "1000", // 隱藏時間(單位: 毫秒)
  116. "timeOut": "1000", // 當超過此設定時間時,則隱藏提示訊息(單位: 毫秒)
  117. "extendedTimeOut": "1000", // 當使用者觸碰到提示訊息時,離開後超過此設定時間則隱藏提示訊息(單位: 毫秒)
  118. "showEasing": "swing", // 顯示動畫時間曲線
  119. "hideEasing": "linear", // 隱藏動畫時間曲線
  120. "showMethod": "fadeIn", // 顯示動畫效果
  121. "hideMethod": "fadeOut" // 隱藏動畫效果
  122. }
  123. toastr.success("複製成功");
  124. }