// ==UserScript== // @name Bunpro: Copy Sentences // @namespace http://tampermonkey.net/ // @version 0.2.4 // @description Allows you to click Japanese sentences and their translations to copy them to clipboard. // @author Kumirei // @include *bunpro.jp/* // @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012 // @grant none // @downloadURL none // ==/UserScript== (function() { waitForKeyElements('body', function(e) { e.on('click', function(e) { //english example sentences else if (["english-example-sentence", "example-sentence-english"].includes(e.target.className)) copyText(e.target.innerText); //while studying else if (e.target.className == "example-sentence-english hide-english") copyText(e.target.innerText); //grammar page else if (["english-example-sentence", "example-sentence-english"].includes(e.target.parentNode.className)) copyText(e.target.parentNode.innerText); //japanese example sentences else if (e.target.className == "japanese-example-sentence") copyText(parseSentence(e.target)); else if ($(e.target).closest('li')[0] != undefined && $(e.target).closest('li')[0].className == "japanese-example-sentence") copyText(parseSentence($(e.target).closest('li')[0])); }); }); //add buttons waitForKeyElements('#check-grammar', function(e) { if (!$('#buttonsBar').length) { $('#check-grammar').before('