Last active
July 19, 2023 16:29
-
-
Save corupta/0eb6b918be6ac85e7649e25a1cf5b856 to your computer and use it in GitHub Desktop.
Timenotes.io add start tracking button on tasks page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// download run javascript extension https://chrome.google.com/webstore/detail/run-javascript/lmilalhkkdhfieeienjbiicclobibjao?hl=en | |
// go to a page inside timenotes.io | |
// open run javascript extension and check "Enable on timenotes.io" | |
// copy this code inside the extension popup | |
// click save & run | |
// now, whenever you go to a project's task page and reload page, you'll get start tracking button | |
// note that I'm not affiliated with timenotes, just a fan of their work/happy user. | |
(() => { | |
const path = window.location.pathname; | |
if (path.match(/^\/projects\/[a-f0-9\-]+\/tasks_overview\/?$/)) { | |
Array.from(document.getElementsByClassName('task-row')).forEach(task => { | |
const dataTaskId = task.getAttribute('data-task-id'); | |
if (task.getElementsByClassName('btn_play').length === 0) { | |
const td = document.createElement('td'); | |
td.classList.add('project-details-task'); | |
td.classList.add('box_icon_table'); | |
td.innerHTML = `<a | |
class="icon_table btn_play icon_pen project-details-timelogs" | |
rel="nofollow" | |
data-method="post" | |
style="background-image: url(https://dbqgn4wfpzwq7.cloudfront.net/img/icon/icon_play_circle.png);" | |
href="/start_tracking?startable_id=${dataTaskId}&startable_type=Task"> | |
<span class="tooltiptext">Track</span> | |
</a>`; | |
task.appendChild(td); | |
} | |
}) | |
totalRow = document.getElementsByClassName('total-filters-container')[0]; | |
if (totalRow.getElementsByClassName('box_icon_table').length === 3) { | |
const td = document.createElement('td'); | |
td.classList.add('box_icon_table'); | |
totalRow.appendChild(td); | |
} | |
const bulkActionsWrapper = document.getElementsByClassName('bulk-actions-wrapper')[0]; | |
bulkActionsWrapper.setAttribute('colspan', '4'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment