Advertisement
jcunews

ldoceonline.com-add-download-links-for-audio-files.user.js

Feb 15th, 2024
1,240
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         ldoceonline.com add download links for audio files
  3. // @namespace    https://greasyfork.org/en/users/85671-jcunews
  4. // @version      1.0.1
  5. // @license      AGPL v3
  6. // @author       jcunews
  7. // @description  Context: https://old.reddit.com/r/software/comments/1arxfim/is_there_a_way_to_download_the_audio_files_from/
  8. // @match        https://www.ldoceonline.com/dictionary/*
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (a => {
  13.   if (a = document.querySelector('.dictlink:has(.speaker) .Tail')) {
  14.     a.insertAdjacentHTML("beforebegin", '<a download id=adl style="display:none"></a><a href=# style="font-weight:bold;color:#070">Download all audio files</a>');
  15.     (a = a.previousSibling).onclick = () => {
  16.       document.querySelectorAll('span.speaker[data-src-mp3]').forEach(e => {
  17.         adl.href = e.dataset.srcMp3;
  18.         adl.click()
  19.       })
  20.     }
  21.   }
  22. })()
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement