diff --git a/widgets/darkjarod/futbol/README.md b/widgets/darkjarod/futbol/README.md new file mode 100644 index 00000000..3270204d --- /dev/null +++ b/widgets/darkjarod/futbol/README.md @@ -0,0 +1,84 @@ +# fútbol + +Live scores, standings, top scorers and news for 60 football leagues, cups and national-team competitions, plus the NFL, NBA, MLB and NHL. The data comes from ESPN's public API: no account, no key, no packages, and it works without Linux. + +Languages: English and Spanish (it follows the phone's language). + +## How to use it + +### Tabs + +- **matches**: today's matches of the selected league (or its latest day), then the next ones, grouped by day. Live matches show the minute in green, with goal scorers and red cards under the score. Tap a match to open it on ESPN. Tap an empty part of the tile to refresh. +- **table**: the standings, with the zones (Champions, relegation…) in ESPN's colours. For football, **goals** and **assists** show the league's top 25. Wide tiles add wins, draws and losses. +- **news**: the latest headlines for the selected league. Tap one to open the article on ESPN. +- **team**: the team you follow: its position and record, its next match and its latest results. + +### Leagues + +- Tap the league's name (top left) to open the picker, with every competition by group. Tap one to switch to it. +- The row of logos under the header holds your favourites, one tap away. Short tiles hide it. + +### Favourites + +- In the picker, tap **★ edit**, then tap leagues to star or unstar them. Up to 10 show in the row. +- To reorder them, tap a favourite in the row at the top of the picker and move it with **◀** and **▶**. Tap **done** to finish. + +### Following a team + +- In the **table** tab, tap a team to follow it; tap it again to stop. It is highlighted in the matches and the table, and fills the **team** tab. + +### Filters + +- In the picker, **● live only** shows only matches being played, and **★ my team only** only your team's. When nothing matches, **show all** turns them off. + +## Notes + +- Scores refresh every 2 minutes while the widget's page is on screen. +- The US leagues have standings, scores and news, but no scorers lists. +- Some competitions have no standings or statistics; the widget says so. + +## Release notes + +- **2.3**: reorder the favourite leagues; this guide. +- **2.2**: scores refresh every 2 minutes instead of every 30 seconds, to save battery. +- **2.1**: news tab, team tab, goals and assists, wins/draws/losses, live-only and my-team-only filters. +- **2.0**: first version in the store. + +--- + +# fútbol (español) + +Resultados en directo, clasificaciones, goleadores y noticias de 60 ligas, copas y competiciones de selecciones, además de la NFL, NBA, MLB y NHL. Los datos vienen de la API pública de ESPN: sin cuenta, sin clave, sin paquetes, y funciona sin Linux. + +## Cómo se usa + +### Pestañas + +- **partidos**: los partidos de hoy de la liga elegida (o de su última jornada) y los siguientes, agrupados por día. Los partidos en juego muestran el minuto en verde, con los goleadores y las tarjetas rojas bajo el marcador. Toca un partido para abrirlo en ESPN. Toca una zona vacía del widget para actualizar. +- **tabla**: la clasificación, con las zonas (Champions, descenso…) en los colores de ESPN. En fútbol, **goles** y **asistencias** muestran los 25 primeros de la liga. Los widgets anchos añaden ganados, empatados y perdidos. +- **noticias**: los últimos titulares de la liga elegida. Toca uno para abrir el artículo en ESPN. +- **equipo**: el equipo que sigues: su posición y balance, su próximo partido y sus últimos resultados. + +### Ligas + +- Toca el nombre de la liga (arriba a la izquierda) para abrir el selector, con todas las competiciones por grupos. Toca una para cambiar a ella. +- La fila de logos bajo la cabecera son tus favoritas, a un toque. Los widgets bajos la ocultan. + +### Favoritas + +- En el selector, toca **★ editar** y luego las ligas para marcarlas o desmarcarlas. En la fila caben hasta 10. +- Para ordenarlas, toca una favorita en la fila de arriba del selector y muévela con **◀** y **▶**. Toca **listo** para terminar. + +### Seguir a un equipo + +- En la pestaña **tabla**, toca un equipo para seguirlo; tócalo otra vez para dejar de seguirlo. Aparece resaltado en los partidos y en la tabla, y llena la pestaña **equipo**. + +### Filtros + +- En el selector, **● solo en directo** muestra solo los partidos en juego y **★ solo mi equipo** solo los de tu equipo. Si no hay ninguno, **ver todos** los desactiva. + +## Notas + +- Los resultados se actualizan cada 2 minutos mientras la página del widget está en pantalla. +- Las ligas de EE. UU. tienen clasificación, resultados y noticias, pero no listas de goleadores. +- Algunas competiciones no tienen clasificación o estadísticas; el widget lo indica. diff --git a/widgets/darkjarod/futbol/widget.owl b/widgets/darkjarod/futbol/widget.owl index ec4e3f77..afe6203f 100644 --- a/widgets/darkjarod/futbol/widget.owl +++ b/widgets/darkjarod/futbol/widget.owl @@ -1,7 +1,7 @@ widget "fútbol" { size: 6x4 minSize: 4x3 - meta { description: "Live scores, standings, top scorers and news from ESPN for 60 football leagues and cups, plus the NFL, NBA, MLB and NHL. Favourite leagues, a team to follow with its results and next match, filters"; version: "2.2"; license: "MIT"; category: "sport"; owl: 16 } + meta { description: "Live scores, standings, top scorers and news from ESPN for 60 football leagues and cups, plus the NFL, NBA, MLB and NHL. Favourite leagues, a team to follow with its results and next match, filters"; version: "2.3"; license: "MIT"; category: "sport"; owl: 16 } strings { en { @@ -35,7 +35,7 @@ widget "fútbol" { no_matches: "no upcoming matches" no_standings: "this competition has no standings" leagues_title: "leagues" - tap_mark: "tap to mark ★" + tap_mark: "★ mark · ◀ ▶ sort" edit_btn: "★ edit" done_btn: "done" team: "team" @@ -101,7 +101,7 @@ widget "fútbol" { no_matches: "no hay partidos próximos" no_standings: "esta competición no tiene clasificación" leagues_title: "ligas" - tap_mark: "toca para marcar ★" + tap_mark: "★ marca · ◀ ▶ ordena" edit_btn: "★ editar" done_btn: "listo" team: "equipo" @@ -148,6 +148,7 @@ widget "fútbol" { state tableMode = "table" state picking = false state editing = false + state moving = null source now = clock every 1m let api = "https://site.api.espn.com/apis/site/v2/sports" @@ -231,7 +232,8 @@ widget "fútbol" { ] let leagues = flatten(groups.map(g => g.leagues)) let pickerRows = flatten(groups.map(g => flatten([[{head: g.name}], chunk(g.leagues, 3).map(c => ({cells: c}))]))) - let favLeagues = leagues.filter(l => favs.any(f => f == l.id)).take(10) + let favLeagues = favs.map(f => leagues.find(l => l.id == f)).filter(l => l != null).take(10) + let movingAt = (favs.map((f, i) => ({f: f, i: i})).find(x => x.f == moving) ?? {i: -1}).i let current = leagues.find(l => l.id == league) ?? leagues[0] let us = current.us == true let sport = current.sport ?? "soccer" @@ -564,7 +566,7 @@ widget "fútbol" { // Every league, by group and importance, as a grid of logos. In edit mode a tap stars or unstars one. Popup { visible: picking - onDismiss: { picking = false; editing = false } + onDismiss: { picking = false; editing = false; moving = null } // Built only while open, and lazily: the tile shows at most 32 images at once. if picking { Column { @@ -575,6 +577,25 @@ widget "fútbol" { Text { text: editing ? str.tap_mark : str.leagues_title; style: label; color: editing ? accent : muted; weight: 1 } Button { text: editing ? str.done_btn : str.edit_btn; color: editing ? accent : muted; onTap: editing = !editing } } + if editing { + Row { + gap: 4 + align: center + Button { text: "◀"; color: movingAt > 0 ? accent : muted; onTap: favs = movingAt > 0 ? favs.map((f, i) => i == movingAt ? favs[movingAt - 1] : i == movingAt - 1 ? favs[movingAt] : f) : favs } + for l in favLeagues { + Box { + weight: 1 + align: center + padding: [0, 3] + radius: 4 * corners + background: l.id == moving ? alpha(accent, 0.35) : alpha(surface, 0.5) + onTap: moving = l.id == moving ? null : l.id + LeagueLogo { l: l; px: 20 } + } + } + Button { text: "▶"; color: movingAt >= 0 && movingAt < len(favs) - 1 ? accent : muted; onTap: favs = movingAt >= 0 && movingAt < len(favs) - 1 ? favs.map((f, i) => i == movingAt ? favs[movingAt + 1] : i == movingAt + 1 ? favs[movingAt] : f) : favs } + } + } Row { gap: 6 Box { onTap: onlyLive = !onlyLive; Chip { label: str.only_live; on: onlyLive } } @@ -583,7 +604,7 @@ widget "fútbol" { Column { lazy: true gap: 4 - height: 330 + height: editing ? 280 : 330 for row in pickerRows { if row.head != null { Text { text: row.head; style: label; color: muted; padding: [2, 6, 0, 0] } @@ -632,7 +653,7 @@ widget "fútbol" { Tabs { } } // The favourites, one tap away, where the tile is tall enough for them. - if !short { + if !short && !(picking && editing) { Row { gap: 4 for l in favLeagues {