猴游脚本 CSDN阅读模式

屏幕录制2021-04-14 下午5.gif

安装: link

// ==UserScript==
// @name         CSDN Reading mode togger
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  用于csdn博客阅读时内容区域扩大
// @author       宏斌
// @match        https://blog.csdn.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const okBtn = document.createElement('button');
    okBtn.id = 'ReadingMode';
    okBtn.setAttribute('class','option-box');
    okBtn.innerText = 'R'
//    $(".blog-content-box").append(okBtn);
    $('.csdn-side-toolbar').append(okBtn);
    $("#ReadingMode").css({ width: '44px',height:'44px','border-radius':'22px','background-color':'#fff','font-size':'25px','color':'#ccc','box-shadow': '0 2px 4px 0 rgb(0 0 0 / 5%)','margin-top':'8px' });
    const mystyles = document.createElement('style');
    mystyles.type = 'text/css';
    $("head").append(mystyles);
    $("#mainBox").css("transition","width 0.3s linear");
    $("#rightAside").css("transition","width 0.3s linear");
    mystyles.innerHTML = `.fillWidth{width: 100% !important} .zeroWidth{width: 0 !important}`;
    $("#ReadingMode").on('click',() => {
    $("#mainBox").toggleClass('fillWidth');
    $('main').toggleClass('fillWidth');
    $("#rightAside").toggleClass("zeroWidth");



})
})();
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容