Last active
March 25, 2017 15:27
-
-
Save ygun/1b2592876c0e51a511facfde8fbc5413 to your computer and use it in GitHub Desktop.
LinguaLeo sound download
This file contains hidden or 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
| // ==UserScript== | |
| // @name LinguaLeo sound download | |
| // @namespace http://golubev.guru/ | |
| // @version 0.2 | |
| // @description auto download mp3 from lingualeo dictionary by F7 | |
| // @author Yuriy Golubev | |
| // @match https://lingualeo.com/* | |
| // @grant GM_download | |
| // @downloadURL https://gist.github.com/ygun/1b2592876c0e51a511facfde8fbc5413/raw/a26311c5d20383cda45e7f2392b4a5da3945dff4/llsd.js | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| // Your code here... | |
| function doc_keyUp(e) { | |
| switch (e.keyCode) { | |
| case 118: | |
| var url = document.getElementsByClassName("word-sound-link")[0].getAttribute("data-voice-url"); | |
| var word = document.getElementsByClassName("word-sound-link")[0].parentElement.parentElement.getElementsByClassName("word-origin")[0].innerText; | |
| GM_download(url, word.replace(/ /g, "-") + ".mp3"); | |
| break; | |
| default: | |
| break; | |
| } | |
| } | |
| document.addEventListener('keyup', doc_keyUp, false); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment