-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 83f4cd4
Showing
4 changed files
with
301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"string": [ | ||
"23071A6932", | ||
"23071A6933" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Campus Automation</title> | ||
<link rel="stylesheet" href="style.css"> | ||
<!-- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> --> | ||
</head> | ||
<body> | ||
<!-- Navbar --> | ||
<!-- <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="#">Campus Automation project</a> | ||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarNav"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" aria-current="page" href="#">Add Rollno</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Login</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Logout</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
<br> | ||
<br> --> | ||
<!-- Navbar end --> | ||
|
||
<div class="navbar1"> | ||
<div class="nav-logo-img1"> | ||
<img src="https://vnrvjiet.ac.in/assets/images/Header%20Logo.png" alt="Campusos" /> | ||
</div> | ||
<div class="nav-logo1">Automation system</div> | ||
</div> | ||
|
||
<center class='hello'><h1>Check student's Hostel Lunch Validity</h1></center> | ||
|
||
<!-- QR code Scanner --> | ||
<center><button type="button" id="showHideBtn">Show/Hide Barcode Scanner</button></center> | ||
<br> | ||
<br> | ||
<div id="hiddenElement"> | ||
<center><div id="interactive" class="viewport"></div></center> | ||
<br> | ||
|
||
<!-- Form --> | ||
<!-- <form id="contactForm"> --> | ||
<form id="search-form"> | ||
<!-- <input type="text" id="text" readonly> --> | ||
<input type="text" id="target" name="target" readonly> | ||
<br> | ||
<center><button type="submit" value="submit" class="button">Submit</button></center> | ||
<br> | ||
<center><input id="reset" type="reset" value="Reset"></center> | ||
<br> | ||
<center><p id="result"></p></center> | ||
</form> | ||
|
||
</div> | ||
<!-- QR code scanner end --> | ||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/firebase/7.14.1-0/firebase.js"></script> --> | ||
|
||
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> --> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quagga.min.js"></script> | ||
|
||
<script src="./script.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
document.getElementById('showHideBtn').addEventListener('click', function() { | ||
var element = document.getElementById('hiddenElement'); | ||
if (element.style.display === 'none') { | ||
element.style.display = 'block'; | ||
} else { | ||
element.style.display = 'none'; | ||
} | ||
}); | ||
|
||
Quagga.init({ | ||
inputStream: { | ||
name: "Live", | ||
type: "LiveStream", | ||
target: document.querySelector('#interactive'), | ||
constraints: { | ||
width: 640, | ||
height: 480, | ||
facingMode: "environment", // or "user" for front camera | ||
}, | ||
}, | ||
decoder: { | ||
readers: ["ean_reader", "code_128_reader", "code_39_reader", "codabar_reader", "upc_reader"], | ||
}, | ||
}, function (err) { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
Quagga.start(); | ||
}); | ||
|
||
|
||
Quagga.onDetected(function (result) { | ||
var code = result.codeResult.code; | ||
document.getElementById('target').value = code; | ||
}); | ||
|
||
// // Firebase script1 | ||
// const firebaseConfig = { | ||
// apiKey: "AIzaSyAWlYyG2NvnMwDZFCawb-KOM2chEzi_-Q4", | ||
// authDomain: "campus-automation-62ead.firebaseapp.com", | ||
// databaseURL: "https://campus-automation-62ead-default-rtdb.firebaseio.com", | ||
// projectId: "campus-automation-62ead", | ||
// storageBucket: "campus-automation-62ead.appspot.com", | ||
// messagingSenderId: "325021104122", | ||
// appId: "1:325021104122:web:b707ac0f01bde7fef81643" | ||
// }; | ||
|
||
|
||
// // initialize firebase | ||
// firebase.initializeApp(firebaseConfig); | ||
|
||
// // reference your database | ||
// var contactFormDB = firebase.database().ref("contactForm"); | ||
|
||
// document.getElementById("contactForm").addEventListener("submit", submitForm); | ||
|
||
// function submitForm(e) { | ||
// e.preventDefault(); | ||
|
||
// var text = getElementVal("text"); | ||
|
||
// saveMessages(text); | ||
|
||
// // // enable alert | ||
// // document.querySelector(".alert").style.display = "block"; | ||
|
||
// // // remove the alert | ||
// // setTimeout(() => { | ||
// // document.querySelector(".alert").style.display = "none"; | ||
// // }, 3000); | ||
|
||
// // // reset the form | ||
// // document.getElementById("contactForm").reset(); | ||
// } | ||
|
||
// const saveMessages = (text) => { | ||
// var newContactForm = contactFormDB.push(); | ||
|
||
// newContactForm.set({ | ||
// text: text, | ||
// }); | ||
// }; | ||
|
||
// const getElementVal = (id) => { | ||
// return document.getElementById(id).value; | ||
// }; | ||
// // Firebase script1 end | ||
|
||
// Searching js | ||
const searchForm = document.getElementById('search-form'); | ||
const targetInput = document.getElementById('target'); | ||
const resultEl = document.getElementById('result'); | ||
|
||
// Define your search list here | ||
const list = ["23071A6932"]; | ||
|
||
searchForm.addEventListener('submit', (event) => { | ||
event.preventDefault(); | ||
|
||
const target = targetInput.value.trim(); | ||
|
||
// Perform linear search | ||
const index = linearSearch(list, target); | ||
|
||
// Update result message | ||
if (index >= 0) { | ||
resultEl.textContent = `Hosteller`; | ||
} else { | ||
resultEl.textContent = `Dayscholar`; | ||
} | ||
}); | ||
|
||
// Linear search function | ||
function linearSearch(arr, target) { | ||
for (let i = 0; i < arr.length; i++) { | ||
if (arr[i].toLowerCase() === target.toLowerCase()) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#hiddenElement { | ||
display: none; | ||
} | ||
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600&display=swap'); | ||
#hiddenElement { | ||
display: none; | ||
} | ||
.nav-logo-img1 img{ | ||
width: 180px; | ||
} | ||
*{ | ||
padding: 0;margin: 0; | ||
font-family: 'Nunito', sans-serif; | ||
} | ||
.navbar1{ | ||
background-color: #4f4f4f17; | ||
padding-top: 20px; | ||
padding-bottom: 20px; | ||
height: 60px; | ||
margin: 0; | ||
|
||
gap: 20px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: row; | ||
} | ||
.nav-logo1{ | ||
|
||
font-size: 20px; | ||
} | ||
.hello{ | ||
margin-top: 50px; | ||
} | ||
.hello h1{ | ||
font-weight: bolder; | ||
color: #82001a; | ||
font-size: 25px; | ||
} | ||
#barcodeResult{ | ||
padding: auto; | ||
margin:auto; | ||
border: none; | ||
color: #82001a; | ||
padding: 20px; | ||
font-size: 40px; | ||
} | ||
#showHideBtn{ | ||
margin-top: 20px; | ||
padding: 10px; | ||
border-radius: 20px; | ||
border: solid #82001a; | ||
} | ||
@media (max-width:700px) { | ||
#interactive{ | ||
width: 100%; | ||
|
||
} | ||
|
||
}#interactive{ | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.drawingBuffer{ | ||
display: none; | ||
} | ||
#target{ | ||
color: #82001a; | ||
font-size: 40px; | ||
} | ||
.button{ | ||
font-size: 20px; | ||
padding: 10px; | ||
border-radius: 10px; | ||
border: 2px solid #82001a; | ||
background-color: white; | ||
} | ||
#reset{ | ||
padding: 6px; | ||
border-radius: 10%; | ||
} | ||
#search-form{ | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
#result { | ||
font-size: xx-large; | ||
} |