Created
March 21, 2025 12:35
-
-
Save ricky9w/3dba60592c6c8007547e62ca3301c953 to your computer and use it in GitHub Desktop.
Remove Sohu pop-ups and slide-bar ads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Sohu Hide Distractions | |
// @version 0.1 | |
// @description Remove Sohu pop-ups and slide-bar ads | |
// @author ricky9w | |
// @match https://www.sohu.com/a/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// 要删除的元素选择器 | |
const elementsToRemove = [ | |
'div#right-side-bar', | |
'div#left-bottom-god', | |
'div.left-bottom-float-fullScreenSleep', | |
'div#groomRead', | |
'div#articleAllsee' | |
]; | |
// 删除元素 | |
function removeElements() { | |
elementsToRemove.forEach(selector => { | |
const element = document.querySelector(selector); | |
if (element) { | |
element.remove(); | |
} | |
}); | |
} | |
// 在页面加载完成后执行隐藏操作 | |
if (document.readyState === 'loading') { | |
document.addEventListener('DOMContentLoaded', removeElements); | |
} else { | |
removeElements(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment