TLR Input Optimizer

For the part-time employees of Seattle Central - take back your time spent using the TLR interface by using this optimized input script!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         TLR Input Optimizer
// @namespace    http://cody.codes
// @version      0.1
// @description  For the part-time employees of Seattle Central - take back your time spent using the TLR interface by using this optimized input script!
// @author       Cody Antonio Gagnon - codycodes
// @match        https://apps.seattlecolleges.edu/TLR/Employee/TimeEntry.aspx*
// @require      https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js
// @grant        none
// ==/UserScript==

(function() {
    var startTime = "9:00 AM"
    var endTime = "5:00 PM"
    document.addEventListener("keypress", function(e) {
//        alert(e.which); // Used to determine which keycode corresponds to the key just pressed.
        if (e.which == 115) {
            TimePicker_FindPicker('ctl00_cphMainContent_tpStartTime').SelectTime(startTime);
        } else if (e.which == 101) {
            TimePicker_FindPicker('ctl00_cphMainContent_tpEndTime').SelectTime(endTime);
        } else if (e.which == 116) {
            var startTimeToParse = prompt('what start time for tlr?');
            startTime = moment(startTimeToParse, 'hh:mm a').format('h:mm A');
            var endTimeToParse = prompt('what end time for tlr?');
            endTime = moment(endTimeToParse, 'hh:mm a').format('h:mm A');
        }
    });
})();