read_progress_style

readonlinefreebook style & scrollProgress

  1. // ==UserScript==
  2. // @name read_progress_style
  3. // @include *
  4. // @supportURL https://github.com/sxlgkxk/browser_script/issues
  5. // @version 0.1
  6. // @description readonlinefreebook style & scrollProgress
  7. // @namespace http://sxlgkxk.github.io/
  8. // @author sxlgkxk
  9. // @icon http://sxlgkxk.github.io/im/avatar.jpg
  10. // @license MIT
  11. // @grant GM_getValue
  12. // @grant GM_setValue
  13. // @grant GM_xmlhttpRequest
  14. // @grant GM_addStyle
  15. // ==/UserScript==
  16.  
  17.  
  18. const $ = selector => document.querySelector(selector);
  19. const $$ = selector => document.querySelectorAll(selector);
  20. const create = tag => document.createElement(tag);
  21.  
  22. (function() {
  23. function getScrollPercent() {
  24. var h = document.documentElement,
  25. b = document.body,
  26. st = 'scrollTop',
  27. sh = 'scrollHeight';
  28. return (h[st]||b[st]) / ((h[sh]||b[sh]) - h.clientHeight) * 100;
  29. }
  30.  
  31. var container=create('p')
  32. container.style="z-index:3000; position:fixed; bottom:50px; left:50px; color:#a9a9a9; font-size:20px"
  33. container.textContent=parseInt(getScrollPercent())+'%'
  34. document.body.append(container);
  35.  
  36. window.onscroll=()=>{
  37. container.textContent=parseInt(getScrollPercent())+'%'
  38. }
  39. })();

QingJ © 2025

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