sehuatang

直接把帖子列表转成图片浏览,点击图片可以进入帖子.

  1. // ==UserScript==
  2. // @name sehuatang
  3. // @description 直接把帖子列表转成图片浏览,点击图片可以进入帖子.
  4. // @version 1.1.6
  5. // @author armyant
  6. // @namespace https://sleazyfork.org/zh-CN/scripts/489232-sehuatang
  7. // @include https://www.sehuatang.net/forum-*
  8. // @include *://*.sehuatang.org/*
  9. // @include *://*.sehuatang.net/*
  10. // @include *://*.1kdj5.app/*
  11. // @include *://*.5aylp.com/*
  12. // @include *://*.jq2t4.com/*
  13. // @include *://*.www.0krgb.com/*
  14. // @include *://*.1qyqs.app/*
  15. // @include *://*.ds5hk.app/*
  16. // @match *://*.sehuatang.net/*
  17. // @match *://*.sehuatang.org/*
  18. // @match *://*.sehuatang.*/*
  19. // @match *://*.jq2t4.com/*
  20. // @match *://*.0krgb.com/*
  21. // @match *://*.xxjsnc.co/*
  22. // @match *://*.o4vag.com/*
  23. // @match *://*.weterytrtrr.*/*
  24. // @match *://*.qweqwtret.*/*
  25. // @match *://*.retreytryuyt.*/*
  26. // @match *://*.qwerwrrt.*/*
  27. // @match *://*.ds5hk.app/*
  28. // @match *://*.30fjp.com/*
  29. // @match *://*.18stm.cn/*
  30. // @match *://*.xo6c5.com/*
  31. // @match *://*.mzjvl.com/*
  32. // @match *://*.9xr2.app/*
  33. // @match *://*.kzs1w.com/*
  34. // @match *://*.nwurc.com/*
  35. // @match *://*.zbkz6.app/*
  36. // @match *://*.ql75t.cn/*
  37. // @match *://*.0uzb0.app/*
  38. // @match *://*.d2wpb.com/*
  39. // @match *://*.5aylp.com/*
  40. // @match *://*.8otvk.app/*
  41. // @include https://www.sehuatang.net/forum.php?mod=forumdisplay&fid=103&page=*
  42. // @require https://code.jquery.com/jquery-3.4.1.min.js
  43. // @grant GM_xmlhttpRequest
  44. // @grant GM_getValue
  45. // @grant GM_setValue
  46. // @license GNU GPLv3
  47. // ==/UserScript==
  48. $(document).ready(function () {
  49. $("tbody[id*='normalthread']").each(function () {
  50. // 获取当前域名 https://www.sehuatang.net/forum-95-9.html www.sehuatang.net
  51. // let urls = "https://www.sehuatang.net/";
  52. let urls = `https://${document.domain}/`;
  53. // 获取详情页地址
  54. urls += $(this).find(".icn a").attr("href");
  55. // 删除所有子元素
  56. // $(this).children().remove()
  57. $(this).find(".tps").remove()
  58. // 标记当前节点
  59. let icn_td = $(this);
  60. console.log(urls);
  61. let href = document.location.href;
  62.  
  63. GM_xmlhttpRequest({
  64. method: "GET",
  65. url: urls,
  66. headers: {
  67. "User-agent": window.navigator.userAgent,
  68. Accept:
  69. "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
  70. cookie: document.cookie,
  71. referer: href,
  72. },
  73. onerror: function (e) {
  74. console.log(e);
  75. },
  76. onload: function (result) {
  77. let doc = result.responseText;
  78. // console.log(doc);
  79.  
  80. // 获取标题
  81. let title = $(doc).find("#thread_subject").html();
  82. // console.log(title);
  83.  
  84. let temp_imges = [];
  85. // 获取所有的图片
  86. $.each($(doc).find(".zoom"), function (index, value) {
  87. let temp_image_url = $(value).attr("file");
  88. if (temp_image_url == undefined || temp_image_url.toString().indexOf("static") > -1) {
  89. // return 实现continue功能
  90. // return false 实现break功能
  91. return;
  92. }
  93. temp_imges.push(temp_image_url);
  94. });
  95. // console.log(temp_imges)
  96.  
  97. // 获取ed2k
  98. let magnet = [];
  99. $.each($(doc).find(".blockcode li"), function (index, value) {
  100. let temp_magnet = $(value).text();
  101. magnet.push(temp_magnet)
  102. });
  103. // console.log(magnet);
  104.  
  105. // 获取附件
  106. let temp_tattl_str = "";
  107. $.each($(doc).find(".pattl .tattl dd"), function (index, value) {
  108. let temp_file_name = $($(value).find("a")[0]).html();
  109. if ((temp_file_name.toString().indexOf("zip") == -1) &&
  110. (temp_file_name.toString().indexOf("rar") == -1) &&
  111. (temp_file_name.toString().indexOf("torrent") == -1)) {
  112. return;
  113. }
  114. temp_tattl_str += `
  115. <div style="background:url(static/image/filetype/rar.gif) no-repeat left center;display: inline-block;margin-left: 10px;" border="0" class="vm" alt="">
  116. <div style="font-size:14px;padding-left:40px;}"><a href='${$($(value).find("a")[0]).attr("href")}' id="aid8294944" target="_blank" initialized="true">${temp_file_name}</a></div>
  117. <div style="font-size:12px;padding-left:40px;color: royalblue">${$($(value).find("p:nth-child(4)")[0]).html()}</div>
  118. </div>
  119. `
  120. });
  121.  
  122. // 附件的另一种方式
  123. let temp_attach_str = "";
  124. $.each($(doc).find("span[id*='attach']"), function (index, value) {
  125. let temp_file_name = $($(value).find("a")[0]).html();
  126. if ((temp_file_name.toString().indexOf("zip") == -1) &&
  127. (temp_file_name.toString().indexOf("rar") == -1) &&
  128. (temp_file_name.toString().indexOf("txt") == -1) &&
  129. (temp_file_name.toString().indexOf("torrent") == -1)) {
  130. return;
  131. }
  132. temp_tattl_str += `
  133. <div style="background:url(static/image/filetype/rar.gif) no-repeat left center;display: inline-block;margin-left: 10px;" border="0" class="vm" alt="">
  134. <div style="font-size:14px;padding-left:40px;}"><a href='${$($(value).find("a")[0]).attr("href")}' id="aid8294944" target="_blank" initialized="true">${temp_file_name}</a></div>
  135. <div style="font-size:12px;padding-left:40px;color: royalblue">${$($(doc).find("div[id*='attach'] > div.tip_c.xs0")[0]).text().replace("点击文件名下载附件", "")}</div>
  136. </div>
  137. `
  138. });
  139.  
  140. let temp_html = "";
  141. temp_html += `<tr><td width="100%" colspan="5">`
  142. for (let i = 0; i < temp_imges.length; i++) {
  143. if (i >= 8) {
  144. break;
  145. }
  146. temp_html += `<img src="${temp_imges[i]}" height="150" style="margin: 2px;"/>`
  147. }
  148. temp_html += `</td></tr>`
  149.  
  150. if (magnet.length > 0) {
  151. temp_html += `<tr><td width="100%" colspan="5"`
  152. // 如果没有附件
  153. if (temp_tattl_str.length == 0 && temp_attach_str.length == 0) {
  154. temp_html += `style="border-bottom: blueviolet 4px solid"`;
  155. }
  156. temp_html += `>`
  157. temp_html += `
  158. <div class="blockcode" style="padding: 5px 0 5px 20px;border: 1px solid #CCC;background: #F7F7F7 url(/static/image/common/codebg.gif) repeat-y 0 0;overflow: hidden;">
  159. <div id="code_BN2" style="padding-left: 20px">
  160. <ol>`;
  161. for (const temp_magnet of magnet) {
  162. temp_html += `<li style="list-style-type:decimal-leading-zero;font-family:Monaco,Consolas,'Lucida Console','Courier New',serif;font-size:12px;line-height:1.8em">
  163. <div style="padding-left: 20px">${temp_magnet}</div>
  164. </li>`
  165. }
  166. temp_html += `</ol></div><div style="padding-left: 40px"><em onclick="let temp_magnet_str_01='${magnet.toString().replace(/(\n|\r|\r\n|↵)/g, '')}';setCopy(temp_magnet_str_01.replace(/(,)/g, '\\r\\n'), '复制成功');return false;">复制代码</em></div></div>`
  167. temp_html += `</td></tr>`
  168. }
  169. // temp_html += `<script type="application/javascript">code_BN2_1=magnet;</script>`;
  170. // temp_html += `<tr><td colspan="5" style="background: blue"></td></tr>`;
  171.  
  172. if (temp_tattl_str.length > 0 || temp_attach_str.length > 0) {
  173. temp_html += `<tr><td width="100%" colspan="5" style="border-bottom: blueviolet 4px solid">`
  174. if (temp_tattl_str.length > 0) {
  175. temp_html += temp_tattl_str;
  176. }
  177.  
  178. if (temp_attach_str.length > 0) {
  179. temp_html += temp_attach_str;
  180. }
  181. temp_html += `</td></tr>`;
  182. }
  183.  
  184. if (temp_tattl_str.length == 0 && temp_attach_str.length == 0 && magnet.length == 0) {
  185. temp_html += `<tr><td width="100%" colspan="5" style="border-bottom: blueviolet 4px solid;">&nbsp;`
  186. temp_html += `</td></tr>`;
  187. }
  188.  
  189. $(icn_td).append(temp_html);
  190. },
  191. });
  192. });
  193.  
  194. $(".pbw").each(function () {
  195. let chain = false;
  196. for (const item_chanin of ["综合区", "原创区", "转帖区", "国产原创", "亚洲无码", "亚洲有码", "中文字幕", "欧美无码", "4K原版", "综合讨论区"]) {
  197. if ($(this).html().search(item_chanin) != -1) {
  198. chain = true;
  199. break;
  200. }
  201. }
  202. if (chain) {
  203. // 获取当前域名 https://www.sehuatang.net/forum-95-9.html www.sehuatang.net
  204. // let urls = "https://www.sehuatang.net/";
  205. let urls = `https://${document.domain}/`;
  206. // 获取详情页地址
  207. urls += $(this).find(".xs3 a").attr("href");
  208. // 删除所有子元素
  209. // $(this).children().remove()
  210. // $(this).find(".tps").remove()
  211. // 标记当前节点
  212. let icn_td = $(this);
  213. $(this).attr("style", "border-bottom: blueviolet 4px solid")
  214. let href = document.location.href;
  215.  
  216. GM_xmlhttpRequest({
  217. method: "GET",
  218. url: urls,
  219. headers: {
  220. "User-agent": window.navigator.userAgent,
  221. Accept:
  222. "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
  223. cookie: document.cookie,
  224. referer: href,
  225. },
  226. onerror: function (e) {
  227. console.log(e);
  228. },
  229. onload: function (result) {
  230. let doc = result.responseText;
  231. // console.log(doc);
  232.  
  233. // 获取标题
  234. let title = $(doc).find("#thread_subject").html();
  235. // console.log(title);
  236.  
  237. let temp_imges = [];
  238. // 获取所有的图片
  239. $.each($(doc).find(".zoom"), function (index, value) {
  240. let temp_image_url = $(value).attr("file");
  241. if (temp_image_url == undefined || temp_image_url.toString().indexOf("static") > -1) {
  242. // return 实现continue功能
  243. // return false 实现break功能
  244. return;
  245. }
  246. temp_imges.push(temp_image_url);
  247. });
  248. // console.log(temp_imges)
  249.  
  250. // 获取ed2k
  251. let magnet = [];
  252. $.each($(doc).find(".blockcode li"), function (index, value) {
  253. let temp_magnet = $(value).text();
  254. magnet.push(temp_magnet)
  255. });
  256. // console.log(magnet);
  257.  
  258. // 获取附件
  259. let temp_tattl_str = "";
  260. $.each($(doc).find(".pattl .tattl dd"), function (index, value) {
  261. let temp_file_name = $($(value).find("a")[0]).html();
  262. if ((temp_file_name.toString().indexOf("zip") == -1) &&
  263. (temp_file_name.toString().indexOf("rar") == -1) &&
  264. (temp_file_name.toString().indexOf("torrent") == -1)) {
  265. return;
  266. }
  267. temp_tattl_str += `
  268. <div style="background:url(static/image/filetype/rar.gif) no-repeat left center;display: inline-block;margin-left: 10px;" border="0" class="vm" alt="">
  269. <div style="font-size:14px;padding-left:40px;}"><a href='${$($(value).find("a")[0]).attr("href")}' id="aid8294944" target="_blank" initialized="true">${temp_file_name}</a></div>
  270. <div style="font-size:12px;padding-left:40px;color: royalblue">${$($(value).find("p:nth-child(4)")[0]).html()}</div>
  271. </div>
  272. `
  273. });
  274.  
  275. // 附件的另一种方式
  276. let temp_attach_str = "";
  277. $.each($(doc).find("span[id*='attach']"), function (index, value) {
  278. let temp_file_name = $($(value).find("a")[0]).html();
  279. if ((temp_file_name.toString().indexOf("zip") == -1) &&
  280. (temp_file_name.toString().indexOf("rar") == -1) &&
  281. (temp_file_name.toString().indexOf("txt") == -1) &&
  282. (temp_file_name.toString().indexOf("torrent") == -1)) {
  283. return;
  284. }
  285. temp_tattl_str += `
  286. <div style="background:url(static/image/filetype/rar.gif) no-repeat left center;display: inline-block;margin-left: 10px;" border="0" class="vm" alt="">
  287. <div style="font-size:14px;padding-left:40px;}"><a href='${$($(value).find("a")[0]).attr("href")}' id="aid8294944" target="_blank" initialized="true">${temp_file_name}</a></div>
  288. <div style="font-size:12px;padding-left:40px;color: royalblue">${$($(doc).find("div[id*='attach'] > div.tip_c.xs0")[0]).text().replace("点击文件名下载附件", "")}</div>
  289. </div>
  290. `
  291. });
  292.  
  293. let temp_html = "";
  294. temp_html += `<tr><td width="100%" colspan="5">`
  295. for (let i = 0; i < temp_imges.length; i++) {
  296. if (i >= 10) {
  297. break;
  298. }
  299. temp_html += `<img src="${temp_imges[i]}" height="150" style="margin: 2px;"/>`
  300. }
  301. temp_html += `</td></tr>`
  302.  
  303. if (magnet.length > 0) {
  304. temp_html += `<tr><td width="100%" colspan="5"`
  305. // 如果没有附件
  306. // if (temp_tattl_str.length == 0 && temp_attach_str.length == 0) {
  307. // temp_html += `style="border-bottom: blueviolet 4px solid"`;
  308. // }
  309. temp_html += `>`
  310. temp_html += `
  311. <div class="blockcode" style="padding: 5px 0 5px 20px;border: 1px solid #CCC;background: #F7F7F7 url(/static/image/common/codebg.gif) repeat-y 0 0;overflow: hidden;">
  312. <div id="code_BN2" style="padding-left: 20px">
  313. <ol>`;
  314. for (const temp_magnet of magnet) {
  315. temp_html += `<li style="list-style-type:decimal-leading-zero;font-family:Monaco,Consolas,'Lucida Console','Courier New',serif;font-size:12px;line-height:1.8em">
  316. <div style="padding-left: 20px">${temp_magnet}</div>
  317. </li>`
  318. }
  319. temp_html += `</ol></div><div style="padding-left: 40px"><em onclick="let temp_magnet_str_01='${magnet.toString().replace(/(\n|\r|\r\n|↵)/g, '')}';setCopy(temp_magnet_str_01.replace(/(,)/g, '\\r\\n'), '复制成功');return false;">复制代码</em></div></div>`
  320. temp_html += `</td></tr>`
  321. }
  322. // temp_html += `<script type="application/javascript">code_BN2_1=magnet;</script>`;
  323. // temp_html += `<tr><td colspan="5" style="background: blue"></td></tr>`;
  324.  
  325. if (temp_tattl_str.length > 0 || temp_attach_str.length > 0) {
  326. temp_html += `<tr><td width="100%" colspan="5">`
  327. if (temp_tattl_str.length > 0) {
  328. temp_html += temp_tattl_str;
  329. }
  330.  
  331. if (temp_attach_str.length > 0) {
  332. temp_html += temp_attach_str;
  333. }
  334. temp_html += `</td></tr>`;
  335. }
  336.  
  337. $(icn_td).append(temp_html);
  338. },
  339. });
  340. } else {
  341. $(this).hide();
  342. }
  343. });
  344. });