Skip to content

Instantly share code, notes, and snippets.

@vikmind
Last active January 24, 2018 17:04
Show Gist options
  • Save vikmind/454acfe1f1373b44f1e0011b996837c5 to your computer and use it in GitHub Desktop.
Save vikmind/454acfe1f1373b44f1e0011b996837c5 to your computer and use it in GitHub Desktop.
Tapermonkey scripts for adding tasks from JIRA to Todoist

Installation process

Create IFTTT task

If maker Event "add_task", then create a task in Inbox

// ==UserScript==
// @name JIRA Board to Todoist
// @namespace https://atlassian.net
// @version 0.1
// @description Convert selected JIRA Board cards to Todoist tasks
// @author Viktor Marchenko
// @match https://*.atlassian.net/secure/RapidBoard.jspa*
// @grant GM_registerMenuCommand
// ==/UserScript==
(function() {
'use strict';
const iftttMakerKey = 'IFTTT maker key https://ifttt.com/maker_webhooks';
const companyNamespace = 'company namespace used in URLs like <COMPANY>.atlassian.net';
const addTaskToTodoist = text => {
const el = document.createElement('img');
el.setAttribute('src',
`https://maker.ifttt.com/trigger/add_task/with/key/${iftttMakerKey}?value1=${encodeURIComponent(text)}`);
document.body.appendChild(el);
};
const getSelectedIssuesData = () =>
Array.from(document.querySelectorAll('.ghx-issue.ghx-selected'))
.map(el => ({
key: el.dataset.issueKey,
url: `https://${companyNamespace}.atlassian.net/browse/${el.dataset.issueKey}`,
title: el.querySelector('.ghx-summary').dataset.tooltip
}));
const itemToTask = item => `${item.url} (${item.title})`;
function addCurrentCardsAsTasks() {
getSelectedIssuesData()
.map(itemToTask)
.map(addTaskToTodoist);
}
GM_registerMenuCommand('add cards', addCurrentCardsAsTasks, 'c');
})();
// ==UserScript==
// @name JIRA task page to Todoist
// @namespace https://atlassian.net
// @version 0.1
// @description JIRA task page (or any) to Todoist task
// @author You
// @match https://*.atlassian.net/browse*
// @grant GM_registerMenuCommand
// ==/UserScript==
(function() {
'use strict';
const iftttMakerKey = 'IFTTT maker key https://ifttt.com/maker_webhooks';
function addTaskToTodoist(text) {
const el = document.createElement('img');
el.setAttribute('src',
`https://maker.ifttt.com/trigger/add_task/with/key/${iftttMakerKey}?value1=${encodeURIComponent(text)}`);
document.body.appendChild(el);
}
function getTaskNameForPage() {
const url = window.location.href;
const title = document.querySelector('title').text.replace(' - JIRA', '');
return url + ' (' + title + ')';
}
function addCurrentPageAsTask() {
addTaskToTodoist(getTaskNameForPage());
}
GM_registerMenuCommand('add task', addCurrentPageAsTask, 't');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment