PTT-顯示推文樓層

顯示 PTT 的推文樓層數

目前為 2023-11-12 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name PTT-顯示推文樓層
  3. // @namespace https://github.com/jlhg/userscript
  4. // @license MIT
  5. // @version 0.1.3
  6. // @description 顯示 PTT 的推文樓層數
  7. // @author jlhg
  8. // @homepage https://github.com/jlhg/userscript
  9. // @supportURL https://github.com/jlhg/userscript/issues
  10. // @match https://www.ptt.cc/bbs/*
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. function createPushLevel(level) {
  18. const el = document.createElement('div');
  19. el.className = 'push-level';
  20. el.style.cssText = 'display: inline-block;' +
  21. 'min-width: 50px;' +
  22. 'margin-left: -62px;' +
  23. 'padding-right: 12px;' +
  24. 'text-align: right;' +
  25. 'color: #808080;';
  26. el.textContent = level;
  27. return el;
  28. }
  29.  
  30. const pushElements = document.querySelectorAll('.push');
  31.  
  32. for (let i = 0; i < pushElements.length; i++) {
  33. pushElements[i].prepend(createPushLevel(i + 1));
  34. }
  35. })();

QingJ © 2025

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