mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
cleanup
This commit is contained in:
parent
1920f8158e
commit
10bc326490
15
css/main.css
15
css/main.css
@ -95,7 +95,7 @@ body {
|
|||||||
header {
|
header {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-family: "Roboto Condensed";
|
font-family: "Roboto Condensed", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
border-bottom: 1px solid #666;
|
border-bottom: 1px solid #666;
|
||||||
line-height: 15px;
|
line-height: 15px;
|
||||||
@ -151,6 +151,7 @@ sup {
|
|||||||
|
|
||||||
.region.right {
|
.region.right {
|
||||||
right: 0;
|
right: 0;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.region.top {
|
.region.top {
|
||||||
@ -161,6 +162,10 @@ sup {
|
|||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.region.bottom .container {
|
||||||
|
margin-top: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.region.top .container:empty {
|
.region.top .container:empty {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@ -185,10 +190,6 @@ sup {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.region.bottom .container {
|
|
||||||
margin-top: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.region.bottom .container:empty {
|
.region.bottom .container:empty {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
@ -231,10 +232,6 @@ sup {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.region.right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.region table {
|
.region table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
|
@ -17,30 +17,30 @@ WeatherProvider.register("darksky", {
|
|||||||
fetchCurrentWeather: function() {
|
fetchCurrentWeather: function() {
|
||||||
this.fetchData(this.getUrl())
|
this.fetchData(this.getUrl())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
Log.log(data);
|
|
||||||
if(!data || !data.currently || typeof data.currently.temperature === "undefined") {
|
if(!data || !data.currently || typeof data.currently.temperature === "undefined") {
|
||||||
// No usable data?
|
// No usable data?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentWeather = this.generateWeatherDayFromCurrentWeather(data);
|
var currentWeather = this.generateWeatherDayFromCurrentWeather(data);
|
||||||
this.setCurrentWeather(currentWeather);
|
this.setCurrentWeather(currentWeather);
|
||||||
}).catch(function(request) {
|
}).catch(function(request) {
|
||||||
Log.error("Could not load data!", request);
|
Log.error("Could not load data ... ", request);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchWeatherForecast: function() {
|
fetchWeatherForecast: function() {
|
||||||
this.fetchData(this.getUrl())
|
this.fetchData(this.getUrl())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
Log.log(data);
|
|
||||||
if(!data || !data.daily || !data.daily.data.length) {
|
if(!data || !data.daily || !data.daily.data.length) {
|
||||||
// No usable data?
|
// No usable data?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var forecast = this.generateWeatherObjectsFromForecast(data.daily.data);
|
var forecast = this.generateWeatherObjectsFromForecast(data.daily.data);
|
||||||
this.setWeatherForecast(forecast);
|
this.setWeatherForecast(forecast);
|
||||||
}).catch(function(request) {
|
}).catch(function(request) {
|
||||||
Log.error("Could not load data!", request);
|
Log.error("Could not load data ... ", request);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ WeatherProvider.register("openweathermap", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setFetchedLocation(data.name + ', ' + data.sys.country)
|
this.setFetchedLocation(`${data.name}, ${data.sys.country}`);
|
||||||
|
|
||||||
var currentWeather = this.generateWeatherObjectFromCurrentWeather(data)
|
var currentWeather = this.generateWeatherObjectFromCurrentWeather(data);
|
||||||
this.setCurrentWeather(currentWeather)
|
this.setCurrentWeather(currentWeather);
|
||||||
})
|
})
|
||||||
.catch(function(request) {
|
.catch(function(request) {
|
||||||
Log.error("Could not load data ... ", request)
|
Log.error("Could not load data ... ", request);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -46,13 +46,13 @@ WeatherProvider.register("openweathermap", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setFetchedLocation(data.city.name + ', ' + data.city.country)
|
this.setFetchedLocation(`${data.city.name}, ${data.city.country}`);
|
||||||
|
|
||||||
var forecast = this.generateWeatherObjectsFromForecast(data.list)
|
var forecast = this.generateWeatherObjectsFromForecast(data.list);
|
||||||
this.setWeatherForecast(forecast)
|
this.setWeatherForecast(forecast);
|
||||||
})
|
})
|
||||||
.catch(function(request) {
|
.catch(function(request) {
|
||||||
Log.error("Could not load data ... ", request)
|
Log.error("Could not load data ... ", request);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -63,45 +63,45 @@ WeatherProvider.register("openweathermap", {
|
|||||||
* Gets the complete url for the request
|
* Gets the complete url for the request
|
||||||
*/
|
*/
|
||||||
getUrl: function() {
|
getUrl: function() {
|
||||||
return this.config.apiBase + this.config.apiVersion + this.config.weatherEndpoint + this.getParams()
|
return this.config.apiBase + this.config.apiVersion + this.config.weatherEndpoint + this.getParams();
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate a WeatherObject based on currentWeatherInformation
|
* Generate a WeatherObject based on currentWeatherInformation
|
||||||
*/
|
*/
|
||||||
generateWeatherObjectFromCurrentWeather: function(currentWeatherData) {
|
generateWeatherObjectFromCurrentWeather: function(currentWeatherData) {
|
||||||
var currentWeather = new WeatherObject()
|
var currentWeather = new WeatherObject();
|
||||||
|
|
||||||
currentWeather.humidity = currentWeatherData.main.humidity
|
currentWeather.humidity = currentWeatherData.main.humidity;
|
||||||
currentWeather.temperature = currentWeatherData.main.temp
|
currentWeather.temperature = currentWeatherData.main.temp;
|
||||||
currentWeather.windSpeed = currentWeatherData.wind.speed
|
currentWeather.windSpeed = currentWeatherData.wind.speed;
|
||||||
currentWeather.windDirection = currentWeatherData.wind.deg
|
currentWeather.windDirection = currentWeatherData.wind.deg;
|
||||||
currentWeather.weatherType = this.convertWeatherType(currentWeatherData.weather[0].icon)
|
currentWeather.weatherType = this.convertWeatherType(currentWeatherData.weather[0].icon);
|
||||||
currentWeather.sunrise = moment(currentWeatherData.sys.sunrise, "X")
|
currentWeather.sunrise = moment(currentWeatherData.sys.sunrise, "X");
|
||||||
currentWeather.sunset = moment(currentWeatherData.sys.sunset, "X")
|
currentWeather.sunset = moment(currentWeatherData.sys.sunset, "X");
|
||||||
|
|
||||||
return currentWeather
|
return currentWeather;
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate WeatherObjects based on forecast information
|
* Generate WeatherObjects based on forecast information
|
||||||
*/
|
*/
|
||||||
generateWeatherObjectsFromForecast: function(forecasts) {
|
generateWeatherObjectsFromForecast: function(forecasts) {
|
||||||
var days = []
|
var days = [];
|
||||||
|
|
||||||
for (var forecast of forecasts) {
|
for (var forecast of forecasts) {
|
||||||
var weather = new WeatherObject()
|
var weather = new WeatherObject();
|
||||||
|
|
||||||
weather.date = moment(forecast.dt, "X")
|
weather.date = moment(forecast.dt, "X");
|
||||||
weather.minTemperature = forecast.temp.min
|
weather.minTemperature = forecast.temp.min;
|
||||||
weather.maxTemperature = forecast.temp.max
|
weather.maxTemperature = forecast.temp.max;
|
||||||
weather.weatherType = this.convertWeatherType(forecast.weather[0].icon)
|
weather.weatherType = this.convertWeatherType(forecast.weather[0].icon);
|
||||||
weather.rain = forecast.rain
|
weather.rain = forecast.rain;
|
||||||
|
|
||||||
days.push(weather)
|
days.push(weather);
|
||||||
}
|
}
|
||||||
|
|
||||||
return days
|
return days;
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -127,9 +127,9 @@ WeatherProvider.register("openweathermap", {
|
|||||||
"11n": "night-thunderstorm",
|
"11n": "night-thunderstorm",
|
||||||
"13n": "night-snow",
|
"13n": "night-snow",
|
||||||
"50n": "night-alt-cloudy-windy"
|
"50n": "night-alt-cloudy-windy"
|
||||||
}
|
};
|
||||||
|
|
||||||
return weatherTypes.hasOwnProperty(weatherType) ? weatherTypes[weatherType] : null
|
return weatherTypes.hasOwnProperty(weatherType) ? weatherTypes[weatherType] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* getParams(compliments)
|
/* getParams(compliments)
|
||||||
@ -144,7 +144,7 @@ WeatherProvider.register("openweathermap", {
|
|||||||
} else if(this.config.location) {
|
} else if(this.config.location) {
|
||||||
params += "q=" + this.config.location;
|
params += "q=" + this.config.location;
|
||||||
} else if (this.firstEvent && this.firstEvent.geo) {
|
} else if (this.firstEvent && this.firstEvent.geo) {
|
||||||
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon
|
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon;
|
||||||
} else if (this.firstEvent && this.firstEvent.location) {
|
} else if (this.firstEvent && this.firstEvent.location) {
|
||||||
params += "q=" + this.firstEvent.location;
|
params += "q=" + this.firstEvent.location;
|
||||||
} else {
|
} else {
|
||||||
@ -157,5 +157,5 @@ WeatherProvider.register("openweathermap", {
|
|||||||
params += "&APPID=" + this.config.apiKey;
|
params += "&APPID=" + this.config.apiKey;
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
},
|
}
|
||||||
});
|
});
|
@ -16,7 +16,6 @@
|
|||||||
padding-bottom: 6px;
|
padding-bottom: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.weather .day {
|
.weather .day {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 25px;
|
padding-right: 25px;
|
||||||
@ -38,9 +37,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.weather tr.colored .min-temp {
|
.weather tr.colored .min-temp {
|
||||||
color: #BCDDFF;
|
color: #bcddff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.weather tr.colored .max-temp {
|
.weather tr.colored .max-temp {
|
||||||
color: #FF8E99;
|
color: #ff8e99;
|
||||||
}
|
}
|
||||||
|
@ -59,16 +59,12 @@ Module.register("weather",{
|
|||||||
|
|
||||||
// Return the scripts that are nessecery for the weather module.
|
// Return the scripts that are nessecery for the weather module.
|
||||||
getScripts: function () {
|
getScripts: function () {
|
||||||
var scripts = [
|
return [
|
||||||
"moment.js",
|
"moment.js",
|
||||||
"weatherprovider.js",
|
"weatherprovider.js",
|
||||||
"weatherobject.js"
|
"weatherobject.js",
|
||||||
|
this.file("providers/" + this.config.weatherProvider.toLowerCase() + ".js")
|
||||||
];
|
];
|
||||||
|
|
||||||
// Add the provider file to the required scripts.
|
|
||||||
scripts.push(this.file("providers/" + this.config.weatherProvider.toLowerCase() + ".js"));
|
|
||||||
|
|
||||||
return scripts
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override getHeader method.
|
// Override getHeader method.
|
||||||
@ -93,7 +89,7 @@ Module.register("weather",{
|
|||||||
this.addFilters();
|
this.addFilters();
|
||||||
|
|
||||||
// Schedule the first update.
|
// Schedule the first update.
|
||||||
this.scheduleUpdate(0);
|
this.scheduleUpdate(this.config.initialLoadDelay);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override notification handler.
|
// Override notification handler.
|
||||||
@ -112,12 +108,10 @@ Module.register("weather",{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (notification === "INDOOR_TEMPERATURE") {
|
||||||
if (notification === "INDOOR_TEMPERATURE") {
|
|
||||||
this.indoorTemperature = this.roundValue(payload);
|
this.indoorTemperature = this.roundValue(payload);
|
||||||
this.updateDom(300);
|
this.updateDom(300);
|
||||||
}
|
} else if (notification === "INDOOR_HUMIDITY") {
|
||||||
if (notification === "INDOOR_HUMIDITY") {
|
|
||||||
this.indoorHumidity = this.roundValue(payload);
|
this.indoorHumidity = this.roundValue(payload);
|
||||||
this.updateDom(300);
|
this.updateDom(300);
|
||||||
}
|
}
|
||||||
@ -125,7 +119,7 @@ Module.register("weather",{
|
|||||||
|
|
||||||
// Select the template depending on the display type.
|
// Select the template depending on the display type.
|
||||||
getTemplate: function () {
|
getTemplate: function () {
|
||||||
return this.config.type.toLowerCase() + ".njk"
|
return `${this.config.type.toLowerCase()}.njk`;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Add all the data to the template.
|
// Add all the data to the template.
|
||||||
@ -144,8 +138,8 @@ Module.register("weather",{
|
|||||||
// What to do when the weather provider has new information available?
|
// What to do when the weather provider has new information available?
|
||||||
updateAvailable: function() {
|
updateAvailable: function() {
|
||||||
Log.log("New weather information available.");
|
Log.log("New weather information available.");
|
||||||
this.updateDom(300);
|
this.updateDom(0);
|
||||||
this.scheduleUpdate(60000);
|
this.scheduleUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
scheduleUpdate: function(delay = null) {
|
scheduleUpdate: function(delay = null) {
|
||||||
@ -214,9 +208,9 @@ Module.register("weather",{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.config.units === "imperial") {
|
if(this.config.units === "imperial") {
|
||||||
return (parseFloat(value) / 25.4).toFixed(2) + " in";
|
return `${(parseFloat(value) / 25.4).toFixed(2)} in`;
|
||||||
} else {
|
} else {
|
||||||
return parseFloat(value).toFixed(1) + " mm";
|
return `${parseFloat(value).toFixed(1)} mm`;
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
class WeatherObject {
|
class WeatherObject {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.date = null
|
this.date = null;
|
||||||
this.windSpeed = null
|
this.windSpeed = null;
|
||||||
this.windDirection = null
|
this.windDirection = null;
|
||||||
this.sunrise = null
|
this.sunrise = null;
|
||||||
this.sunset = null
|
this.sunset = null;
|
||||||
this.temperature = null
|
this.temperature = null;
|
||||||
this.minTemperature = null
|
this.minTemperature = null;
|
||||||
this.maxTemperature = null
|
this.maxTemperature = null;
|
||||||
this.weatherType = null
|
this.weatherType = null;
|
||||||
this.humidity = null
|
this.humidity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
cardinalWindDirection () {
|
cardinalWindDirection () {
|
||||||
@ -78,4 +78,4 @@ class WeatherObject {
|
|||||||
var now = new Date();
|
var now = new Date();
|
||||||
return (this.sunrise < now && this.sunset > now) ? "sunset" : "sunrise";
|
return (this.sunrise < now && this.sunset > now) ? "sunset" : "sunrise";
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -36,71 +36,71 @@ var WeatherProvider = Class.extend({
|
|||||||
// Called when a weather provider is initialized.
|
// Called when a weather provider is initialized.
|
||||||
init: function(config) {
|
init: function(config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
Log.info("Weather provider: " + this.providerName + " initialized.")
|
Log.info(`Weather provider: ${this.providerName} initialized.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Called to set the config, this config is the same as the weather module's config.
|
// Called to set the config, this config is the same as the weather module's config.
|
||||||
setConfig: function(config) {
|
setConfig: function(config) {
|
||||||
this.config = config
|
this.config = config;
|
||||||
Log.info("Weather provider: " + this.providerName + " config set.", this.config)
|
Log.info(`Weather provider: ${this.providerName} config set.`, this.config);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Called when the weather provider is about to start.
|
// Called when the weather provider is about to start.
|
||||||
start: function(config) {
|
start: function(config) {
|
||||||
Log.info("Weather provider: " + this.providerName + " started.")
|
Log.info(`Weather provider: ${this.providerName} started.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// This method should start the API request to fetch the current weather.
|
// This method should start the API request to fetch the current weather.
|
||||||
// This method should definetly be overwritten in the provider.
|
// This method should definetly be overwritten in the provider.
|
||||||
fetchCurrentWeather: function() {
|
fetchCurrentWeather: function() {
|
||||||
Log.warn("Weather provider: " + this.providerName + " does not subclass the fetchCurrentWeather method.")
|
Log.warn(`Weather provider: ${this.providerName} does not subclass the fetchCurrentWeather method.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// This method should start the API request to fetch the weather forecast.
|
// This method should start the API request to fetch the weather forecast.
|
||||||
// This method should definetly be overwritten in the provider.
|
// This method should definetly be overwritten in the provider.
|
||||||
fetchWeatherForecast: function() {
|
fetchWeatherForecast: function() {
|
||||||
Log.warn("Weather provider: " + this.providerName + " does not subclass the fetchWeatherForecast method.")
|
Log.warn(`Weather provider: ${this.providerName} does not subclass the fetchWeatherForecast method.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// This returns a WeatherDay object for the current weather.
|
// This returns a WeatherDay object for the current weather.
|
||||||
currentWeather: function() {
|
currentWeather: function() {
|
||||||
return this.currentWeatherObject
|
return this.currentWeatherObject;
|
||||||
},
|
},
|
||||||
|
|
||||||
// This returns an array of WeatherDay objects for the weather forecast.
|
// This returns an array of WeatherDay objects for the weather forecast.
|
||||||
weatherForecast: function() {
|
weatherForecast: function() {
|
||||||
return this.weatherForecastArray
|
return this.weatherForecastArray;
|
||||||
},
|
},
|
||||||
|
|
||||||
// This returns the name of the fetched location or an empty string
|
// This returns the name of the fetched location or an empty string
|
||||||
fetchedLocation: function() {
|
fetchedLocation: function() {
|
||||||
return this.fetchedLocationName || ''
|
return this.fetchedLocationName || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set the currentWeather and notify the delegate that new information is available.
|
// Set the currentWeather and notify the delegate that new information is available.
|
||||||
setCurrentWeather: function(currentWeatherObject) {
|
setCurrentWeather: function(currentWeatherObject) {
|
||||||
// We should check here if we are passing a WeatherDay
|
// We should check here if we are passing a WeatherDay
|
||||||
this.currentWeatherObject = currentWeatherObject
|
this.currentWeatherObject = currentWeatherObject;
|
||||||
|
|
||||||
this.updateAvailable()
|
this.updateAvailable();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set the weatherForecastArray and notify the delegate that new information is available.
|
// Set the weatherForecastArray and notify the delegate that new information is available.
|
||||||
setWeatherForecast: function(weatherForecastArray) {
|
setWeatherForecast: function(weatherForecastArray) {
|
||||||
// We should check here if we are passing a WeatherDay
|
// We should check here if we are passing a WeatherDay
|
||||||
this.weatherForecastArray = weatherForecastArray
|
this.weatherForecastArray = weatherForecastArray;
|
||||||
|
|
||||||
this.updateAvailable()
|
this.updateAvailable();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set the fetched location name
|
// Set the fetched location name
|
||||||
setFetchedLocation: function(name) {
|
setFetchedLocation: function(name) {
|
||||||
this.fetchedLocationName = name
|
this.fetchedLocationName = name;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Notify the delegate that new weather is available.
|
// Notify the delegate that new weather is available.
|
||||||
updateAvailable: function() {
|
updateAvailable: function() {
|
||||||
this.delegate.updateAvailable(this)
|
this.delegate.updateAvailable(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
// A convinience function to make requests. It returns a promise.
|
// A convinience function to make requests. It returns a promise.
|
||||||
@ -125,30 +125,30 @@ var WeatherProvider = Class.extend({
|
|||||||
/**
|
/**
|
||||||
* Collection of registered weather providers.
|
* Collection of registered weather providers.
|
||||||
*/
|
*/
|
||||||
WeatherProvider.providers = []
|
WeatherProvider.providers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static method to register a new weather provider.
|
* Static method to register a new weather provider.
|
||||||
*/
|
*/
|
||||||
WeatherProvider.register = function(providerIdentifier, providerDetails) {
|
WeatherProvider.register = function(providerIdentifier, providerDetails) {
|
||||||
WeatherProvider.providers[providerIdentifier.toLowerCase()] = WeatherProvider.extend(providerDetails)
|
WeatherProvider.providers[providerIdentifier.toLowerCase()] = WeatherProvider.extend(providerDetails);
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static method to initialize a new weather provider.
|
* Static method to initialize a new weather provider.
|
||||||
*/
|
*/
|
||||||
WeatherProvider.initialize = function(providerIdentifier, delegate) {
|
WeatherProvider.initialize = function(providerIdentifier, delegate) {
|
||||||
providerIdentifier = providerIdentifier.toLowerCase()
|
providerIdentifier = providerIdentifier.toLowerCase();
|
||||||
|
|
||||||
var provider = new WeatherProvider.providers[providerIdentifier]()
|
var provider = new WeatherProvider.providers[providerIdentifier]();
|
||||||
|
|
||||||
provider.delegate = delegate
|
provider.delegate = delegate;
|
||||||
provider.setConfig(delegate.config)
|
provider.setConfig(delegate.config);
|
||||||
|
|
||||||
provider.providerIdentifier = providerIdentifier;
|
provider.providerIdentifier = providerIdentifier;
|
||||||
if (!provider.providerName) {
|
if (!provider.providerName) {
|
||||||
provider.providerName = providerIdentifier
|
provider.providerName = providerIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
return provider;
|
return provider;
|
||||||
}
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user