Skip to content

Commit

Permalink
nicer favorite menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Øyvind Nilsen committed Aug 29, 2024
1 parent fd113ee commit 1ceebdb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions yr.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
"nb": "kart/radar",
"nn": "kart/radar",
"sme": "kárta/rádár"
},
"myPlaces": {
"en": "My locations",
"nb": "Mine steder",
"nn": "Mine stader",
"sme": "Mu báikkit"
}
};

Expand Down Expand Up @@ -70,9 +76,9 @@
const locationPromises = combinedLocations.map(id => fetch(`https://www.yr.no/api/v0/locations/${id}?language=${lang_code}`).then(response => response.json()));
const locations = await Promise.all(locationPromises);

menu.innerHTML = '<ul>' + locations.map((location, index) => `
menu.innerHTML = '<h3 class="header-3 heading--color-primary">' + translations['myPlaces'][lang_code] + '</h3><ul>' + locations.map((location, index) => `
<li data-id="${location.id}" data-index="${index}">
${location.name}
<span class="header-4 heading--color-primary weather-location-list-item__location-heading">${favourites.includes(location.id) ? '⭐' : '🕛'} ${location.name}</span>
</li>`).join('') + '</ul>';
menu.style.display = 'block';
menu.style.opacity = '1';
Expand Down

0 comments on commit 1ceebdb

Please sign in to comment.