Skip to content

Instantly share code, notes, and snippets.

@hellodword
Last active August 25, 2024 02:10
Show Gist options
  • Save hellodword/214e9f96e269c168a7fe7399d22a5fed to your computer and use it in GitHub Desktop.
Save hellodword/214e9f96e269c168a7fe7399d22a5fed to your computer and use it in GitHub Desktop.
油猴脚本
// ==UserScript==
// @name PreSearch Ads
// @namespace Violentmonkey Scripts
// @match https://presearch.com/search*
// @grant none
// @version 0.0.2
// @author hellodword
// @run-at document-start
// ==/UserScript==
(function(){
const removeAds = function(){
for (let div of document.querySelectorAll('div')){
if (div && div.getAttribute){
let xData = div.getAttribute('x-data');
let xShow = div.getAttribute('x-show');
if (xData && (xData.indexOf('kwrdAdFirst') != -1 || xData.indexOf('extensionNotice') != -1)) {
div.remove();
} else if (xShow && xShow.indexOf('showAiResults') != -1) {
div.remove();
}
}
};
};
setInterval(removeAds, 300);
})()
// ==UserScript==
// @name Redirect NixOS manual
// @namespace http://tampermonkey.net/
// @version 24.11
// @description Redirect NixOS manual
// @author hellodword
// @match https://github.com/NixOS/nixpkgs/blob/release-24.11/*
// @grant none
// @run-at document-start
// ==/UserScript==
location.href = location.href.replace('/release-24.11/', '/nixos-unstable/');
// ==UserScript==
// @name Explain xkcd: It's 'cause you're dumb.
// @description Redirect 'cause you're dumb
// @namespace Violentmonkey Scripts
// @author hellodword
// @match https://xkcd.com/*
// @grant none
// @version 1.0
// @run-at document-start
// ==/UserScript==
(function(){
const u = location.href.replace(/\/*$/, '').replace(/xkcd\.com\/+/, 'xkcd.com/');
if (new RegExp(/^https?:\/\/xkcd\.com(\/+\d+)?$/).test(u)) {
location.href = u.replace('xkcd.com', 'www.explainxkcd.com/wiki/index.php');
}
})();
// ==UserScript==
// @name Zhihu aria
// @description Redirect to zhihu aria
// @namespace Violentmonkey Scripts
// @author hellodword
// @match https://www.zhihu.com/question/*
// @match https://www.zhihu.com/aria/question/*
// @grant none
// @version 1.0
// @run-at document-start
// ==/UserScript==
(function(){
const u = location.href.replace(/\/*$/, '').replace(/\/+/, '/');
if (new RegExp(/zhihu\.com\/question/).test(u)) {
location.href = location.href.replace('zhihu.com/question', 'zhihu.com/aria/question');
}
var myInterval = setInterval(function(){
document.querySelectorAll('.Sticky').forEach(function(ele){
ele.remove();
clearInterval(myInterval);
});
}, 100);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment