This commit is contained in:
parent
08ebf7fc9e
commit
5914178e2f
19 changed files with 440 additions and 63 deletions
|
|
@ -1,6 +1,3 @@
|
|||
// ===============================
|
||||
// HEADER
|
||||
// ===============================
|
||||
export function headerToggle() {
|
||||
const header = document.getElementById("site-header");
|
||||
const buttonToggle = document.querySelector("#menu-toggle");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { headerToggle, headerScrollVisibility } from './header.js';
|
||||
import { copyLink } from './share.js';
|
||||
|
||||
// TEMP, with includeHTML() --------------------------------------
|
||||
|
||||
|
|
@ -24,9 +25,10 @@ function runIncludeHTML() {
|
|||
|
||||
// Note: une fois que IncludeHTML() est supprimé, on peut supprimer tout le temp au dessus
|
||||
// remplacer `function initAfterLoad()` par ↓
|
||||
// window.onload = async function () {
|
||||
// window.onload = async function () { }
|
||||
|
||||
function initAfterLoad() {
|
||||
headerToggle();
|
||||
headerScrollVisibility();
|
||||
copyLink();
|
||||
}
|
||||
|
|
|
|||
19
assets/js/share.js
Normal file
19
assets/js/share.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export function copyLink() {
|
||||
let buttons = document.querySelectorAll('.copy-link button');
|
||||
buttons.forEach(function (button, index) {
|
||||
console.log(button);
|
||||
let link = button.parentNode.querySelector("input").value;
|
||||
|
||||
button.addEventListener('click', function() {
|
||||
navigator.clipboard.writeText(link).then(() => {
|
||||
const originalText = button.textContent;
|
||||
button.textContent = 'Lien copié';
|
||||
setTimeout(() => {
|
||||
button.textContent = originalText;
|
||||
}, 1000);
|
||||
}).catch(err => {
|
||||
console.error('Erreur lors de la copie:', err);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue