update ajax.js

This commit is contained in:
Boof 2023-01-17 13:44:20 +01:00 committed by GitHub
parent 866a986e99
commit 817571fff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,11 @@
/* This is a simple javascript library that i made.
It needs jquery to function.
The ip grabber does not store the users ip anywhere.
The ip grabber does not store the users ip.
*/
//##Options##
//Enable automatic responsive website (beta)
//Put this in a javascript file: var resppage = true/false
// Set delay to ms
function delay(milliseconds){
@ -11,6 +14,9 @@ function delay(milliseconds){
});
}
//Get the current year and store it in a variable
var year = new Date().getFullYear();
// Get the userip and store it in a variable
$.getJSON("https://europe-central2-portfolio-website-374313.cloudfunctions.net/getip", function(data) {
})
@ -22,3 +28,16 @@ window.onload = async function startdown(){
fetch('https://t0m0t0w.github.io/favicon.png', {cache: "no-store"})
}
}
// Get the width of the screen
var screenWidth = window.innerWidth;
// Get all elements with the class "responsive"
var responsiveElements = document.getElementsByClassName("responsive");
// Loop through all responsive elements and adjust their width
if(resppage = true){
for (var i = 0; i < responsiveElements.length; i++) {
responsiveElements[i].style.width = (screenWidth / responsiveElements.length) + "px";
}
}