smashing install 688c9a1a135fcebbbb3332e9cd8e8c82
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="airparif" data-view="Airparif" data-title="Airparif"></div>
</li>
| class Dashing.Airparif extends Dashing.Widget |
| <h1 data-bind="title" data-showif="title"></h1> | |
| <img data-bind-src="image" alt="Airparif"/> | |
| <p class="updated-at" data-bind="updatedAtMessage"></p> |
| require 'open-uri' | |
| url = 'https://namek.airparif.fr/geoserver/prev_horair/wms?&service=WMS&request=GetMap&layers=prev_horair%3Aindice%2Cprev_horair%3AcommunesIDF&styles=&format=image%2Fpng&transparent=true&version=1.1.0&width=1024&height=768&srs=EPSG%3A3857&bbox=160357,6126721,397357,6316721' | |
| SCHEDULER.every '5m', first_in: 0 do | |
| image = nil | |
| begin | |
| URI.open(url) do |io| | |
| image = io.read | |
| end | |
| rescue StandardError => e | |
| puts("ERROR: Unable to download Airparif map: #{e}") | |
| next | |
| end | |
| send_event('airparif', | |
| image: "data:image/png;base64,#{Base64.strict_encode64(image)}") | |
| end |
| // ---------------------------------------------------------------------------- | |
| // Sass declarations | |
| // ---------------------------------------------------------------------------- | |
| $background-color: #50A4AF; | |
| // ---------------------------------------------------------------------------- | |
| // Widget-airparif styles | |
| // ---------------------------------------------------------------------------- | |
| .widget-airparif { | |
| background-color: $background-color; | |
| } |