-
Notifications
You must be signed in to change notification settings - Fork 22
/
PyBLOCK-Widget.scriptable
73 lines (73 loc) Β· 2.72 KB
/
PyBLOCK-Widget.scriptable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// PyBLΓCK Widget by PyBLΓCK-Crew
let req = new Request("https://mempool.space/api/blocks/tip/height");
let blockHeight = await req.loadString();
let count = new Request('https://blockchain.info/q/unconfirmedcount');
let tx = await count.loadString();
let make = new Request('https://mempool.space/api/v1/fees/recommended');
let json = await make.loadJSON();
fast = json.fastestFee.toString();
halfHour = json.halfHourFee.toString();
hour = json.hourFee.toString();
let call = new Request('https://blockchain.info/q/totalbc');
let supply = await call.loadString();
let get = new Request('https://blockchain.info/tobtc?currency=USD&value=1');
let MoscowTime = await get.loadString();
let prin = new Request('https://blockchain.info/q/24hrprice');
let Price = await prin.loadString();
let widget = await createWidget();
if (config.runsInWidget)
{
Script.setWidget(widget);
}
else
{
widget.presentLarge();
}
Script.complete();
async function createWidget()
{
let listwidget = new ListWidget();
listwidget.backgroundColor = new Color("#000000");
let nextRefresh = Date.now() + 1000*10
listwidget.refreshAfterDate = new Date(nextRefresh)
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("#0aff17");
let txs = listwidget.addText("βββββ
ββ " + tx + " βββ
ββββ");
txs.centerAlignText();
txs.font = Font.boldSystemFont(13);
txs.textColor = new Color("#FFFFFF");
let wdgDesc = listwidget.addText("π₯ π¨ π©");
let mem = listwidget.addText(fast + " " + halfHour + " " + hour);
wdgDesc.centerAlignText();
mem.centerAlignText();
wdgDesc.font = Font.boldSystemFont(10);
if(fast < 10)
mem.font = Font.boldSystemFont(30);
else if(fast < 100)
mem.font = Font.boldSystemFont(30);
else
mem.font = Font.boldSystemFont(30);
wdgDesc.textColor = new Color("#EEEEEE");
mem.textColor = new Color("#0aff17");
let pr = listwidget.addText(Price + " $ = 1 βΏitcoin");
pr.centerAlignText();
pr.font = Font.boldSystemFont(13);
pr.textColor = new Color("#EEEEEE")
let ms = listwidget.addText(MoscowTime +" Θats = 1 $");
ms.centerAlignText();
ms.font = Font.boldSystemFont(22);
ms.textColor = new Color("#0aff17")
let coin = listwidget.addText(supply + " Supply");
coin.centerAlignText();
coin.font = Font.boldSystemFont(13);
coin.textColor = new Color("#EEEEEE")
let req = new Request('https://pbs.twimg.com/media/E3IikexWYAQfqY2.png');
let SN = await req.loadImage();
let gn = listwidget.addImage(SN).centerAlignImage()
return listwidget;
}