Looking to install the script? Click Here
You'll need Node.js 18 or newer.
git clone https://github.com/UCProjects/UnderScript.git
cd UnderScript
npm installnpm run buildbuilds the script once intodist/.npm startrebuilds whenever a file insrc/changes. It also includes files named*.local.js(or in a*.localfolder), which are left out of normal builds, and writes the translations tolang/underscript.ignore.json.- Files and folders with
.ignorein the name are never built or committed, so they're a good place for scratch work.
Install a userscript manager such as Tampermonkey, allow it to access file URLs, and add a script that loads your build. Chrome, Edge and Opera also need "Developer mode" turned on at chrome://extensions (edge://extensions, opera://extensions), or "Allow User Scripts" for Tampermonkey on Chrome 138 or newer:
// ==UserScript==
// @name UnderScript (dev)
// @match https://*.undercards.net/*
// @exclude https://*.undercards.net/*/*
// @run-at document-body
// @grant none
// @require https://unpkg.com/showdown@2.0.0/dist/showdown.min.js
// @require https://unpkg.com/popper.js@1.16.1/dist/umd/popper.min.js
// @require https://unpkg.com/tippy.js@4.3.5/umd/index.all.min.js
// @require https://unpkg.com/axios@0.21.4/dist/axios.min.js
// @require https://unpkg.com/luxon@1.28.0/build/global/luxon.min.js
// @require https://github.com/raw/feildmaster/SimpleToast/3.0.0/dist/simpletoast.js
// @require file:///path/to/UnderScript/dist/underscript.js
// ==/UserScript==The @require lines before the last one are copied from src/meta.js, which is the source of truth if they ever change. Tampermonkey does not re-read the header of a local script, so copy any change into it by hand. Disable the regular UnderScript while you test. If both are enabled, whichever loads second stops with "UnderScript loaded twice" in the console, and that may be your build.
npm run lintandnpm testshould pass.npm run csschecks the stylesheets.- Add a line to the
## Unreleasedsection of changelog.md for anything a player or plugin author would notice. Don't add a version number or date. - Don't include
lang/underscript.json, it's generated by the build. - Open the pull request against
master.
Community plugins are listed in plugins.json, which UnderScript fetches from master to populate the "Community Plugins" menu. To add a plugin, open a pull request with an entry:
{
"name": "Deck Tracker",
"author": "feildmaster",
"updateURL": "https://github.com/UCProjects/plugin-tracker/releases/latest/download/tracker.meta.js"
}namemust match the name the plugin passes tounderscript.plugin(name), otherwise UnderScript can't tell that it's already installed.updateURLpoints at anything the version can be read from: a userscript (or.meta.js) file, a gist, or a github release. The install link is taken from its@downloadURL, or from the release's.user.jsasset.downloadURLis optional, and only needed when the install link can't be derived fromupdateURL.
To try entries out before pushing them, declare the file as a plugins.json resource in your development userscript header:
// @grant GM_getResourceText
// @resource plugins.json file:///path/to/UnderScript/plugins.jsonEnglish strings live in lang/en. To translate them into another language, generate a template from your language code (for example fr):
npm install
npm run lang -- frThis creates lang/fr/*.json, with one file per English file. Each string appears twice: a // line with the English text, and the real key with an empty value for you to fill in.
"//dismiss": "Dismiss",
"dismiss": "Fermer"- Only edit the values. Leave the
//lines alone, they're just there for reference. - Strings left empty fall back to English, so a partial translation is fine. An array (a list of strings) is only used once every entry in it is filled in.
- Keep placeholders such as
$1and{{...}}in your translation exactly as they are. - Run the command again after pulling changes. It adds new strings, never overwrites your translations, and prints how many are left in each file.
- If the English text of a string you already translated changes, its comment becomes
//dismiss!. Review your translation, then remove the!from the key to clear the flag. - Keys that no longer exist in English are moved to the bottom of the file and reported as unknown. Delete them or move them to the right key.
lang/underscript.json is generated by the build, so don't edit it or include it in your pull request.