$(function () { $("#read").before(`
`) let list_flex = $(".list .list-flex "); function href (e) { e.stopPropagation(); let url = $(this).data("href"); if (!url) { $("#toast").show(); return false }; window.location.href = url; } Array.from(list_flex).forEach(item => { let list_item = $(item).find(".list-item,.p>div"); list_item.click(href); let list = $(item).find(".list-item"); if (list.length == 1) { $(item).append(``); } }) }) $(function () { let path = lxd.parseUrl(window.location.href).pathname; let reg = /(?<=\/h_exam\/).*?(?=.html)/; $.ajax({ url: `http://api.gaokaoapp.net/exampaper/h/${path.match(reg)}/`, data: { }, type: "get", error: function (error) { $(".loading").html("获取更多的评论,请下载大联考app").show(); }, success: function (res) { let { comments, like_count = 1, read_count = 1 } = res.data; $(".good>span").html(like_count); $(".see").html(`阅读数:${read_count}`); let father = document.createDocumentFragment(); Array.from(comments).forEach( item => { item.user_face = item.user_face || '../imgs/user_face.png'; let str = `
${item.user_name}
${item.like_count}
${item.content}
${item.delay_time}
`; $(father).append(str); } ) $("#detail").append(father); $(".loading").html("获取更多的评论,请下载大联考app").show() } }) })