From 00460dd1b85b5c9b9f7b786420fdfcb503c7c7ed Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 29 Oct 2020 01:01:50 +0800 Subject: [PATCH] update --- 52pojie-Enhanced.user.js | 36 +++++++++++++++++++++++++++++------- Zhihu-Enhanced.user.js | 20 ++++++++++++++++---- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/52pojie-Enhanced.user.js b/52pojie-Enhanced.user.js index 40efefe..abda1c0 100644 --- a/52pojie-Enhanced.user.js +++ b/52pojie-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 吾爱破解论坛增强 - 自动签到、翻页 -// @version 1.1.1 +// @version 1.1.2 // @author X.I.U // @description 自动签到、自动无缝翻页 // @match *://www.52pojie.cn/* @@ -107,7 +107,7 @@ qianDaoBack(); // 先看看是不是签到跳转页面,如果是则返回 - qianDao(); // 看看有没有签到 + //qianDao(); // 看看有没有签到 pageLoading(); // 自动翻页 @@ -148,11 +148,10 @@ // 签到后立即返回 function qianDaoBack() { - var qiandaoback = document.querySelector('#messagetext p.alert_btnleft a'); - if (qiandaoback){ - if(location.href === "https://www.52pojie.cn/home.php?mod=task&do=draw&id=2") - { - setTimeout(`qiandaoback.click()`, 300); + if(location.href === "https://www.52pojie.cn/home.php?mod=task&do=draw&id=2"){ + var qiandaoback = document.querySelector('#messagetext p.alert_btnleft a'); + if (qiandaoback){ + setTimeout(function(){qiandaoback.click()}, 500); } } } @@ -174,6 +173,29 @@ } + // 监听 XMLHttpRequest 事件 + function EventXMLHttpRequest() { + var _send = window.XMLHttpRequest.prototype.send + function sendReplacement(data) { + if(this.onreadystatechange) { + this._onreadystatechange = this.onreadystatechange; + } + this.onreadystatechange = onReadyStateChangeReplacement; + return _send.apply(this, arguments); + } + function onReadyStateChangeReplacement() { + if(this._onreadystatechange) { + if (this.readyState==4 && this.status==200) + { + console.log('111111111111111111111111111111111111111') + } + } + return this._onreadystatechange.apply(this, arguments); + } + window.XMLHttpRequest.prototype.send = sendReplacement; + } + + var ShowPager = { // 修改自 https://greasyfork.org/scripts/14178 getFullHref: function (e) { if(e == null) return ''; diff --git a/Zhihu-Enhanced.user.js b/Zhihu-Enhanced.user.js index a6bb5bf..6246102 100644 --- a/Zhihu-Enhanced.user.js +++ b/Zhihu-Enhanced.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎增强 -// @version 1.1.3 +// @version 1.1.4 // @author X.I.U // @description 一键收起回答、置顶显示时间、区分问题文章 // @match *://www.zhihu.com/* @@ -272,6 +272,7 @@ function addTypeTips() { patt_tip = /zhihu_e_tips/ var postList = document.querySelectorAll('h2.ContentItem-title a'); postNum = document.querySelectorAll('small.zhihu_e_tips'); + console.log(`${postList.length} ${postNum.length}`) if (postList.length > postNum.length){ for(var num = postNum.length;num -1){ // 搜索结果页 // collapsedAnswer(); // 一键收起回答 setInterval(topTime_search, 300); // 置顶显示时间 - setInterval(addTypeTips, 1000); // 区分问题文章 + EventXMLHttpRequest(); // 区分问题文章 }else if(window.location.href.indexOf("topic") > -1){ // 话题页 // if(window.location.href.indexOf("unanswered") == -1){ collapsedAnswer(); // 一键收起回答 setInterval(topTime_search, 300); // 置顶显示时间 - setInterval(addTypeTips, 1000); // 区分问题文章 + EventXMLHttpRequest(); // 区分问题文章 } }else if(window.location.href.indexOf("zhuanlan") > -1){ // 文章 // setInterval(topTime_zhuanlan, 300); // 置顶显示时间 @@ -346,6 +358,6 @@ function addTypeTips() { }else{ // 首页 // collapsedAnswer(); // 一键收起回答 setInterval(topTime_index, 300); // 置顶显示时间 - setInterval(addTypeTips, 1000); // 区分问题文章 + EventXMLHttpRequest(); // 区分问题文章 } })(); \ No newline at end of file