Tailwind css added

This commit is contained in:
Aravind142857
2023-06-21 15:56:08 -05:00
parent 0d2619b9c0
commit cc421f40c6
1574 changed files with 277349 additions and 177 deletions

View File

@@ -30,21 +30,10 @@ function valueRequested() {
}
function checkboxCallback(event) {
const radiusLabel = document.getElementById("radiusLabel");
const radiusSelect = document.getElementById("radiusSelect");
const mandatoryRadius = document.getElementById("mandatory-radius");
if (event.currentTarget.checked) {
radiusLabel.hidden = false;
mandatoryRadius.hidden = false;
radiusSelect.hidden = false;
radiusSelect.required = true;
document.getElementById("radiusSelect").required = true;
valueRequested();
getLocation();
} else {
radiusLabel.hidden = true;
mandatoryRadius.hidden = true;
radiusSelect.hidden = true;
radiusSelect.required = false;
}
}
@@ -68,108 +57,108 @@ function showPosition(position) {
}
// submit.addEventListener('click', validate);
function validate() {
//e.preventDefault();
const checked = document.getElementById("restricted");
if (checked.checked) {
const lat = document.getElementById("latitude");
const long = document.getElementById("longitude");
if (lat.value === "" || long.value === "") {
/* wait */
return false
}
function validate() {
//e.preventDefault();
const checked = document.getElementById("restricted");
if (checked.checked) {
const lat = document.getElementById("latitude");
const long = document.getElementById("longitude");
if (lat.value === "" || long.value === "") {
/* wait */
return false
}
}
const url = document.getElementById("URL");
let glink = document.getElementById("GLink");
const error = document.getElementById("error");
// if (!url) {
// /* Flag */
// }
let valid = true;
const domainExp = new RegExp("^http(s)*:\\/\\/[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)+$");
const filepathExp = new RegExp("^[a-zA-Z]+$");
const glinkExp = new RegExp("^[a-zA-Z]*$");
let glinkStr = glink.value;
let count = 0;
let index = -1;
let domain = "";
let filepath = "";
for (let i = 0; i < url.value.length; i++) {
if (url.value.charAt(i) == '/') {
count++;
}
if (count == 3) {
index = i;
break;
}
const url = document.getElementById("URL");
let glink = document.getElementById("GLink");
const error = document.getElementById("error");
// if (!url) {
// /* Flag */
// }
let valid = true;
const domainExp = new RegExp("^http(s)*:\\/\\/[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)+$");
const filepathExp = new RegExp("^[a-zA-Z]+$");
const glinkExp = new RegExp("^[a-zA-Z]*$");
let glinkStr = glink.value;
let count = 0;
let index = -1;
let domain = "";
let filepath = "";
for (let i = 0; i < url.value.length; i++) {
if (url.value.charAt(i) == '/') {
count++;
}
if (count >= 3) {
domain = url.value.substring(0, index);
if (index == url.value.length - 1) {
filepath = url.value.charAt(index);
} else {
filepath = url.value.substring(index, url.value.length - 1);
}
alert("Domain is " + domain + " filepath is " + filepath);
if (count == 3) {
index = i;
break;
}
}
if (count >= 3) {
domain = url.value.substring(0, index);
if (index == url.value.length - 1) {
filepath = url.value.charAt(index);
} else {
domain = url.value;
filepath = url.value.substring(index, url.value.length - 1);
}
console.log(domain);
alert("Domain is " + domain + " filepath is " + filepath);
} else {
domain = url.value;
}
console.log(domain);
if (glinkStr === "") {
var result = window.confirm("You have left the glink field blank. A random one will be generated for you.");
if (result === false) {
return false;
}
if (glinkStr === "") {
var result = window.confirm("You have left the glink field blank. A random one will be generated for you.");
if (result === false) {
return false;
}
}
if (domain.match(domainExp) && glinkStr.match(glinkExp))/** and is available? */{
if (error.classList.contains("visible")) {
error.classList.remove("visible");
if (domain.match(domainExp) && glinkStr.match(glinkExp))/** and is available? */{
if (error.classList.contains("visible")) {
error.classList.remove("visible");
}
if (url.classList.contains("invalid")) {
url.classList.remove("invalid");
}
url.classList.add("valid");
if (glink.classList.contains("invalid")) {
glink.classList.remove("invalid");
}
glink.classList.add("valid");
error.setAttribute('aria-hidden', true);
error.setAttribute('aria-invalid', false);
console.log("Valid with url= " +url.value+ " glink=" +glink);
return valid;
} else {
/*flag*/
error.classList.add("visible");
//error.classList.add("hidden");
if (!domain.match(domainExp)) {
if (url.classList.contains("valid")) {
url.classList.remove("valid");
}
url.classList.add("invalid");
} else {
if (url.classList.contains("invalid")) {
url.classList.remove("invalid");
}
url.classList.add("valid");
}
if (!glinkStr.match(glinkExp)) {
if (glink.classList.contains("valid")) {
glink.classList.remove("valid");
}
glink.classList.add("invalid");
} else {
if (glink.classList.contains("invalid")) {
glink.classList.remove("invalid");
}
glink.classList.add("valid");
error.setAttribute('aria-hidden', true);
error.setAttribute('aria-invalid', false);
console.log("Valid with url= " +url.value+ " glink=" +glink);
return valid;
} else {
/*flag*/
error.classList.add("visible");
//error.classList.add("hidden");
if (!domain.match(domainExp)) {
if (url.classList.contains("valid")) {
url.classList.remove("valid");
}
url.classList.add("invalid");
} else {
if (url.classList.contains("invalid")) {
url.classList.remove("invalid");
}
url.classList.add("valid");
}
if (!glinkStr.match(glinkExp)) {
if (glink.classList.contains("valid")) {
glink.classList.remove("valid");
}
glink.classList.add("invalid");
} else {
if (glink.classList.contains("invalid")) {
glink.classList.remove("invalid");
}
glink.classList.add("valid");
}
error.setAttribute('aria-hidden', false);
error.setAttribute('aria-invalid', true);
return false;
}
error.setAttribute('aria-hidden', false);
error.setAttribute('aria-invalid', true);
return false;
}
}

17
public/src/redirect.js Normal file
View File

@@ -0,0 +1,17 @@
let latitude = document.getElementById("latitude");
let longitude = document.getElementById("longitude");
console.log("entered");
latitude.setValue = function (newValue) {
this.value = newValue;
document.getElementById("form").submit();
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
longitude.value = position.coords.longitude;
latitude.setValue(position.coords.latitude);
});
} else {
console.log("Your browser does not support geolocation.");
}