starting grammar sweep

This commit is contained in:
prospect
2024-01-25 01:39:15 -05:00
parent 2daf505f33
commit 0d3674d31e
5 changed files with 44 additions and 38 deletions

View File

@@ -1077,6 +1077,10 @@ select {
height: 100vh;
}
.h-16 {
height: 4rem;
}
.w-1\/12 {
width: 8.333333%;
}
@@ -1370,6 +1374,18 @@ select {
--tw-bg-opacity: 0.6;
}
.bg-opacity-80 {
--tw-bg-opacity: 0.8;
}
.bg-opacity-20 {
--tw-bg-opacity: 0.2;
}
.bg-opacity-30 {
--tw-bg-opacity: 0.3;
}
.object-cover {
-o-object-fit: cover;
object-fit: cover;

View File

@@ -75,9 +75,10 @@ class HammerGestures {
// Add a swipe event listener for swipe right
hammer.on('swiperight', ev => {
this.currentUrl = window.location.href;
this.homeUrl = `https://${window.location.hostname}`;
// this.goBack(this.currentUrl)
console.log(ev.type);
console.log(this.homeUrl);
console.log(JSON.parse(sessionStorage.getItem('historyArray')));
if (JSON.parse(sessionStorage.getItem('historyArray')).length > 1) {
this.pageTransition.animatePageTransition(() => {
@@ -146,9 +147,9 @@ class Nav {
this.init();
}
init() {
// Open and Close the Nav Menu
document.addEventListener('DOMContentLoaded', () => {
this.toggleMenuBtn.addEventListener('click', () => this.toggleNavMenu());
document.addEventListener('click', event => this.handleOutsideClick(event));
});
}
toggleNavMenu() {
@@ -164,6 +165,15 @@ class Nav {
});
}, 600);
}
handleOutsideClick(event) {
if (!this.toggleMenuBtn.contains(event.target) && !this.toggleSlideOutMenu.contains(event.target) && !event.target.classList.contains('accordion')) {
// Click is outside the menu and toggle button
this.toggleMenuBtn.classList.remove('active');
this.toggleSlideOutMenu.classList.remove('open');
document.body.classList.remove('noScroll');
this.collapseAllAccordions();
}
}
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Nav);
@@ -234,7 +244,6 @@ class PageTransitions {
this.animatePageTransition(() => {
this.submitFormAsync(form);
});
this.formResetter(form);
});
});
}
@@ -266,29 +275,24 @@ class PageTransitions {
body: formData
}).then(response => response.text()).then(data => {
// Assuming the response contains the new content to be loaded
const targetUrl = form.action + '?s=' + formData.get('s'); // You might need to adjust this based on your server's response
const targetUrl = form.action + '?s=' + formData.get('s');
const elementId = 'content-container';
// Update content, push state, and remove transition class
this.updateContent(data, elementId);
history.pushState(null, null, targetUrl);
// Trigger removal of transition class after fetching data
const contentContainer = document.getElementById(elementId);
setTimeout(() => {
this.removeTransitionClass(contentContainer);
}, 300);
// Update the page title
const newTitle = parsedData.querySelector('title');
if (newTitle) {
document.title = newTitle.textContent;
}
// Initialize or update dynamic components
this.collapsePanel = new _CollapsePanel__WEBPACK_IMPORTED_MODULE_0__["default"]();
this.collapsePanel.addToggleCollapseListener('#content-container .accordion-toggle');
this.addLinkClickListener('#content-container a');
// Update content, push state, and remove transition class
this.updateContent(data, elementId);
history.pushState(null, null, targetUrl);
this.formResetter(form);
}).catch(error => console.error('Error submitting form:', error));
}
formResetter(form) {
@@ -310,7 +314,6 @@ class PageTransitions {
const newContent = targetElement.innerHTML;
// Update the content container
contentContainer.innerHTML = newContent;
// Trigger removal of transition class after fetching data
@@ -345,36 +348,23 @@ class PageTransitions {
createHistoryTracker() {
// Get the initial page's href
let initialHref = window.location.href;
// Add Home To History Array
this.historyArray.unshift(initialHref);
// Function to update history array and log it
const updateHistory = () => {
// Get the current page's href
const currentHref = window.location.href;
// Check if the currentHref is the same as the last item in the history array
// and if it's different from the initialHref
if (currentHref !== initialHref && (this.historyArray.length === 0 || currentHref !== this.historyArray[this.historyArray.length])) {
this.emptySearch = `https://${window.location.hostname}/?s=`;
// Remove all occurrences of the currentHref from this.historyArray
this.historyArray = this.historyArray.filter(url => url !== currentHref);
// Add the currentHref to the history array
this.historyArray.unshift(currentHref);
// initialHref = currentHref
// this.historyArray.pop()
// Save the updated history array to the sessionStorage
const itemToRemove = 'https://' + window.location.hostname + '/?s=';
console.log(itemToRemove);
console.log('Yes');
// Use the filter method to create a new array without the item to remove
this.historyArray = this.historyArray.filter(item => item !== itemToRemove);
sessionStorage.setItem('historyArray', JSON.stringify(this.historyArray));
this.historyArray = JSON.parse(sessionStorage.getItem('historyArray')) || [];
// sessionStorage.setItem('historyArray', JSON.stringify(this.historyArray))
// Log the history array (you can replace this with your own logic)
// console.log('History Array:', this.historyArray)
}
};

File diff suppressed because one or more lines are too long