index.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 style='width:25%;padding:0.5em;'>";
  18. html += '<div style="position: relative;">';
  19. html +=
  20. "<div class='' style='position: absolute;background-color: darkred;color: white;padding: 0 6px;right: 0;'>" + gLocal.gui.ongoing + "</div>";
  21. html += "</div>";
  22. html += "<div class='card article_list' style='padding:10px;'>";
  23. gLocal.gui.ongoing + "</div>";
  24. html += "<div class='title' style='font-weight:700'>";
  25. html +=
  26. "<a href='../article/?id=" +
  27. iterator.id +
  28. "'>" +
  29. iterator.title +
  30. "</a>";
  31. html += "</div>";
  32. html += "<div class='collect' style='color:gray'>";
  33. if(iterator.collect){
  34. html += "<a href='../article/?collect=" +iterator.collect.id + "'>" + iterator.collect.title + "</a>";
  35. }
  36. else{
  37. html += "unkow";
  38. }
  39. html += "</div>";
  40. if(iterator.subtitle){
  41. html += "<div style=''>" + iterator.subtitle + "</div>";
  42. }
  43. html += "<div style=''>" + iterator.username.nickname + "</div>";
  44. if(iterator.summary){
  45. html += "<div style=''>" + iterator.summary + "</div>";
  46. }
  47. html += "</div>";
  48. html += "</div>";
  49. }
  50. $("#article_new").html(html);
  51. }
  52. );
  53. }
  54. function index_load_term_new() {
  55. $.get("../term/new.php", function (data, status) {
  56. let xDiv = document.getElementById("pali_pedia");
  57. if (xDiv) {
  58. xDiv.innerHTML = data;
  59. }
  60. });
  61. }
  62. function index_load_course_new() {
  63. $.get("../course/list_new.php", function (data, status) {
  64. let xDiv = document.getElementById("course_list_new");
  65. if (xDiv) {
  66. xDiv.innerHTML = data;
  67. }
  68. });
  69. }