Categorization Map

enter something useful

Verze ze dne 18. 08. 2015. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name       Categorization Map
// @version    0.8
// @description  enter something useful
// @match      https://s3.amazonaws.com/mturk_bulk/hits*
// @require     http://code.jquery.com/jquery-latest.min.js
// @copyright  2014+, Tjololo
// @namespace https://greasyfork.org/users/710
// ==/UserScript==

var elem = $("p.ng-scope:last").text();
var addy = elem.split(':')[1];
console.log(addy);
var api = "";
var zoomlevel = 20;
var googlePrefix = "https://maps.googleapis.com/maps/api/staticmap?markers=size:mid%7Ccolor:red%7C";
var url = googlePrefix + encodeURIComponent(addy.replace(",","")) + "&size=512x512&zoom="+zoomlevel+"&maptype=hybrid&sensor=false";
if (api != "")
    url += "&key="+api;
console.log(url);
var ifrm = document.createElement("img");
ifrm.setAttribute("src", url);
ifrm.setAttribute("id", "map");
ifrm.style.width = 512+"px";
ifrm.style.height = 512+"px";

var zoomlvl = document.createElement("div");
zoomlvl.setAttribute("id","zoom_level");
zoomlvl.innerHTML="Zoom: "+zoomlevel;

$("div.span7.ng-scope").append(ifrm);
$("div.span7.ng-scope").append(zoomlvl);

var content = document.getElementById("wrapper");
content.tabIndex = "0";
content.focus();

var element = document.getElementById('preview_overlay');
if (element)
    element.parentNode.removeChild(element);

document.onkeydown = showkeycode;
function showkeycode(evt){
    var keycode = evt.keyCode;
    switch (keycode) {
        case 65: //a
            $("[id='Completely Shaded']").click();
            document.getElementById("mturk_form").submit();
            break;
        case 66: //b
            $("[id='Mostly Shaded']").click();
            document.getElementById("mturk_form").submit();
            break;
        case 67: //c
            $("[id='Mostly Not Shaded']").click();
            document.getElementById("mturk_form").submit();
            break;
        case 68: //d
            $("[id='Completely NOT Shaded']").click();
            document.getElementById("mturk_form").submit();
            break;
        case 69: //e
            $("[id='House Not Visible']").click();
            document.getElementById("mturk_form").submit();
            break;
        case 13: //enter
            document.getElementById("mturk_form").submit();
            break;
        case 107: //+
            zoomlevel += 1;
            url = googlePrefix + encodeURIComponent(addy.replace(",","")) + "&size=512x512&zoom="+zoomlevel+"&maptype=hybrid&sensor=false";
            console.log(url);
            document.getElementById("map").setAttribute("src", url);
            document.getElementById("zoom_level").innerHTML="Zoom: "+zoomlevel;
            break;
        case 187: //+
            zoomlevel += 1;
            url = googlePrefix + encodeURIComponent(addy.replace(",","")) + "&size=512x512&zoom="+zoomlevel+"&maptype=hybrid&sensor=false";
            console.log(url);
            document.getElementById("map").setAttribute("src", url);
            document.getElementById("zoom_level").innerHTML="Zoom: "+zoomlevel;
            break;
        case 109: //+
            zoomlevel -= 1;
            url = googlePrefix + encodeURIComponent(addy.replace(",","")) + "&size=512x512&zoom="+zoomlevel+"&maptype=hybrid&sensor=false";
            console.log(url);
            document.getElementById("map").setAttribute("src", url);
            document.getElementById("zoom_level").innerHTML="Zoom: "+zoomlevel;
            break;
        case 189: //+
            zoomlevel -= 1;
            url = googlePrefix + encodeURIComponent(addy.replace(",","")) + "&size=512x512&zoom="+zoomlevel+"&maptype=hybrid&sensor=false";
            console.log(url);
            document.getElementById("map").setAttribute("src", url);
            document.getElementById("zoom_level").innerHTML="Zoom: "+zoomlevel;
            break;
    }
}