🎮f site page

Append the next content to the bottom seamlessly

目前为 2023-04-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 🎮f site page
  3. // @description Append the next content to the bottom seamlessly
  4. // @namespace f_____l
  5. // @author Covenant
  6. // @version 1.0.1
  7. // @license MIT
  8. // @homepage
  9. // @match https://*.site/*
  10. // @icon data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEwLjQzNCAxLjQ2Mi40MDIgMTguNjEyQy0uNzQgMjAuNTYzLjY4NyAyMyAyLjk2NiAyM2gyMC4wNjhjMi4yOCAwIDMuNzA2LTIuNDM3IDIuNTY0LTQuMzg3TDE1LjU2NiAxLjQ2M2MtMS4xNDItMS45NS0zLjk5LTEuOTUtNS4xMzIgMHoiIGZpbGw9IiM5QjlCOUIiLz48cGF0aCBkPSJNMTMuOTk1IDE3LjM1N2MuMjUzLjI1LjM5NS41NjYuMzk1Ljk1NnMtLjE0My43MjUtLjM5NS45NzVjLS4yODkuMjUtLjYwOS4zNy0xLjAwNC4zN3MtLjcxOS0uMTQtLjk2OC0uMzljLS4yODgtLjI1LS40MS0uNTY1LS40MS0uOTU1cy4xMjYtLjcxLjQxLS45NTZjLjI1My0uMjUuNTczLS4zNy45NjgtLjM3cy43MzUuMTI1IDEuMDA0LjM3em0uMTgxLTkuNjQtLjM4MyA3LjY3OWEuNjczLjY3MyAwIDAgMS0uNjc1LjYzNWgtLjIzOGMtLjM2IDAtLjY2LS4yOC0uNjc1LS42MzVsLS4zODMtNy42NzlhLjY3MS42NzEgMCAwIDEgLjY3NS0uNzAyaDFjLjM4NyAwIC42OTUuMzIuNjc1LjcwMmguMDA0eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // @grant GM_registerMenuCommand
  14. // @run-at document-end
  15. // @noframes
  16. // ==/UserScript==
  17. var div_content;
  18. function fn_XMLHttpRequest(url,fn){
  19. const xhr=new XMLHttpRequest();
  20. xhr.open("GET", url, true);
  21. xhr.send();
  22. xhr.onreadystatechange=function(){
  23. if(xhr.readyState==4 && xhr.status==200){
  24. console.log([
  25. "xmlhttpRequest",
  26. url,
  27. xhr.status,
  28. xhr.statusText,
  29. xhr.readyState,
  30. xhr.getResponseHeader("Content-Type"),
  31. //response.responseText,
  32. xhr.finalUrl].join("\n")
  33. );
  34. fn(xhr);
  35. }
  36. };
  37. }
  38. function fn_re_page(response){
  39. let dom=document.createRange().createContextualFragment(response.responseText);
  40. if(response.status==200){
  41. var entry_content=dom.querySelectorAll('div.entry-content');
  42. div_content.appendChild(entry_content[0].cloneNode(true));
  43. }
  44. else{//
  45. console.log("response.status: "+response.status+response.responseHeaders);
  46. }
  47. }
  48.  
  49. (function() {
  50. 'use strict';
  51. var ary_tmp=document.querySelectorAll('.entry-content');
  52. if(ary_tmp.length>0){
  53. div_content=ary_tmp[0];
  54. var url=new URL(document.location);
  55. var ary_page=div_content.querySelectorAll('.lcp_paginator>li>a');
  56. if(ary_page.length>0&&url.searchParams.get('lcp_page0')==null){
  57. var page_len=parseInt(ary_page[ary_page.length-2].innerText,10);
  58. for(let i=2; i <= page_len; i++){
  59. window.setTimeout(( () => fn_XMLHttpRequest("https://"+url.host+url.pathname+"?lcp_page0="+i,fn_re_page) ), i*1000*0.6);
  60. }
  61. }
  62. }
  63. })();