-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samuel Morgan-Tyghe
committed
Sep 17, 2020
1 parent
0b0a3db
commit a3b770f
Showing
50 changed files
with
37,975 additions
and
1,192 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
|
||
function passCity() | ||
function passCity1() | ||
{ | ||
const content = event.target.innerHTML | ||
document.getElementById("weatherLocation").innerHTML = content.toString() | ||
console.log(content.toString()) | ||
onclicks(event) | ||
// console.log(content.toString()) | ||
return content | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
console.log('city') | ||
export class City{ | ||
passCity() | ||
{ | ||
console.log('innercity') | ||
|
||
const content = (<Element>event.target).innerHTML | ||
document.getElementById("weatherLocation").innerHTML = content.toString() | ||
return content | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
let indexOf = 1 | ||
|
||
function weatherApi1() { | ||
let i = 0 | ||
|
||
fetch('https://api.openweathermap.org/data/2.5/forecast?q='+event.target.innerHTML.toString()+'&appid=ab57b33912fbd3d3015d3f296505d3a8') | ||
.then(response => response.json()) | ||
.then(data => { | ||
// console.log(data) | ||
|
||
for( i = 0 ; i <=3; i++ ){ | ||
var nameValue = data['city']['name'] | ||
var tempValue = data ['list'][i.toString()]['main']['temp'] | ||
var dateValue = data ['list'][i.toString()]['dt_txt'] | ||
var descValue = data['list'][i.toString()]['weather']['0']['description'] | ||
var iconValue = data['list'][i.toString()]['weather']['0']['icon'] | ||
tempValueC = parseInt (tempValue - 273.15) //Kelvin To Celsius | ||
document.getElementById("i"+indexOf.toString()).innerHTML = nameValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = tempValueC +'C' | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = dateValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = descValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).src = 'http://openweathermap.org/img/wn/'+iconValue+'@2x.png' | ||
indexOf++ | ||
if (indexOf > 20 ){indexOf=1} | ||
|
||
|
||
} | ||
i=0 | ||
}) | ||
.catch(function (error) {console.log(error.message)}) | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
let indexOf = 1 | ||
|
||
function weatherApi1() { | ||
let i = 0 | ||
|
||
axios.get('https://api.openweathermap.org/data/2.5/forecast?q='+event.target.innerHTML.toString()+'&appid=ab57b33912fbd3d3015d3f296505d3a8') | ||
.then((response) => { | ||
for( i = 0 ; i <=3; i++ ){ | ||
|
||
var nameValue = response.data['city']['name'] | ||
var tempValue = response.data ['list'][i.toString()]['main']['temp'] | ||
var dateValue = response.data ['list'][i.toString()]['dt_txt'] | ||
var descValue = response.data['list'][i.toString()]['weather']['0']['description'] | ||
var iconValue = response.data['list'][i.toString()]['weather']['0']['icon'] | ||
|
||
|
||
tempValueC = parseInt (tempValue - 273.15) //Kelvin To Celsius | ||
document.getElementById("i"+indexOf.toString()).innerHTML = nameValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = tempValueC +'C' | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = dateValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = descValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).src = 'http://openweathermap.org/img/wn/'+iconValue+'@2x.png' | ||
indexOf++ | ||
if (indexOf > 20 ){indexOf=1} | ||
|
||
} i=0 | ||
|
||
}) | ||
|
||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
console.log('weather') | ||
|
||
export function weatherApi() { | ||
console.log('weatherinner') | ||
|
||
let indexOf = 1 | ||
|
||
let i = 0 | ||
|
||
|
||
fetch('https://api.openweathermap.org/data/2.5/forecast?q='+(<Element>event.target).toString()+'&appid=ab57b33912fbd3d3015d3f296505d3a8') | ||
.then(response => response.json()) | ||
.then(data => { | ||
// console.log(data) | ||
|
||
for( i = 0 ; i <=3; i++ ){ | ||
var nameValue = data['city']['name'] | ||
var tempValue = data ['list'][i.toString()]['main']['temp'] | ||
var dateValue = data ['list'][i.toString()]['dt_txt'] | ||
var descValue = data['list'][i.toString()]['weather']['0']['description'] | ||
var iconValue = data['list'][i.toString()]['weather']['0']['icon'] | ||
|
||
let tempValueC = (parseInt(tempValue)) - 273 //Kelvin To Celsius | ||
document.getElementById("i"+indexOf.toString()).innerHTML = nameValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = tempValueC +'C' | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = dateValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = descValue | ||
indexOf++ | ||
(<HTMLImageElement>document.getElementById("i"+indexOf.toString())).src = 'http://openweathermap.org/img/wn/'+iconValue+'@2x.png' | ||
indexOf++ | ||
if (indexOf > 20 ){indexOf=1} | ||
|
||
|
||
} | ||
i=0 | ||
}) | ||
.catch(function (error) {console.log(error.message)}) | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
|
||
let indexOf = 1 | ||
|
||
|
||
function axiosExample() { | ||
let i = 0 | ||
|
||
axios.get('https://api.openweathermap.org/data/2.5/forecast?q='+event.target.innerHTML.toString()+'&appid=ab57b33912fbd3d3015d3f296505d3a8') | ||
.then((response) => { | ||
|
||
var nameValue = response.data['city']['name'] | ||
var tempValue = response.data ['list'][i.toString()]['main']['temp'] | ||
var dateValue = response.data ['list'][i.toString()]['dt_txt'] | ||
var descValue = response.data['list'][i.toString()]['weather']['0']['description'] | ||
var iconValue = response.data['list'][i.toString()]['weather']['0']['icon'] | ||
|
||
|
||
tempValueC = parseInt (tempValue - 273.15) //Kelvin To Celsius | ||
document.getElementById("i"+indexOf.toString()).innerHTML = nameValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = tempValueC +'C' | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = dateValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = descValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).src = 'http://openweathermap.org/img/wn/'+iconValue+'@2x.png' | ||
indexOf++ | ||
if (indexOf > 20 ){indexOf=1} | ||
|
||
|
||
}) | ||
|
||
i=0 | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// OOP model with: | ||
// - public name; string for displaying on button | ||
// - public key; string for API usage | ||
|
||
|
||
export class City { | ||
passCity() | ||
|
||
{ | ||
console.log('innercity') | ||
|
||
const content = (<Element>event.target).innerHTML | ||
document.getElementById("weatherLocation").innerHTML = content.toString() | ||
return content | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
console.log('weather') | ||
|
||
export function weatherApi() { | ||
console.log('weatherinner') | ||
|
||
let indexOf = 1 | ||
|
||
let i = 0 | ||
|
||
|
||
fetch('https://api.openweathermap.org/data/2.5/forecast?q='+(<Element>event.target).toString()+'&appid=ab57b33912fbd3d3015d3f296505d3a8') | ||
.then(response => response.json()) | ||
.then(data => { | ||
// console.log(data) | ||
|
||
for( i = 0 ; i <=3; i++ ){ | ||
var nameValue = data['city']['name'] | ||
var tempValue = data ['list'][i.toString()]['main']['temp'] | ||
var dateValue = data ['list'][i.toString()]['dt_txt'] | ||
var descValue = data['list'][i.toString()]['weather']['0']['description'] | ||
var iconValue = data['list'][i.toString()]['weather']['0']['icon'] | ||
|
||
let tempValueC = (parseInt(tempValue)) - 273 //Kelvin To Celsius | ||
document.getElementById("i"+indexOf.toString()).innerHTML = nameValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = tempValueC +'C' | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = dateValue | ||
indexOf++ | ||
document.getElementById("i"+indexOf.toString()).innerHTML = descValue | ||
indexOf++ | ||
(<HTMLImageElement>document.getElementById("i"+indexOf.toString())).src = 'http://openweathermap.org/img/wn/'+iconValue+'@2x.png' | ||
indexOf++ | ||
if (indexOf > 20 ){indexOf=1} | ||
|
||
|
||
} | ||
i=0 | ||
}) | ||
.catch(function (error) {console.log(error.message)}) | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {weatherApi} from './WeatherDay' | ||
import {City} from './City' | ||
|
||
import * as _ from 'lodash'; | ||
|
||
|
||
|
||
class index { } | ||
console.log('button') | ||
|
||
const city = new City() | ||
|
||
city.passCity() | ||
|
||
|
||
|
||
document.getElementById("allButtons").addEventListener("click", city.passCity); | ||
|
||
|
||
|
||
|
||
|
||
console.log('index') | ||
|
||
export default function weatherAppjs(){ | ||
console.log('innerindex') | ||
weatherApi() | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
|
||
function weatherAppjs1(event){ | ||
passCity(event) | ||
weatherApi(event) | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {weatherApi} from './WeatherDay' | ||
import {City} from './City' | ||
import * as _ from 'lodash'; | ||
|
||
const city = new City() | ||
|
||
city.passCity() | ||
|
||
console.log('index') | ||
|
||
export default function weatherAppjs(){ | ||
console.log('innerindex') | ||
weatherApi() | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
Empty file.
Oops, something went wrong.