changes to blocks and styles

This commit is contained in:
Jeremy Rangel
2024-12-27 22:56:39 -08:00
parent 93cc7be3bf
commit 462cffdddc
39 changed files with 959 additions and 228 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,4 +55,62 @@ document.addEventListener('DOMContentLoaded', function() {
});
});
});
});
});
// REPEATERS
// Example html:
// <div class="my-repeater-container">
// <div class="my-repeater-row">
// <input type="text" name="field_1[]">
// <input type="text" name="field_2[]">
// <input type="text" name="field_3[]">
//<button class="delete-repeater-row">Delete Row</button>
//</div>
//<button class="new-repeater-row">Click to add a new row</button>
//</div>
document.addEventListener('DOMContentLoaded', function () {
// Get all repeater containers
const repeaterContainers = document.querySelectorAll('.my-repeater-container');
// Loop through each repeater container and initialize the functionality
repeaterContainers.forEach(function (container) {
const newRowButton = container.querySelector('.new-repeater-row');
const rowTemplate = container.querySelector('.my-repeater-row');
// Hide the row template (we will clone it)
rowTemplate.style.display = 'none';
// Add event listener for the 'Add New Row' button
newRowButton.addEventListener('click', function () {
// Clone the row template
const newRow = rowTemplate.cloneNode(true);
// Make sure the new row is visible
newRow.style.display = 'flex'; // or 'block' based on your layout
// Reset input values in the new row
const inputs = newRow.querySelectorAll('input');
inputs.forEach(input => input.value = '');
// Add the new row to the repeater container
container.insertBefore(newRow, newRowButton);
});
// Handle deleting rows
container.addEventListener('click', function (e) {
if (e.target && e.target.classList.contains('delete-repeater-row')) {
const rowToDelete = e.target.closest('.my-repeater-row');
if (rowToDelete) {
rowToDelete.remove();
}
}
});
});
});

View File

@ -0,0 +1,71 @@
document.addEventListener("DOMContentLoaded", function () {
// Get reference to the popup element
const popup = document.getElementById('popup');
const facebookShareLink = document.getElementById('facebook-share');
const twitterShareLink = document.getElementById('twitter-share');
// Function to check if selection intersects with any <p> tag
function isSelectionInParagraph(selection) {
const range = selection.getRangeAt(0); // Get the selected range
const paragraphs = document.querySelectorAll('p'); // Get all <p> elements
for (let p of paragraphs) {
// Check if the selected range intersects with this <p> tag
const pRect = p.getBoundingClientRect();
const rangeRect = range.getBoundingClientRect();
// Check if the range and the <p> element's bounding boxes overlap
if (rangeRect.top < pRect.bottom && rangeRect.bottom > pRect.top &&
rangeRect.left < pRect.right && rangeRect.right > pRect.left) {
return true; // Selection intersects with this <p> tag
}
}
return false; // No intersection with any <p> tag
}
// Function to show the popup near the selected text
function showPopup(e) {
const selection = window.getSelection();
// Check if any text is selected and if it is inside or intersects with a <p> tag
if (selection.toString().length > 0 && isSelectionInParagraph(selection)) {
// Get the bounding rectangle of the selected text
const range = selection.getRangeAt(0);
const rect = range.getBoundingClientRect();
// Position the popup above the selection (adjust for spacing)
popup.style.left = `${rect.left + window.scrollX}px`;
popup.style.top = `${rect.top + window.scrollY - popup.offsetHeight - 5}px`;
// Show the popup
popup.style.display = 'block';
// Set up share links with the selected text and page URL
const selectedText = selection.toString();
const pageUrl = window.location.href;
// Facebook share link
facebookShareLink.setAttribute('href', `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(pageUrl)}&quote=${encodeURIComponent(selectedText)}`);
// Twitter/X share link
twitterShareLink.setAttribute('href', `https://twitter.com/intent/tweet?text=${encodeURIComponent(selectedText)}&url=${encodeURIComponent(pageUrl)}`);
} else {
// Hide the popup if no text is selected or it's not inside or overlapping a <p> tag
popup.style.display = 'none';
}
}
// Listen for mouse-up event (when selection ends)
document.addEventListener('mouseup', showPopup);
// Optionally, listen for touchend event for mobile devices
document.addEventListener('touchend', showPopup);
// Hide the popup if user clicks anywhere else
document.addEventListener('click', function(event) {
if (!popup.contains(event.target) && !window.getSelection().toString()) {
popup.style.display = 'none';
}
});
});

23
assets/json/icons.json Normal file
View File

@ -0,0 +1,23 @@
[
{
"family": "Font Awesome",
"svgs": [
{
"id": "comment-dots",
"name": "Comment Dots",
"path": "<path d='M168.2 384.9c-15-5.4-31.7-3.1-44.6 6.4c-8.2 6-22.3 14.8-39.4 22.7c5.6-14.7 9.9-31.3 11.3-49.4c1-12.9-3.3-25.7-11.8-35.5C60.4 302.8 48 272 48 240c0-79.5 83.3-160 208-160s208 80.5 208 160s-83.3 160-208 160c-31.6 0-61.3-5.5-87.8-15.1zM26.3 423.8c-1.6 2.7-3.3 5.4-5.1 8.1l-.3 .5c-1.6 2.3-3.2 4.6-4.8 6.9c-3.5 4.7-7.3 9.3-11.3 13.5c-4.6 4.6-5.9 11.4-3.4 17.4c2.5 6 8.3 9.9 14.8 9.9c5.1 0 10.2-.3 15.3-.8l.7-.1c4.4-.5 8.8-1.1 13.2-1.9c.8-.1 1.6-.3 2.4-.5c17.8-3.5 34.9-9.5 50.1-16.1c22.9-10 42.4-21.9 54.3-30.6c31.8 11.5 67 17.9 104.1 17.9c141.4 0 256-93.1 256-208S397.4 32 256 32S0 125.1 0 240c0 45.1 17.7 86.8 47.7 120.9c-1.9 24.5-11.4 46.3-21.4 62.9zM144 272a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm144-32a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm80 32a32 32 0 1 0 0-64 32 32 0 1 0 0 64z'/>"
},
{
"id": "newspaper",
"name": "Newspaper",
"path": "<path d='M168 80c-13.3 0-24 10.7-24 24l0 304c0 8.4-1.4 16.5-4.1 24L440 432c13.3 0 24-10.7 24-24l0-304c0-13.3-10.7-24-24-24L168 80zM72 480c-39.8 0-72-32.2-72-72L0 112C0 98.7 10.7 88 24 88s24 10.7 24 24l0 296c0 13.3 10.7 24 24 24s24-10.7 24-24l0-304c0-39.8 32.2-72 72-72l272 0c39.8 0 72 32.2 72 72l0 304c0 39.8-32.2 72-72 72L72 480zM176 136c0-13.3 10.7-24 24-24l96 0c13.3 0 24 10.7 24 24l0 80c0 13.3-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24l0-80zm200-24l32 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-32 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 80l32 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-32 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zM200 272l208 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-208 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 80l208 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-208 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z'/>"
},
{
"id": "map",
"name": "Map",
"path": "<path d='M565.6 36.2C572.1 40.7 576 48.1 576 56l0 336c0 10-6.2 18.9-15.5 22.4l-168 64c-5.2 2-10.9 2.1-16.1 .3L192.5 417.5l-160 61c-7.4 2.8-15.7 1.8-22.2-2.7S0 463.9 0 456L0 120c0-10 6.1-18.9 15.5-22.4l168-64c5.2-2 10.9-2.1 16.1-.3L383.5 94.5l160-61c7.4-2.8 15.7-1.8 22.2 2.7zM48 136.5l0 284.6 120-45.7 0-284.6L48 136.5zM360 422.7l0-285.4-144-48 0 285.4 144 48zm48-1.5l120-45.7 0-284.6L408 136.5l0 284.6z'/>"
}
]
}
]