Skip to content

Commit

Permalink
Merge pull request #216 from vishal-lokare/update
Browse files Browse the repository at this point in the history
Multi fixes, pre Hacktoberfest
  • Loading branch information
vishal-lokare authored Sep 30, 2023
2 parents f5cb715 + c7e9887 commit b7f078a
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 51 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<br><br><hr>
<p> AutoJoomer extension on Chrome Webstore - <a href="https://chrome.google.com/webstore/detail/autojoomer/gbclbcfjcjnajkkibmadammhkbmgbiao">Add to your browser</a></p>
<p> AutoJoomer GitHub repo - <a href="https://www.github.com/vishal-lokare/AutoJoomer">https://www.github.com/vishal-lokare/AutoJoomer</a></p>
<p> AutoJoomer website - <a href="https://www.autojoomer.co/">https://www.autojoomer.co/</a></p>
<p> AutoJoomer website - <a href="https://autojoomer-21321.web.app/">https://autojoomer-21321.web.app/</a></p>
<p> AutoJoomer app on - <a href="https://play.google.com/store/apps/details?id=co.autojoomer.autojoomer">Play Store</a></p>

</p>

Expand All @@ -46,11 +47,15 @@ Many more to come.

## Installation

If you are just a user, then you can install the extension from the <a href="https://chrome.google.com/webstore/detail/autojoomer/gbclbcfjcjnajkkibmadammhkbmgbiao">Chrome Webstore</a>.
![image](https://user-images.githubusercontent.com/94455615/198865183-c0d16224-84e4-4dcd-bc55-4820eaf9b678.png)

1. To Install the AutoJoomer Extension head to <a href="https://chrome.google.com/webstore/category/extensions"> Chrome Webstore</a>
2. Search for <b>AUTOJOOMER</b> and add it to your Chrome, Brave or Edge.
* Or you can directly click on this <a href="https://chrome.google.com/webstore/detail/autojoomer/gbclbcfjcjnajkkibmadammhkbmgbiao">link</a> to add the Extension to your browser.

And for contributors, they can follow the below steps to add the extension in Developer mode.

1. Download all the files to a folder either by the "Download as ZIP" button or by cloning the repo.
1. Fork the repo <b><a href = "https://github.com/vishal-lokare/AutoJoomer">vishal-lokare/AutoJoomer</a></b>, and clone it to your Local Computer.

2. Open your browser, go to

Expand All @@ -70,8 +75,9 @@ Everytime you make any change in your local code, go to "chrome://extensions" or

## How to stay updated

Users from Chrome Webstore will get updates automatically.
Google Chrome Webstore will update Extensions automatically with in 2-3 days, if you are a user who added the extension from chrome webstore, your extension will get updated automatically.

If you are a developer or contributor,
To stay up-to-date with the latest version hosted on GitHub, while being in the same directory where the downloaded files are, run

```
Expand All @@ -82,7 +88,9 @@ in the terminal and restart your browser / reload the extension.

OR

Repeat the installation process again.
Go to your forked repo, and Click On <i>Sync Fork</i> to get updated with all the commits from the main Repository.
![image](https://user-images.githubusercontent.com/94455615/198865630-0ec6e099-f23f-40ad-9060-e82c1f173c57.png)


## Tech Stack Used

Expand All @@ -102,7 +110,8 @@ Repeat the installation process again.

## Future Updates

<p>-> Publish extension in the Chrome Web Store. (Finally Published 🥳)</p>
- <p>Publish extension in the Chrome Web Store. (Finally Published 🥳)</p>
- <p>Add 2023 batch support in the extension.</p>

## License

Expand Down
10 changes: 7 additions & 3 deletions src/js/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@
width: 100%;
justify-content: center;
border-right: solid #000000 0.5px;
border-left: solid #000000 0.5px;
border-top: solid #000000 0.5px;
border-bottom: solid #000000 0.5px;
background-color: #DDE8FB;
text-decoration: none;
color: #000000;
Expand Down Expand Up @@ -255,7 +257,9 @@
color: #ffffff;
width: 100%;
border-right: solid #ffffff 0.5px;
border-left: solid #ffffff 0.5px;
border-top: solid #ffffff 0.5px;
border-bottom: solid #ffffff 0.5px;
text-decoration: none;
padding: 0.75em 0;

Expand Down Expand Up @@ -341,16 +345,16 @@
<p class="foot_txt">Login</p>
</a>

<a href="https://lms.iiitkottayam.ac.in/login/index.php" target="_blank" class="foot_item foot_box">
<a class="foot_item foot_box" id="lms_button" href="">
<p class="foot_txt">LMS</p>
</a>
</a>
<a href="" class="foot_item foot_box">

<p class="foot_txt">Contributions</p>
</a>
</div>
</footer>


</body>

</html>
31 changes: 26 additions & 5 deletions src/js/popup.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
let checker = 0;

let study_year="";
window.onload = function () {
theme(); //checks theme
// pingURL();
//isOnline();
};

document.addEventListener("DOMContentLoaded", function () {
window.onload = function populate() {
const year = document.querySelector("#year");
//fetch AutoJoomerYear

chrome.storage.local.get("AutoJoomerYear", function (result) {
study_year = result["AutoJoomerYear"];
});
}

document.addEventListener("DOMContentLoaded", function (){
document.getElementById("nav_button").addEventListener("click", mode_change);
document
.getElementById("nav_logo")
.addEventListener("click", open_autojoomer);
document.getElementById("nav_logo").addEventListener("click", open_autojoomer);
document.getElementById("lms_button").addEventListener("click", open_lms);
});


// function getRandomString () {
// return Math.random().toString(36).substring(2, 15)
// }
Expand Down Expand Up @@ -105,6 +114,17 @@ function open_autojoomer() {
window.open("https://www.autojoomer.co/", (target = "_blank"));
}

function open_lms()
{
//study_year = document.login_form.year.selectedIndex;
if(study_year == 2020)
{window.open("https://lms.iiitkottayam.ac.in/", (target="_blank"));}
else if(study_year == 2019 || study_year == 2021)
{window.open("https://lmsone.iiitkottayam.ac.in/", (target="_blank"));}
else
{alert("KINDLY ENTER YOUR CREDENTIALS");}
}

function mode_change() {
let element1 = document.body;
element1.classList.toggle("dark_bg");
Expand Down Expand Up @@ -179,3 +199,4 @@ async function connect_wifi() {
// offline.style.display="none";
// online.style.display="flex";
}

65 changes: 47 additions & 18 deletions src/pages/login/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ let firstChange = 0;
year.disabled = true;
branch.disabled = true;
batch.disabled = true;
let logo = document.getElementById("nav_logo");

logo.addEventListener("click", open_autojoomer);

function open_autojoomer() {
window.open("https://www.autojoomer.co/", (target = "_blank"));
}

for(let i = 0; i < elements.length; i++) {
elements[i].addEventListener("keyup", () => {
if (!firstChange) {
firstChange++;
firstChange++;
if (!firstChange) {
roll.value = "";
password.value = "";
year.value = "";
Expand All @@ -35,9 +42,11 @@ roll.addEventListener("keyup", () => {
year.value = "2019";
branch.value = "CSE";
batch.value = "";
} else if (yearValue == 2020) {
}
else if (yearValue == 2020) {
year.value = "2020";
} else if (yearValue == 2021) {
}
else if (yearValue == 2021) {
year.value = "2021";
}
});
Expand All @@ -49,30 +58,35 @@ roll.addEventListener("keyup", () => {
branchValue = inputValue.slice(4, 7);
if (branchValue == "BCS") {
branch.value = "CSE";
} else if (branchValue == "BEC") {
}
else if (branchValue == "BEC") {
if (year.value != "2019") {
branch.value = "ECE";
}
} else if (branchValue == "BCY") {
if (year.value != "2019" || year.value != "2020") {
branch.value = "BCY";
}
else if (branchValue == "BCY") {
if (year.value != "2019" && year.value != "2020") {
branch.value = "CSY";
}
}
});

//batch
var batchValue = "";
var setvalue = "";
roll.addEventListener("keyup", () => {
let inputValue = roll.value.toUpperCase();
batchValue = inputValue[10];
if (year.value != "2019") {
if (inputValue.length > 10) {
if (inputValue.length > 10) {
batchValue = inputValue[10];
if (year.value != "2019") {
if (batchValue % 2 == 0) {
batch.value = "2";
} else {
}
else {
batch.value = "1";
}
} else batch.value = "";
}
else batch.value = "";
}
});

Expand All @@ -85,23 +99,38 @@ btn.addEventListener("click", () => {
alert("Invalid Roll Number");
return;
}
if (pattern.test(roll.value)) {
let t =pattern.test(roll.value);
if (t) {
alert("You have been Logged In");
chrome.storage.local.set({ ["AutoJoomerUsername"]: roll.value });
chrome.storage.local.set({ ["AutoJoomerPassword"]: password.value });
chrome.storage.local.set({ ["AutoJoomerYear"]: yearValue });
chrome.storage.local.set({ ["AutoJoomerBranch"]: branchValue });
chrome.storage.local.set({ ["AutoJoomerBatch"]: batchValue });
chrome.storage.local.set({ ["AutoJoomerBatch"]: setvalue });
btn.setAttribute(
"style",
"background: var(--light); color: rgba(9, 9, 121, 1);"
"background: var(--light); color: rgba(9, 9, 120, 1);"
);
btn.disabled = true;
btn.innerText = "Saved";
setTimeout(() => { //redirecting to popup.html

//Create button to go back
const div = document.getElementsByClassName("form-container")[0];
const back_button = document.createElement('BUTTON');
back_button.className = "submit-btn";
back_button.id = "back";
const text = document.createTextNode("Home");
back_button.onclick = function() { //Redirect to popup
window.open("/src/js/popup.html", "_self");
}, 1000);
}
back_button.appendChild(text);
//append line break
div.appendChild(document.createElement("br"));
div.appendChild(back_button);

} else {
alert("Roll number does not exist");
alert("The Roll number does not exist");
return;
}
});
9 changes: 6 additions & 3 deletions src/pages/login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<body>
<div class="form-container">
<h1>Login</h1>
<form method="post">
<form name="login_form" method="post">

<div class="form-group">
<label for="roll">LMS Roll No.</label>
<input type="text" class="form-input" name="roll" id="roll" maxlength="11"
Expand All @@ -28,19 +29,20 @@ <h1>Login</h1>
<div class="form-group-col">
<label for="year">Year: </label>
<select name="year" id="year">
<option value="">Select Year</option>
<option selected="selected" value="">Select Year</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select>
</div>

<div class="form-group-col">
<label for="branch">Branch: </label>
<select name="branch" id="branch">
<option value="">Select branch</option>
<option value="CSE">CSE</option>
<option value="ECE">ECE</option>
<option value="BCY">BCY</option>
<option value="CSY">CSY</option>
</select>

</div>
Expand All @@ -54,6 +56,7 @@ <h1>Login</h1>
</div>
</div>
<button id="mb" type="button" class="submit-btn">Log In</button>

</form>
</div>

Expand Down
39 changes: 26 additions & 13 deletions src/pages/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,41 @@ window.onload = function populate() {
const year = document.querySelector("#year");
const branch = document.querySelector("#branch");
const batch = document.querySelector("#batch");

//fetch AutoJoomerUsername, AutoJoomerYear, AutoJoomerBranch and AutoJoomerBatch
chrome.storage.local.get("AutoJoomerUsername", function (result) {
document.getElementById("roll").value = result["AutoJoomerUsername"];
});
document.getElementById("password").value = "******";

document.getElementById("password").value = "*******";

chrome.storage.local.get("AutoJoomerYear", function (result) {
year.value = result["AutoJoomerYear"];
document.getElementById("year").value = result["AutoJoomerYear"];
});

chrome.storage.local.get("AutoJoomerBranch", function (result) {
switch(result["AutoJoomerBranch"]) {
case "ECE": {
branch.value = "ECE";
}
default: {
branch.value = "CSE";
}
if (result["AutoJoomerBranch"] == "BCS"){
document.getElementById("branch").value = "CSE";
}
else if (result["AutoJoomerBranch"] == "BCY"){
document.getElementById("branch").value = "CSY";
}
if (result["AutoJoomerBranch"] == "BEC"){
document.getElementById("branch").value = "ECE";
}
// branch.value = result["AutoJoomerBranch"];
});

chrome.storage.local.get("AutoJoomerBatch", function (result) {
if(result["AutoJoomerBatch"] % 2) batch.value = 1;
else batch.value = 2;
// document.getElementById("batch").value = result["AutoJoomerBatch"];
if (result["AutoJoomerBatch"] == ""){
document.getElementById("batch").value = "";
}
else if (result["AutoJoomerBatch"] % 2 == 1){
document.getElementById("batch").value = "1";
}
else if (result["AutoJoomerBatch"] % 2 == 0){
document.getElementById("batch").value = "2";
}

});

};
Loading

0 comments on commit b7f078a

Please sign in to comment.