diff --git a/wheniwork.hours.user.js b/wheniwork.hours.user.js new file mode 100644 index 0000000..45cae33 --- /dev/null +++ b/wheniwork.hours.user.js @@ -0,0 +1,63 @@ +// ==UserScript== +// @name WhenIWork True Total Worked +// @namespace danielrayjones +// @description Adds the Total hours worked, including today +// @include https://app.wheniwork.com/payroll/ +// @version 0.2 +// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js +// ==/UserScript== + +/* global $ */ + +$(document).ready(function() { + 'use strict'; + + // Filter out this event from iframes + if (!this.body.classList.contains("controller-payroll")) { + return; + } + + let currentHourSum = 0; + + function updateHours(hours) { + currentHourSum = hours; + + let weekPlusDayTotal = $('#week-plus-day-total'); + let span = `Total with Today${hours}` + + if (weekPlusDayTotal.length === 0) { + $('#header-summary-container .stats').append( + `