remove ads from smbc & clear view

It might not work correctly for your device.

目前为 2025-02-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name remove ads from smbc & clear view
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description It might not work correctly for your device.
  6. // @author resursator
  7. // @license MIT
  8. // @match https://www.smbc-comics.com/comic/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=smbc-comics.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const target = document.getElementById('cc-comicbody');
  16. let prevElement = target.previousElementSibling;
  17.  
  18. // Check if previous element is an anchor tag containing an image
  19. if (prevElement && prevElement.tagName === 'A' &&
  20. prevElement.querySelector('img')) {
  21. prevElement.remove();
  22. }
  23.  
  24. const comicright = document.getElementById('comicright');
  25. if (comicright) {
  26. comicright.remove();
  27. }
  28.  
  29. const comicleft = document.getElementById('comicleft');
  30. if (comicleft) {
  31. comicleft.style.width = '100%';
  32. }
  33.  
  34. if (target) {
  35. target.style.marginLeft = 'auto';
  36. target.style.marginRight = 'auto';
  37. }
  38.  
  39. const buythis = document.getElementById('buythis');
  40. if (buythis) {
  41. buythis.remove();
  42. }
  43.  
  44. const jumpbar = document.getElementById('hw-jumpbar');
  45. if (jumpbar) {
  46. jumpbar.remove();
  47. }
  48.  
  49. const commentspace = document.getElementById('comment-space');
  50. if (commentspace) {
  51. commentspace.remove();
  52. }
  53.  
  54. const blogHeader = document.getElementById('blogheader');
  55. if (blogHeader) {
  56. blogHeader.style.marginLeft = '18%';
  57. }
  58. })();