Collins multiple copy/paste
Version au
// ==UserScript==
// @name Collins 2
// @version 0.1
// @description Collins multiple copy/paste
// @author Cristo
// @include *
// @copyright 2012+, You
// @namespace https://greasyfork.org/users/1973
// ==/UserScript==
//Highlight what you want to copy and press the key.
//Q copys title
//W copys artist
//E copys date
//R copys site you're on, no need to highlight
//A fills title
//S fills artist
//D fills date
//F fills site
if ( document.getElementById("mturk_form") ) {
var page = document.getElementById("mturk_form");
var textBase = page.getElementsByTagName("li")[0];
var termLoc = textBase.getElementsByTagName("strong")[0];
var term = termLoc.innerHTML;
var searchLink = '<a href="http://www.google.com/search?q=' + term + '"' + 'target="_blank">' + term + '</a>'; //format for link that opens in new tab
termLoc.innerHTML = termLoc.innerHTML.replace(term, searchLink);
var fBox = document.getElementById("title");
var aBox = document.getElementById("creator");
var yBox = document.getElementById("date");
var lBox = document.getElementById("url");
}
document.addEventListener( "keydown", kas, false);
function kas(i) {
if ( i.keyCode == 65 ) { //A fills title
fBox.setAttribute( "value", GM_getValue("fb") );
}
if ( i.keyCode == 83 ) { //S fills artist
aBox.setAttribute( "value", GM_getValue("ab") );
}
if ( i.keyCode == 68 ) { //D fills date
yBox.setAttribute( "value", GM_getValue("yb") );
}
if ( i.keyCode == 70 ) { //F fills site
lBox.setAttribute( "value", GM_getValue("lb") );
}
if ( i.keyCode == 81 ) { //Q copys title
ffb();
}
if ( i.keyCode == 87 ) { //W copys artist
fab();
}
if ( i.keyCode == 69 ) { //E copys date
fyb() ;
}
if ( i.keyCode == 82 ) { //R copys site
flb() ;
}
}
function ffb() {
var box1 = window.getSelection().toString();
GM_setValue( "fb", box1 );
}
function fab() {
var box2 = window.getSelection().toString();
GM_setValue( "ab", box2 );
}
function fyb() {
var box3 = window.getSelection().toString();
GM_setValue( "yb", box3 );
}
function flb() {
var box4 = document.URL.toString();
GM_setValue( "lb", box4 );
}