美文网首页
油猴jquery问题

油猴jquery问题

作者: Joker168 | 来源:发表于2022-07-05 14:18 被阅读0次

    jQuery:eslint: no-undef - $ is not defined“

    虽然不影响实际运行,但是看上去非常不爽。

    在代码头部插入

    var $ = unsafeWindow.jQuery;
    即可解决。

    // ==UserScript==
    // @name         自定义
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  去其他
    // @author       XiaoM
    // @match        *.shtml
    // @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
    // @grant        unsafeWindow
    // @require      https://code.jquery.com/jquery-3.6.0.min.js
    // ==/UserScript==
    
    (function() {
        'use strict';
        var $ = unsafeWindow.jQuery;
    
        // Your code here...
        $(".HeaderView").hide();
        $(".crumbs-wrap").hide();
        $(".paper-tools-wrap").hide();
        $(".BasketView").hide();
        $(".g-sd2").hide();
    
    })();
    

    相关文章

      网友评论

          本文标题:油猴jquery问题

          本文链接:https://www.haomeiwen.com/subject/gwssbrtx.html