-
Notifications
You must be signed in to change notification settings - Fork 0
/
Local.html
166 lines (155 loc) · 5.43 KB
/
Local.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<html lang="en-us">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="Real.css"/>
<script src="jquery-1.11.0.js"></script>
<style type="text/css">
</style>
<title></title>
</head>
<body>
<header>
<div class="topdiv">
<div class="selctn">
<span onclick="openNav()" id="sidebarimg">☰</span>
<span id="name">NewsOasis.com</span>
</div>
</div>
<div class="selct">
<div class="ers">
<a href="#">Local</a></span>
<a href="Foreign.html" target="_self">Foreign</a>
<a onclick="document.getElementById('wdiv').style.display='block'"style="width:auto;">Weather</a>
<a href="Football.html" target="_self">Football</a>
<a>Check Results</a>
<a href="Wallpapers.html" target="_blank">Wallpapers</a>
</div>
</div>
</header>
<div id="wdiv" class="modal">
<form class="modal-content animate">
<div class="imgcontainer">
<span onclick="document.getElementById('wdiv').style.display='none'"class="close" title="Close Modal">×</span>
<div class="container">
<label><b>City name </b></label>
<input type="text" placeholder="Enter city name"name="uname" id="cty"required>
<button onclick="weather()">Get Weath</button>
<button type="button"onclick="document.getElementById('wdiv').style.display='none'" class="cancelbtn">Cancel</button>
</div>
</div>
</form>
</div>
<div class="holder">
<div id="myNav" class="overlay">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<div class="overlay-content">
<a href="Aboutme.html">About</a>
<a href="#">Services</a>
<a href="#contact">Contact</a>
</div>
</div>
</div><br><br><br><br><br>
<section class="section">
<center>
<div id="section">
<div class="sdiv">
<label id="osrc">original source</label>
<div class="pdiv">
<img src="Paris.png" id="pic">
</div>
<p class="cont">read more...</p>
<label id="nt">news time</label>
</div>
</div>
</center>
</section>
<footer>
<div class="fd">
<div class="footer">
<div class="footer-left">
<a href="#"><label class="pana">Facebook</label> <img src="Facebook.png" class="social"></a><br><br>
<a href="#"><label class="pana">Instagram</label> <img src="Instagram.png" class="social"></a><br><br>
<a href="#"><label class="pana">Twitter</label> <img src="Twitter.png" class="social"></a><br><br>
<a href="[email protected]"><label class="pana">Email</label> <img src="googleplus.png" class="social"></a>
</div>
<div class="footer-right">
<a href="#"><label class="pana">WhatsApp</label> <img src="watsap.png" class="social"></a><br><br>
<a href="#"><label class="pana">Phone</label> <img src="phone.png" class="social"></a><br><br>
<a href="#"><label class="pana">About Me</label> <img src="Me.png" class="social"></a>
</div>
</div>
<b><label class="you" id="demo"></label></b>
</div>
</footer>
<script type="text/javascript">
function openNav()
{
document.getElementById("myNav")
.style.height="100%";
}
function closeNav()
{
document.getElementById("myNav")
.style.height = "0%";
}
var myVar=setInterval(function () {myTimer()}, 1000);
function myTimer()
{
var d = new Date();
document.getElementById("demo").innerHTML = d.toLocaleTimeString();
}
var root = document.getElementById("section");
function weather (){
var city = document.getElementById("cty").value;
//alert ("you just checked for "+city);
console.log("you just checked for "+city);
$.ajax({
header: { 'Access-Control-Allow-Origin': '*' },
url:'http://api.openweathermap.org/data/2.5/weather?q='+city,
dataType: 'json',
type: 'GET',
}).done(function(response) {
console.log(response);
});
}
$.ajax({
header: { 'Access-Control-Allow-Origin': '*' },
url:'https://newsapi.org/v2/top-headlines?country=ng&apiKey=2cb973f54ebe457d96530c3b136160c9',
dataType: 'json',
type: 'GET',
}).done(function(response){
console.log(response);
var tR = response.totalResults;
console.log(tR);
for(i=1;i<=tR;i++){
var a = document.createElement("a");
a.href = response.articles[i].url;
var sdiv = document.createElement("div");
sdiv.setAttribute('class','sdiv');
var osrc = document.createElement("label");
osrc.setAttribute('id','osrc');
osrc.innerHTML=response.articles[i].source.name;
var cont = document.createElement("div");
cont.setAttribute('class','cont');
cont.innerHTML=response.articles[i].description;
var nt = document.createElement("label");
nt.setAttribute('id','nt');
nt.innerHTML= response.articles[i].publishedAt;
var pdiv = document.createElement("div");
pdiv.setAttribute('class','pdiv');
var image = document.createElement("img");
image.setAttribute('id','pic');
image.src = response.articles[i].urlToImage;
pdiv.appendChild(image);
sdiv.appendChild(osrc);
sdiv.appendChild(pdiv);
sdiv.appendChild(cont);
sdiv.appendChild(nt);
a.appendChild(sdiv);
root.appendChild(a);
}
});
</script>
</body>
</html>