Mine is the bottom, the top is official Wikipedia app's widget. It's been broken for months and I was sick of looking at it, so I made my own with Scriptable! I only had the Wikipedia app installed for this widget, so I guess I can delete it.
Only thing I haven't copied is the little graph that appears next to the view counts. Maybe someone better at JS than me can contribute to it.
Edit: In the hour since I made this, the Wikipedia API has changed. I'll have a look into it later, for the time being the widget is broken unfortunately
Edit 2: It works again! The API seems to be experimental at the moment
I've gone ahead and made a quick fix, see the GitHub page -- I think it might not be an API issue, some articles just might not have thumbnails - so I'm showing a placeholder there for now
I've gone ahead and made another edit to support small and medium widgets! As well as being able to directly tap on each article to go straight to it on Wikipedia.
That’s a welcome change I’ve added the clickable links myself just before 🤭
Haven’t found a way to make the rank number not blurry though 🤔
Also your workaround to show an UITable was smart, even if the presentation lacked customization, it was smart as one could make clicking « Top reads » text in the Widget to show the 50 top reads in the UItable, as the original Wikipedia does.
Also, unfortunately there’s no deeplink available to show directly the Top reads in Wikipedia.
I only realised the clickable links were possible when I accidentally stumbled across a .url property on widgetStacks on the docs! 😅
I think I will bring back the UItable for clicking on the top reads heading! It'd be nice to see the 50 top reads as you said the Wikipedia app did (I never realised that was there)
Also I can't seem to figure out what might be making your rank numbers blurry. Mine seem to be okay, I figured since I'm using SF symbols they should be nice and vectorised, at least until they are converted to an image when I display it in the widget 🤔
I've reintroduced UITable, but with more functionality! And made nicer placeholders for missing thumbnails, along with making sure the padding is even on the widgets. I'm really happy with the progress!
Do you think you could create a GitHub repo, so I could make PR ? I have some great idea : Multilanguage support set from widget's parameter, etc.
For now here's my idea :
// Lang set from widgetParameter, in the form of: "en", "de", "fr", etc..
let lang = args.widgetParameter || "en"
// Queryparameters are params passed trough URLScheme.
// When script is ran with an external uri + some params.
// This is required when clicking "Top read", since it runs the script
// itself trough an URLScheme.
if (args.queryParameters.lang != undefined) {
lang = args.queryParameters.lang
}
QueryParameters is required so that when you click "Top read" it run the Script (with the UITable) in the correct language.As such, you have to add an URL to the "Top read" string.
Example :
line = "scriptable:///run/" + Script.name() + "?lang="+lang;
Future improvement would be to localize the "Top read" string.
5
u/iiiKurt Jan 01 '24 edited Jan 04 '24
Mine is the bottom, the top is official Wikipedia app's widget. It's been broken for months and I was sick of looking at it, so I made my own with Scriptable! I only had the Wikipedia app installed for this widget, so I guess I can delete it.
Only thing I haven't copied is the little graph that appears next to the view counts. Maybe someone better at JS than me can contribute to it.
Link on GitHub
Edit: In the hour since I made this, the Wikipedia API has changed. I'll have a look into it later, for the time being the widget is broken unfortunately
Edit 2: It works again! The API seems to be experimental at the moment
1
u/Starmina Jan 03 '24 edited Jan 03 '24
Hello I would love to try it unfortunately the endpoint returns 404 :/
Edit : never mind it does work if I append the date as the script does, however it always throw an error.
Error on line 107:44: TypeError: undefined is not an object (evaluating ‘article.thumbnail.source’)