fork download
  1. // ==UserScript==
  2. // @name ex tags
  3. // @namespace http://t...content-available-to-author-only...y.net/
  4. // @version 0.54
  5. // @description 顯示搜索的參數
  6. // @author You
  7. // @include https://e...content-available-to-author-only...i.org/*
  8. // @grant none
  9. // @grant GM.xmlHttpRequest
  10. // @grant GM.getValue
  11. // @grant GM.setValue
  12. // ==/UserScript==
  13.  
  14. var list = [];
  15. var port;
  16. function posttext()
  17. {
  18. let xhr = new XMLHttpRequest();
  19.  
  20. xhr.open("POST", "http://127.0.0.1:" + port);
  21. xhr.setRequestHeader("Accept", "application/x-www-form-urlencoded", false);
  22. xhr.onload = function() {
  23. if(xhr.status != 200) {
  24. posttext();
  25. }
  26. }
  27. xhr.send(list);
  28. // console.log(list);
  29. }
  30. function gettag(pdom)
  31. {
  32. if(typeof pdom !== "undefined") {
  33. for(let next = pdom.firstChild; next != null ; next = next.nextSibling) {
  34. //let tag_title = next.getElementsByTagName("td")[0];
  35. let tags = function(dom) {
  36. dom = dom.getElementsByTagName("td")[1];
  37. for(let next = dom.firstChild; next != null ; next = next.nextSibling) {
  38. list.push(next.getAttribute('title') + ",,");
  39. }
  40. }(next);
  41.  
  42. }
  43. }
  44. }
  45. function tags(doc)
  46. {
  47. let x = doc.getElementsByClassName("itg glte")[0].getElementsByTagName("tbody")[0];
  48. for(let next = x.firstChild; next != null ; next = next.nextSibling) {
  49. //標題
  50. let title = next.getElementsByClassName("glink")[0];
  51. //console.log(title);
  52. list.push(title.innerHTML + ",,");
  53.  
  54. //tags
  55. gettag(next.getElementsByTagName("tbody")[0]);
  56. //console.log(next.getElementsByTagName("tbody")[0]);
  57. }
  58. posttext();
  59. //console.log(x);
  60. }
  61.  
  62. function sleep(milliseconds) {
  63. var start = new Date().getTime();
  64. for (var i = 0; i < 1e7; i++) {
  65. if ((new Date().getTime() - start) > milliseconds){
  66. break;
  67. }
  68. }
  69. }
  70.  
  71. function page(count, max)
  72. {
  73. var xhr = new XMLHttpRequest();
  74. xhr.onload = function() {
  75. if(xhr.status!= 200) {
  76. sleep(5000);
  77. page(count, max);
  78. }
  79. console.log(count);
  80. tags(this.responseXML)
  81. if(count < max) {
  82. sleep(5000);
  83. page(++count, max);
  84. }
  85. //console.log(this.responseXML.getElementsByClassName("itg glte")[0].getElementsByTagName("tbody")[0]);
  86. }
  87. if(count == 1) {
  88. xhr.open("GET", "https://e...content-available-to-author-only...i.org/");
  89. }
  90. else {
  91. xhr.open("GET", "https://e...content-available-to-author-only...i.org/?page=" + (count - 1));
  92. }
  93. xhr.responseType = "document";
  94. xhr.send();
  95. }
  96. let min = prompt("min");
  97. let max = prompt("max");
  98. port = prompt("port");
  99.  
  100. page(min, max);
Runtime error #stdin #stdout #stderr 0.35s 41932KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
js: uncaught JavaScript runtime exception: ReferenceError: "prompt" is not defined.