Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Morgan-Tyghe committed Sep 17, 2020
1 parent 0b0a3db commit a3b770f
Show file tree
Hide file tree
Showing 50 changed files with 37,975 additions and 1,192 deletions.
30 changes: 0 additions & 30 deletions WeatherDay.js

This file was deleted.

5 changes: 2 additions & 3 deletions City.js → backup/City.js
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
}

13 changes: 13 additions & 0 deletions backup/City.ts
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
}


}
40 changes: 40 additions & 0 deletions backup/WeatherDay copy.js
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)})
}




38 changes: 38 additions & 0 deletions backup/WeatherDay.js
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

})

}



45 changes: 45 additions & 0 deletions backup/WeatherDay.ts
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)})
}




39 changes: 39 additions & 0 deletions backup/axiosExample.js
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

}


19 changes: 19 additions & 0 deletions backup/backup2/City.ts
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
}


}

45 changes: 45 additions & 0 deletions backup/backup2/WeatherDay.ts
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)})
}




34 changes: 34 additions & 0 deletions backup/backup2/index.ts
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()

}





12 changes: 12 additions & 0 deletions backup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@



function weatherAppjs1(event){
passCity(event)
weatherApi(event)
}





20 changes: 20 additions & 0 deletions backup/index.ts
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 added bootstrap.css
Empty file.
Loading

0 comments on commit a3b770f

Please sign in to comment.