Skip to content

Instantly share code, notes, and snippets.

@AngusFu
Last active September 14, 2021 08:59
Show Gist options
  • Save AngusFu/7e5bbe226ee66177faa17d48e4a69a64 to your computer and use it in GitHub Desktop.
Save AngusFu/7e5bbe226ee66177faa17d48e4a69a64 to your computer and use it in GitHub Desktop.
tianya-cleaner
// ==UserScript==
// @name 天涯神贴
// @namespace https://gist.github.com/AngusFu/7e5bbe226ee66177faa17d48e4a69a64
// @version 0.3
// @description try to take over the world!
// @author You
// @match https://bbs.tianya.cn/m/post-*
// @icon https://www.google.com/s2/favicons?domain=tianya.cn
// @grant none
// ==/UserScript==
(function () {
$(`<style>
.item-ht:not(.item-lz),
.u-like,
.u-func,
.rcode-wrap,
.post-func-close,
#edit_div,
#post_more_btn,
#J_ty_footer {
display: none !important;
}
</style>
`).insertBefore("title");
const url = location.href.replace(
/-(\d+)(?=\.s?html)/,
(_, g) => `-${g++ + 1}`
);
if ($('.item-lz').size() < 1) {
location.href = url;
}
$(`<link rel="prerender" href="${url}" />`).appendTo("body");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment