Greasy Fork

自动展开全文

自动展开网站内容而无需点击。当前支持知乎,cdsn。如需支持更多内容,请至以下网址提交 https://meta.appinn.net/t/14383

目前为 2020-03-07 提交的版本。查看 最新版本

// ==UserScript==
// @name        自动展开全文
// @namespace   Show me all post.
// @match       *://www.zhihu.com/question/*
// @match       *://blog.csdn.net/*/article/details/*
// @grant       GM_addStyle
// @version     0.0.1
// @author      稻米鼠
// @description 自动展开网站内容而无需点击。当前支持知乎,cdsn。如需支持更多内容,请至以下网址提交 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'],
  },
  {
    reg: /^http(s):\/\/blog\.csdn\.net\/[^/]+\/article\/details\/\d+/,
    remove: ['div.hide-article-box', '.readall_box'],
    content: ['#article_content', '#article .article_content'],
  },
]

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(`
      `+removeEls+` {
        display: none !important;
      }
      `+contentEls+` {
        height: auto !important;
        max-height: none !important;
      }
    `)
  }
}