Skip to content

Instantly share code, notes, and snippets.

@sisiwei
Last active August 19, 2019 15:39
Show Gist options
  • Save sisiwei/aaaedd3128928bbd090cd80c3b59dc0b to your computer and use it in GitHub Desktop.
Save sisiwei/aaaedd3128928bbd090cd80c3b59dc0b to your computer and use it in GitHub Desktop.
// This is a javascript bookmarklet that makes Zenefits show you
// your APPROVED vacation taken/scheduled in days instead of hours.
// Notes:
// - Script will probably only work in 2019 'cause it seems complicated to detect year
// - If you don't get 22 days off each year, adjust that number in totalVacation below
// Usage Instructions (2 options, depending on if you've used bookmarklets before):
// 1. Bookmark this:
javascript:(function()%7Bvar%20totalVacation%20%3D%2022%3Bvar%20hoursPerDay%20%3D%208%3Bvar%20approved%20%3D%200%3B%24.each(%24('.z-vr-status-approved%20.u-bold')%2C%20function(k%2Cv)%7B%20approved%20%2B%3D%20Math.abs(v.innerText)%20%7D)%3Bvar%20daysTaken%20%3D%20approved%2FhoursPerDay%3Bvar%20daysRemaining%20%3D%20totalVacation-daysTaken%3B%24('.container.settings').prepend(%22%3Cdiv%20style%3D'margin%3A%2030px%200%200%200%3B'%3EDays%20Taken%3A%20%22%20%2B%20daysTaken%20%2B%20%22%20%2F%2F%20Days%20Remaining%3A%20%22%20%2B%20daysRemaining%20%2B%20%22%3C%2Fdiv%3E%22)%7D)()
// 2. OR
// Go to this URL https://bookmarkify.it/15805
// and drag the "Zenefits" link to your bookmarks bar
// Here's the raw code. So fun.
var totalVacation = 22;
var hoursPerDay = 8;
var approved = 0;
$.each($('.z-vr-status-approved .u-bold'), function(k,v){ approved += Math.abs(v.innerText) });
var daysTaken = approved/hoursPerDay;
var daysRemaining = totalVacation-daysTaken;
$('.container.settings').prepend("<div style='margin: 30px 0 0 0;'>Days Taken: " + daysTaken + " // Days Remaining: " + daysRemaining + "</div>");
@sisiwei
Copy link
Author

sisiwei commented Aug 19, 2019

Extra note: If you've taken personal days, that shows up in a different tab so the javascript can't access it. You may have to add 1-2 days to your days taken based on whether you've taken your personal days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment