Skip to content

Instantly share code, notes, and snippets.

@dacer
Last active February 2, 2021 08:42
Show Gist options
  • Save dacer/a2f7e7ec07945439d0baf153f79e5b18 to your computer and use it in GitHub Desktop.
Save dacer/a2f7e7ec07945439d0baf153f79e5b18 to your computer and use it in GitHub Desktop.
kot.user.js
// ==UserScript==
// @name King of Time modification
// @namespace https://dacer.im/
// @version 0.1
// @description Make Kot be better
// @author Dacer
// @grant none
// @include https://*.kingtime.jp/admin/*
// ==/UserScript==
(function() {
'use strict';
// bye new windows
$('a[target="_blank"]').removeAttr('target');
// extra hour
var worked_day = 0;
$('[data-ht-sort-index="CUSTOM_DISPLAY_NAME_5"]').each(function(i) {
if ($(this).text().includes(".")) {
worked_day += 1;
}
});
var worked_hour = parseFloat($('table.specific-table_800 tbody td.custom11').html());
// var worked_day = parseFloat($('ul.specific-daysCount_1 div.custom12').html());
var extra_hour = (worked_hour - worked_day * 8).toFixed(2);
var target_table = $('.specific-table_800');
target_table.find("thead").find("tr").append('<th>Extra Hour</th>');
target_table.find("tbody").find("tr").append(`<td>${extra_hour}</td>`);
console.log(extra_hour);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment