Greasy Fork

Greasy Fork is available in English.

TypingClub Text Extractor

Extracts text from exercises and logs it into browser console.

当前为 2022-05-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         TypingClub Text Extractor
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Extracts text from exercises and logs it into browser console.
// @author       Timotej Milčák
// @match        https://*.edclub.com/sportal/program-*/*.play
// @icon         https://www.google.com/s2/favicons?sz=64&domain=edclub.com
// @grant        none
// @license      MIT
// ==/UserScript==

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

(async function() {
    'use strict';
    await sleep(5000);
    let lines = document.getElementsByClassName("token_unit  _clr");
    let complete_string = "";

    for(let i = 0;i < lines.length;i++) {
       if(lines[i].innerHTML != "<span class=\"_enter\">&nbsp;</span><br>")
           complete_string += lines[i].innerText;
        else
            complete_string += "$";
    }


    console.log(complete_string);

    //console.log("FUNGUJEM XD");
    // Your code here...
})();