Geektime-Cleaner

Remove specific elements on Geektime website

当前为 2023-07-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Geektime-Cleaner
  3. // @namespace geektime.removeads
  4. // @version 1.4
  5. // @description Remove specific elements on Geektime website
  6. // @license MIT
  7. // @author upupnoah
  8. // @match https://time.geekbang.org/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. // MIT License
  13. /*
  14. MIT License
  15.  
  16. Copyright (c) [year] [copyright holders]
  17.  
  18. Permission is hereby granted, free of charge, to any person obtaining a copy
  19. of this software and associated documentation files (the "Software"), to deal
  20. in the Software without restriction, including without limitation the rights
  21. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  22. copies of the Software, and to permit persons to whom the Software is
  23. furnished to do so, subject to the following conditions:
  24.  
  25. The above copyright notice and this permission notice shall be included in all
  26. copies or substantial portions of the Software.
  27.  
  28. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  29. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  31. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  32. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34. SOFTWARE.
  35. */
  36.  
  37. (function() {
  38. 'use strict';
  39.  
  40. // Remove specific elements
  41. function removeElements() {
  42. var aiButton = document.querySelector('.AiButton_aiButton_1pFq4');
  43. var leads = document.querySelector('div[data-v-2f5f09d4].leads');
  44. var aiChat = document.querySelector('div[data-v-72acb7bf].draggable');
  45.  
  46. if (aiButton) {
  47. aiButton.remove();
  48. }
  49.  
  50. if (leads) {
  51. leads.remove();
  52. }
  53.  
  54. if (aiChat) {
  55. aiChat.remove();
  56. }
  57. }
  58.  
  59. // Run the script
  60. removeElements();
  61.  
  62. // Observe DOM changes and remove elements dynamically
  63. var observer = new MutationObserver(function(mutations) {
  64. mutations.forEach(function(mutation) {
  65. if (mutation.type === 'childList') {
  66. removeElements();
  67. }
  68. });
  69. });
  70.  
  71. observer.observe(document.body, {
  72. childList: true,
  73. subtree: true
  74. });
  75. })();

QingJ © 2025

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