新增 吾爱破解论坛增强、美化 两个脚本

This commit is contained in:
xiu2
2020-10-08 14:00:46 +08:00
parent ea6046dadc
commit 44297559db
3 changed files with 155 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
// ==UserScript==
// @name 吾爱破解论坛美化 - 精简多余内容
// @version 1.0.0
// @author X.I.U
// @description 精简多余内容
// @match *://www.52pojie.cn/*
// @icon https://www.52pojie.cn/favicon.ico
// @license GPL-3.0 License
// @run-at document-start
// @namespace https://github.com/XIU2/UserScript/blob/master/52pojie-Beautification.user.js
// ==/UserScript==
(function() {
var style_Add = document.createElement('style');
style_Add.innerHTML = `
a[href="connect.php?mod=config"], #toptb, #navmenu, #nv_ph, #nv, #pt .y, #chart, #online, #ft, .bm.lk, .dnch_eo_pt, .dnch_eo_pr, .dnch_eo_f, .bml, ul.xl.xl2.o.cl, dl.pil.cl, td.plc.plm .sign, .dnch_eo_pb, .dnch_eo_pt, .pls .side-star, .pls .side-group, .res-footer-note, .comiis_nav, .scbar_hot_td, .bm_h.cl, .md_ctrl, .pls.favatar .xg1 {
display:none !important;
}
/*.wp {
width:70%;
}*/
@media (max-width:650px) {
#postlist .favatar.pls .avatar img {
margin:0 0 2px;
}
.pls .avatar img {
width:100px;
height:100px;
background:none;
padding:0;
border:4px solid #ffffff
}
.avtm img {
width:60px;
}
}
.pls .avatar {
text-align:center;
}
.t_fsz {
min-height:60px;
}
.pls .pi {
text-align:center;
padding:10px 0 0 0;
border:none;
overflow:visible;
}
.xw1 {
font-size:15px;
}
textarea#fastpostmessage {
background:none !important;
}
.pcb img {
max-width:60%;
margin:4px;
}
.rate {
margin:0;
}
.ratl td {
padding:0px;
}
.xw1 {
font-size:12px;
font-weight:500;
}
.xi2,.xi2 a,.xi3 a {
color:red;
}
.toptitle_7ree td {
border-top: 1px solid #CDCDCD;
}
.mtw {
margin-top:0px !important;
}
#p_btn {
padding:0px;
margin:0 0 0 1px;
display:flex;
justify-content:space-evenly;
}
#scbar {
border-top:0;
border-bottom:0;
background:0;
}`;
document.head.appendChild(style_Add);
})();
+61
View File
@@ -0,0 +1,61 @@
// ==UserScript==
// @name 吾爱破解论坛增强 - 自动签到、翻页
// @version 1.0.0
// @author X.I.U
// @description 吾爱破解论坛自动签到、自动翻页
// @match *://www.52pojie.cn/*
// @icon https://www.52pojie.cn/favicon.ico
// @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @license GPL-3.0 License
// @run-at document-end
// @namespace https://github.com/XIU2/UserScript/blob/master/52pojie-Enhanced.user.js
// ==/UserScript==
(function() {
qianDao();
pageLoading();
// 自动签到
function qianDao() {
var qiandao = document.querySelector('#um p:last-child a:first-child');
if (qiandao != null){
if(qiandao.href === "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2")
{
qiandao.click();
}
}
}
// 自动翻页
function pageLoading() {
var patt = /forum-\d+-\d+\.html/
if (patt.test(location.pathname)){
windowScroll(function (direction, e) {
if (direction === "down") { // 下滑才准备翻页
var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
let scrollDelta = 666;
if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) {
if (document.querySelector('#autopbn').innerText == "下一页 »"){ // 如果已经在加载中了,就忽略
document.querySelector('#autopbn').click();
}
}
}
});
}
}
// 滚动条事件
function windowScroll(fn) {
var beforeScrollTop = document.documentElement.scrollTop,
fn = fn || function () {};
setTimeout(function () { // 延时执行,避免刚载入到页面就触发翻页事件
window.addEventListener("scroll", function (e) {
var afterScrollTop = document.documentElement.scrollTop,
delta = afterScrollTop - beforeScrollTop;
if (delta == 0) return false;
fn(delta > 0 ? "down" : "up", e);
beforeScrollTop = afterScrollTop;
}, false);
}, 1000)
}
})();
+3
View File
@@ -20,6 +20,9 @@
* **[「安装」](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhiyoo-Beautification.user.js)** [智友邦论坛美化 - 精简多余内容、宽屏显示](https://greasyfork.org/scripts/412361)
* **[「安装」](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/Zhiyoo-Enhanced.user.js)** [智友邦论坛增强 - 自动签到、回复、清理置顶帖子](https://greasyfork.org/scripts/412362)
****
* **[「安装」](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/52pojie-Beautification.user.js)** [吾爱破解论坛美化 - 精简多余内容](https://greasyfork.org/scripts/412681)
* **[「安装」](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/52pojie-Enhanced.user.js)** [吾爱破解论坛增强 - 自动签到、翻页](https://greasyfork.org/scripts/412680)
****
* **[「安装」](https://cdn.jsdelivr.net/gh/XIU2/UserScript@master/GithubEnhanced-High-Speed-Download.user.js)** [Github 增强 - 高速下载 \[Clone、Release、Raw、Code(ZIP)\]](https://greasyfork.org/scripts/412245)
****