Widget Examples

hi, this is exactly what i was looking for @pdizin or @mzeryck is it possible for you to incorporate the reminder function in the last version of @mzeryck modular widget. it would be a dream if the reminder app would open when you click on the reminder. thank you for your work! unfortunately i have no experience in programming.

Hi supermamon!

Thank you so much for your work on making it possbile to make transparent widgets!

Unfortunately I’m not able to make them using your instructions. Could you maybe help me on getting them to work on my new iPhone 12 Pro? I would love to have a transparent medium widget on the top my first homescreen.

I downloaded your “no-background.js module”, “No Background Config.js Script” and “Widget template” in my Scriptable App but was not able to get them to work. If I try to run “no-background.js module” : nothing happens
“No Background Config.js Script” : Error on line 14:26 No file to import at no-background.js
"“Widget Template” : Error on line 6:26 No file to import at no-background.js

Would be awesome if you could help my figure it out :slight_smile:

Can you add the actual weather to the right side of the header of the calendar widget?

Thanks a lot @akerr :blush:

1 Like

It’s gonna sound silly but try re-downloading no-background.js then run the config again.

Thanks for your reply! I tried it but now I’m getting this error message:

Error on line 225:27 Type error: undefined is not an object (evaluating ‘items’)

Any help on getting it to work? :slight_smile:

Here’s my contribution to the widgetsphere (building upon r/Slowlydev and @marco79): WeatherCal displays 4 compact sections with hourly, daily, sunrise/sunset, and upcoming event data. I tried to organize things effectively to make it easy for others to switch out my modules with whatever works best for them (like the day and date instead of sunrise data).

7 Likes

Hello eqsOne: I tried to scrape data from https://geoportal.essen.de/covid19/ but it won‘t work. I think it is not a classical html site. Do you have a clue how to scrape data from this website?

Hi Simon,

I’ve been using your launcher code, and it works great, but I am having to open files app and download app icons before it works. I have tried to add in fm.downloadFileFromiCloud in multiple places but am unable to get this to work.

Any help would be appreciated!

This is great, thanks so much for sharing. I’m a complete novice, but I got it to work (other than the Sonos feature, which is beyond me). When I tap on the widget, it momentarily opens Scriptable before it passes on to Spotify. Is this Scriptable pop-up avoidable? (Or perhaps I just managed to mess something up.) Thanks!

This one looks great @grantavery! Will try to create something similar. Love the fact that it looks like the shortcuts widget from Apple.

I had the same error and think I figured 2 problems. Feel free to correct me if I am wrong supermamon but I believe those 2 issues are just simple typos. In the no-background.js module line 61 has a period in stead of a comma. Line 61 should read:

“await presentAlert(message,[“OK”],ALERTS_AS_SHEETS)”

The second issue is that line 240 incorrectly identifies the iPhone 12 screen size as 2352, when in fact it is 2532. If you make both the changes it should work.

1 Like

Working on a sunrise/sunset widget:

Unfortunately I can’t get the layout the way I want:

  • 4 (aligned) columns per line (image, hours, colon & minutes)
  • image, hours, colon & minutes vertically centered
  • minutes & hours right-aligned

Any tips on how to achieve this layout?

PS @simonbs: is there a bug in time formatting? Even though I use numeric (not 2-digit) I still get a leading zero in the sunset hour…

@gentlel Nope, sorry. Looks like the required DOM elements are generated dynamically. Here is a snippet that logs what WebView can see:

await loadCnt()

Script.complete()

async function loadCnt() {
  let url='https://geoportal.essen.de/covid19/'
  let wbv = new WebView()
  await wbv.loadURL(url)
  
  //This logs available html stuff:
  let x = await wbv.getHTML(url)
  log(x)
}

@klaus_schuser Well done, great!

thanks, I have fixed those now. @bottecla, you’ll need to re-download the module and try again.

1 Like

@rob, If you would like to get rid of the leading zero, JavaScript is your friend:

('0'+minutes).slice(-2)

See my widget as well (lines 159 and following).

Can you please explain that code?

I think it takes care of adding a leading zero, not removing it?

Yes, it adds a leading zero. Did I understand you wrong? Try it on your browser console, for example:

new Date().getMinutes().toString().slice(-2)

or even simpler:

('0'+"02").slice(-2)
// "02"
1 Like

Did I understand you wrong?

Looks like that; I want “7:24” instead of “07:24” (remove the trailing zero from the hours).

toLocaleTimeString should do this when using option “numeric” (instead of “2-digit”), but I still get the leading zero (bug in Scriptable/iOS?).

There’s a DateFormatter object in Scriptable that you could use.

1 Like