-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobcan.js
22 lines (22 loc) · 1.09 KB
/
jobcan.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
javascript:(function () {
if (!location.href.startsWith("https://ssl.jobcan.jp/m/work/conditions")) {
alert("failed");
return;
}
const today = new Date().toLocaleDateString();
const page_month = document.querySelector("#container > table.data03 > tbody > tr > th").innerText.replace(/[年月]/g, '/');
const schedules = Array.from(document.querySelector(".schedule4").rows);
const sum = schedules
.map(function(schedule) {
return {
date: schedule.children[0].innerText.replace(/ .*/, ''),
state: schedule.children[1].innerText,
time: schedule.children[5].innerText
};
})
.filter(schedule => schedule.time.includes("時間"))
.filter(schedule => page_month.concat(schedule.date) != today)
.map(p => (p.state == "有"||p.state == "特" ? -240 : -480) + parseInt(p.time.substr(0,2)) *60 + parseInt(p.time.substr(4,2)))
.reduce((prev, curr) => prev + curr);
alert(`${today} の前日までの勤務時間を計算します\n${sum}分の差異があります`);
})()