Skip to content

Instantly share code, notes, and snippets.

@ricky9w
Created March 21, 2025 12:35
Show Gist options
  • Save ricky9w/3dba60592c6c8007547e62ca3301c953 to your computer and use it in GitHub Desktop.
Save ricky9w/3dba60592c6c8007547e62ca3301c953 to your computer and use it in GitHub Desktop.
Remove Sohu pop-ups and slide-bar ads
// ==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