Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name Click-To-Copy Rainforest
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Click to Copy text from instructions with double click word or select the entire message and clicking again ( like a ctrl+c ) "DON'T USE IF INSTRUCTIONS ASK FOR TYPE!
// @author Eduardo Gimenez - edufgimenez
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @match https://tester.rainforestqa.com/tester/preassigned/*
// ==/UserScript==
(function() {
'use strict';
var $ = window.$
//the almost code I got from google research, I don't know much about javascript, only python and perl.
$('div').each(function() {
var $this = $(this);
$this.html($this.text().replace(/\b(\w+)\b/g, "<span>$1</span>"));
});
$('div span').click(
function() {
(copyText($(this).html()));
});
function copyText(word){
document.execCommand("copy")
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment