Skip to content

Instantly share code, notes, and snippets.

@goshatch
Last active March 21, 2024 21:18
Show Gist options
  • Save goshatch/be0e85b52ec46d9b973492f569c1aa4f to your computer and use it in GitHub Desktop.
Save goshatch/be0e85b52ec46d9b973492f569c1aa4f to your computer and use it in GitHub Desktop.
A bookmarklet for sending a Jira issue to Things 3
/*
Create a task in Things 3 from a Jira ticket using the Things URL scheme (https://culturedcode.com/things/support/articles/2803573/)
Use this code to generate a bookmarklet with https://caiorss.github.io/bookmarklet-maker/
Based on @keram's Jira to Notion bookmarklet.
*/
var project = 'Indeed Flex';
var heading = 'Daily work';
var checklistItems = [
'Move to In Progress',
'Send to QA',
'Release'
];
var tags = ['Jira'];
var h = document.getElementById('jira-issue-header').getElementsByTagName('a');
var a = h[h.length - 1];
var t = document.querySelector('h1[data-test-id="issue.views.issue-base.foundation.summary.heading"]');
if (a && t) {
console.log('OK to proceed');
var encodedTitle = encodeURIComponent(`[${a.textContent}] ${t.textContent}`)
var encodedUrl = encodeURIComponent(a.href);
var encodedProject = encodeURIComponent(project);
var encodedHeading = encodeURIComponent(heading);
var encodedChecklist = encodeURIComponent(checklistItems.join('\n'));
var encodedTags = encodeURIComponent(tags.join(','));
window.location.href = `things:///add?title=${encodedTitle}&notes=${encodedUrl}&checklist-items=${encodedChecklist}&tags=${encodedTags}&list=${encodedProject}&heading=${encodedHeading}`;
} else {
alert("This doesn't look like a Jira issue!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment