Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
midoalawieh authored Feb 20, 2024
1 parent 4803784 commit 23d3ca4
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 56 deletions.
9 changes: 9 additions & 0 deletions JS/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ checkMark.addEventListener("click", () => {
policyCheck.checked = !policyCheck.checked;
console.log(policyCheck.checked);
});

let flipper = document.querySelectorAll(".switch-link");
let card = document.querySelector(".card");
flipper.forEach((el) => {
el.addEventListener("click", () => {
card.classList.toggle("card-flipped");
console.log(card);
});
});
111 changes: 55 additions & 56 deletions JS/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,6 @@ for (let i = 0; i < copyText.length; i++) {
}
}

let mobileToggle = document.querySelector(".mobile-store-title");
let mobileCates = document.querySelector(".mobile-cates");

if (mobileToggle !== null) {
mobileToggle.addEventListener("click", () => {
if (mobileCates.style.height === "0px" || mobileCates.style.height === "") {
mobileCates.style.height = mobileCates.scrollHeight + "px";
} else {
mobileCates.style.height = "0px";
}
mobileToggle.classList.toggle("store-open");
});
}

let customerHeads = document.querySelector(".customer-heads");

for (let i in config.topCustomers) {
Expand All @@ -121,20 +107,39 @@ for (let i in config.topCustomers) {
}
}

let faqItem = document.getElementsByClassName("faq-item");
let faqDesc = document.getElementsByClassName("faq-desc");

if (faqItem != null) {
for (let i = 0; i < faqItem.length; i++) {
faqItem[i].addEventListener("click", () => {
if (faqDesc[i].style.height === "0px" || faqDesc[i].style.height === "") {
faqDesc[i].style.height = faqDesc[i].scrollHeight + "px";
faqItem[i].classList.toggle("faq-open");
} else {
faqDesc[i].style.height = "0px";
faqItem[i].classList.toggle("faq-open");
}
});
}
}

let rule = document.getElementsByClassName("rule");
let ruleDesc = document.getElementsByClassName("rule-desc");
if (rule != null) {
for (let i = 0; i < rule.length; i++) {
rule[i].addEventListener("click", () => {
if (
ruleDesc[i].style.height === "0px" ||
ruleDesc[i].style.height === ""
) {
ruleDesc[i].style.height = ruleDesc[i].scrollHeight + "px";
rule[i].classList.toggle("rule-open");
} else {
ruleDesc[i].style.height = "0px";
rule[i].classList.toggle("rule-open");
if (window.innerWidth <= 992) {
if (
ruleDesc[i].style.height === "0px" ||
ruleDesc[i].style.height === ""
) {
ruleDesc[i].style.height = ruleDesc[i].scrollHeight + "px";
rule[i].classList.toggle("rule-open");
} else {
ruleDesc[i].style.height = "0px";
rule[i].classList.toggle("rule-open");
}
}
});
}
Expand Down Expand Up @@ -179,39 +184,6 @@ const getMinecraftOnlinePlayer = async () => {
getDiscordOnlineUsers();
getMinecraftOnlinePlayer();

// Get a reference to the ::after pseudo-element by its id
// Create a function to update the scrolling indicator
// Function to update the scrolling indicator
// Function to update scrolling indicators
function updateScrollIndicators() {
const sectionContentContainers =
document.querySelectorAll(".section-content");

sectionContentContainers.forEach((container) => {
const scrollIndicator = container.querySelector(".scroll-indicator");
if (scrollIndicator) {
const containerTop = container.getBoundingClientRect().top;
const containerHeight = container.offsetHeight;
const windowHeight = window.innerHeight;
const scrollY = window.scrollY;
// Calculate the scroll indicator position based on container visibility
const maxTop = 100 - (30 / window.innerHeight) * 100; // Calculate the maximum value
const topPosition = `${Math.min(
maxTop,
Math.max(0, (1 - containerTop / windowHeight) * 100)
).toFixed(2)}%`;

scrollIndicator.style.top = topPosition;
}
});
}

// Add a scroll event listener to update all scrolling indicators
window.addEventListener("scroll", updateScrollIndicators);

// Initially update the scrolling indicators when the page loads
window.addEventListener("load", updateScrollIndicators);

let members = document.querySelectorAll(".member");
let memberName = document.querySelectorAll(".member-name");
let memberImage = document.querySelectorAll(".member-img");
Expand Down Expand Up @@ -243,3 +215,30 @@ if (signUpBtn) {
window.location.href = "/signup.html";
});
}

function setMainMinHeight() {
var headerHeight = document.querySelector("header").offsetHeight;
var footerHeight = document.querySelector("footer").offsetHeight;

var main = document.querySelector("main");
var windowHeight = window.innerHeight;

console.log(windowHeight);
var minMainHeight = windowHeight - (headerHeight + footerHeight);
main.style.minHeight = minMainHeight + "px";
}

// Call the function on window resize
window.addEventListener("resize", setMainMinHeight);

setMainMinHeight();
console.log(window.innerWidth);

let pcNav = document.querySelector(".pc-nav");
let heroText = document.querySelector(".hero-text");

let childrenArray = Array.from(pcNav.children);

childrenArray.forEach((element, index) => {
element.style.animation = `pc-nav 1s forwards ${0.3 * index}s ease`;
});
6 changes: 6 additions & 0 deletions JS/staff-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let options = document.querySelector(".options");
let optionsChildren = Array.from(options.children);
let positionTitle = document.querySelector(".pos-title");
let selectedPosition = document.querySelector("#selectedPosition");
let inputs = document.querySelectorAll("hidden-input");
let staffForm = document.forms[0];
const fullNameInput = document.getElementById("full-name");
const emailInput = document.getElementById("email");
Expand Down Expand Up @@ -40,6 +41,11 @@ position.onclick = (e) => {
};
for (let i in optionsChildren) {
optionsChildren[i].onclick = (e) => {
contactForm.classList.replace(
contactForm.classList[1],
`${optionsChildren[i].classList[0]}-chosen`
);
console.log("hey");
let classToAdd = optionsChildren[i].classList[0];
for (let j in optionsChildren) {
position.classList.remove(`position-${optionsChildren[j].classList[0]}`);
Expand Down
67 changes: 67 additions & 0 deletions JS/staff-members-demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
let staffNavs = document.querySelectorAll(".staff-nav, .mobile-staff-nav");
let staffDef = document.querySelector(".staff-def");
let currentlyActive = staffDef;

function handleNavClick(navElement) {
let cateClass = navElement.classList[0];
console.log(cateClass);
let staffItems = document.querySelector(`.${cateClass}-roles`);
let activeNav = document.querySelectorAll(".active-nav");
let toActive = document.querySelectorAll(`.${cateClass}`);
// Check if the clicked navElement is already active
if (!navElement.classList.contains("active-nav")) {
currentlyActive.classList.remove("show");
activeNav.forEach((nav) => {
nav.classList.remove("active-nav");
});
staffItems.classList.remove("hidden");
toActive.forEach((nav) => {
nav.classList.add("active-nav");
});
staffItems.classList.add("fade");
setTimeout(() => {
staffItems.classList.add("show");
}, 100);
staffItems.addEventListener(
"transitionend",
() => {
staffItems.classList.remove("fade");
},
{ once: true }
);
currentlyActive.classList.add("hidden");
currentlyActive = staffItems;
}
}

staffNavs.forEach((nav) => {
nav.addEventListener("click", (event) => {
event.preventDefault();
handleNavClick(nav);
});
});

let mobileToggle = document.querySelector(".mobile-staff-title");
let mobileCates = document.querySelector(".mobile-cates");

if (mobileToggle !== null) {
mobileToggle.addEventListener("click", () => {
console.log("hey");
if (mobileCates.style.height === "0px" || mobileCates.style.height === "") {
mobileCates.style.height = mobileCates.scrollHeight + "px";
} else {
mobileCates.style.height = "0px";
}
mobileToggle.classList.toggle("staff-open");
});
}

let staffMembers = document.querySelectorAll(".staff-member");

staffMembers.forEach((el) => {
let pfp = el.children[0];
pfp.setAttribute(
"src",
`https://mc-heads.net/head/${el.getAttribute("staff-name")}/left`
);
});
15 changes: 15 additions & 0 deletions JS/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ for (let i = 0; i < item.length; i++) {
itemBig.appendChild(itemSideTwo);
itemBig.appendChild(itemClose);
document.body.appendChild(itemBig);
overlay.style.display = "block";
document.body.appendChild(overlay);
setTimeout(() => {
itemBig.classList.add("item-big-shown");
Expand Down Expand Up @@ -109,3 +110,17 @@ window.onscroll = (e) => {
}
}
};

let mobileToggle = document.querySelector(".mobile-store-title");
let mobileCates = document.querySelector(".mobile-cates");

if (mobileToggle !== null) {
mobileToggle.addEventListener("click", () => {
if (mobileCates.style.height === "0px" || mobileCates.style.height === "") {
mobileCates.style.height = mobileCates.scrollHeight + "px";
} else {
mobileCates.style.height = "0px";
}
mobileToggle.classList.toggle("store-open");
});
}

0 comments on commit 23d3ca4

Please sign in to comment.