Public archive for the Return to Ritherdon project.
https://www.nicolaellisandritherdon.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
49 lines
1.7 KiB
function toggleSiteSideMenu() { |
|
let displayStyle = document.getElementById("be-site-side-menu").style.display; |
|
if (displayStyle === "flex") { |
|
document.getElementById("be-site-side-menu").style.display = "none"; |
|
} else { |
|
document.getElementById("be-site-side-menu").style.display = "flex"; |
|
} |
|
} |
|
|
|
function closeAlert() { |
|
document.getElementById("be-alert-container").style.display = "none"; |
|
} |
|
|
|
window.addEventListener("load", () => { |
|
// (A) GET HTML ELEMENTS |
|
var filter = document.getElementById("fe-search-filter"), // search box |
|
list = document.querySelectorAll("#fe-search-filter-list li"); // all list items |
|
|
|
// (B) ATTACH KEY UP LISTENER TO SEARCH BOX |
|
filter.onkeyup = () => { |
|
// (B1) GET CURRENT SEARCH TERM |
|
let search = filter.value.toLowerCase(); |
|
|
|
// (B2) LOOP THROUGH LIST ITEMS - ONLY SHOW THOSE THAT MATCH SEARCH |
|
for (let i of list) { |
|
let item = i.innerHTML.toLowerCase(); |
|
if (item.indexOf(search) == -1) { i.classList.add("hide"); } |
|
else { i.classList.remove("hide"); } |
|
} |
|
}; |
|
}); |
|
|
|
|
|
function copyToClipBoard (slug) { |
|
let URL = location.protocol + "//" + location.host + "/storage/view/media/" + slug; |
|
let popup = document.getElementById(slug + "-popup"); |
|
navigator.clipboard.writeText(URL).then(() => { |
|
/* Resolved - text copied to clipboard */ |
|
console.log("Copied: " + URL + " to clipboard."); |
|
popup.style.visibility = "visible"; |
|
setTimeout(function () { |
|
popup.style.visibility = "hidden"; |
|
}, 2000); |
|
|
|
},() => { |
|
/* Rejected - clipboard failed */ |
|
console.log("Couldn't copy " + URL + " to clipboard"); |
|
}); |
|
}
|
|
|