Last active
March 15, 2019 23:57
-
-
Save ashlux/944de55dd270563c56b3bbd73dc9534a to your computer and use it in GitHub Desktop.
Improve & Fix Technology Partner's Timesheet Entry
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 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