// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://bbs.tampermonkey.net.cn/
// @resource JS https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js
// @resource CSS https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css
// @grant GM_getResourceText
// @grant GM_addStyle
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
unsafeWindow.eval(GM_getResourceText("JS"))
GM_addStyle(GM_getResourceText("CSS"));
toastr.info('Are you the 6 fingered man?')
})();
GG,感觉可以直接通过resource+eval的方式变相require原js,这样就不用魔改了
不清楚greasyfork支不支持这样
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://bbs.tampermonkey.net.cn/
// @resource JS https://raw.githubusercontent.com/eligrey/FileSaver.js/master/dist/FileSaver.min.js
// @grant GM_getResourceText
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
unsafeWindow.eval(GM_getResourceText("JS"))
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
saveAs(blob, "hello world.txt");
})();
然后https://bbs.tampermonkey.net.cn/thread-1146-1-1.html这篇也不需要with了