Skip to content

Instantly share code, notes, and snippets.

@spitfire05
Last active October 14, 2019 06:50
Show Gist options
  • Save spitfire05/da6be0638b2358bdb7a45de30a826771 to your computer and use it in GitHub Desktop.
Save spitfire05/da6be0638b2358bdb7a45de30a826771 to your computer and use it in GitHub Desktop.
T3 Improved source
// ==UserScript==
// @name T3-Improved
// @namespace emrsn.net/
// @version 0.2.2
// @description Improves T3 Time Tracker usability
// @author michal.borejszo@emerson.com
// @match http://usaust-techweb2/t3/*
// @grant none
// @updateURL https://gist.githubusercontent.com/spitfire05/da6be0638b2358bdb7a45de30a826771/raw/t3-improved.js
// ==/UserScript==
(function() {
'use strict';
if (window.location.pathname.toLowerCase() === '/t3/default.asp')
{
var edit_appearance = true;
if (edit_appearance)
{
// First, make some display tweaks
var style = document.createElement('style');
style.innerHTML = `
.ContentBoxed, .Content, .ContentBold, .projtime, .button, .contentblue, .timecard, .fieldtd {
font-size: small;
}
.ContentBoxed {
text-align: left
}
`;
document.body.appendChild(style);
document.getElementsByClassName('GridTable')[0].width = '100%'
document.getElementsByClassName('DetailsTable')[0].width = '100%'
document.getElementsByClassName('HeaderTable')[0].width = '100%'
}
var tot_names = ['sattot', 'suntot', 'montot', 'tuestot', 'wedtot', 'thurtot', 'fritot'];
var tot_values = [0, 0, 0, 0, 0, 0, 0];
var n = 0;
tot_names.forEach(function(x) {
tot_values[n] = document.querySelector(`[name="${x}"]`).value
n++;
} )
var len_rows = document.getElementsByClassName('GridTable')[0].rows.length;
var this_row = document.getElementsByClassName('GridTable')[0].rows[len_rows - 23];
var new_row = document.getElementsByClassName('GridTable')[0].insertRow(len_rows-23);
new_row.classList.add("GridTableTRLightBlue")
var total_cell = new_row.insertCell(0);
total_cell.colSpan = 9;
total_cell.innerHTML = '<font class="ContentBold">DAILY TOTALS</font>';
this_row.cells[0].colSpan = 1;
this_row.cells[1].colSpan = 1;
this_row.cells[1].style.display = 'none';
var total = this_row.cells[2].innerHTML;
this_row.cells[2].innerHTML = `<b>${total}</b>`;
for (var i=0; i < tot_values.length; i++)
{
var cell = this_row.insertCell(1);
cell.innerHTML = `<b>${tot_values[6-i]}</b>`;
cell.classList.add('ContentBoxed');
cell.align = "center";
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment