Skip to content

Commit

Permalink
First upload
Browse files Browse the repository at this point in the history
  • Loading branch information
stefannienhuis committed Aug 11, 2018
0 parents commit af36033
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ISC License (ISC)

Copyright 2018 stefannienhuis

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR

23 changes: 23 additions & 0 deletions MMM-Buienradar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
* MMM-Buienradar
*
* stefannienhuis
* ISC Licensed.
*
*/

.mapContainer {
height: 310px;
width: 310px;
}

.map {
margin-left: -10px;
margin-top: -10px; /*-25*/
height: 330px;
width: 330px;
overflow: hidden;
border: none;
-webkit-transform: scale(calc(310 / 330));
}
56 changes: 56 additions & 0 deletions MMM-Buienradar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* Magic Mirror
* Module: MMM-Buienradar
*
* By stefannienhuis
* ISC Licensed.
*/

Module.register("MMM-Buienradar", {
defaults: {
lat: 52.1015474, // latitude
lon: 5.1758052, // longitude
zoom: 1 // 4: city, 3: region, 2: province, 1: country
},

getScripts: function() {
return ['https://www.amcharts.com/lib/3/amcharts.js', 'https://www.amcharts.com/lib/3/serial.js', 'https://www.amcharts.com/lib/3/themes/light.js']
},

getStyles: function() {
return ['MMM-Buienradar.css']
},

getDom: function() {
var mapContainer = document.createElement('div');
mapContainer.className = 'mapContainer';

var zoom;

console.error(this.config.zoom);

switch (this.config.zoom) {
case 4:
zoom = 13;
break;
case 3:
zoom = 11;
break;
case 2:
zoom = 8;
break;
case 1:
zoom = 6;
break;
default:
zoom = 6;
break;
}

var frame = document.createElement('iframe');
frame.className = 'map';
frame.src = 'https://gadgets.buienradar.nl/gadget/zoommap/?lat=' + this.config.lat + '&lng=' + this.config.lon + '&overname=2&zoom=' + zoom + '&size=2b&voor=0';
mapContainer.appendChild(frame);

return mapContainer;
}
});
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# MMM-Buienradar

This is a module for the [MagicMirror²](https://github.com/MichMich/MagicMirror/).

This module will show a map with weather the forecast provided by [Buienradar](https://www.buienradar.nl).

**Note:** Since this module uses [Buienradar](https://www.buienradar.nl), this module will only work for locations in the Netherlands & Belgium

## Installation
1. Navigate to your MagicMirror's modules folder, and run the following command: `git clone https://github.com/StefanNienhuis/MMM-Buienradar.git`
2. Add the module and a valid configuration to your `config/config.js` file

## Using the module

This is an example configuration for your `config/config.js` file:
```js
var config = {
modules: [
{
module: 'MMM-Buienradar',
position: 'top_left',
config: {
lat: 52.1015474,
lon: 5.1758052,
zoom: 1
}
}
]
}
```

## Configuration options

| Option | Description
|----------------- |-----------
| `lat` | *Required* The latitude of the location
| `lon` | *Required* The longitude of the location
| `zoom` | *Optional* The zoom level of the map (1 - 4)<br>*Default*: 1
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "MMM-Buienradar",
"version": "1.0.0",
"description": "Todo: Insert description here!",
"main": "MMM-Buienradar.js",
"author": "stefannienhuis",
"license": "ISC"
}

0 comments on commit af36033

Please sign in to comment.