Widget Examples

That’s a really beautiful and clean widget, great work! Above all, I like that it’s build modularly and lets the user rearrange elements.
On my device, I added a battery indicator instead of the greeting message, which is may more useful for me. If anyone’s interested: https://gist.github.com/anga83/ffbdf6d0f544a01203aa1f093167460e

3 Likes

thank you. looks great!

Here is a simple widget to display the bin collection schedule for South Cambridgeshire (England). No fancy layout or graphics…

3 Likes

Ahoj, můžeš mi prosím sdílet kód. Díky

Oh nice, I was actually planning to add battery next! I was thinking of doing it “Apple Watch” style like the high/low temperatures, but I love the clever use of SFSymbols!

I recreated Greg Joswiak’s widget that counts down to the Apple Event on October 13th :smiley:

Get the script here: https://gist.github.com/simonbs/8dd0735d0cdffb7616b812d849cfc695

7 Likes

Continuing the discussion from Widget Examples:

Hi - can you share your script for this please? I’m learning Swedish and would find this useful. Thanks!

How do I use refreshAfterDate? My widget basically just needs a single refresh after midnight.

Getting this error when trying to use this code.

Error on line 109:29: TypeError: undefined is not an object (evaluating ‘weatherData.current.weather’)

I added my api key and long and lat etc. is there something else I am missing?

When did you claim your API key? For me it took several hours for it to start working, and I didn’t get a notification or anything unfortunately.

It was just about 25 min ago. I will wait and give it some time. Thanks

Hey, I’m getting this error, any idea why?

1 Like

(Sorry for spamming so much about an AdGuard widget on here, but I promise I’ll try and remove this stuff after I’ve gotten the widget)

So, If anyone can make a widget for AdGuard that looks like this, that would take you too the AdGuard app (scheme URL: adguard-pro:// or adguard:// ), I would be very thankful!!! (Umm… dark mode is preferred, and I’m hoping that the buttons and Color of the icons would change according to the status if it’s on or off)

I just want to say thanks for posting this, and for structuring and documenting it so beautifully — I feel like am learning more Javascript reading through this than I have in all my fumbling about with StackOverflow etc. for the last few months.

Edit: I mean, this line alone is worth a beer — I can think of all kinds of applications for it.

const eventsAreVisible = (futureEvents.length > 0) && (numberOfEvents > 0)

3 Likes

That is wonderful to hear. I am definitely learning as I go as well – one reason I document so heavily is to make sure I understand what’s going on. Also, Javascript is just such a fun and expressive language too.

And trust me that line of code came at the end of hours of strife trying to figure out some bugs!

It looks amazing. I tried to put it in my phone (iphone 7) and found the space is not enough if there are 3 events shows on the medium widge.But thanks for your great notes in the code, I modified according it and got a perfect result.

4 Likes

Welcome @Lewis_Gale. I’m afraid you don’t show the offending line.

Sorry I’m still new to all of this, and trying to learn. What do you mean by that?

He means in your screenshot you did not show the line that caused the error.

1 Like

Ah my bad, here is a screenshot.
Also if it helps… it’s for the Apple event countdown script.

1 Like