How to embed additional jQuery plugins into Greasemonkey

后端 未结 2 937
被撕碎了的回忆
被撕碎了的回忆 2020-12-29 16:04

So I\'ve been able to get Greasemonkey and jQuery 1.2.6 to work together without issue, but, now I\'m wondering how to embed additional jQuery plugins into my Greasemonkey s

2条回答
  •  萌比男神i
    2020-12-29 16:57

    First, if you are OK with not having Firebug debugging access the easiest way to include jquery is to use the require settings:

    // @require        http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
    // @require        http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.min.js 
    

    Following that line you can include other external scripts. Most of the jquery plugins are not available like the jquery api, but you can host it yourself.

    Using the require also allows you to dump all the loading code and simply go with:

    $(document).ready( function() { ... });
    

    Firebug will report bugs, but you will not be able to step into the debugger.

    Additionally, once you have jquery loaded you can load other items to like so:

    $('head').append(""); 
    

提交回复
热议问题