-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
76 lines (67 loc) · 2.26 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<html>
<head>
</head>
<body>
<h1>Canonical Task ID generator for Trello and Asana</h1>
<h2>The Problem</h2>
<p>Task managers like Asana and Trello don't provide you with canonical task
IDs that last the life time of the task. This makes it very difficult
to have intelligent conversations with your team about tasks.</p>
<p>In Asana, for example, if you close out Task 5, Task 6 becomes Task 5.</p>
<h2>The Solution</h2>
<p>This bookmarklet prepends input or textarea DOM elements with a
simple canonical task ID, based on today's date and 3 random letters.
</p>
<p>The ID generated is of the form [425-ABC] where "425" means April 25th,
and ABC is the probablistically globally unique identifier.
The rationale for this is in case you're working on multiple projects
or there are some tasks that are currently not visible, you have
a pretty good chance of not colliding globally (currently 1/(26*26*26) = 1/17576 chance).
</p>
<h2>Installation</h2>
<p>Drag the link below to your tool bar, and then select an task in
Trello or Asana, then click the bookmarklet. A task ID will be
prepended to the task.
<p>
<a href="javascript:
(
function ()
{
function AddTaskId()
{
var d = new Date();
var month = d.getMonth()+1;
var day = ('0' + d.getDate()).slice(-2);
var prefix = String(month)+day;
var hits = new Array();
var pattern = /\[[0-9]*\-[A-Z]*\]/g;
var match;
var input = document.all[0].innerHTML;
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var suffix='';
for( var i=0; i < 3; i++ )
{
suffix += possible.charAt(Math.floor(Math.random() * possible.length));
}
/*and end removing here*/
var taskString='['+prefix+'-'+suffix+']';
var element=document.activeElement;
if(!element.value.match(pattern))
{
element.value = taskString+' '+element.value;
}
}
if( document.activeElement.nodeName === 'INPUT' || document.activeElement.nodeName === 'TEXTAREA' )
{
AddTaskId();
}
}
)();
"><br/>Generate Task ID</a>
<h2>Test Area</h2>
<p>Select the input box below after installing the bookmarklet), and click the
bookmarklet.</p>
Input:<br/>
<input id = "test"></input>
</body>
</html>