- Joined
- Jan 12, 2016
- Messages
- 65,204
- Reaction score
- 145,744
- Points
- 2,088
- Gender
- Male
You can already click the image to zoom, and change the setting for how big it zooms, but this will default the zoom to on:The only thing would be to make the pictures a little bigger, but I am not sure how they would fit in the frame
Code:
// ==UserScript==
// @name DCF - Shoe feature labelling
// @version 1.2
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @include https://s3.amazonaws.com/mturk_bulk/hits*
// @include https://www.mturkcontent.com/dynamic/*
// ==/UserScript==
if ($('td:contains("Shoe feature labelling")').length){
var image_scaling = 2.0;
var default_zoom = true;
$('td:contains("Common Ambiguities")').wrapInner('<div class="instructions"></div>');
$(".instructions").before('<button id="toggle" type="button"><span>Show Instructions</span></button>').hide();
$('#toggle').click(function() {
$(".instructions").toggle();
$('#toggle').text() == 'Show Instructions' ? str = 'Hide Instructions' : str = 'Show Instructions';
$('#toggle span').html(str);
});
$('table:eq(1)').after('<img src="' + $('td:contains("Link to shoe image")').next().find('a').attr('href') + '">');
if (default_zoom){
$('img').width($('img').width ()*image_scaling);
$('img').toggleClass('zoomed');
}
$('img').click(function(){
if ($(this).hasClass('zoomed')){
$(this).width($(this).width ()/image_scaling);
$(this).toggleClass('zoomed');
}
else{
$(this).width($(this).width ()*image_scaling);
$(this).toggleClass('zoomed');
}
});
$('table:eq(2) tr').append('<td class="filler"></td>');
$('.filler').each(function(index){
var fill_options = [];
$(this).prev().find('option').each(function(){
fill_options.push($(this).text().replace(/^\w\)/,'').split(':')[0]);
});
$(this).html('<span class="options_list' + index + '">' + fill_options.join('</span> | <span class="options_list' + index + '">') + '</span>');
});
$('[class^=options_list]').click(function(){
$(this).parent().prev().find('select')[0].selectedIndex = $(this).parent().find('[class^=options_list]').index($(this));
$('[class=' + $(this).attr('class') + ']').css('background-color','');
$(this).css('background-color','lightgreen');
});
$('table:eq(2) tr').each(function(){
$(this).find('span:last')[0].click();
});
}
change default_zoom to false if you don't want it to zoom the image initially
Last edited: