清理 CSDN 底部提示栏及广告并展开内容
当前为
// ==UserScript==
// @name CSDN-remove-obstacle
// @namespace http://tampermonkey.net/
// @version 0.2
// @description 清理 CSDN 底部提示栏及广告并展开内容
// @icon https://avatar.csdn.net/D/7/F/3_nevergk.jpg
// @author sven
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @include https://blog.csdn.net/*
// @include https://bbs.csdn.net/topics/*
// @match <$URL$>
// ==/UserScript==
var inline_src = (<><![CDATA[
// 底部提示栏
// const bottomBar = document.querySelector('.pulllog-box')
// if (bottomBar instanceof window.HTMLDivElement) {
// bottomBar.parentElement.removeChild(bottomBar)
// }
// 阅读更多按钮
// const readMoreBtn = document.getElementById('btn-readmore')
// if (readMoreBtn instanceof window.HTMLAnchorElement) {
// readMoreBtn.click()
// }
// 将正文部分宽度最大化
const aside = document.getElementsByTagName('aside')
const main = document.getElementsByTagName('main')
if (aside && aside[0]) {
aside[0].parentElement.removeChild(aside[0])
}
if (main && main[0]) {
main[0].style.width = '100%'
}
// 添加 style 标签
(() => {
const sheets = `
.recommend-right,.pulllog-box,.adblock,.fourth_column,.hide-article-box,#csdn-toolbar,.meau-gotop-box {display: none !important;}
.article_content {height: auto !important;}
`
const sheet = document.createTextNode(sheets)
const el = document.createElement('style')
el.appendChild(sheet)
document.getElementsByTagName('head')[0].appendChild(el)
console.warn(el)
})()
]]></>).toString();
var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] });
eval(c.code);