// ==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=*
// @grant GM_addStyle
// @version 0.0.5
// @author 稻米鼠
// @description 自动展开网站内容而无需点击。当前支持知乎,cdsn,B 站、A 站和 Youtube 的视频简介。如需支持更多内容,请至以下网址提交 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')
},
},
]
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)
}
}
}