Greasy Fork is available in English.

代你码的日志

自动点击代码日志等内容窃取网站的来源链接,回到源网站

// ==UserScript==
// @name        代你码的日志
// @description 自动点击代码日志等内容窃取网站的来源链接,回到源网站
// @namespace   RainSlide
// @match       https://codeday.me/*
// @match       http://*.voidcc.com/*
// @match       http://*.voidcn.com/*
// @version     1.1
// @grant       none
// @run-at      document-idle
// @license     Unlicense
// ==/UserScript==

new Map([
	// 代码日志
	["codeday.me", '.article-es-url > a' ],
	// 开发小院
	["voidcc.com", '.page > .item-description > blockquote:first-child > a:first-of-type'],
	// 程序园
	["voidcn.com", '.source > a#originfo']
]).forEach(
	( selector, domain ) => {

		let link = document.querySelector(selector);

		if (
			domain === location.hostname.split(".").slice( -domain.split(".").length ).join(".") &&
			link && link.href
		) {
			link = link.href.startsWith( "javascript:" )
				? link.textContent.trim()
				: link.href;
			document.body.style.filter = "grayscale()";
			// document.body.style.display = "none";
			// document.html.style.backgroundColor = "black";  // 适配夜间模式
			location.assign(link);
		}

	}
);