index.js 2.3 KB

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