Last active
November 4, 2022 07:09
-
-
Save Cojad/c12a8cd155582ce2f3015c71bac0e12c to your computer and use it in GitHub Desktop.
Load npm js in tampermonkey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name load jQuery and yaml on 越南商店 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://sites.google.com/view/nicsolas/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com | |
// @require http://code.jquery.com/jquery-3.4.1.min.js | |
// @require https://github.com/plohoj/userscript-requirejs/releases/download/0.0.2/userscript-require.js | |
// @resource requirejs https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js | |
// @resource yaml https://cdn.jsdelivr.net/npm/[email protected]/dist/js-yaml.js | |
// @resource rxjs https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.3.3/rxjs.umd.js | |
// @grant unsafeWindow | |
// @grant GM_getResourceText | |
// ==/UserScript== | |
// https://github.com/plohoj/userscript-requirejs 引用npmjs的方法 | |
(function() { | |
'use strict'; | |
require(['yaml'], (yaml) => { | |
console.log(yaml.default); | |
unsafeWindow.yaml = yaml; | |
}); | |
require(['rxjs'], (rxjs) => { | |
console.log(rxjs); | |
}); | |
unsafeWindow.jQuery=jQuery; | |
unsafeWindow.$=jQuery; | |
// Your code here... | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment