/
index.html
42 lines (39 loc) · 2.04 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>AUTO PMC</title>
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<style>
body { font-family: 'Source Sans Pro', sans-serif; }
</style>
</head>
<body>
<ol>
<p>Bookmarklet to copy Time Journal report from previous week</p>
<li>Drag-n-drop this link to your bookmarks panel (or bookmark it another way): <br/>
<a href="javascript:(function()%7Bdocument.querySelectorAll('.nested-data.activities-container%20.table-right-part').forEach(part%20%3D%3E%20%7Blet%20weeks%20%3D%20part.querySelectorAll('.table-week')%3Blet%20leftDays%20%3D%20weeks%5B0%5D.querySelectorAll('.table-activity-cell.cell%3Anot(.not-workday)%20input')%3Blet%20rightDays%20%3D%20weeks%5B1%5D.querySelectorAll('.table-activity-cell.cell%3Anot(.not-workday)%20input')%3BrightDays.forEach((rightDay%2C%20idx)%20%3D%3E%20%7BrightDay.value%20%3D%20leftDays%5BMath.min(idx%2C%20leftDays.length%20-%201)%5D.value%3BrightDay.dispatchEvent(new%20Event('blur'))%3B%7D)%7D)%7D)()">Fill PMC</a>
</li>
<li>
Open the Time app
</li>
<li>
Click the bookmarked link
</li>
<li>
Click Save
</li>
</ol>
<small>Works only in 2-weeks view. Copies left week values to the right week. Skips holidays/vacs on both left and right week while copying. If left week has more work days than right, the last day of the left week will be duplicated.</small>
<br/><small>Source:</small>
<pre>
document.querySelectorAll('.nested-data.activities-container .table-right-part').forEach(part => {
let weeks = part.querySelectorAll('.table-week');
let leftDays = weeks[0].querySelectorAll('.table-activity-cell.cell:not(.not-workday) input');
let rightDays = weeks[1].querySelectorAll('.table-activity-cell.cell:not(.not-workday) input');
rightDays.forEach((rightDay, idx) => {
rightDay.value = leftDays[Math.min(idx, leftDays.length - 1)].value;
rightDay.dispatchEvent(new Event('blur'));
})
})
</pre>