Skip to content

Instantly share code, notes, and snippets.

@cassmtnr
Last active October 9, 2020 03:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cassmtnr/6dd964587c4846a0a937e53391e8d91c to your computer and use it in GitHub Desktop.
Save cassmtnr/6dd964587c4846a0a937e53391e8d91c to your computer and use it in GitHub Desktop.
Scriptable quantity downloads
let quantity = "500.000";
let widget = new ListWidget();
let widgetInputRAW = args.widgetParameter;
if (widgetInputRAW) {
try {
widgetInputRAW.toString();
if (widgetInputRAW.toString() !== "") {
quantity = widgetInputRAW.toString();
}
} catch (e) {
throw new Error("Please long press the widget and add a parameter.");
}
}
widget.backgroundColor = new Color("#FEFFA9");
let qt = widget.addText(quantity);
qt.font = Font.semiboldSystemFont(24);
qt.textColor = Color.black();
const label = "DOWNLOADS!!";
let text = widget.addText(label);
text.font = Font.semiboldSystemFont(16);
text.textColor = Color.black();
Script.setWidget(widget);
widget.presentSmall();
Script.complete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment