-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjob.html
176 lines (118 loc) · 3.97 KB
/
job.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
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./styles/job.css">
<link rel="stylesheet" href="./style/footer.css">
<link rel="stylesheet" href="./style/header.css">
<title>Jobs</title>
</head>
<body>
<div id="asheader">
</div>
<div id="navbar">
</div>
<div id="bahutBada">
<div id="badaDiv">
<u style="text-decoration-color:red ;"><h1>JOBS & EDUCATION</h1></u>
</div>
<div id="chotaDiv">
<u style="text-decoration-color:red "><h1 id="head">MOST POPULAR</h1></u>
</div>
</div>
<footer id="as_footer">
</footer>
</body>
</html>
<script type="module">
// const url="https://newsapi.org/v2/everything?q=${query}&apikey=bf6c4661eaeb4853a23a5aa81dd3b8cf"
//const url = "https://newsapi.org/v2/everything?q=education&apikey=bf6c4661eaeb4853a23a5aa81dd3b8cf"
// const apiKey=`bf6c4661eaeb4853a23a5aa81dd3b8cf`
// const apikey=`95d1fbec7675485aba5f17e941467b38`
const apikey=`a4b263da6c6c4f1ab7f29e452bc9d108`
const url = `https://newsapi.org/v2/everything?q=jobs&apikey=${apikey}`
async function schoolData(){
try{
let res = await fetch (url)
let data= await res.json()
//console.log(data.articles)
appendSchool(data.articles)
}
catch(err){
console.log(err)
}
}
schoolData()
function appendSchool(data){
data.forEach((ele)=>{
let divB= document.createElement("div")
divB.setAttribute("class", "divB")
let divS1= document.createElement("div")
divS1.setAttribute("class", "divS1")
let divS2= document.createElement("div")
divS2.setAttribute("class", "divS2")
let image1= document.createElement("img")
image1.src=ele.urlToImage
image1.setAttribute("class","chutkaimage")
divS1.append(image1)
let h3 = document.createElement("h3")
h3.innerText=ele.title
let p= document.createElement("p")
p.innerText=ele.content
divS2.append(h3,p)
divB.append(divS1,divS2)
document.getElementById("badaDiv").append(divB)
divB.addEventListener("click",function(){
storeData(ele)
})
})
function storeData(ele){
localStorage.setItem("detailNews",JSON.stringify(ele))
window.location.href="newsDetails.html"
}
}
const url1 = `https://newsapi.org/v2/everything?q=schools&apikey=${apikey}`
async function jobData(){
try{
let res = await fetch (url1)
let data= await res.json()
//console.log(data.articles)
appendJob(data.articles)
}
catch(err){
console.log(err)
}
}
jobData()
function appendJob(data){
data.forEach((ele)=>{
let divS= document.createElement("div")
divS.setAttribute("class", "divS")
let divS3= document.createElement("div")
divS3.setAttribute("class", "divS3")
let divS4= document.createElement("div")
divS4.setAttribute("class", "divS4")
let image1= document.createElement("img")
image1.setAttribute("class","chutkaimage")
image1.src=ele.urlToImage
divS3.append(image1)
let h3 = document.createElement("h3")
h3.innerText=ele.title
divS4.append(h3)
divS.append(divS3,divS4)
document.getElementById("chotaDiv").append(divS)
})
}
</script>
<script src="./scripts/icon.js"></script>
<script src="./scripts/sidepanel.js"></script>
<script type="module">
import {navbar} from "./comp/navbar.js"
import {footer} from "./comp/footer.js"
import{header} from "./comp/header.js"
let nav =document.getElementById("navbar").innerHTML=navbar()
let foot =document.getElementById("as_footer").innerHTML=footer()
let head=document.getElementById("asheader").innerHTML=header()
</script>