Skip to content

Instantly share code, notes, and snippets.

@raxoft
Last active February 11, 2021 09:42
Show Gist options
  • Save raxoft/91ab6a7d63d392adfe0ab721baade8d7 to your computer and use it in GitHub Desktop.
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.
// ==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