From 6b9def500e0336e2ba42471adc637ad3f4eedcaf Mon Sep 17 00:00:00 2001 From: Sh Raj Date: Sun, 17 Mar 2024 22:07:48 +0530 Subject: [PATCH] disabling download enabled --- audiplay.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/audiplay.js b/audiplay.js index 820e5ca..b6c33b6 100644 --- a/audiplay.js +++ b/audiplay.js @@ -133,8 +133,18 @@ const ap_audioElements = document.querySelectorAll('.audiplay'); ap_audioElements.forEach((audioElement, index) => { audioElement.insertAdjacentHTML('beforebegin', ap_html); createContainer(audioElement, index); + + // Check if 'nodownload' attribute is present + if (audioElement.getAttribute("nodownload") !== null) { + const apContainer = audioElement.previousElementSibling; + const downloadButton = apContainer.querySelector('.ap_download'); + if (downloadButton) { + downloadButton.style.display = 'none'; + } + } }); + // Function to create container with appropriate class function createContainer(audioElement, index) { const apContainer = audioElement.previousElementSibling;