2023-01-01 15:35:59 +00:00
|
|
|
function view_more(t, pid, sort, offset) {
|
2022-12-29 14:20:27 +00:00
|
|
|
btn = document.getElementById("viewbtn");
|
|
|
|
btn.disabled = true;
|
|
|
|
btn.innerHTML = "Requesting...";
|
|
|
|
const form = new FormData();
|
|
|
|
const xhr = new XMLHttpRequest();
|
2023-10-15 15:48:56 +00:00
|
|
|
ids = t.dataset.ids.replace(/[\[\] ]/g, '')
|
2022-12-29 14:20:27 +00:00
|
|
|
xhr.open("get", `/view_more/${pid}/${sort}/${offset}?ids=${ids}`);
|
|
|
|
xhr.setRequestHeader('xhr', 'xhr');
|
2023-03-10 03:21:02 +00:00
|
|
|
xhr.onload=function(){
|
2022-12-29 14:20:27 +00:00
|
|
|
if (xhr.status==200) {
|
|
|
|
let e = document.getElementById(`view_more-${offset}`);
|
2022-12-30 13:17:04 +00:00
|
|
|
e.innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`);
|
2023-01-01 07:55:25 +00:00
|
|
|
register_new_elements(e);
|
2022-12-29 14:20:27 +00:00
|
|
|
bs_trigger(e)
|
2023-01-01 07:55:25 +00:00
|
|
|
|
2022-12-29 14:20:27 +00:00
|
|
|
highlight_unread("old-comment-counts")
|
|
|
|
}
|
|
|
|
btn.disabled = false;
|
|
|
|
}
|
|
|
|
xhr.send(form)
|
|
|
|
}
|