FR: Support libraries with the `Import scripts` feature
References:
* https://sourceforge.net/p/greasemonkey/wiki/Metadata_Block/
* https://openuserjs.org/about/Userscript-Beginners-HOWTO#what-is-a-library-script-
---
There are at least two ways of identifying libraries:
* The use of `==UserLibrary==` in the metadata block
* File extension of `.js` and NOT `.user.js`
It would be nice if, when using the import feature, either or both of those could be used to mark a new import as a library rather than a script. (and perhaps rejecting if there is a mismatch)
---
I cannot recall where I read this, but one recommendation I saw (and one I use), is that the metadata block should look like the following for best compatibility between suppliers (GF, OUJS) and managers (GM, VM, TM, FM).
```
// ==UserScript==
// ==UserLibrary==
// @name Name
// @description Base library usable any time.
// @version 123
// @license GPL-3.0-or-later; https://www.gnu.org/licenses/gpl-3.0-standalone.html
// @homepageURL https://github.com/octocat/userscripts
// @supportURL https://github.com/octocat/userscripts/issues
// @match https://www.example.com/*
// ==/UserLibrary==
// ==/UserScript==
```
(I forget which system actually requires the `@match`, but I want to say it was GF.)
关闭于 2026-03-29 1 条评论