Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Auto-fill monthly attendance - Main page
- // @namespace http://tampermonkey.net/
- // @version 0.2
- // @description Auto-fill monthly attendance
- // @author Mor Merhav
- // @match https://jfrog-sso.net.hilan.co.il/Hilannetv2/Attendance/calendarpage.aspx*
- // @grant none
- // ==/UserScript==
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
- window.addEventListener('load', async function() {
- 'use strict';
- debugger;
- const beforeBtn = document.getElementById("ctl00_mp_calendar_prev");
- beforeBtn.click();
- do {
- var cells = document.getElementsByClassName("calendarCpecialDay");
- await sleep(1000);
- } while (cells.length == 0)
- for (var i = 0; i < cells.length ; i++) {
- var cell = cells[i];
- if (cell.title.includes("אוטו")) {
- cell.click();
- }
- }
- await sleep(500);
- const addDaysBtn = document.querySelector("#ctl00_mp_RefreshSelectedDays");
- addDaysBtn.click();
- do {
- var inputEntryCells = document.querySelectorAll('input[id*="_cellOf_ManualEntry_EmployeeReports_row_"]');
- await sleep(1000);
- } while (inputEntryCells.length == 0);
- var inputExitCells = document.querySelectorAll('input[id*="_cellOf_ManualExit_EmployeeReports_row_"]');
- var reportTypeCells = document.querySelectorAll('select[id*="_cellOf_Symbol\.SymbolId_EmployeeReports_row_"]')
- for (i = 0; i < inputEntryCells.length; i++) {
- var inputEntryCell = inputEntryCells[i];
- if (inputEntryCell.value == '') {
- inputEntryCell.value = '09:30';
- inputEntryCell.focus();
- var inputExitCell = inputExitCells[i];
- inputExitCell.focus();
- inputExitCell.value = '19:00';
- var reportTypeCell = reportTypeCells[i];
- reportTypeCell.selectedIndex = 1;
- }
- }
- document.querySelector("#ctl00_mp_RG_Days_17711420_2023_10_btnSave").click();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement