anyone who want to show a google staticmap on there mirror. Here is the code:
/* global Module */
/* Magic Mirror
* Module: staticmap
*
*/
Module.register("staticmap",{
defaults: {
center: "new york",
zoom: 14,
mapwidth: 600,
mapheight: 500,
highway: "on",
arterial: "on",
local: "on"
},
start: function(){
Log.info('Starting module: ' + this.name);
},
getDom: function() {
var wrapper = document.createElement("div");
var img = document.createElement("img");
img.src = "https://maps.googleapis.com/maps/api/staticmap?center=" + this.config.center +
"&zoom=" + this.config.zoom +
"&size=" + this.config.mapwidth + "x" + this.config.mapheight +
"&maptype=roadmap" +
"&style=feature:road.highway|visibility:" + this.config.highway +
"&style=feature:road.arterial|visibility:" + this.config.arterial +
"&style=feature:road.local|visibility:" + this.config.local +
"&style=feature:road|invert_lightness:true|saturation:-100|weight:1|lightness:1" +
"&style=feature:administrative|invert_lightness:true|saturation:-100|weight:1|lightness:1|visibility:on" +
"&style=feature:poi|invert_lightness:true|weight:1|saturation:-100|lightness:1|visibility:on" +
"&style=feature:transit|invert_lightness:true|saturation:-100|lightness:1|weight:1|visibility:on" +
"&style=feature:landscape|invert_lightness:true|weight:1|saturation:-100|lightness:1|visibility:on" +
"&style=feature:water|invert_lightness:true|weight:1|saturation:-100|lightness:1|visibility:on" +
"&style=feature:road|element:labels.text.fill|lightness:100" +
"&style=feature:road|element:labels.text.stroke|lightness:-100";
img.width = this.config.mapwidth;
img.height = this.config.mapheight;
wrapper.appendChild(img);
return wrapper;
}
});