tampermonkey 油猴例子

// ==UserScript==
// @name         阅读模式
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://*/*
// @match        https://*/*
// @require    https://cdn.bootcdn.net/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
        var fa=$("body");
        var btn=$("<div id='chennimei'></div>");
        var json={
            "background":"#31e16d",
            //"height":"36px",
            "padding":"5px",
            "cursor": "pointer",
            "top":"50px",
            "right":"2px",
            "position": "fixed",
            "z-index": 99999
        };
        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();
                $("#article_content").siblings(".similar_article").hide();
                $("#res-relatived").hide();
                $("#side").hide();
                $("#comment_title").parent("div").hide();
                $("#pub_footerall").parent("div").hide();
            }else{
                console.log(3435);
                console.log(456);
                $("#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...
})();
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值