User Script Hosting

From GreaseSpot Wiki
Revision as of 04:06, 12 December 2019 by Gholk (talk | contribs) (hack url and using pastebin)
Jump to navigationJump to search

Greasy Fork

https://greasyfork.org/

Created by the maintainer of http://userstyles.org/. HTTPS is available and enforced by default. Open source, hosted on GitHub.

OpenUserJS.org

https://openuserjs.org/

"The home of FOSS user scripts." Only HTTPS is available. Open source, hosted on GitHub.

Gist

https://gist.github.com/

Gist is GitHub's "paste" service, where any set of simple files can be pasted into a web form and saved. Gist files may be named. If they are given the .user.js suffix, then the raw link for the gist will serve perfectly as an install. HTTPS is available and used by default.

The Whole Internet

Any server across the entire web may host user scripts. For Greasemonkey, the only requirement is that the (entire) URL ends with .user.js and that it is not served with a text/html content type. Servers supporting HTTPS are best, in order to be compatible with Greasemonkey's built in update checker.

Hack the URL

If you host your script on some websites that you can not custom url, you can append the url with query string or hash fragment , making it ending with .user.js , so greasemonkey could recognize it. Most websites just skip unexpected query string in url, so it will not result in error in accessing webpage. Because hash fragment only works in client side, adding hash fragment will not crash webpage, too. (if website had not stored information in hash fragment for client side routing or what.)

For example, a webpage with url https://pastebin.com/raw/zxASqw12 :

Therefore, url end with *.user.js , and greasemonkey will recognize it.

pastebin

https://pastebin.com/

The advantage of pastebin is that it does not require regist, allowing anonymous paste, so you can host user script anonymous.

When you make a paste on pastebin, you will get a url with hash, like https://pastebin.com/zxASqw12, which link to a webpage containing your code. However, the page is a webpage but not responsed without Content-Type: text/html , and its url is not ending with *.user.js

To get a url responsed without Content-Type: text/html and containing only user script code, you should click the raw button on the webpage, or add /raw to url, like https://pastebin.com/raw/zxASqw12

To make url end with *.user.js , you can add querystring or hash fragment. Add query string: https://pastebin.com/raw/zxASqw12?file=somename.user.js