AA Time

Shows AA time when you expand a HIT in the search

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        AA Time
// @match       https://*.mturk.com/mturk/viewhits*
// @match       https://*.mturk.com/mturk/findhits*
// @match       https://*.mturk.com/mturk/sorthits*
// @match       https://*.mturk.com/mturk/searchbar*
// @match       https://*.mturk.com/mturk/viewsearchbar*
// @match       https://*.mturk.com/mturk/sortsearchbar*
// @match       https://*.mturk.com/mturk/preview?*
// @match       https://*.mturk.com/mturk/statusdetail*
// @match       https://*.mturk.com/mturk/return*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// @version     1
// @namespace https://greasyfork.org/users/6438
// @description Shows AA time when you expand a HIT in the search
// ==/UserScript==

$(function(){
    $('a[id^="capsule"]').each(function(index) {
        $(this).click(function(){
            var this_row = $(this).parent().parent();
            var url="";      
            this_row.find("a").each(function() {
                if (this.href.indexOf("preview?") !== -1)
                {
                    url = "https://www.mturk.com" + $(this).attr('href');
                    
                }  });
            if (url !=="" )
            {
            var $src;
            jQuery.ajax({
                url:    url,
                success: function(data) {$src = $(data);},
                async:   false
            });
            var hitAutoAppDelayInSeconds = $src.find("input[type='hidden'][name='hitAutoAppDelayInSeconds']").val();
            var days  = Math.floor((hitAutoAppDelayInSeconds/(60*60*24)));
            var hours = Math.floor((hitAutoAppDelayInSeconds/(60*60)) % 24);
            var mins  = Math.floor((hitAutoAppDelayInSeconds/60) % 60);
            var secs  = hitAutoAppDelayInSeconds % 60;
            
            var time_str = (days  == 0 ? "" : days  + (days  > 1 ? " days "    : " day "))    +
                           (hours == 0 ? "" : hours + (hours > 1 ? " hours "   : " hour "))   + 
                           (mins  == 0 ? "" : mins  + (mins  > 1 ? " minutes " : " minute ")) + 
                           (secs  == 0 ? "" : secs  + (secs  > 1 ? " seconds " : " second "));
        
            if (hitAutoAppDelayInSeconds == 0)
            {
                time_str = '0 seconds';
            }
            //var sea = "#AA"+index;
            //if !($(document).find(sea) == null)
            if($(this).parent().parent().find("[id^='AA']").length==0)
                $(this).after("<tr><td colspan='11' id='AA" + index+ "' valign='top' nowrap='' align='left'><b>&nbsp;Automatically Approved in&nbsp;"+time_str+"</b></td></tr>");
            }
        });
    });
});