Last active
March 8, 2021 20:17
-
-
Save jasonrush/0ff044def153ba30309ee1fea43aed32 to your computer and use it in GitHub Desktop.
Jason's GreaseMonkey script for highlighting client info on job pages I often miss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Jason's Upwork Stuff | |
// @namespace https://portfolio.jason-rush.com/ | |
// @version 0.1 | |
// @description Highlight important information about clients on job pages I often miss | |
// @author Jason Rush ([email protected]) | |
// @match https://www.upwork.com/jobs/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-3.4.1.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var minimumHourlyRate = 15.00; // NOTE: This must be a decimal number. If you want an even dollar amount, use 15.00 for example. | |
// Flag "0% hire rate" with an orange background | |
var checkHireRateExist = setInterval(function() { | |
if ($("li[data-qa='client-job-posting-stats']").length) { | |
var postingStats = $("li[data-qa='client-job-posting-stats']") | |
console.log("li[data-qa='client-job-posting-stats'] exists."); | |
console.log( postingStats.html() ); | |
if ($(postingStats).find("div[class='text-muted']").length) { | |
var textMuted = $(postingStats).find("div[class='text-muted']") | |
console.log("div[class='text-muted'] exists."); | |
if( textMuted.html().startsWith(" 0% hire rate") ){ | |
console.log("text-muted starts with '0% hire rate'"); | |
textMuted.css("background-color","orange"); | |
} | |
console.log( textMuted.html() ); | |
} | |
clearInterval(checkHireRateExist); | |
} | |
}, 100); // check every 100ms | |
// Flag low average hourly rates with an orange background | |
var checkAverageRateExist = setInterval(function() { | |
if ($("strong[data-qa='client-hourly-rate']").length) { | |
var hourlyRateElement = $("strong[data-qa='client-hourly-rate']") | |
console.log("strong[data-qa='client-hourly-rate'] exists."); | |
var hourlyRateString = hourlyRateElement.text().split(' ')[1] | |
console.log( "Hourly rate (string): " + hourlyRateString ); | |
var hourlyRateFloat = parseFloat( hourlyRateString ); | |
console.log( "Hourly rate (float): " + hourlyRateFloat ); | |
if ( hourlyRateFloat < minimumHourlyRate ) { | |
console.log("Hourly rate ("+hourlyRateFloat+" is less than "+minimumHourlyRate); | |
hourlyRateElement.css("background-color","orange"); | |
} | |
clearInterval(checkAverageRateExist); | |
} | |
}, 100); // check every 100ms | |
// Flag payment method not verified with an orange background | |
var checkPaymentMethodVerifiedExist = setInterval(function() { | |
if ($("div[id='payment-not-verified']").length) { | |
var notVerifiedBadgeElement = $("div[id='payment-not-verified']") | |
var notVerifiedParentElement = $("div[id='payment-not-verified']").parent() | |
console.log("Not verified badge found."); | |
notVerifiedParentElement.css("background-color","orange"); | |
clearInterval(checkPaymentMethodVerifiedExist); | |
} | |
}, 100); // check every 100ms | |
// Flag existing hires with an orange background | |
var checkExistingHiresExist = setInterval(function() { | |
if ($("span[class='text-muted']:contains('Hires:')").length) { | |
var existingHiresElement = $("span[class='text-muted']:contains('Hires:')") | |
console.log("Existing hires found."); | |
existingHiresElement.css("background-color","orange"); | |
clearInterval(checkExistingHiresExist); | |
} | |
}, 100); // check every 100ms | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment