HabrCacheEnhanced

Перенаправляет удалённые или скрытые в черновики записи с habr.com на СоХабр и кэш Google

当前为 2018-07-16 提交的版本,查看 最新版本

// ==UserScript==
// @name            HabrCacheEnhanced
// @description     Перенаправляет удалённые или скрытые в черновики записи с habr.com на СоХабр и кэш Google
// @namespace       habrcache
// @version         20180717.1
// @include         https://habr.com/*
// @supportURL      https://github.com/dartraiden/HabrCacheEnhanced/issues
// ==/UserScript==

var h1 = document.querySelector("h1,.info .state");
if(h1.innerHTML == "Доступ к публикации закрыт" || h1.innerHTML == "Страница не найдена"){
	var id = document.location.href.replace(/^.*\/(\d+)\/?.+/, '$1');
	var lnks = document.getElementsByTagName('A');
	for (var i = 0; i < lnks.length; ++i) {
		if (lnks[i].className == 'button')
			lnks[i].outerHTML += '<p>&bull; <a href="https://sohabr.net/habr/post/' + id + '/">СоХабр</a></p><p>&bull; <a href="https://webcache.googleusercontent.com/search?q=cache:' + document.location.href + '">Google Cache</a></p>';
	}
}
else if(h1.innerHTML == "прекратила активность на хабре"){
	var link = "https://webcache.googleusercontent.com/search?q=cache:" + window.location;
	window.location = link
}


(/^.*\/(\d+)\/?.+/, '$1');
(/^.*\/(\d+)\/*.+/, '$1');

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址