// ==UserScript== // @name MTurk Check calorie information // @description Makes 'product' easily copyable, and makes URL to website a hyperlink. Also scrolls ocado.com directly to Nutrition section // @namespace http://idlewords.net // @include https://www.mturkcontent.com/dynamic/hit* // @include https://www.ocado.com/webshop/product* // @version 2 // @require https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js // @grant none // @downloadURL none // ==/UserScript== if ($("p:contains('Find the energy kJ per 100 g')").length) { $("table>tbody>tr").each(function(index, element) { $(this).children("td").each(function(index_c, element) { if (index_c == 0) { return true; } else if (index == 0) { var website = $(this).children("strong").text(); $(this).children("strong").wrapInner(""); } else if (index == 1) { var product = $(this).children("strong").text(); $(this).children("strong").text(''); $(this).append(''); $("#product").css('width', '400px').css('border', 'none'); } }); }); $("#product").mouseover(function() { $(this).select(); }); $("#product").mouseout(function() { $(this).select(); }); } if ($("a.shopLink:contains('Browse Shop')").length && document.URL.search('/product') > -1) { $("h2:contains('Nutrition')").wrapInner(''); $("#nutrition").css('border', 'none'); $("#nutrition").get(0).scrollIntoView(); window.scrollBy(0, -150); }