JR Noblis Image Finder Helper

Makes it easier to select answer for images of people.

当前为 2016-02-20 提交的版本,查看 最新版本

// ==UserScript==
// @name        JR Noblis Image Finder Helper
// @namespace   https://gf.qytechs.cn/users/6406
// @description Makes it easier to select answer for images of people.
// @version     0.4
// @require     http://code.jquery.com/jquery-1.10.2.min.js
// @include     http*://s3.amazonaws.com/TurkAnnotator*
// @grant       none
// ==/UserScript==

var OPEN_URL_AUTO = true;
var CLOSE_POPWINDOW_AFTER = true;

var gQuestions = [];
var gQuestionIndex = 0;
var gOpenedWindow = null;

function isNoblisIMages() { return $('#instructions_subject_present:contains("Determine whether the person represented by this google image link")').length; }

$(function() {
    if ( isNoblisIMages() ) {
        setTimeout( function() {
            console.log("Found Noblis Images");
            if (OPEN_URL_AUTO) {
                var personLink = $("#person_link").attr("href");
                var windowWidth = "width=" + screen.width/2;
                var windowHeight = "height=" + (screen.height-(screen.height/10));
                var windowPosition = "left=0," + windowHeight + "," + windowWidth + ",top=0";
                if (personLink) {
                    gOpenedWindow = window.open(personLink,"imagesearch",windowPosition)
                    if (gOpenedWindow) gOpenedWindow.blur();
                    window.focus();
                }
            }
            if ($("#img_boundary")) {
                $("#img_boundary > div").each( function(i,theObject) {
                    if (i>0) {
                        $(theObject).find("div:first").width("140px");
                        $(theObject).find("img:first").css( {marginLeft : "130px"} );
                        $(theObject).find(":radio:eq(0)")[0].nextSibling.nodeValue = "Present (1)";
                        $(theObject).find(":radio:eq(1)")[0].nextSibling.nodeValue = "Not Present (2)";
                        $(theObject).find(":radio:eq(1)").click();
                        $(theObject).find(":radio:eq(2)")[0].nextSibling.nodeValue = "Can't tell (3)";
                        $(theObject).find(":radio:eq(3)")[0].nextSibling.nodeValue = "no Image (0)";
                        gQuestions.push(theObject);
                    }
                });
                $(gQuestions[gQuestionIndex]).css( "background-color", "#66CCCC" );
                $(document).keydown(function(event) {
                    //console.log(gQuestions.length);
                    if (gQuestionIndex<gQuestions.length) {
                        var goToNext = false;
                        if (event.which == 49 || event.which == 97) { // 1 - Present
                            $(gQuestions[gQuestionIndex]).find(":radio:eq(0)").click();
                            goToNext=true;
                        }
                        if (event.which == 50 || event.which == 98) { // 2 - Not Present
                            $(gQuestions[gQuestionIndex]).find(":radio:eq(1)").click();
                            goToNext=true;
                        }
                        if (event.which == 51 || event.which == 99) { // 3 - Can't Tell
                            $(gQuestions[gQuestionIndex]).find(":radio:eq(2)").click();
                            goToNext=true;
                        }
                        if (event.which == 48 || event.which == 96) { // 0 - Image Not Loaded
                            $(gQuestions[gQuestionIndex]).find(":radio:eq(3)").click();
                            goToNext=true;
                        }
                        if (goToNext) {
                            $(gQuestions[gQuestionIndex]).css( "background-color", "" );
                            gQuestionIndex++;
                            if (gQuestionIndex>=gQuestions.length) $("#button_div").css( "background-color", "#66CCCC" );
                            else {
                                $('html, body').animate({
                                    scrollTop: $(gQuestions[gQuestionIndex]).offset().top-21
                                }, 700);
                                $(gQuestions[gQuestionIndex]).css( "background-color", "#66CCCC" );
                            }
                        }
                    } else if (	event.which == 13) {
                        $("#submitbutton").click();
 						event.preventDefault();
						event.stopPropagation();
                        if (OPEN_URL_AUTO && CLOSE_POPWINDOW_AFTER && gOpenedWindow) gOpenedWindow.close();
                   }
                });
            }
        }, 903);
    }
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址