tampermonkey实现CSDN阅读模式

来源:互联网 发布:硬盘linux系统安装教程 编辑:程序博客网 时间:2024/06/03 20:24

因为技能树都是图片形式的总结,以下是csdn的阅读模式脚本

// ==UserScript==// @name         csdn阅读模式// @namespace    http://tampermonkey.net/// @version      1.0// @description  try to take over the world!// @author       LFSenior// @match        http://blog.csdn.net/*// @require    http://code.jquery.com/jquery-1.11.0.min.js// @grant        none// ==/UserScript==(function() {    'use strict';    /*点赞功能$("#btnDigg").click();*/       var fa=$("body");        var btn=$("<li></li>");        var json={            "background":"#31e16d",            "height":"16px",            "padding":"5px",            "cursor": "pointer",            "top":"300px",            "right":"80px",            "position": "fixed"        };        btn.css(json);        btn.html("<span id='lfsenior'>开启阅读模式</span>");        fa.append(btn);        var bodywidth=$("#body").css("width");        var mainwidth=$("#main").css("width");        btn.click(function () {            if($("#lfsenior").html()=="开启阅读模式"){                $("#lfsenior").html("关闭阅读模式");                $("#body").css("width","100%");                $("#main").css("width","100%");                $(".csdn-tracking-statistics").hide(1000);                $("#article_content").siblings(".similar_article").hide(1000);                $("#res-relatived").hide(1000);                $("#side").hide(1000);                $("#comment_title").parent("div").hide(1000);                $("#pub_footerall").parent("div").hide(1000);            }else{                $("#lfsenior").html("开启阅读模式");                $("#body").css("width",bodywidth);                $("#main").css("width",mainwidth);                $(".csdn-tracking-statistics").show(1000);                $("#article_content").siblings(".similar_article").show(1000);                $("#res-relatived").show(1000);                $("#side").show(1000);                $("#comment_title").parent("div").show(1000);                $("#pub_footerall").parent("div").show(1000);            }        });    // Your code here...})();