【js】在csdn中开启阅读模式

// ==UserScript==
// @name         开启阅读模式
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       evan_qb
// @match        http://blog.csdn.net/Evan_QB/article/details/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    var json = {
         "width": "100px",
         "height": "35px",
         "position": "fixed",
         "top": "200px",
         "right": "200px",
         "background-color": "gray",
         "border-radius": "10px",
         "text-align": "center",
         "line-height": "35px",
         "cursor":"pointer",
         "color": "white",
         "border":"1px solid gray"
    };

    var articleJson = {
        "width":"100%",
        "position":"absolute",
        "left":"0"
    };


    var btn = $("<span id='evan_qb'>开启阅读模式</span>");
    btn.css(json);
    $("body").append(btn);
    var bodywidth=$("#body").css("width");
    var mainwidth=$("#main").css("width");
    var artwidth = $("#article_details").css("width");
    btn.click(function(){
        console.log($("#evan_qb").html());
        var txt = $("#evan_qb").html();
         if(txt == "开启阅读模式"){
                 $("#evan_qb").html("关闭阅读模式");
                 $("#body").css("width","100%");
                 $("#main").css("width","100%");
                 $("#side").hide(1000);
                 //$("#article_details",".details").css(articleJson);
                 $("#article_details").css(articleJson);
                 $("#main .main").css("width","100%");
                 $(".recommend_list").hide(1000);
                 $(".comment_class").hide(1000);
                 $("#navigator").hide(1000);
                 $("#header").hide(1000);
                 $(".csdn-toolbar ").hide(1000);
                 //$(".clear").hide(1000);

         }else{
                 $("#evan_qb").html("开启阅读模式");
                 $("#side").show(1000);
                 $("#body").css("width",bodywidth);
                 $("#main").css("width",mainwidth);
                 //$(".csdn-tracking-statistics").show(1000);
                 $(".recommend_list").show(1000);
                 $(".comment_class").show(1000);
                 $("#navigator").show(1000);
                  $("#header").show(1000);
                 $(".csdn-toolbar ").show(1000);

                 $("#article_details").css("position","static");
                 $("#article_details").css("width",artwidth);
         }
    });




})();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值