Update PyBLØCK Widget.scriptable

This commit is contained in:
Satoshi Nakamoto 2022-04-23 23:47:25 +02:00 committed by GitHub
parent 3425631f62
commit a6c7241e18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
let req = new Request("https://mempool.space/api/blocks/tip/height");
let blockHeight = await req.loadString();
@ -14,6 +15,12 @@ hour = json.hourFee.toString();
let call = new Request('https://bitcoinexplorer.org/api/blockchain/coins');
let supply = await call.loadString();
let get = new Request('https://bitcoinexplorer.org/api/price/usd/sats');
let MoscowTime = await get.loadString();
let prin = new Request('https://bitcoinexplorer.org/api/price/usd');
let Price = await prin.loadString();
let widget = await createWidget();
// Check where the script is running
@ -47,15 +54,16 @@ async function createWidget()
// Add widget heading
let pyblock = listwidget.addText("PyBLØCK");
pyblock.centerAlignText();
pyblock.font = Font.boldRoundedSystemFont(50);
pyblock.textColor = new Color("#FFFFFF")
let sns = new Request('https://raw.githubusercontent.com/curly60e/pyblock/master/pybitblock/resources/images/Logo.PNG');
let pyp = await sns.loadImage();
let tt = listwidget.addImage(pyp).centerAlignImage()
let heading = listwidget.addText(blockHeight);
heading.centerAlignText();
heading.font = Font.boldSystemFont(70);
heading.textColor = new Color("#00FF7F");
let txs = listwidget.addText(tx + " - ▁▂▃▄▅▆▇█");
heading.textColor = new Color("#0aff17");
let txs = listwidget.addText("▁▂▃▄▅▆▇█ " + tx);
txs.centerAlignText();
txs.font = Font.boldSystemFont(13);
txs.textColor = new Color("#FFFFFF");
@ -77,12 +85,24 @@ async function createWidget()
mem.font = Font.boldSystemFont(30);
wdgDesc.textColor = new Color("#EEEEEE");
mem.textColor = new Color("#00FF7F");
mem.textColor = new Color("#0aff17");
let coin = listwidget.addText(supply + " ₿itcoin Supply");
let pr = listwidget.addText(Price + " $ = 1 ₿");
pr.centerAlignText();
pr.font = Font.boldSystemFont(11);
pr.textColor = new Color("#eeeeee")
let ms = listwidget.addText(MoscowTime +" Ș = 1 $");
ms.centerAlignText();
ms.font = Font.boldSystemFont(11);
ms.textColor = new Color("#0aff17")
let coin = listwidget.addText(supply + " Supply");
coin.centerAlignText();
coin.font = Font.boldSystemFont(10);
coin.textColor = new Color("#eeeeee")
coin.textColor = new Color("#EEEEEE")
let req = new Request('https://pbs.twimg.com/media/FIMmCzIWQAk_Ul_.png');
let SN = await req.loadImage();