Skip to content

Instantly share code, notes, and snippets.

@yanickxia
Last active July 17, 2020 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanickxia/c3fadd04e0ea5e3b239ee756df00c051 to your computer and use it in GitHub Desktop.
Save yanickxia/c3fadd04e0ea5e3b239ee756df00c051 to your computer and use it in GitHub Desktop.
toggl-tomator
// ==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