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.

Revisions

  1. ygun revised this gist Mar 25, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions llsd.js
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@
    // @author Yuriy Golubev
    // @match https://lingualeo.com/*
    // @grant GM_download
    // @downloadURL https://gist.github.com/ygun/1b2592876c0e51a511facfde8fbc5413/raw/a26311c5d20383cda45e7f2392b4a5da3945dff4/llsd.js
    // ==/UserScript==

    (function() {
  2. ygun created this gist Mar 25, 2017.
    27 changes: 27 additions & 0 deletions llsd.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    // ==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
    // ==/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);
    })();