// ==UserScript==
// @name 自动展开全文
// @namespace Show me all post.
// @match *://www.zhihu.com/question/*
// @match *://blog.csdn.net/*/article/details/*
// @match *://www.bilibili.com/video/av*
// @match *://m.bilibili.com/video/av*
// @match *://www.youtube.com/watch?v=*
// @match *://m.youtube.com/watch?v=*
// @match *://www.acfun.cn/v/ac*
// @match *://m.acfun.cn/v/?ac=*
// @match *://www.ipaperclip.net/doku.php?id=*
// @match *://zhidao.baidu.com/question/*
// @match *://wap.peopleapp.com/article/*
// @match *://*.ifeng.com/*
// @match *://www.javascriptcn.com/*
// @grant GM_addStyle
// @version 0.0.7
// @author 稻米鼠
// @description 自动展开网站内容而无需点击。当前支持知乎,cdsn,B 站、A 站和 Youtube 的视频简介,回形针手册(PC 页面),百度知道,人民日报移动端页面,JavaScript中文网,凤凰网移动端页面。如需支持更多内容,请至以下网址提交 https://meta.appinn.net/t/14383
// ==/UserScript==
const rules = [
{ // 知乎 - 移动端页面
reg: /^http(s):\/\/(www\.)?zhihu\.com\/question\/\d+/,
remove: ['.RichContent--unescapable.is-collapsed .ContentItem-rightButton'],
content: ['.Body--Mobile .RichContent.is-collapsed .RichContent-inner'],
},
{ // CSDN - PC & 移动端页面
reg: /^http(s):\/\/blog\.csdn\.net\/[^/]+\/article\/details\/\d+/,
remove: [
'div.hide-article-box',
'.readall_box'
],
content: [
'#article_content',
'#article .article_content'
],
},
{ // B 站视频简介
reg: /^http(s):\/\/(www\.)?bilibili\.com\/video\/av\d+/,
remove: ['.video-desc .btn'],
content: ['.video-desc .info'],
},
{ // B 站移动端视频标题
reg: /^http(s):\/\/m\.bilibili\.com\/video\/av\d+/,
remove: ['.index__videoInfo__src-videoPage-videoInfo- .index__foldSwitch__src-videoPage-videoInfo-'],
content: [
'.index__videoInfo__src-videoPage-videoInfo- .index__title__src-videoPage-videoInfo-',
'.index__descWrap__src-videoPage-infoBlock-'
],
style: `
.index__videoInfo__src-videoPage-videoInfo- .index__title__src-videoPage-videoInfo- .index__titleContent__src-videoPage-videoInfo- {
white-space: normal !important;
}
`,
},
{ // Youtube 视频简介
reg: /^http(s):\/\/(www\.)?youtube\.com\/watch\?v=\w+/,
remove: ['paper-button.ytd-expander'],
content: ['#content.ytd-expander'],
},
{ // Youtube 移动端视频标题
reg: /^http(s):\/\/m\.youtube\.com\/watch\?v=\w+/,
remove: [],
content: [],
script: ()=>{
document.querySelector('button.slim-video-metadata-header').click()
},
},
{ // AcFun 视频简介
reg: /^http(s):\/\/(www\.)?acfun\.cn\/v\/ac\d+/,
remove: ['#main .introduction .desc-operate'],
content: ['#main .introduction .content-description.gheight'],
style: `
#main .introduction .content-description.gheight .tag {
display: block !important;
}
`,
},
{ // AcFun 移动端视频标题
reg: /^http(s):\/\/m\.acfun\.cn\/v\/\?ac=\d+/,
remove: ['.video-title .down'],
content: [],
script: ()=>{
document.querySelector('.video-title .info-title').classList.remove('hide-more')
},
},
{ // 回形针手册
reg: /^http(s):\/\/(www\.)?ipaperclip\.net\/doku\.php\?id=.*/,
remove: ['.paperclip__showcurtain'],
content: ['.paperclip__h1content__wrapped'],
},
{ // 百度知道
reg: /^http(s):\/\/zhidao\.baidu\.com\/question\/\d+\.html/,
remove: [
'.wgt-ask .q-content .conSamp',
'.wgt-ask .expend',
'.wgt-answers .answer-text .wgt-answers-mask',
'.iknow-root-dom-element .wgt-question-desc-explode .wgt-question-desc .wgt-question-desc-action',
'.iknow-root-dom-element .w-detail-full-new .newyl-fold'
],
content: [
'.wgt-answers .answer-text',
'.iknow-root-dom-element .wgt-question-desc-explode .wgt-question-desc .wgt-question-desc-inner',
'.iknow-root-dom-element .w-detail-full-new .w-detail-newyl.fold'
],
style: `
.wgt-ask .q-content .conTemp, .wgt-ask .q-content .con-all {
display: block !important;
}
.iknow-root-dom-element .wgt-question-desc-explode .wgt-question-desc .wgt-question-desc-inner {
width: auto !important;
white-space: normal !important;
}
`,
},
{ // 人民日报
reg: /^http(s):\/\/wap\.peopleapp\.com\/article\/\d+/,
remove: ['.read-more'],
content: ['.article-wrapper.has-more-high'],
},
{ // 凤凰网
reg: /^http(s):\/\/\w+\.ifeng\.com\/.*/,
remove: [],
content: [],
script: ()=>{
document.querySelectorAll('*').forEach(el=>{
for(let i=0; i<el.classList.length; i++){
const elClass = el.classList[i]
if(/^(main_content|containerBox)-[a-zA-Z0-9]+/.test(elClass)){
el.style.height = 'auto'
el.style.maxHeight = 'none'
}else if(/^(more-1|tip|bottom_box|ad_box|shadow|callupBtn|bottomSlide|headerInfo|fixedIcon)-[a-zA-Z0-9]+/.test(elClass)){
el.style.display = 'none'
}
}
})
},
},
{ // JavaScript中文网
reg: /^http(s):\/\/(www\.)?javascriptcn\.com\/.*/,
remove: ['.readall_box'],
content: ['.markdown-body'],
},
]
for(const rule of rules){
if(rule.reg.test(window.location.href)){
const removeEls = rule.remove.join(',\n')
const contentEls = rule.content.join(',\n')
GM_addStyle((rule.remove
? removeEls+` {
display: none !important;
}\n`
: ``)
+(rule.content
? contentEls+` {
height: auto !important;
max-height: none !important;
}\n`
: ``)
+(rule.style
? rule.style
: ``)
)
if(typeof(rule.script) === 'function'){
window.addEventListener("load", rule.script)
}
}
}