Last active
February 11, 2021 09:42
-
-
Save raxoft/91ab6a7d63d392adfe0ab721baade8d7 to your computer and use it in GitHub Desktop.
Little script to show hours in KS portal both as hours and days.
This file contains hidden or 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 Show KS portal hours as days | |
// @author [email protected] | |
// @version 2 | |
// @include https://ks.scssoft.com/ksportal/* | |
// ==/UserScript== | |
var cells = document.querySelectorAll('td[id*="FormView1"][id*="_hodin"] span'); | |
for (var i = 0; i < cells.length; i++) { | |
var text = cells[i].textContent; | |
if (!text.match(/^[0-9\,]+$/)) { | |
continue; | |
} | |
var hours = Number(text.replace(',','.')); | |
var days = Math.ceil(hours * 10 / 8.0) / 10.0; | |
cells[i].textContent = hours.toString() + "h = " + days.toString() + "d"; | |
} | |
// EOF // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment