If maker Event "add_task", then create a task in Inbox
Last active
January 24, 2018 17:04
-
-
Save vikmind/454acfe1f1373b44f1e0011b996837c5 to your computer and use it in GitHub Desktop.
Tapermonkey scripts for adding tasks from JIRA to Todoist
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 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'); | |
})(); |
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 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