Skip to content

Instantly share code, notes, and snippets.

@ygun
Last active March 25, 2017 15:27
Show Gist options
  • Save ygun/1b2592876c0e51a511facfde8fbc5413 to your computer and use it in GitHub Desktop.
Save ygun/1b2592876c0e51a511facfde8fbc5413 to your computer and use it in GitHub Desktop.
LinguaLeo sound download
// ==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