// ==UserScript== // @name Kemtah Timecards // @description Make the timecard interface more user-friendly. // @author Steven Klassen // @include https://www.kemtah.com/mykemtah/* // ==/UserScript== // Add a link to go to the previous week. if (document.title == 'Kemtah Template Worksheet') { dd = document.getElementById('ddlWeek') newElement = document.createElement('strong') dd.parentNode.insertBefore(newElement, dd.nextSibling); newElement.innerHTML = '   [ Previous Week ]'; } // Update the approve button to send the time in immediately. if (document.title == 'Kemtah Approve Time Entries') { var apprElement; apprElement = document.getElementById('lbApprove1'); apprElement.href = "javascript:__doPostBack('lbApprove2','')"; } // Some adjustments to the Time History Summary form. if (document.title == 'Time History Summary') { document.getElementById('ddlJob').selectedIndex = 1; document.getElementById('ddlPastWeeks').selectedIndex = 0; document.getElementById('ddlStatus').selectedIndex = 1 document.getElementById('rlsIsSecondaryApprover_0').checked = true; // If it's Monday, I want last week's entries. today = new Date(); if (today.getDay() == 1) { StartOfLastWeekMS = today.getTime() - ( 24*60*60*1000*(today.getDay()+6)); StartOfLastWeek = new Date(StartOfLastWeekMS); DateFmt = StartOfLastWeek.getMonth()+1 + '/' + StartOfLastWeek.getDate() + '/' + StartOfLastWeek.getFullYear(); document.getElementById('txtDate').value = DateFmt; } }