Last active
July 9, 2025 12:59
Revisions
-
jacopocolo revised this gist
Aug 18, 2020 . 1 changed file with 10 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,12 @@ // Variables used by Scriptable. // These must be at the very top of the file. Do not edit. // icon-color: black; icon-glyph: user-md; // just replace the url below with the url if the channel you want to use // image channels only, doesnt supoort text or anything else const channel = 'https://www.are.na/una/color-tx32pz_qsu0' const url = 'https://api.are.na/v2/channels/'+channel.substring(channel.lastIndexOf('/') + 1)+'/contents'; const req = new Request(url) const res = await req.loadJSON() const randomBlock = await res.contents[Math.floor(Math.random() * res.contents.length)]; @@ -18,11 +23,13 @@ if (config.runsInWidget) { Safari.open("https://are.na/block/"+id) } function createWidget(title, img) { let w = new ListWidget() w.backgroundColor = new Color("#1A1A1A") w.centerAlignContent() let image = w.addImage(img); image.centerAlignImage(); image.imageSize = new Size(150,150) return w } -
jacopocolo created this gist
Aug 17, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // Variables used by Scriptable. // These must be at the very top of the file. Do not edit. // icon-color: black; icon-glyph: user-md; const url = `https://api.are.na/v2/channels/archillect-selects/contents` const req = new Request(url) const res = await req.loadJSON() const randomBlock = await res.contents[Math.floor(Math.random() * res.contents.length)]; const id = randomBlock.id const i = await new Request(randomBlock.image.square.url); const img = await i.loadImage(); if (config.runsInWidget) { // create and show widget let widget = createWidget("Are.na random image", img) Script.setWidget(widget) Script.complete() } else { Safari.open("https://are.na/block/"+id) } function createWidget(title, img) { let w = new ListWidget() w.backgroundColor = new Color("#000000") w.centerAlignContent() let image = w.addImage(img); image.centerAlignImage(); return w }