Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashlux/944de55dd270563c56b3bbd73dc9534a to your computer and use it in GitHub Desktop.
Save ashlux/944de55dd270563c56b3bbd73dc9534a to your computer and use it in GitHub Desktop.
Improve & Fix Technology Partner's Timesheet Entry
// ==UserScript==
// @name Imporve & Fix Technology Partner's Timesheet Entry
// @namespace http://www.ashlux.com/
// @version 0.1
// @description Technology Partner's timesheet entry a little bit easier. Also fixes the problem when the UI doesn't render after updating your time (at least in Chrome).
// @author Ash Lux
// @updateURL https://gist.github.com/ashlux/944de55dd270563c56b3bbd73dc9534a/raw
// @downloadURL https://gist.github.com/ashlux/944de55dd270563c56b3bbd73dc9534a/raw
// @match https://consultant.technologypartners.net/consultant/cp/cp_consultant_home.jsp
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
function focusOnHoursWorked(hoursWorked) {
setTimeout(() => {
const $hoursWorked = $(hoursWorked);
if ($hoursWorked.val() == "0") {
$hoursWorked.val("8");
}
$hoursWorked.focus().select();
}, 100); // Small timeout because sometimes the focus hack doesn't work...
};
waitForKeyElements("#hrs_worked", focusOnHoursWorked, false, "#iframe");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment