Last active
July 17, 2020 13:24
-
-
Save yanickxia/c3fadd04e0ea5e3b239ee756df00c051 to your computer and use it in GitHub Desktop.
toggl-tomator
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
// ==UserScript== | |
// @name add tomator timer for toggle | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author yanick | |
// @match toggl.com/* | |
// @match app.clickup.com/* | |
// @grant GM_addStyle | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @require https://momentjs.com/downloads/moment.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
waitForKeyElements (".time-format-utils__duration", actionFunction); | |
waitForKeyElements (".cu-task-info__value", actionFunction); | |
function actionFunction (jNode) { | |
let n = Math.floor(moment.duration(jNode[0].innerText).asMinutes() / 25); | |
if(n > 0){ | |
$(`<br/><span> 🍅 x ${n} </span>`).insertAfter(jNode); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment