// ==UserScript== // @name Mturk Expanded Header (Cached) // @namespace DonovanM // @author DonovanM (dnast) // @description Gives you an expanded header with transfer balance and Worker ID without polling on every page load. This also works on the latest Firefox (the other scripts will break soon). // @include https://www.mturk.com/mturk/* // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // @version 0.9 // @grant none // @downloadURL none // ==/UserScript== /** Users can change the values below to thier liking. The cache_time is the number of minutes before the balance is checked again. For the colors you can use hex i.e. "#ABC123" or RBG(A) i.e. "rgba(100,255,220, .8)". Just make sure the color values are in quotes (but not the cache time). **/ var UserSettings = { }; UserSettings.cache_time = 5; // Minutes to wait between updating UserSettings.idColor = "#c60"; // Color of the WorkerId highlight UserSettings.balanceColor = "#03B603"; // Color of the balance amount. Use "#000" to go back to black /** End of user settings **/ var LOCAL_STORAGE = "expanded_header_data"; $(document).ready(function() { var header = new Header(); }); function Header() { this.URL = "https://www.mturk.com/mturk/dashboard"; this.CACHE_TIME = UserSettings.cache_time * 60000; // Convert mins to millis this.isSignedIn = false; this.init(); } Header.prototype.init = function() { this.addStyle(); this.addDiv(); this.getData(); } Header.prototype.addDiv = function() { // Get the place in the document to add the header var container = $("#user_name_field").parent(); if (container.length === 0) container = $("#lnkWorkerSignin").parent(); else this.isSignedIn = true; // Create the div var div = $("