From 24d51ea7d413f3eec05e8c52349c7672677d7c64 Mon Sep 17 00:00:00 2001 From: Vishal Date: Sat, 8 Jan 2022 09:49:34 +0530 Subject: [PATCH 1/2] added saved values populator on popup page --- manifest.json | 2 +- popup.html | 2 +- popup.js | 55 ++++++++++++++++++++++++++++++++++---------- version_updates.json | 3 ++- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/manifest.json b/manifest.json index 2e02ec2..ca5ab4b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "AutoJoomer", - "version": "2.2.0", + "version": "2.2.1", "manifest_version": 2, "permissions": [ "tabs" diff --git a/popup.html b/popup.html index c42cf6f..ad5989f 100644 --- a/popup.html +++ b/popup.html @@ -151,4 +151,4 @@ - \ No newline at end of file + diff --git a/popup.js b/popup.js index b263337..fbfbf9c 100644 --- a/popup.js +++ b/popup.js @@ -1,5 +1,15 @@ +//global variables +var username; +var password; +var branch; +var confirmation; window.onload = function () { - document.getElementById("button").addEventListener("click", savevalues); + username = document.getElementById("username"); + password = document.getElementById("password"); + branch = document.getElementById("branch"); + confirmation = document.getElementById("confirmation"); + populator(); + document.getElementById("button").addEventListener("click", saveValues); document.getElementById("button").innerHTML = "SAVE"; document.getElementById("button").disabled = false; @@ -30,20 +40,41 @@ window.onload = function () { }); } -function savevalues() { +function saveValues() { + username = document.getElementById("username"); + password = document.getElementById("password"); + branch = document.getElementById("branch"); + confirmation = document.getElementById("confirmation"); document.getElementById("button").style.color = "white"; document.getElementById("button").innerHTML = "RESTART BROWSER"; document.getElementById("button").disabled = true; - var username = document.getElementById("username").value; - var password = document.getElementById("password").value; - var branch = document.getElementById("branch").value; - var confirmation; + var uname = username.value; + var pass = password.value; + var bran = branch.value; if (document.getElementById("confirmation").checked) - confirmation = 1; + conf = 1; else - confirmation = 0; - window.localStorage.setItem("AutoJoomerUsername", JSON.stringify(username)); - window.localStorage.setItem("AutoJoomerPassword", JSON.stringify(password)); - window.localStorage.setItem("AutoJoomerBranch", JSON.stringify(branch)); - window.localStorage.setItem("AutoJoomerConfirmation", JSON.stringify(confirmation)); + conf = 0; + window.localStorage.setItem("AutoJoomerUsername", JSON.stringify(uname)); + window.localStorage.setItem("AutoJoomerPassword", JSON.stringify(pass)); + window.localStorage.setItem("AutoJoomerBranch", JSON.stringify(bran)); + window.localStorage.setItem("AutoJoomerConfirmation", JSON.stringify(conf)); +} + +function populator() { + username = document.getElementById("username"); + password = document.getElementById("password"); + branch = document.getElementById("branch"); + 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("AutoJoomerBranch")) != null) + branch.value = JSON.parse(window.localStorage.getItem("AutoJoomerBranch")); + if (JSON.parse(window.localStorage.getItem("AutoJoomerConfirmation")) == 1) + confirmation.checked = true; + if (JSON.parse(window.localStorage.getItem("AutoJoomerConfirmation")) == 0) + confirmation.checked = false; } \ No newline at end of file diff --git a/version_updates.json b/version_updates.json index 1b3cfd5..d5113cf 100644 --- a/version_updates.json +++ b/version_updates.json @@ -3,5 +3,6 @@ "2.1.0": "Added full page time table.", "2.1.1": "Added support for extra classes and all other club meets/events", "2.1.2": "Added an About Us page", - "2.2.0": "Automatically updates in realtime on changes to database" + "2.2.0": "Automatically updates in realtime on changes to database", + "2.2.1": "Automatic values fill in popup" } \ No newline at end of file From 0ecb07c0669c96c095ecc2f2c6ce205f42372b5e Mon Sep 17 00:00:00 2001 From: Vishal Lokare <31512838+vishal-lokare@users.noreply.github.com> Date: Sat, 8 Jan 2022 14:59:20 +0530 Subject: [PATCH 2/2] Changed version to 2.2.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3c8c19..ba4d7ab 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url] -[![Generic badge](https://img.shields.io/badge/Version-2.2.0-Green.svg?style=for-the-badge)](https://github.com/vishal-lokare/AutoJoomer) +[![Generic badge](https://img.shields.io/badge/Version-2.2.1-Green.svg?style=for-the-badge)](https://github.com/vishal-lokare/AutoJoomer) [contributors-shield]: https://img.shields.io/github/contributors/vishal-lokare/AutoJoomer.svg?style=for-the-badge [contributors-url]: https://github.com/vishal-lokare/AutoJoomer/graphs/contributors