2
0

uhome.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. function getUserBio(userid) {
  2. if (userid == "") {
  3. userid = getCookie("userid");
  4. if (userid == "") {
  5. return;
  6. }
  7. }
  8. $.get(
  9. "../ucenter/get.php",
  10. {
  11. id: userid,
  12. bio: true,
  13. },
  14. function (data, status) {
  15. let result = JSON.parse(data);
  16. let html = "<div>";
  17. if (result.length > 0) {
  18. html += marked(result[0].bio);
  19. } else {
  20. html += gLocal.gui.not_found;
  21. }
  22. html += "</div>";
  23. $("#bio").html(html);
  24. }
  25. );
  26. }
  27. function getUserPalicanon(userid) {
  28. $.getJSON(
  29. "/api/v2/progress?view=studio&id="+userid
  30. ).done(function(data){
  31. $('#content').html(render_palicanon_chapter_list(data.data.rows));
  32. });
  33. }
  34. function render_palicanon_chapter_list(data){
  35. let html = '';
  36. for (const iterator of data) {
  37. let link = "<a href='../article/?view=chapter&book="+iterator.book+"&par="+iterator.para+"&channel="+iterator.channel_id+"' target='_blank'>";
  38. html += "<div class='chapter_list'>";
  39. let title = iterator.title;
  40. if(title==''){
  41. title = 'unkow';
  42. }
  43. html += "<div class='title'>"+link+title+"</a>"+"<tag>"+"</tag></div>";
  44. html += "<div class='path'>"+iterator.path+"</div>";
  45. html += "<div class='date'> 创建:"+iterator.created_at+" 更新:"+iterator.updated_at+"</div>";
  46. html += "</div>";
  47. }
  48. return html;
  49. }