自动展开全文

自动展开网站内容而无需点击。当前支持知乎,CSDN,B 站、A 站和 Youtube 的视频简介,回形针手册(PC 页面),百度知道,人民日报移动端页面,JavaScript中文网,凤凰网移动端页面。如需支持更多内容,请至以下网址提交 https://meta.appinn.net/t/14383

As of 2020-04-18. See the latest version.

// ==UserScript==
// @name        自动展开全文
// @namespace   Show me all post.
// @icon        https://i.v2ex.co/81ToM02ss.png
// @grant       GM_addStyle
// @version     0.0.25
// @author      稻米鼠
// @description 自动展开网站内容而无需点击。当前支持知乎,CSDN,B 站、A 站和 Youtube 的视频简介,回形针手册(PC 页面),百度知道,人民日报移动端页面,JavaScript中文网,凤凰网移动端页面。如需支持更多内容,请至以下网址提交 https://meta.appinn.net/t/14383
// @supportURL  https://meta.appinn.net/t/14383
// @homepageURL https://meta.appinn.net/t/14383
// @match       *://www.zhihu.com/question/*
// @match       *://blog.csdn.net/*/article/details/*
// @match       *://bbs.csdn.net/topics/*
// @match       *://www.bilibili.com/video/av*
// @match       *://www.bilibili.com/video/BV*
// @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/*
// @match       *://www.360doc.com/content/*
// @match       *://www.360doc.cn/article/*
// @match       *://www.iteye.com/blog/*
// @match       *://sports.sina.cn/*
// @match       *://3g.163.com/*
// @match       *://xw.qq.com/*
// @match       *://m.toutiao.com/*
// @match       *://chejiahao.m.autohome.com.cn/i*
// @match       *://post.m.smzdm.com/p/*
// @match       *://m.smzdm.com/p/*
// @match       *://m.iask.sina.com.cn/b/*
// @match       *://m.tiexue.net/touch/thread_*
// @match       *://baijiahao.baidu.com/s?id=*
// @match       *://www.bandbbs.cn/threads/*
// @match       *://cloud.tencent.com/developer/article/*
// @match       *://book.douban.com/subject/*
// @match       *://www.jianshu.com/p/*
// @match       *://www.chinaz.com/*
// @match       *://www.pinlue.com/article/*
// @match       *://m.jiemian.com/article/*
// ==/UserScript==

const rules = [
  { // 知乎 - 移动端页面
    reg: /^http(s)?:\/\/(www\.)?zhihu\.com\/question\/\d+/i,
    remove: ['.RichContent--unescapable.is-collapsed .ContentItem-rightButton'],
    content: [
      '.Body--Mobile .RichContent.is-collapsed .RichContent-inner',
      '.RichContent--unescapable.is-collapsed .RichContent-inner'
    ],
    style: `
    .RichContent.is-collapsed {
      cursor: auto !important;
    }
    .RichContent--unescapable.is-collapsed .RichContent-inner {
      -webkit-mask-image: none !important;
      mask-image: none !important;
    }
    `
  },
  { // CSDN 博客 - PC & 移动端页面
    reg: /^http(s)?:\/\/blog\.csdn\.net\/[^/]+\/article\/details\/\d+/i,
    remove: [
      'div.hide-article-box',
      '.readall_box'
    ],
    content: [
      '#article_content',
      '#article .article_content'
    ],
  },
  { // CSDN 论坛 - PC & 移动端页面
    reg: /^http(s)?:\/\/bbs\.csdn\.net\/topics\/\d+/i,
    remove: [
      '.hide_topic_box',
      '.readall_wrap'
    ],
    content: [
      '.container-box .bbs_detail_wrap',
      '.first_show'
    ],
  },
  { // B 站视频简介
    reg: /^http(s)?:\/\/(www\.)?bilibili\.com\/video\/(av\d+|bv\w+)/i,
    remove: ['.video-desc .btn'],
    content: ['.video-desc .info'],
  },
  { // B 站移动端视频标题
    reg: /^http(s)?:\/\/m\.bilibili\.com\/video\/av\d+/i,
    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+/i,
    remove: ['paper-button.ytd-expander'],
    content: ['#content.ytd-expander'],
  },
  { // Youtube 移动端视频标题
    reg: /^http(s)?:\/\/m\.youtube\.com\/watch\?v=\w+/i,
    remove: [],
    content: [],
    script: ()=>{
      document.querySelector('button.slim-video-metadata-header').click()
    },
  },
  { // AcFun 视频简介
    reg: /^http(s)?:\/\/(www\.)?acfun\.cn\/v\/ac\d+/i,
    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+/i,
    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=.*/i,
    remove: ['.paperclip__showcurtain'],
    content: ['.paperclip__h1content__wrapped'],
  },
  { // 百度知道
    reg: /^http(s)?:\/\/zhidao\.baidu\.com\/question\/\d+\.html/i,
    remove: [
      '.wgt-ask .q-content .conSamp',
      '.wgt-ask .expend',
      '.wgt-answers .answer-text .wgt-answers-mask',
      'div.wgt-best .best-text .wgt-best-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',
      '.iknow-root-dom-element .w-detail-full .w-detail-display-btn',
      '.iknow-root-dom-element .w-detail-dis-na-btn'
    ],
    content: [
      '.wgt-answers .answer-text',
      'div.wgt-best .best-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',
      '.iknow-root-dom-element .w-detail-full .w-detail-container'
    ],
    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+/i,
    remove: ['.read-more'],
    content: ['.article-wrapper.has-more-high'],
  },
  { // 凤凰网
    reg: /^http(s)?:\/\/\w+\.ifeng\.com\/.*/i,
    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\/.*/i,
    remove: ['.readall_box'],
    content: ['.markdown-body'],
  },
  { // 360doc 个人图书馆
    reg: /^http(s)?:\/\/(www\.)?360doc\.com\/content\/.*/i,
    remove: ['.article_showall'],
    content: ['.articleMaxH .article_container'],
  },
  { // 360doc 个人图书馆(移动端)
    reg: /^http(s)?:\/\/(www\.)?360doc\.cn\/article\/.*/i,
    remove: ['.article_showall'],
    content: ['.article_maxh'],
  },
  { // ITeye
    reg: /^http(s)?:\/\/(www\.)?iteye\.com\/blog\//i,
    remove: ['.hide-article-box'],
    content: ['.hide-main-content'],
  },
  { // 新浪体育(移动端)
    reg: /^http(s)?:\/\/sports\.sina\.cn\/.*/i,
    remove: ['.look_more'],
    content: ['.art_box'],
  },
  { // 手机网易
    reg: /^http(s)?:\/\/3g\.163\.com\/.*/i,
    remove: ['.footer'],
    content: ['article'],
  },
  { // 腾讯新闻
    reg: /^http(s)?:\/\/xw\.qq\.com\/.*/i,
    remove: ['.collapseWrapper', '#article_body > .mask'],
    content: ['#article_body'],
  },
  { // 头条移动版
    reg: /^http(s)?:\/\/m\.toutiao\.com\/\w+\//i,
    remove: ['.unfold-field'],
    content: ['.article'],
  },
  { // 汽车之家(手机版)
    reg: /^http(s)?:\/\/(\w+\.)?m\.autohome\.com\.cn\/\w+\//i,
    remove: ['.pgc-details .continue_reading'],
    content: [],
    script: ()=>{
      document.querySelectorAll('#content .fn-hide').forEach(el=>{
        el.classList.remove('fn-hide')
      })
    }
  },
  { // 张大妈移动端
    reg: /^http(s)?:\/\/(post\.)?m\.smzdm\.com\/p\/\d+/i,
    remove: ['.article-wrapper .expand-btn', '.foot-banner'],
    content: ['.article-wrapper'],
  },
  { // 爱问移动版
    reg: /^http(s)?:\/\/m\.iask\.sina\.com\.cn\/b\/\w+\.html/i,
    remove: ['.answer_lit'],
    content: [],
    style: `
      .answer_all{
        display: block !important;
      }
    `,
  },
  { // 铁血移动版
    reg: /^http(s)?:\/\/m\.tiexue\.net\/touch\/thread_\d+/i,
    remove: ['.yxqw'],
    content: ['.articleCont'],
  },
  { // 百度百家号
    reg: /^http(s)?:\/\/baijiahao\.baidu\.com\/s\?id=\d+/i,
    remove: ['.packupButton', '.contentMedia .openImg'],
    content: ['.mainContent'],
  },
  { // 米坛
    reg: /^http(s)?:\/\/(www\.)?bandbbs\.cn\/threads\/\d+/i,
    remove: ['.u-bottomFixer', '.bbCodeBlock--expandable.is-expandable .bbCodeBlock-expandLink'],
    content: ['.bbCodeBlock--expandable .bbCodeBlock-expandContent'],
  },
  { // 腾讯云社区
    reg: /^http(s)?:\/\/cloud\.tencent\.com\/developer\/article\/\d+/i,
    remove: ['.com-markdown-collpase-hide .com-markdown-collpase-toggle'],
    content: ['.com-markdown-collpase-hide .com-markdown-collpase-main'],
  },
  { // 豆瓣图书
    reg: /^http(s)?:\/\/book\.douban\.com\/subject\/\d+/i,
    remove: [],
    content: [],
    script: ()=>{
      document.querySelectorAll('.indent > .short').forEach(el=>{ el.classList.add('hidden') })
      document.querySelectorAll('.indent > .all').forEach(el=>{ el.classList.remove('hidden') })
    }
  },
  { // 简书移动版
    reg: /^http(s)?:\/\/(w+\.)?jianshu\.com\/p\/\w+/i,
    remove: ['#note-show .content .show-content-free .collapse-tips'],
    content: ['#note-show .content .show-content-free .collapse-free-content'],
  },
  { // 站长之家
    reg: /^http(s)?:\/\/(w+\.)?chinaz\.com\/\w+/i,
    remove: ['.contentPadding'],
    content: ['#article-content'],
  },
  { // 品略
    reg: /^http(s)?:\/\/(w+\.)?pinlue\.com\/article\//i,
    remove: ['.readall_box'],
    content: ['.textcontent'],
  },
  { // 品略
    reg: /^http(s)?:\/\/m\.jiemian\.com\/article\/\d+/i,
    remove: ['.content-fold .show-change'],
    content: ['.article-main'],
  },
]
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)
    }
    break
  }
}