-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display the SoundCloud URL when JS is disabled
- Loading branch information
Showing
3 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
for (const wrapper of document.getElementsByClassName("Soundcloud")) { | ||
const link = wrapper.firstElementChild; | ||
const url = wrapper.firstElementChild.getAttribute('href'); | ||
const iframe = document.createElement("iframe"); | ||
iframe.className = "Soundcloud-iframe"; | ||
iframe.setAttribute("src", `https://w.soundcloud.com/player/?url=${link.getAttribute('href')}&show_comments=false`); | ||
iframe.setAttribute("src", `https://w.soundcloud.com/player/?url=${url}&show_comments=false`); | ||
const button = document.createElement("button"); | ||
button.className = "Soundcloud-player"; | ||
button.textContent = 'Load SoundCloud player'; | ||
button.className = "Soundcloud-box Soundcloud-box--button"; | ||
button.textContent = "Load SoundCloud player"; | ||
button.onclick = () => wrapper.replaceChildren(iframe); | ||
wrapper.replaceChild(button, link); | ||
const policy = document.createElement("a"); | ||
policy.className = "Soundcloud-policy"; | ||
policy.textContent = "(cookie policy)"; | ||
policy.setAttribute("href", "https://soundcloud.com/pages/cookies"); | ||
wrapper.replaceChildren(button, policy); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters