Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions University-detector/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// let h1=document.querySelector('h1');
// let p=document.querySelector('p');
// let btn=document.querySelector("button");
// let img=document.querySelector("img");
// btn.addEventListener('click',async()=>{
// let randImg=await getFact();
// console.log(randImg)
// img.setAttribute("src",randImg)
// })


// // let fact = "https://catfact.ninja/fact?max_length=110";//
// let fact="https://dog.ceo/api/breeds/image/random"
// async function getFact(){
// try{
// let res=await axios(fact)
// return res.data.message
// }
// catch(er){
// let noData="noData";
// return noData

// }


// };

// getFact()



// let fact="https://icanhazdadjoke.com/";

// async function getData(){
// try{
// const config={headers:{Accept:"application/json"}}
// let res=await axios.get(fact,config)
// console.log(res.data.joke)
// }
// catch(er){
// console.log(er);
// }
// }

// getData()



//Univercityu detector

let inp=document.querySelector("input");
let inpState=document.querySelector("#inp_state");
let btn=document.querySelector("button");
let li=document.querySelector("#list");

let url="http://universities.hipolabs.com/search?country=";

btn.addEventListener('click',async()=>{
let cunName=inp.value;
let stateName=inpState.value;
let res2=await getUnivercity(cunName,stateName);


// console.log(res2)
// console.log(stateName)

listName(res2)


})



async function getUnivercity(cunName,stateName){
try{

let jointUrl=url+cunName+"&name="+stateName;
let res=await axios.get(jointUrl);

// console.log(jointUrl)
// console.log(url)
// console.log(res)
return res.data

}
catch(er){
return er
}

};

// console.log(getUnivercity("india","jharkhand"))

function listName(arry){
li.innerText="";
for(let i=0;i<arry.length;i++){
let list=document.createElement("li");
list.innerText=arry[i].name
li.appendChild(list)
}
};














// fetch(fact)
// .then((result) => {
// console.log(result);
// return result.json()

// })
// .then((data) => {
// console.log("data1:",data.fact)
// return fetch(fact)
// })
// .then((res) => {
// return res.json()

// })
// .then((data) => {
// console.log("data 2:", data.fact)
// })
// .catch((err) => {
// console.log(err)
// })
37 changes: 37 additions & 0 deletions University-detector/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>

<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
</head>

<body>

<div class="container">
<div class="hcontaner">
<h1>University Detecter</h1>
</div>

<input type="text" placeholder="Enter country Name" class="inp">
<input type="text" placeholder="Enter your state" id="inp_state" class="inp">
<button class="btn"><i class="fa-solid fa-magnifying-glass"></i> Search</button>

<ol id="list">
</ol>


</div>

<script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>
<script src="app.js"></script>
</body>

</html>
67 changes: 67 additions & 0 deletions University-detector/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

.body{
text-align: center;
display: flex;
align-items: center;
}

.container{
background-color: rgb(189, 200, 200);


width: 50rem;
border-radius:1rem;
margin: 0 auto;

}
h1{
font-size: 1.9rem;
font-family: "Poppins", serif;
display: block;


}
.hcontaner{
text-align: center;
}
.inp{
height: 2rem;
width: 20rem;
background-color:#f0f0f0;
color: #000000;
border-radius: .0.5rem ;
opacity:0.9;
cursor: pointer;
display: block;
margin: 0 auto;
margin-bottom:0.3rem;




}
.btn{
background-color:#fff;
height:2rem;
width: 6rem;
border-radius:.0.5rem;
opacity: 0.8;
cursor: pointer;
margin: 0 auto;
display: block;
}
.inp:hover{
box-shadow: 2px 2px 2px 5px #cdcdcd;
opacity:1;
}
.btn:hover{
box-shadow:2px 2px 2px 1px #828897;
scale: 0.95;
}

li{
margin-top: 10px;
font-family: "Poppins", serif;


}