index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. function collect_load(begin = 0) {
  2. $.get(
  3. "./list.php", {
  4. begin: begin,
  5. },
  6. function(data, status) {
  7. let arrCollectList = JSON.parse(data);
  8. let html = "";
  9. for (const iterator of arrCollectList.data) {
  10. html += "<div class='card collect_card'>";
  11. html += "<div class='card_state'>" + gLocal.gui.ongoing + "</div>";
  12. html += "<div class='card_info'>"; //卡片信息开始
  13. html += "<div class='collect_title'>";
  14. html += "<a href='../article/?view=collection&collection=" + iterator.id + "'>" + iterator.title + "</a>";
  15. html += "</div>";
  16. if (iterator.subtitle && iterator.subtitle != "null") {
  17. html += "<div class='subtitle'>" + iterator.subtitle + "</div>";
  18. }
  19. if (iterator.summary && iterator.summary != "null") {
  20. html += "<div class='summary'>" + marked(iterator.summary) + "</div>";
  21. }
  22. if (iterator.tag) {
  23. html += "<div style='overflow-wrap: anywhere;'>" + iterator.tag + "</div>";
  24. }
  25. html += "<div style='margin-top:10px'>" + iterator.username.nickname + "</div>";
  26. html += "</div>"; //卡片信息关闭
  27. const article_limit = 4;
  28. let article_count = 0;
  29. let article_list = JSON.parse(iterator.article_list);
  30. //章节预览链接
  31. html += "<div class='article_title_list' >";
  32. //!!!!!!請加上不同語言!!!!!
  33. html += "<div style='font-weight:700;'>" + gLocal.gui.content + "</div>";
  34. //章節列表
  35. html += "<div>";
  36. for (const article of article_list) {
  37. html += "<div style='padding:6px 0; border-top: #707070 1px solid;'>";
  38. html += "<a class='article_title'";
  39. html +=" style='color:var(--main_color);font-weight:700;'";
  40. html +=" href='../article/?view=article&id=" + article.article +"&collection="+iterator.id+"' target='_blank'>" ;
  41. html += article.title ;
  42. html += "</a>";
  43. html += "</div>";
  44. article_count++;
  45. if (article_count > article_limit) {
  46. break;
  47. }
  48. }
  49. html += "</div>"; //章節列表結束
  50. html += "</div>"; //章节预览链接结束
  51. html += "</div>"; //card内容 结束
  52. }
  53. $("#book_list").html(html);
  54. }
  55. );
  56. }