index.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. function index_onload() {
  2. index_load_term_new();
  3. index_load_collect_new();
  4. index_load_course_new();
  5. }
  6. function index_load_collect_new() {
  7. $.get(
  8. "../article/list_new.php",
  9. {
  10. begin: 0,
  11. page: 4,
  12. },
  13. function (data, status) {
  14. let arrCollectList = JSON.parse(data);
  15. let html = "";
  16. for (const iterator of arrCollectList.data) {
  17. html += "<div class='card'>";
  18. html += "<div class='card_state'>" + gLocal.gui.ongoing + "</div>";
  19. //!!!!!請協助補上頭像代碼!!!!!
  20. html += "<div style='padding:10px 10px 0 0;'><span class='head_img'>";
  21. html += iterator.username.nickname.slice(0, 1);
  22. html += "</span></div>";
  23. html += "<div class='article_right'>";
  24. gLocal.gui.ongoing + "</div>";
  25. html += "<div class='title'>";
  26. html += "<a href='../article/?view=article&id=" + iterator.id + "&collection=" + iterator.collect.id+"'>" + iterator.title + "</a>";
  27. html += "</div>";
  28. html += "<div class='collect'>";
  29. if (iterator.collect) {
  30. html +=
  31. "<a href='../article/?view=collection&collection=" + iterator.collect.id + "'>" + iterator.collect.title + "</a>";
  32. } else {
  33. html += "unkow";
  34. }
  35. html += "</div>";
  36. if (iterator.subtitle) {
  37. html += "<div class='subtitle'>" + iterator.subtitle + "</div>";
  38. }
  39. if (iterator.summary) {
  40. html += "<div class='summary'>" + iterator.summary + "</div>";
  41. }
  42. html += "<div style='margin-top:1em;'>" + iterator.username.nickname + "</div>";
  43. html += "</div>";
  44. html += "</div>";
  45. }
  46. $("#article_new").html(html);
  47. }
  48. );
  49. }
  50. function index_load_term_new() {
  51. $.get("../term/new.php", function (data, status) {
  52. let xDiv = document.getElementById("pali_pedia");
  53. if (xDiv) {
  54. xDiv.innerHTML = data;
  55. }
  56. });
  57. }
  58. function index_load_course_new() {
  59. $.get("../course/list_new.php", function (data, status) {
  60. let xDiv = document.getElementById("course_list_new");
  61. if (xDiv) {
  62. xDiv.innerHTML = data;
  63. }
  64. });
  65. }