ESJ Zone: Notifications on Mobile

Enable notification dot on mobile UI.

目前为 2023-12-03 提交的版本,查看 最新版本

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