Merge pull request #150 from gnain/master

Updates Open Weather Map datasource to modern usage with API key
pull/155/head
Vishal Kumar 2016-01-13 19:47:35 -05:00
commit 1f8c2c75a4
5 changed files with 66 additions and 49 deletions

View File

@ -3222,7 +3222,7 @@ $.extend(freeboard, jQuery.eventEmitter);
this.updateNow = function () {
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?q=" + encodeURIComponent(currentSettings.location) + "&units=" + currentSettings.units,
url: "http://api.openweathermap.org/data/2.5/weather?APPID="+currentSettings.api_key+"&q=" + encodeURIComponent(currentSettings.location) + "&units=" + currentSettings.units,
dataType: "JSONP",
success: function (data) {
// Rejigger our data into something easier to understand
@ -3264,6 +3264,12 @@ $.extend(freeboard, jQuery.eventEmitter);
display_name: "Open Weather Map API",
settings: [
{
name: "api_key",
display_name: "API Key",
type: "text",
description: "Your personal API Key from Open Weather Map"
},
{
name: "location",
display_name: "Location",
type: "text",
@ -4476,26 +4482,26 @@ freeboard.loadDatasourcePlugin({
type_name: "indicator",
display_name: "Indicator Light",
settings: [
{
name: "title",
display_name: "Title",
type: "text"
},
{
name: "value",
display_name: "Value",
type: "calculated"
},
{
name: "on_text",
display_name: "On Text",
type: "calculated"
},
{
name: "off_text",
display_name: "Off Text",
type: "calculated"
}
{
name: "title",
display_name: "Title",
type: "text"
},
{
name: "value",
display_name: "Value",
type: "calculated"
},
{
name: "on_text",
display_name: "On Text",
type: "calculated"
},
{
name: "off_text",
display_name: "Off Text",
type: "calculated"
}
],
newInstance: function (settings, newInstanceCallback) {
newInstanceCallback(new indicatorWidget(settings));

File diff suppressed because one or more lines are too long

View File

@ -199,7 +199,7 @@
this.updateNow = function () {
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?q=" + encodeURIComponent(currentSettings.location) + "&units=" + currentSettings.units,
url: "http://api.openweathermap.org/data/2.5/weather?APPID="+currentSettings.api_key+"&q=" + encodeURIComponent(currentSettings.location) + "&units=" + currentSettings.units,
dataType: "JSONP",
success: function (data) {
// Rejigger our data into something easier to understand
@ -241,6 +241,12 @@
display_name: "Open Weather Map API",
settings: [
{
name: "api_key",
display_name: "API Key",
type: "text",
description: "Your personal API Key from Open Weather Map"
},
{
name: "location",
display_name: "Location",
type: "text",
@ -1403,7 +1409,7 @@ freeboard.loadDatasourcePlugin({
var isOn = false;
var onText;
var offText;
function updateState() {
indicatorElement.toggleClass("on", isOn);
@ -1434,7 +1440,7 @@ freeboard.loadDatasourcePlugin({
}
if (settingName == "off_text") {
offText = newValue;
}
}
updateState();
}
@ -1453,26 +1459,26 @@ freeboard.loadDatasourcePlugin({
type_name: "indicator",
display_name: "Indicator Light",
settings: [
{
name: "title",
display_name: "Title",
type: "text"
},
{
name: "value",
display_name: "Value",
type: "calculated"
},
{
name: "on_text",
display_name: "On Text",
type: "calculated"
},
{
name: "off_text",
display_name: "Off Text",
type: "calculated"
}
{
name: "title",
display_name: "Title",
type: "text"
},
{
name: "value",
display_name: "Value",
type: "calculated"
},
{
name: "on_text",
display_name: "On Text",
type: "calculated"
},
{
name: "off_text",
display_name: "Off Text",
type: "calculated"
}
],
newInstance: function (settings, newInstanceCallback) {
newInstanceCallback(new indicatorWidget(settings));

File diff suppressed because one or more lines are too long

View File

@ -199,7 +199,7 @@
this.updateNow = function () {
$.ajax({
url: "http://api.openweathermap.org/data/2.5/weather?q=" + encodeURIComponent(currentSettings.location) + "&units=" + currentSettings.units,
url: "http://api.openweathermap.org/data/2.5/weather?APPID="+currentSettings.api_key+"&q=" + encodeURIComponent(currentSettings.location) + "&units=" + currentSettings.units,
dataType: "JSONP",
success: function (data) {
// Rejigger our data into something easier to understand
@ -241,6 +241,12 @@
display_name: "Open Weather Map API",
settings: [
{
name: "api_key",
display_name: "API Key",
type: "text",
description: "Your personal API Key from Open Weather Map"
},
{
name: "location",
display_name: "Location",
type: "text",