方便各大程序员免关注阅读CSDN全文
// ==UserScript== // @name CSDN免关注阅读全文 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 方便各大程序员免关注阅读CSDN全文 // @author bbbyqq // @match *://blog.csdn.net/* // @icon https://www.google.com/s2/favicons?sz=64&domain=csdn.net // @grant GM_addStyle // @license bbbyqq // ==/UserScript== (function () { 'use strict' const hide_article_box = document.querySelector('.hide-article-box') const btn = document.createElement('div') const css = ` .btn-no-follow { background: #fc5531; color: #ffffff; width: 130px; border-radius: 12px; margin: 10px auto; cursor: pointer; height: 24px; line-height: 24px; } .btn-no-follow:hover { background: #ff6e6e; }` GM_addStyle(css) // GM_addStyle动态添加css btn.textContent = '免关注阅读全文' btn.className = 'btn-no-follow' hide_article_box.appendChild(btn) // 免关注阅读全文 btn.onclick = function () { const article_content = document.getElementById("article_content") article_content.removeAttribute("style") const follow_text = document.getElementsByClassName('follow-text')[0] follow_text.parentElement.parentElement.removeChild(follow_text.parentElement) const hide_article_box = document.getElementsByClassName(' hide-article-box')[0] hide_article_box.parentElement.removeChild(hide_article_box) } })()