the_king_of_crap / 工单填写

// ==UserScript==
// @name         工单填写
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  工单填写
// @author       The King of Crap
// @match        https://toms.tigermed.net/Modules/Timesheet
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license      MIT
// @copyright    2021, the_king_of_crap (https://openuserjs.org/users/the_king_of_crap)
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  /* 使用快捷键 Enter 一键填写工单 */
  document.querySelector("html").addEventListener('keydown', function (e) {
    /* 快捷键分配为:Enter */
    if (e.keyCode == 13) {
      /* 目前为 study: It's a dummy study */
      document.querySelector("#event-form > div:nth-child(10) > a").click();
      /* 目前为 site: It's a dummy site */
      document.querySelector("#event-form > div:nth-child(14) > a").click();
      /* 第一次由于需要加载task,所以我们需要按两次快捷键,后面则不用 */
      /* task: non-project related */
      document.querySelector("#event-form > div:nth-child(20) > span").click();
      document.querySelector("#datagrid-row-r13-2-407 > td:nth-child(1)").click();
      /* 确认:ok */
      document.querySelector("#event-dlg-buttons > a.easyui-linkbutton.easyui-tooltip.tooltip-f.l-btn.l-btn-small > span").click();
    }
  });
})();