ESJ Zone:移动版通知

在移动版界面显示通知标志。

  1. // ==UserScript==
  2. // @name ESJ Zone: Notifications on Mobile
  3. // @name:zh-TW ESJ Zone:流動版通知
  4. // @name:zh-CN ESJ Zone:移动版通知
  5. // @description Enable notification dot on mobile UI.
  6. // @description:zh-TW 在流動版界面顯示通知徽章。
  7. // @description:zh-CN 在移动版界面显示通知标志。
  8. // @icon https://icons.duckduckgo.com/ip3/www.esjzone.cc.ico
  9. // @author Jason Kwok
  10. // @namespace https://jasonhk.dev/
  11. // @version 1.1.2
  12. // @license MIT
  13. // @match https://www.esjzone.cc/*
  14. // @match https://www.esjzone.me/*
  15. // @run-at document-end
  16. // @grant none
  17. // @require https://update.greasyfork.org/scripts/483122/1304475/style-shims.js
  18. // @supportURL https://greasyfork.org/scripts/481323/feedback
  19. // ==/UserScript==
  20.  
  21. GM.addStyle(`
  22. @media (max-width: 991px)
  23. {
  24. .site-branding .account-msg::after
  25. {
  26. display: block;
  27. position: absolute;
  28. top: 10px;
  29. left: 54px;
  30. border-width: 1px;
  31. border-radius: 50%;
  32. width: 10px;
  33. height: 10px;
  34. content: " ";
  35. background: #fd3995;
  36. }
  37. }
  38.  
  39. @media (max-width: 576px)
  40. {
  41. .site-branding .account-msg::after
  42. {
  43. left: 41px;
  44. }
  45. }
  46.  
  47. #mobile-menu .account-msg::after
  48. {
  49. display: block;
  50. position: absolute;
  51. top: 5px;
  52. left: 45px;
  53. border-width: 1px;
  54. border-radius: 50%;
  55. width: 10px;
  56. height: 10px;
  57. content: " ";
  58. background: #fd3995;
  59. }
  60. `);
  61.  
  62. const accountButton = document.querySelector(".tools .account");
  63. if (accountButton.classList.contains("account-msg"))
  64. {
  65. const menuToggle = document.querySelector(".site-branding .menu-toggle");
  66. menuToggle.classList.add("account-msg");
  67.  
  68. const memberMenuToggle = document.querySelector("#mobile-menu .menu li:nth-child(2) .sub-menu-toggle");
  69. memberMenuToggle.classList.add("account-msg");
  70. }