// ------------------add new card js-------------- // function bookmarkContent() { const files = document.querySelector(".file_upload").files; return `
${$('#title').val()}

${$('#weburl').val()}

`; } // <---------on click icon fill js -------->// function getActionsFeture() { try { const deleteButtons = document.querySelectorAll('.deletbtn'); const heartIcons = document.querySelectorAll('.hearticon'); const shareIcons = document.querySelectorAll('.shareicon'); const starIcons = document.querySelectorAll('.staricon'); deleteButtons.forEach(function (btn) { btn.addEventListener('click', function (event) { const deletbtn = event.target.closest(".col-xxl-4"); document.querySelector('#delet-tab-pane .row').appendChild(deletbtn.cloneNode(true)); deletbtn.closest(".col-xxl-4").remove(); }); }); heartIcons.forEach(function(icon) { icon.addEventListener('click', function(event) { this.classList.toggle('ph-bold'); // Toggle between outline icon this.classList.toggle('ph-fill'); // and filled icon const heartBtn = this.closest(".col-xxl-4").cloneNode(true); if (event.target.classList.contains("ph-fill")) { document.querySelector('#favourite-tab-pane .row').appendChild(heartBtn); } else { const existingElements = document.querySelectorAll('#favourite-tab-pane .row .col-xxl-4'); existingElements.forEach(child => { if (child.dataset.originalId === heartBtn.dataset.originalId) { child.remove() } }); } }); }); shareIcons.forEach(function(icon) { icon.addEventListener('click', function(event) { this.classList.toggle('ph-bold'); // Toggle between outline icon this.classList.toggle('ph-fill'); // and filled icon const shareBtn = this.closest(".col-xxl-4").cloneNode(true); if (event.target.classList.contains("ph-fill")) { document.querySelector('#share-tab-pane .row').appendChild(shareBtn); } else { const existingElements = document.querySelectorAll('#share-tab-pane .row .col-xxl-4'); existingElements.forEach(child => { if (child.dataset.originalId === shareBtn.dataset.originalId) { child.remove() } }); } }); }); starIcons.forEach(function(icon) { icon.addEventListener('click', function(event) { this.classList.toggle('ph-bold'); // Toggle between outline icon this.classList.toggle('ph-fill'); // and filled icon const starBtn = this.closest(".col-xxl-4").cloneNode(true); if (event.target.classList.contains("ph-fill")) { document.querySelector('#important-tab-pane .row').appendChild(starBtn); } else { const existingElements = document.querySelectorAll('#important-tab-pane .row .col-xxl-4'); existingElements.forEach(child => { if (child.dataset.originalId === starBtn.dataset.originalId) { child.remove() } }); } }); }); } catch (error) { console.error('Error in getActionsFeture:', error); } } document.querySelector('#bookkey').onclick = function (event) { try { const rowElement = document.querySelector("#bookmark-tab-pane .row"); if (rowElement) { rowElement.insertAdjacentHTML('afterbegin', bookmarkContent()); $("#bookmarkAddModal").modal("hide"); getActionsFeture(); } } catch (error) { console.error('Error while adding bookmark content:', error); } } // Initializing actions getActionsFeture();