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
48 changes: 48 additions & 0 deletions bhaskar/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Github_user_finder</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="style.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=DynaPuff:wght@500&display=swap" rel="stylesheet">
</head>

<body style="background-color: #ADE4DB ;">
<div class="container">

<br><br>
<h1>
(❁´◡`❁)GitHub_User_finder(❁´◡`❁)
</h1>
<br><br>
<form action="" id="myForm" autocomplete="off">
<div class="form-group">
<input type="text" class="form-control" id="search" placeholder="Search Username">
<br>
</div>
<div class="form-group">
<button class="btn btn-dark btn-block" id="btn1" onclick="functionName()"
style="align-items: center; justify-content: center; display: flex; background-color: #FF6D60; width: auto;">
Search User
</button>
</div>
</form>
<div class="box b1" style="padding-top: 10px;">
(●'◡'●) Use this to find any user with their Username (●'◡'●)
</div>
<br>
<div id="result">

</div>
</div>

<script src="script.js"></script>
</body>

</html>
34 changes: 34 additions & 0 deletions bhaskar/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

//to display text after click on search!
function functionName() {
document.querySelector(".box").classList.toggle("b1")
}

//fetch data from form!
var form = document.getElementById("myForm");


form.addEventListener('submit', function (e) {

//prevent the auto submission of form
e.preventDefault();

var search = document.getElementById("search").value;

//to remove space in b/w firstName & lastName
var originalName = search.split(' ').join('');

document.getElementById("result").innerHTML = '';

fetch("https://api.github.com/users/" + originalName)
.then((result) => result.json())
.then((data) => {
console.log(data)

document.getElementById("result").classList.add("discription");

document.getElementById("result").innerHTML = `
<a target="_blank" href="https://www.github.com/${originalName}"> <img src="${data.avatar_url}"/></a>
`
})
})