Sinus Soother
– Farmhouse Fresh Wholesale
Skip to content
async function downloadFile(url) {
try {
// Fetch the file
const response = await fetch(url);
console.log(url.split('/').pop().split('#')[0].split('?')[0]);
// Get the Blob data
const blob = await response.blob();
// Create a download link
const downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = url.split('/').pop().split('#')[0].split('?')[0];
// Trigger the download
document.body.appendChild(downloadLink);
downloadLink.click();
// Clean up
setTimeout(() => {
URL.revokeObjectURL(downloadLink.href);
document.body.removeChild(downloadLink);
}, 100);
} catch (error) {
console.error('Error downloading the file:', error.message);
}
}
// START code to hide the elements under saved cart
// function hidePreconfiguredRows() {
// const rows = document.querySelectorAll(".aodForm table tbody tr");
// rows.forEach((row) => {
// const propertiesContainer = row.querySelector(".aod-properties-container");
// if (propertiesContainer && propertiesContainer.textContent.includes("Pre-configured")) {
// const quantityInput = row.querySelector(".aodqty input[type='number']");
// const removeButton = row.querySelector(".aodbtn button");
// if (quantityInput) {
// quantityInput.style.display = "none";
// }
// if (removeButton) {
// removeButton.style.display = "none";
// }
// }
// });
// }
// // Callback function for MutationObserver
// const observerCallback = function (mutationsList, observer) {
// for (const mutation of mutationsList) {
// if (mutation.type === "childList") {
// // New elements were added or removed from the DOM
// const addButton = document.querySelector(".btn.aod_btn.aod_add_new_prd_btn.btn.btn-dark");
// if(addButton)
// {
// document.querySelector(".btn.aod_btn.aod_add_new_prd_btn.btn.btn-dark").style.display = "none";
// hidePreconfiguredRows(); // Call the function to hide rows
// }
// }
// }
// };
// // Create a MutationObserver instance
// const observer = new MutationObserver(observerCallback);
// // Define the target node to observe (in this case, the element)
// const targetNode = document.querySelector("body");
// // Configure the observer to watch for childList changes
// const observerConfig = { childList: true };
// // Start observing the target node
// observer.observe(targetNode, observerConfig);
// END code to hide the elements under saved cart