簡(jiǎn)書(shū)現(xiàn)在出了一個(gè)超惡心的需求,對(duì)過(guò)長(zhǎng)的文章搞了一個(gè)遮罩,讓用戶主動(dòng)點(diǎn)擊才能展開(kāi)全文,臥槽真的好煩啊,然后我以為是該網(wǎng)站為了減輕帶寬搞的兩次請(qǐng)求數(shù)據(jù)呢,結(jié)果一查network發(fā)現(xiàn)明明就一次請(qǐng)求~~~ 這非要讓用戶兩次操作,煩死了~
ps:時(shí)間回到2022/7//22簡(jiǎn)書(shū)已經(jīng)把這個(gè)惡心需求去掉了,估計(jì)也是意識(shí)到自己的錯(cuò)誤~
然而辦法總比困難多,這里我提供一個(gè)我利用油猴腳本進(jìn)行擴(kuò)展去廣告
,去點(diǎn)擊展開(kāi)全文
的方法
1.工具
油猴腳本插件,可以到這個(gè)網(wǎng)站進(jìn)行下載,目前支持的瀏覽器也比較多chrome,safari等等都可以的,少數(shù)瀏覽器要求使用Violentmonkey,尤其移動(dòng)端瀏覽器,清注意.
2.腳本的使用
腳本工具使用方法咱就不說(shuō)了,自行百度即可
我這里使用了別人寫(xiě)的一個(gè)腳本,在此基礎(chǔ)上我擴(kuò)展了一下里面的功能,主要讓他把某平臺(tái)(至于哪個(gè)平臺(tái),想必你向下拉已經(jīng)發(fā)現(xiàn)一個(gè)展開(kāi)全文了吧??)惡心的點(diǎn)擊展開(kāi)全文自動(dòng)被去除掉,順帶著也把廣告去掉了~
// ==UserScript==
// @name 閱讀全文、自動(dòng)展開(kāi)全文蜂奸、自動(dòng)移除萬(wàn)惡彈框
// @namespace http://tampermonkey.net/
// @version 2.17.2
// @require https://greasyfork.org/scripts/415668-zmquery3-5-1/code/zmQuery351.js?version=866815
// @description 【非自動(dòng)關(guān)注】【自用身害,長(zhǎng)期維護(hù)】【功能有】1. 閱讀全文網(wǎng)站支持:CSDN、github.io冲甘、xz577.com、iteye.com、720ui.com洲劣、cloud.tencent.com、新浪课蔬、頭條囱稽、網(wǎng)易新聞、騰訊新聞二跋、51CTO战惊、知乎、果殼科技(移動(dòng)版)扎即、awesomes.cn吞获、javascriptcn.com、人民日?qǐng)?bào)(移動(dòng)版)谚鄙、鳳凰網(wǎng)各拷、虎撲移動(dòng)版、百度經(jīng)驗(yàn)闷营、360文檔(個(gè)人圖書(shū)館)撤逢、樂(lè)居買(mǎi)房(移動(dòng)版)、電子發(fā)燒友網(wǎng)(PC粮坞、移動(dòng)版)蚊荣、悟空問(wèn)答(PC、移動(dòng)版)莫杈、百家號(hào)互例、百度文章、簡(jiǎn)書(shū)移動(dòng)版筝闹、搜狐移動(dòng)版媳叨、goodreads(PC腥光、移動(dòng)版)、百度文庫(kù)(移動(dòng)糊秆、PC版)武福、36氪移動(dòng)版
// @author zhengmingliang
// @match https://*.csdn.net/*
// @match *://*.github.io/*
// @match *://*.jianshu.com/p/*
// @match *://m.sohu.com/a/*
// @match *://*.xz577.com/*
// @match *://*.javascriptcn.com/*
// @match *://*.baidu.com/*
// @exclude https://www.baidu.com/*
// @exclude *://tieba.baidu.com/*
// @exclude *://pan.baidu.com/*
// @match *://*.iteye.com/*
// @match *://*.720ui.com/*
// @match *://*.goodreads.com/book/show/*
// @match *://www.wukong.com/question/*
// @match *://cloud.tencent.com/*
// @match *://m.leju.com/*
// @match *://*.didispace.com/*
// @match *://*.sina.cn/*
// @match *://*.toutiao.com/*
// @match *://weibo.com/ttarticle/p/show*
// @match *://card.weibo.com/article/m/show/id/*
// @match *://3g.163.com/*
// @match *://*.*.163.com/news/*
// @match *://*.inews.qq.com/*
// @match *://*.36kr.com/p/*
// @match *://*.elecfans.com/*
// @match *://inews.qq.com/*
// @match *://xw.qq.com/*
// @match *://blog.51cto.com/*
// @match *://*.zhihu.com/question/*
// @match *://*.guokr.com/*
// @match *://*.awesomes.cn/*
// @match *://*.javazhiyin.com/*
// @match *://m.hupu.com/bbs/*
// @match *://wap.peopleapp.com/article/*
// @match *://jingyan.baidu.com/article/*
// @match *://*.ifeng.com/c/*
// @match *://*.360doc.com/content/*
// @match *://www.hi-linux.com/posts/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
/**
* 閱讀全文 規(guī)則1(openwrite.cn 插件規(guī)則)
* @param readMoreSelector
* @param contentSelector
*/
function readAllRule1(readMoreSelector, contentSelector,isCurrent) {
if ($$$(readMoreSelector).length > 0) {
console.log("檢測(cè)到有閱讀全文關(guān)注限制。痘番。捉片。。")
// 移除閱讀全文
if(isCurrent){
$$$(readMoreSelector).remove();
}else {
$$$(readMoreSelector).parent().remove();
}
// 使?jié)L動(dòng)條可見(jiàn)
// $$$("#article_content").css('overflow','auto')
// 優(yōu)化后:直接將style置為空
console.log("style:%s", $$$(contentSelector).prop('style'))
$$$(contentSelector).prop('style', '')
$$$(contentSelector).attr('style', '')
$$$(contentSelector).css('max-height', 'none')
$$$(contentSelector).css('height', 'auto')
$$$(contentSelector).css('overflow', 'visible')
console.log("已解除閱讀全文關(guān)注限制汞舱。伍纫。。昂芜。")
}
}
/**
* 閱讀全文 規(guī)則1(openwrite.cn 插件規(guī)則)
* @param readMoreSelector
* @param contentSelector
*/
function readAllRule1ByOrigin(readMoreSelector, contentSelector,removeCurrent) {
var dom;
var parentElement, contentElement;
if (readMoreSelector.startsWith("#")) {
dom = document.getElementById(readMoreSelector.substring(1))
parentElement = removeCurrent ? dom : dom.parentElement;
} else if (readMoreSelector.startsWith(".")) {
dom = document.getElementsByClassName(readMoreSelector.substring(1))
if (dom.length > 0) {
parentElement = removeCurrent ? dom : dom[0].parentElement;
}
} else {
dom = document.getElementsByTagName(readMoreSelector)
parentElement = document.getElementsByClassName(readMoreSelector)[0].parentElement;
}
if (contentSelector.startsWith("#")) {
contentElement = document.getElementById(contentSelector.substring(1))
contentElement.style = ''
} else if (contentSelector.startsWith(".")) {
contentElement = document.getElementsByClassName(contentSelector.substring(1))
contentElement[0].style = ''
} else {
contentElement = document.getElementsByTagName(contentSelector)
contentElement[0].style = ''
}
console.log(111)
parentElement.parentElement.removeChild(parentElement);
}
/**
* 規(guī)則2:移除指定標(biāo)簽的某個(gè)class樣式
* @param readMoreSelector
* @param removeSelector
* @param removeClass
*/
function readAllRule2(readMoreSelector, removeSelector, removeClass) {
if ($$$(readMoreSelector).length > 0) {
console.log("檢測(cè)到有閱讀全文關(guān)注限制莹规。。泌神。良漱。")
// 移除閱讀全文
$$$(readMoreSelector).remove();
// 使?jié)L動(dòng)條可見(jiàn)
// $$$("#article_content").css('overflow','auto')
}
if($$$(removeSelector).length > 0){
// 優(yōu)化后:直接將style置為空
$$$(removeSelector).removeClass(removeClass)
console.log("已解除閱讀全文關(guān)注限制。欢际。债热。。")
}
}
/**
* 直接點(diǎn)擊展開(kāi)
* @param clickSelector
*/
function readAllRule3(clickSelector) {
var selector = $$$(clickSelector);
if (!selector) {
selector = jQuery(clickSelector);
}
if (selector.length > 0) {
console.log("檢測(cè)到有閱讀全文關(guān)注限制幼苛。。焕刮。舶沿。")
// 點(diǎn)擊展開(kāi)
selector.trigger("click")
console.log("已解除閱讀全文關(guān)注限制。配并。括荡。。")
}
}
/**
* 使用openwrite.cn策略的個(gè)人博客或其他使用類(lèi)似的規(guī)則
*/
function readAllRule4(removeSelector) {
console.log("檢測(cè)到有閱讀全文關(guān)注限制溉旋。畸冲。。观腊。")
// 移除閱讀全文
$$$(removeSelector).parent().remove();
var zIndexArray = [];
var parentSelector = "div[style]"
if ($$$("article[style]").length > 0) {
parentSelector = "article[style]"
}
var flag = false
//存放只有height屬性的節(jié)點(diǎn)
let heightArray = [];
findElements();
if (flag) {
console.log("已解除閱讀全文關(guān)注限制邑闲。。梧油。")
} else {
if (parentSelector == "div[style]" && heightArray.length == 1) {
heightArray[0].prop("style", "")
console.log("已解除閱讀全文關(guān)注限制苫耸。。儡陨。褪子。")
} else {
parentSelector = "div[style]"
heightArray = [];
findElements();
if (heightArray.length == 1) {
heightArray[0].prop("style", "")
console.log("已解除閱讀全文關(guān)注限制量淌。。嫌褪。呀枢。。")
}
}
}
function findElements() {
$$$(parentSelector).each(function (index) {
var attr = $$$(this).attr('style');
if (attr.indexOf("overflow") != -1 && attr.indexOf("height") != -1) {
var overflow = $$$(this).css("overflow");
if ('hidden' == overflow) {
$$$(this).prop("style", "")
flag = true
}
} else if (attr.indexOf("height") != -1) {
console.log("index:", index, $$$(this))
heightArray.push($$$(this))
}
let text = $$$(this).text();
if (attr.indexOf("z-index") != -1 && (text.indexOf("首次訪問(wèn)") != -1 || text.indexOf("人機(jī)檢測(cè)") != -1)) {
let zIndex = $$$(this).css("z-index");
console.log("zIndex:", zIndex)
let lastDiv = $$$("div[style]").filter(function () {
return $$$(this).attr('style').indexOf("z-index") != -1 && $$$(this).css("z-index") == zIndex - 1
})
console.log("lastDiv:", lastDiv)
if (lastDiv && lastDiv.length > 0) {
lastDiv.remove();
}
}
})
}
}
/**
* java學(xué)習(xí) javazhiyin.com
*/
function removeFirstLayer() {
if ($$$(".layui-layer-page").length > 0) {
var text = $$$(".layui-layer-page").text();
if (text.indexOf('首次訪問(wèn)') != -1 || text.indexOf('人機(jī)識(shí)別')) {
}
$$$(".layui-layer-page").remove();
$$$(".layui-layer-shade").remove();
}
$$$("div[index]")
}
/**
* 對(duì)layui或layer 樣式進(jìn)行重寫(xiě)笼痛,使其彈框進(jìn)行隱藏
*/
function addLayerCssStyle() {
$$$("style").get(0).append(".layui-layer-shade{display:none !important} .layui-layer-page{display:none !important}")
}
function addLayerCssStyle2() {
$$$("style").get(0).append(".layer-main{display:none !important}")
}
/**
* 對(duì)class 樣式進(jìn)行重寫(xiě)裙秋,使?jié)L動(dòng)條顯示
*/
function addOverflowCssStyle(cssSelector) {
console.log("style:%s", $$$(cssSelector).prop('style'))
$$$(cssSelector).prop('style', '')
$$$(cssSelector).attr('style', '')
$$$(cssSelector).css('max-height', 'none')
$$$(cssSelector).css('height', 'auto')
$$$(cssSelector).css('overflow', 'visible')
}
/**
* 對(duì)class 樣式進(jìn)行重寫(xiě)
*/
function addDisplayStyle(cssSelector) {
$$$(cssSelector).css("display","none");
$$$(cssSelector).attr("style","display:none");
}
function addDisplayCssStyle() {
$$$("style").get(0).append("article{opacity: 1 !important;display: block !important;}" +
"#menu li{opacity: 1;display: block;}")
}
function removeAlertRule1() {
$$$("div[style]").each(function (index) {
let attr = $$$(this).attr('style');
let text = $$$(this).text();
if (attr.indexOf("z-index") != -1 && (text.indexOf("首次訪問(wèn)") != -1 || text.indexOf("人機(jī)檢測(cè)") != -1)) {
let zIndex = $$$(this).css("z-index");
console.log("zIndex:", zIndex)
let lastDiv = $$$("div[style]").filter(function () {
return $$$(this).attr('style').indexOf("z-index") != -1 && $$$(this).css("z-index") == zIndex - 1
})
console.log("lastDiv:", lastDiv)
if (lastDiv && lastDiv.length > 0) {
lastDiv.remove();
}
$$$(this).remove();
$$$('body').css("overflow", 'auto');
}
})
}
/**
* 公共閱讀全文規(guī)則1: 查找當(dāng)前頁(yè)面所有div接單,判斷其style屬性是否包含特征值
*/
function commonReadAllRule1() {
$$$("div").each(function (index) {
let attr = $$$(this).attr('style');
if(attr){
if (attr.indexOf("height") != -1 && attr.indexOf("overflow") != -1 && attr.indexOf("hidden") != -1) {
let id = $$$(this).attr('id');
let cls = $$$(this).attr('class');
let founded = false;
if(id){
console.log("檢測(cè)到隱藏了全文的id:%s",id)
founded = true
}
if(cls){
console.log("檢測(cè)到隱藏了全文的class:%s",cls)
founded = true
}
if(founded){
$$$(this).prop('style','')
$$$(this).attr('style','')
}
}
}
})
}
/**
* 公共移除dom節(jié)點(diǎn)
*/
function commonRemoveRules1(selectors,isRemoveParent) {
if ('string' == typeof (selectors)) {
return commonRemoveRule1(selectors,isRemoveParent)
}else {
for (let index in selectors) {
commonRemoveRule1(selectors[index],isRemoveParent)
}
}
}
/**
* 公共查找節(jié)點(diǎn)名稱(chēng)
*/
function commonFindRules1(keys) {
let split = keys.split(",");
let selector = $$$("div").filter(function (){
let text = $$$(this).text();
let flag = false;
for (let i in split) {
flag = text.indexOf(split[i]) && flag ;
}
return flag && $$$(this).children().length == 0
})
let id = selector.attr("id");
if(id){
return "#"+id;
}
let cls = selector.attr("class");
if(cls){
return "."+cls;
}
return selector;
}
function commonRemoveRule1(selector,isRemoveParent) {
var $selector = $$$(selector);
if($selector.length > 0){
if(isRemoveParent){
$selector.parent().remove();
}else {
$selector.remove();
}
}
}
/**
* 公共隱藏
* @param selectors
* @param isRemoveParent
*/
function commonHideRule1(selectors) {
var selectorArray = selectors.split(",");
for (let index in selectorArray) {
if ($$$("style").length > 0) {
$$$("style").get(0).append(selectorArray[index] + "{display:none !important}");
}else {
$$$("header").append("<style></style>");
$$$("style").get(0).append(selectorArray[index] + "{display:none !important}");
}
}
}
var $$$ = $ || window._$ || zmQuery;
var href = window.location.href
function intervalReadAllRule2(checkSelector, removeSelector, removeClass) {
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(checkSelector).length > 0) {
readAllRule2(checkSelector, removeSelector, removeClass)
clearInterval(interval)
}
}, 1000)
}
// csdn
if (href.indexOf('csdn') != -1) {
console.log("檢測(cè)到CSDN晃痴。残吩。。倘核。")
// 已登錄
readAllRule1("#btn-readmore-zk", "#article_content")
// 未登錄
readAllRule1(".btn-readmore", "#article_content")
// 移動(dòng)端處理
readAllRule1(".btn_mod", ".article_content")
$$$("style").get(0).append(".login-box{display:none !important} \r\n .login-mark{display:none !important}");
} else if (href.indexOf('github.io') != -1) { //hoxis.github.io
console.log("檢測(cè)到github.io泣侮。。紧唱。活尊。")
readAllRule1("#read-more-btn", "#container")
addDisplayCssStyle();
} else if (href.indexOf('jianshu.com') != -1) { //jianshu.com
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
let count=0
if ($$$(".ant-btn").length > 0) {
console.log("展開(kāi)全文")
//向按鈕派發(fā)事件
$$$(".ant-btn").click()
clearInterval(interval)
}
count++
if(count>10){
clearInterval(interval)
}
}, 1000)
let guanggaocount=0
let interval2 = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".logo-close-img").length > 0) {
console.log("廣告關(guān)閉")
//向按鈕派發(fā)事件
$$$(".logo-close-img").click()
}
guanggaocount++
if(guanggaocount>10){
clearInterval(interval2)
}
}, 1000)
commonHideRule1(".download-app-guidance,.call-app-btn,#jianshu-header")
readAllRule1(".close-collapse-btn", ".collapse-free-content",)
} else if (href.indexOf('m.sohu.com') != -1) { //m.sohu.com
console.log("m.sohu.com。漏益。蛹锰。。")
commonHideRule1(".lookall-box")
readAllRule2("#artLookAll", ".hidden-content","hide")
$$$(".content-image").each(function () {
var src = $$$(this).data("src");
$$$(this).attr("src",src);
$$$(this).attr("data-lazy-load-completed","1");
})
} else if (href.indexOf('jingyan.baidu.com') != -1) { //百度經(jīng)驗(yàn)
console.log("檢測(cè)到百度經(jīng)驗(yàn)绰疤。铜犬。。轻庆。")
readAllRule2(".read-whole-mask", ".exp-content-container.fold","fold")
} else if (href.indexOf('xz577') != -1) { //www.xz577.com
console.log("檢測(cè)到xz577癣猾。。余爆。纷宇。")
readAllRule1(".m-zk", "#mewsmian")
// Your code here...
} else if (href.indexOf('cloud.tencent.com') != -1) { //cloud.tencent.com
console.log("檢測(cè)到tencent。蛾方。像捶。。")
let interval = setInterval(function () {
if ($$$(".com-markdown-collpase-hide").length > 0) {
readAllRule1(".com-markdown-collpase-toggle", ".com-markdown-collpase-main", true)
readAllRule2(".com-markdown-collpase-toggle", ".com-markdown-collpase-hide", "com-markdown-collpase-hide")
clearInterval(interval)
}
}, 1000)
// Your code here...
} else if (href.indexOf('iteye.com') != -1) { //iteye.com
console.log("檢測(cè)到iteye.com桩砰。拓春。。亚隅。")
readAllRule3("#btn-readmore")
// Your code here...
} else if (href.indexOf('720ui.com') != -1) { // 720ui.com
console.log("檢測(cè)到720ui.com痘儡。。枢步。沉删。")
readAllRule1("#read-more-btn", "#main")
} else if (href.indexOf('360doc.com') != -1) { // 360doc
console.log("檢測(cè)到360doc.com渐尿。。矾瑰。砖茸。")
addOverflowCssStyle(".article_container")
addDisplayStyle(".article_showall")
} else if (href.indexOf('m.leju.com') != -1) { // 360doc
console.log("檢測(cè)到m.leju.com。殴穴。凉夯。。")
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".ztt_more").length > 0) {
readAllRule1(".ztt_more", ".ztt_outer",true)
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('card.weibo.com') != -1) { // 微博
console.log("檢測(cè)到weibo.com采幌。劲够。。休傍。")
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".f-art-opt").length > 0) {
readAllRule1(".f-art-opt", ".f-art",true)
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('weibo.com') != -1) { // 微博
console.log("檢測(cè)到weibo.com征绎。。磨取。人柿。")
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".artical_add_box").length > 0) {
readAllRule1(".artical_add_box", ".WB_editor_iframe_new",true)
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('sina.cn') != -1) { // k.sina.cn
console.log("檢測(cè)到sina.cn。忙厌。凫岖。。")
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".unfold-btn1").length > 0) {
readAllRule1ByOrigin(".unfold-btn1", ".main-body")
clearInterval(interval)
}else if ($$$(".ztt_more").length > 0) {
readAllRule1ByOrigin(".ztt_more", ".ztt_outer",true)
clearInterval(interval)
}else if ($$$(".look_more_a").length > 0) {
readAllRule1ByOrigin("#artFoldBox", ".s_card z_c1",true)
clearInterval(interval)
}
commonRemoveRules1(".callApp_fl_btn")
}, 1000)
} else if (href.indexOf('toutiao') != -1) { // toutiao.com
console.log("檢測(cè)到toutiao逢净。哥放。。爹土。")
// 循環(huán)檢測(cè)
intervalReadAllRule2(".fold-btn", ".fold-btn-content", "fold-btn-content-fold");
// document.removeEventListener('click',getEventListeners($$$(document).get(0)).click[0].listener)
} else if (href.indexOf('3g.163.com') != -1) { // 3g.163.com
console.log("檢測(cè)到163.com甥雕。。着饥。。")
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".expand_more").length > 0) {
readAllRule1(".expand_more", "article")
clearInterval(interval)
}
$$$(".article_comment").css("display","block")
}, 1000)
} else if (href.indexOf('baijiahao') != -1|| href.indexOf('mbd.baidu.com') != -1) { // 百度文章
console.log("檢測(cè)到百家號(hào)惰赋。宰掉。。赁濒。")
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".oPadding").length > 0) {
readAllRule1(".oPadding", ".mainContent",true)
$$$(".scrollHide").removeClass("scrollHide");
clearInterval(interval)
}
if ($$$(".height-fold").length > 0) {
readAllRule1(".height-fold", ".dynamic-item",true)
$$$(".scrollHide").removeClass("scrollHide");
clearInterval(interval)
}
}, 1000)
addLayerCssStyle2();
} else if (href.indexOf('wenku.baidu.com') != -1) { // 百度文庫(kù)PC版
console.log("檢測(cè)到百度文庫(kù)轨奄。。拒炎。挪拟。")
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$("#reader-container").length > 0) {
$$$("#reader-container").css("height","fit-content");
commonHideRule1(".try-end-fold-page")
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('wk.baidu.com') != -1) { // 百度文庫(kù)移動(dòng)版
console.log("檢測(cè)到百度文庫(kù)。击你。玉组。谎柄。")
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".fold-pager").length > 0) {
$$$("#reader-container").css("height","fit-content");
commonHideRule1(".fold-pager")
$$$(".reader-wrap").css('height', 'auto')
$$$("#view-app").css('max-height', '')
$$$(".try-end-fold-page").css('display', 'block')
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('www.elecfans.com') != -1) { // elecfans.com
console.log("檢測(cè)到電子發(fā)燒友。惯雳。朝巫。。")
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".seeHide").length > 0) {
readAllRule1(".seeHide", ".simditor-body", true)
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('m.elecfans.com') != -1) { // elecfans.com
console.log("檢測(cè)到電子發(fā)燒友石景。劈猿。。潮孽。")
// 循環(huán)檢測(cè)
let
interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".see_more_arc").length > 0) {
readAllRule2(".see_more_arc", ".limit_height", "limit_height")
clearInterval(interval)
commonRemoveRule1(".open_app",false)
commonRemoveRule1(".open_app_arc",false)
commonRemoveRule1(".open_app_btn",false)
}
}, 1000)
} else if (href.indexOf('wukong.com') != -1) { // elecfans.com
console.log("檢測(cè)到悟空問(wèn)答揪荣。。往史。仗颈。")
// 循環(huán)檢測(cè)
let
interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".fold").length > 0) {
readAllRule2(".expand-bottom", ".fold", "fold")
}
}, 1000)
let interval2 = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".read-mask").length > 0) {
readAllRule1(".read-mask", ".content", true)
clearInterval(interval2)
commonRemoveRule1(".btn",false)
commonRemoveRule1(".download",false)
}
}, 1000)
} else if (href.indexOf('peopleapp.com') != -1) { // peopleapp.com
console.log("檢測(cè)到人民日?qǐng)?bào)。怠堪。揽乱。。")
let count = 0;
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".read-more-mask").length > 0) {
readAllRule1(".read-more-mask", ".has-more-high",)
$$$("#header").remove()
if(count++ > 10){
clearInterval(interval)
}
}
}, 1000)
} else if (href.indexOf('ifeng.com') != -1) { // ifeng.com
console.log("檢測(cè)到鳳凰網(wǎng)粟矿。凰棉。。陌粹。")
// 循環(huán)檢測(cè)
let interval = setInterval(function () {
console.log("輪訓(xùn)檢測(cè)...")
if ($$$("div[class^=tip-]").length > 0) {
// readAllRule4(, "div[class^=main_content-]")
commonRemoveRules1(["div[class^=tip-]",".link-1xGgkMtk"])
commonReadAllRule1();
clearInterval(interval)
}
}, 1000)
} else if (href.indexOf('awesomes.cn') != -1) { // awesomes.com
console.log("檢測(cè)到awesomes.cn撒犀。。掏秩。或舞。")
// 循環(huán)檢測(cè)
if ($$$(".read_more_mask").length > 0) {
readAllRule1(".read_more_mask", ".content")
}
} else if (href.indexOf('javascriptcn.com') != -1) { // javascriptcn.com
console.log("檢測(cè)到j(luò)avascriptcn.com。蒙幻。映凳。。")
// 循環(huán)檢測(cè)
if ($$$(".read_more_mask").length > 0) {
readAllRule1(".read_more_mask", ".markdown-body")
}
} else if (href.indexOf('hupu.com') != -1) { // hupu.com
console.log("hupu.com邮破。诈豌。。抒和。")
// 循環(huán)檢測(cè)
let interval = setInterval(function (){
console.log("輪訓(xùn)檢測(cè)...")
if ($$$(".open-btn").length > 0) {
readAllRule1(".open-btn", "#bbs-detail-wrap")
clearInterval(interval)
}
},1000)
} else if (href.indexOf('xw.qq.com') != -1) { // xw.qq.com
console.log("檢測(cè)到xw.qq.com矫渔。。摧莽。庙洼。")
// 循環(huán)檢測(cè)
intervalReadAllRule2("div[aria-label]", "#article_body", "jsx-2375966888");
$$$("#article_body").prop("style","margin:0 0.18rem; position:relative")
} else if (href.indexOf('inews.qq.com') != -1) { // inews.qq.com
console.log("檢測(cè)到inews.qq.com。。油够。蚁袭。")
// 循環(huán)檢測(cè)
let interval = setInterval(function (){
console.log("輪訓(xùn)檢測(cè)...")
if($$$("._1mAOD6Nkgp2wM7xlGCHeNi").length > 0){
commonRemoveRules1(["._1mAOD6Nkgp2wM7xlGCHeNi","._1GTaS1LTuTrKnZ-oQ6KFRG"],true)
commonReadAllRule1()
clearInterval(interval)
}
},1000)
} else if (href.indexOf('goodreads.com') != -1) { // goodreads.com
console.log("檢測(cè)到goodreads.com。叠聋。撕阎。。")
// 循環(huán)檢測(cè)
let interval = setInterval(function (){
console.log("輪訓(xùn)檢測(cè)...")
if($$$("a[onclick^=swapContent").length > 0){
// PC 版本
$$$(".readable > span:nth-child(2)").attr("style","display:block")
// 移動(dòng)版本
$$$(".bookReviewBody > span:nth-child(2)").attr("style","display:block")
$$$("a[onclick^=swapContent").attr("style","display:none")
clearInterval(interval)
}
},1000)
} else if (href.indexOf('51cto.com') != -1) { // blog.51cto.com
console.log("檢測(cè)到blog.51cto.com碌补。虏束。。厦章。")
// 循環(huán)檢測(cè)
/*$$$(document).scroll(function (){
let count = 0;
console.log("輪訓(xùn)檢測(cè)")
let interval = setInterval(function (){
if($$$("#login_iframe_mask").length > 0){
console.log("已清理登錄彈框")
$$$("#login_iframe_mask").remove();
clearInterval(interval)
}
if( count ++ > 10){
count = 0;
clearInterval(interval)
}
},1000)
})*/
// modify by zml 2020年10月31日 23:07:07 將原來(lái)監(jiān)聽(tīng)是否有元素方式改為頁(yè)面中添加css樣式的方式來(lái)更好的解決彈框不停彈出的問(wèn)題
$$$("style").get(0).append("#login_iframe_mask{display:none}");
} else if (href.indexOf('zhihu.com') != -1 && document.documentElement.clientWidth<768) { // blog.51cto.com
console.log("檢測(cè)到zhihu.com镇匀。。袜啃。汗侵。")
let count = 0;
let interval = setInterval(function (){
if(".ModalWrap-body".length > 0){
$$$(".ModalWrap-body").prop("style","").removeClass("ModalWrap-body")
}
if(".is-collapsed".length > 0){
$$$(".is-collapsed").removeClass("is-collapsed");
}
if($$$(".RichContent-inner").length > 0){
// $$$(".RichContent-inner").prop("style","").removeClass("RichContent-inner--collapsed")
addOverflowCssStyle(".RichContent-inner--collapsed")
addOverflowCssStyle(".RichContent--unescapable")
addOverflowCssStyle(".is-collapsed")
}
if ($$$(".expandButton").length > 0) {
console.log("移除閱讀全文")
// $$$(".expandButton").remove()
addDisplayStyle(".expandButton")
}
if ($$$(".ContentItem-expandButton").length > 0) {
console.log("移除閱讀全文")
// $$$(".ContentItem-expandButton").remove()
addDisplayStyle(".ContentItem-expandButton")
}
if(count++ > 100){
clearInterval(interval);
}
},100)
$$$("style").get(0).append(".ModalWrap{display:none}");
} else if (href.indexOf('36kr.com') != -1 && document.documentElement.clientWidth<768) { // 36氪
console.log("檢測(cè)到36kr.com。群发。晰韵。。")
let interval = setInterval(function (){
if($$$(".tips-mask").length > 0){
commonHideRule1(".tips-mask");
commonHideRule1(".tips-content");
commonHideRule1(".swiper-wrapper");
$$$("#body-content").removeClass(" no-open")
$$$("body").attr("style","")
commonHideRule1(".article-goapp");
clearInterval(interval);
}
},100)
} else if (href.indexOf('m.guokr.com') != -1) { // m.guokr.com
console.log("檢測(cè)到m.guokr.com熟妓。雪猪。。起愈。")
//let height = $$$(".styled__ArticleContent-sc0ctyfcr-4").position().top-$$$(".styled__ArticleContent-sc0ctyfcr-4").children().position().top
//$$$(".styled__ArticleContent-sc0ctyfcr-4").css("height",height);
$$$(".jYkhp").css("max-height","100%");
$$$(".jYkhp").css("overflow","auto");
$$$(".styled__Button-sc-1ctyfcr-7").parent().remove()
$$$(".gJghO").css("display","none")// 移除底部APP橫幅廣告
} else if ($$$("#read-more-btn").length > 0) {
console.log("檢測(cè)到可能使用了openwrite推廣工具只恨。。抬虽。官觅。")
readAllRule4("#read-more-btn");
} else if ($$$(".mask").length > 0 && $$$(".info").length > 0) { // cmsblogs.com
console.log("檢測(cè)到%s。阐污。休涤。。", href)
readAllRule4(".info");
} else if (href.indexOf("iocoder") != -1) {
setInterval(removeAlertRule1(), 10000);
} else if (href.indexOf("javazhiyin") != -1) {
addLayerCssStyle();
// 每隔10s移除彈出的關(guān)注檢測(cè)彈框
setInterval(removeFirstLayer(), 10000)
} else {
}
})();
三 其他人想擴(kuò)展也很簡(jiǎn)單
- 加入自己想捕捉的網(wǎng)站
- 添加捕捉規(guī)則以及去除規(guī)則(可能是點(diǎn)擊或者直接刪除dom元素)
- 某些網(wǎng)站比較狡猾,他在網(wǎng)站打開(kāi)的幾秒后才進(jìn)行元素渲染,直接捕捉就捕捉個(gè)寂寞,因此咱們可能要進(jìn)行循環(huán)睡眠捕捉,捕捉他個(gè)幾十次差不多了;