NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name LingQ text to clipboard // @namespace http://tampermonkey.net/ // @include https://www.lingq.com/learn/* // @version 0.1.1 // @grant GM_setClipboard // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js // @description Adds a copy to clipboard button to texts in lingq.com // @author Asdrubal Ivan // ==/UserScript== (function() { 'use strict'; function getData(){ var paragraphs = []; //Let's select paragrahs $("div.text-block").find("p").each(function(){ var txt = $(this).text(); if(txt){ paragraphs.push(txt); } }); return paragraphs; } function copyClipboard() { var data = getData().join('\n\n'); GM_setClipboard(data, "text"); alert("Text copied"); } $(function(){ var button = "<button class='btn btn-lingq btn-lingq-3d know-all-btn' data-copy-clipboard>Copy to clipboard</button>"; $("#content-wrapper").find("div.reading-block").append(button); $("button[data-copy-clipboard]").click(function(e) { e.preventDefault(); copyClipboard(); }); }); })();