HideHackingWithSwiftNavAndSkybar

hide hackingWithSwift Nav and video

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

  1. // ==UserScript==
  2. // @name HideHackingWithSwiftNavAndSkybar
  3. // @namespace https://www.hackingwithswift.com/
  4. // @version 0.1
  5. // @description hide hackingWithSwift Nav and video
  6. // @author MorganWang
  7. // @match https://www.hackingwithswift.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=hackingwithswift.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function hideNavAndSkyBar(){
  17. console.log("HHHH");
  18. var mAds=document.querySelectorAll(".navbar"),i;
  19. for(i=0;i<mAds.length;i++){
  20. var mAd=mAds[i];
  21. mAd.remove();
  22. }
  23. var list=document.querySelectorAll("#hws-latest-tutorial");
  24. for(i=0;i<list.length;i++){
  25. let item = list[i];
  26. item.remove();
  27. }
  28. var rightColumn=document.querySelectorAll(".col-lg-3");
  29. for(i=0;i<rightColumn.length;i++){
  30. let item = rightColumn[i];
  31. item.remove();
  32. }
  33. }
  34.  
  35. function removeTopVideo(){
  36. var topVideo=document.querySelectorAll(".embed-responsive-16by9"),i;
  37. for(i=0;i<topVideo.length;i++){
  38. let item=topVideo[i];
  39. item.remove();
  40. }
  41. }
  42.  
  43. function removeSupportImage() {
  44. var supportItems = document.querySelectorAll(".row.text-center"),i;
  45. for(i=0;i<supportItems.length;i++){
  46. var item=supportItems[i];
  47. item.remove();
  48. }
  49. }
  50.  
  51. window.addEventListener('load', function() {
  52. hideNavAndSkyBar();
  53. removeTopVideo();
  54. removeSupportImage();
  55. }, false);
  56.  
  57. setTimeout(() => {
  58. hideNavAndSkyBar();
  59. removeTopVideo();
  60. removeSupportImage();
  61. }, 2000);
  62. })();