Skip to content

Commit

Permalink
added 2021 temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
vishal-lokare committed Jan 28, 2022
1 parent 24d51ea commit b33478f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 23 deletions.
24 changes: 11 additions & 13 deletions logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ chrome.runtime.sendMessage('getPassword', (password) => {

$(document).ready(function () {
var url = window.location.href;
if (url == 'https://lms.iiitkottayam.ac.in/')
if (url == 'https://lms.iiitkottayam.ac.in/' || url == 'https://lmsone.iiitkottayam.ac.in/')
document.getElementsByClassName('btn-login')[0].click();

if (url == 'https://lms.iiitkottayam.ac.in/login/index.php' || url == 'https://lms.iiitkottayam.ac.in/login/index.php/#') {
if (url == 'https://lms.iiitkottayam.ac.in/login/index.php' || url == 'https://lms.iiitkottayam.ac.in/login/index.php/#' || url == 'https://lmsone.iiitkottayam.ac.in/login/index.php' || url == 'https://lmsone.iiitkottayam.ac.in/login/index.php/#') {
document.getElementById('username').value = replaceusername;
document.getElementById('password').value = replacepassword;
document.getElementsByClassName('btn btn-primary btn-block mt-3')[0].click();
}


if (url.includes('?reason=AutoJoomer')){
if (url.includes('?reason=AutoJoomer')) {
var btn = document.getElementById("join_button_input");

var timerId = setInterval(function(){
if(btn){
btn.click();
clearInterval(timerId);
}
else{
btn = document.getElementById("join_button_input");
}

var timerId = setInterval(function () {
if (btn) {
btn.click();
clearInterval(timerId);
} else {
btn = document.getElementById("join_button_input");
}
}, 1000);
}
})
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
"matches": [
"https://lms.iiitkottayam.ac.in/",
"https://lms.iiitkottayam.ac.in/login/index.php",
"https://lms.iiitkottayam.ac.in/login/index.php/#",
"https://lms.iiitkottayam.ac.in/mod/bigbluebuttonbn/*"
"https://lms.iiitkottayam.ac.in/login/index.php/*",
"https://lms.iiitkottayam.ac.in/mod/bigbluebuttonbn/*",
"https://lmsone.iiitkottayam.ac.in/*"
],
"js": [
"jquery.js",
Expand Down
17 changes: 14 additions & 3 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
color: white;
background: none;
border: 0;
width: fit-content;
}

select:focus {
Expand All @@ -55,7 +56,7 @@

label {
color: white;
font-size: 110%;
font-size: 100%;
}

.switch {
Expand Down Expand Up @@ -130,11 +131,21 @@
<input id="password" type="password" placeholder="Enter LMS password...">
<br><br>
<center>
<select name="year" id="year">
<option value="null" style="color: grey;" selected disabled>Year</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select>
<select name="branch" id="branch">
<option value="null" style="color: grey;" selected disabled>Select Branch</option>
<option value="null" style="color: grey;" selected disabled>Branch</option>
<option value="C">CSE</option>
<option value="E">ECE</option>
</select>
<select name="batch" id="batch">
<option value="null" style="color: grey;" selected disabled>Batch</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br><br>
<label for="confirmation">Confirmation Before Joining Classes ? </label>

Expand All @@ -151,4 +162,4 @@
</div>
</body>

</html>
</html>
14 changes: 14 additions & 0 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ var confirmation;
window.onload = function () {
username = document.getElementById("username");
password = document.getElementById("password");
year = document.getElementById("year");
branch = document.getElementById("branch");
batch = document.getElementById("batch");
confirmation = document.getElementById("confirmation");
populator();
document.getElementById("button").addEventListener("click", saveValues);
Expand Down Expand Up @@ -50,29 +52,41 @@ function saveValues() {
document.getElementById("button").disabled = true;
var uname = username.value;
var pass = password.value;
var uyear = document.getElementById("year").value;
var ubatch = document.getElementById("batch").value;

var bran = branch.value;
if (document.getElementById("confirmation").checked)
conf = 1;
else
conf = 0;
window.localStorage.setItem("AutoJoomerUsername", JSON.stringify(uname));
window.localStorage.setItem("AutoJoomerPassword", JSON.stringify(pass));
window.localStorage.setItem("AutoJoomerYear", JSON.stringify(uyear));
window.localStorage.setItem("AutoJoomerBranch", JSON.stringify(bran));
window.localStorage.setItem("AutoJoomerBatch", JSON.stringify(ubatch));
window.localStorage.setItem("AutoJoomerConfirmation", JSON.stringify(conf));
}

function populator() {
username = document.getElementById("username");
password = document.getElementById("password");
year = document.getElementById("year");
branch = document.getElementById("branch");
batch = document.getElementById("batch");
confirmation = document.getElementById("confirmation");
//setting the values
if (JSON.parse(window.localStorage.getItem("AutoJoomerUsername")) != null)
username.value = JSON.parse(window.localStorage.getItem("AutoJoomerUsername"));
if (JSON.parse(window.localStorage.getItem("AutoJoomerPassword")) != null)
password.value = JSON.parse(window.localStorage.getItem("AutoJoomerPassword"));
if (JSON.parse(window.localStorage.getItem("AutoJoomerYear")) != null)
year.value = JSON.parse(window.localStorage.getItem("AutoJoomerYear"));
if (JSON.parse(window.localStorage.getItem("AutoJoomerBranch")) != null)
branch.value = JSON.parse(window.localStorage.getItem("AutoJoomerBranch"));
if (JSON.parse(window.localStorage.getItem("AutoJoomerBatch")) != null)
batch.value = JSON.parse(window.localStorage.getItem("AutoJoomerBatch"));

if (JSON.parse(window.localStorage.getItem("AutoJoomerConfirmation")) == 1)
confirmation.checked = true;
if (JSON.parse(window.localStorage.getItem("AutoJoomerConfirmation")) == 0)
Expand Down
21 changes: 16 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
var username = JSON.parse(window.localStorage.getItem("AutoJoomerUsername"));
var password = JSON.parse(window.localStorage.getItem("AutoJoomerPassword"));
var year = JSON.parse(window.localStorage.getItem("AutoJoomerYear"));
var branch = JSON.parse(window.localStorage.getItem("AutoJoomerBranch"));
var batch = JSON.parse(window.localStorage.getItem("AutoJoomerBatch"));
var confirmation = JSON.parse(window.localStorage.getItem("AutoJoomerConfirmation"));

if ((branch == null) || (branch == "null") || (username == null) || (password == null) || (username == "null") || (password == "null") || (username == "") || (password == "") || (confirmation == null)) {
// if ((year = "null") || (batch == "null") || (branch == "null") || (username == null) || (password == null) || (username == "null") || (password == "null") || (username == "") || (password == "") || (confirmation == null)) {
if (year == "null" || branch == "null" || batch == "null" || username == "" || password == "" || confirmation == null) {
alert("Some values have not been set. Navigate to the extensions panel in your browser, choose \"AutoJoomer\", save your values and restart your browser for changes to take effect.");
} else {
runningscript();
Expand Down Expand Up @@ -65,6 +68,8 @@ function runningscript() {
br = "CSE";
else
br = "ECE";
var dbReference = year + br + batch;
console.log(dbReference);

const firebaseConfig = {
apiKey: "AIzaSyDbgLGtFvaeR_4n_9UPuvkhcXjsLc0-ERk",
Expand All @@ -78,22 +83,28 @@ function runningscript() {
};

firebase.initializeApp(firebaseConfig);
var db = firebase.database().ref().child('links').child(br).child(day)
var db = firebase.database().ref().child('links').child(dbReference);
db.on('value', function (links) {
console.log("AutoJoomer started");
if (links.val() == null) {
window.alert("No classes found for today.");
return;
}
for (let i = 0; i < timeouts.length; i++)
clearTimeout(timeouts[i]);
var thatDay = links.toJSON();
var thatDay = links.toJSON()[day];
console.log(thatDay);
//counts the number of lectures on that day
if (thatDay != null) {
var nooflec = Object.keys(thatDay).length;
for (let i = 1; i < nooflec; i++) {
var thatClass = thatDay[i];
console.log(thatClass);
thatClassName[i] = thatClass['class_name'];
thatClassLink[i] = thatClass['class_link'];
//parseint to convert string to integer
h[i] = String(thatClass['class_time'][0]) + String(thatClass['class_time'][1]);
m[i] = String(thatClass['class_time'][2]) + String(thatClass['class_time'][3]);
h[i] = thatClass['class_time'].substring(0, 2);
m[i] = thatClass['class_time'].substring(2, 4);
//to check if the class name or link is empty
if ((thatClassName[i] == '') || (thatClassLink[i] == '')) continue;
millisOfThatClass[i] = new Date(now.getFullYear(), now.getMonth(), now.getDate(), parseInt(h[i]), parseInt(m[i]), 0, 0) - now;
Expand Down

0 comments on commit b33478f

Please sign in to comment.