topic_list_load.js 793 B

12345678910111213141516171819202122232425
  1. function topic_list_load(topic_num, s_num, where) {
  2. var o_data = document.getElementById(where);
  3. var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + String(s_num);
  4. var n_data = "";
  5. var xhr = new XMLHttpRequest();
  6. xhr.open("GET", url, true);
  7. xhr.send(null);
  8. xhr.onreadystatechange = function() {
  9. if(this.readyState === 4 && this.status === 200) {
  10. var t_data = JSON.parse(this.responseText);
  11. var t_plus_data = '';
  12. for(key in t_data) {
  13. n_data += t_data[key]['data'];
  14. t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
  15. }
  16. o_data.innerHTML = n_data;
  17. eval(t_plus_data);
  18. }
  19. }
  20. }