hpc_job

self mode

目前为 2019-04-15 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name hpc_job
  3. // @version 0.0.4
  4. // @include http://219.217.238.193/job
  5. // @include http://h/job
  6. // @description self mode
  7. // @run-at document-start
  8. // @namespace https://gf.qytechs.cn/users/164996
  9. // ==/UserScript==
  10. const head = `<meta charset="UTF-8" />
  11. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  12. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  13. <title>job</title>
  14. <style>
  15. body {
  16. user-select: none;
  17. margin: 0;
  18. }
  19. #table {
  20. display: grid;
  21. grid-template-columns: repeat(9, auto);
  22. grid-column-gap: 1em;
  23. }
  24. #node{
  25. margin: 0;
  26. }
  27. .other {
  28. color: #bbb;
  29. }
  30. #disconnect{
  31. display: none;
  32. color: #bbb;
  33. position: fixed;
  34. left: 50%;
  35. transform: translateX(-50%);
  36. }
  37. </style>`
  38. const body = `<div id="app">
  39. <div id='disconnect'>disconnect</div>
  40. <pre id="node"></pre>
  41. <div id="table"></div>
  42. </div>`
  43. document.head.innerHTML = head
  44. document.body.innerHTML = body
  45. const usr = 'bilabila'
  46. const app = document.querySelector('#app')
  47. const node = document.querySelector('#node')
  48. const table = document.querySelector('#table')
  49. const disconnect = document.querySelector('#disconnect')
  50. const parse = s => {
  51. const t = document.implementation.createHTMLDocument()
  52. t.body.innerHTML = s
  53. return t
  54. }
  55. const main = async () => {
  56. let a
  57. try {
  58. a = await fetch(window.location.href)
  59. a = await a.text()
  60. } catch (error) {
  61. disconnect.style.display = 'block'
  62. return
  63. }
  64. disconnect.style.display = 'none'
  65. a = parse(a)
  66. let b = [...a.querySelectorAll('tr')].map(i => [...i.children].map(j => j.textContent.trim()))
  67. let c = b.reduceRight(
  68. (a, c) =>
  69. c[1] === usr
  70. ? c.map(i => '<div>' + i + '</div>').join('') + a
  71. : a + c.map(i => '<div class=other>' + i + '</div>').join(''),
  72. ''
  73. )
  74. let d = a.querySelector('table').nextSibling.textContent.trim()
  75. d = d.slice(d.indexOf('\n') + 1, d.lastIndexOf('\n'))
  76. requestAnimationFrame(() => {
  77. node.innerHTML = d
  78. table.innerHTML = c
  79. })
  80. }
  81. main()
  82. setInterval(main, 5000)

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址