-
Notifications
You must be signed in to change notification settings - Fork 1
/
add labels
122 lines (118 loc) · 3.2 KB
/
add labels
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// go to repo labels page
// open browser console
// paste the following and hit enter! :)
[
{
"name": "needs: backend",
"description": "issues that requires backend task",
"color": "e5e234"
},
{
"name": "needs: frontend",
"description": "issues that require frontend tasks",
"color": "e5e234"
},
{
"name": "needs: UI",
"description": "issues that require UI tasks",
"color": "e5e234"
},
{
"name": "scope: analytics",
"description": "issues related to analytics",
"color": "000000"
},
{
"name": "scope: api",
"description": "issues related to api",
"color": "000000"
},
{
"name": "scope: branding",
"description": "issues related to branding kit",
"color": "000000"
},
{
"name": "scope: dashboard",
"description": "issues related to dashboard",
"color": "000000"
},
{
"name": "scope: gallery",
"description": "issues related to web gallery",
"color": "000000"
},
{
"name": "scope: leads",
"description": "issues related to leads",
"color": "000000"
},
{
"name": "scope: roam app",
"description": "issues related solely to roam app",
"color": "000000"
},
{
"name": "scope: sharing",
"description": "issues related to sharing kit",
"color": "000000"
},
{
"name": "scope: wave app",
"description": "issues related to solely to wave app",
"color": "000000"
},
{
"name": "type: architecture",
"description": "improvements and additions to backend",
"color": "00eacc"
},
{
"name": "type: design",
"description": "solely a design issue/feature",
"color": "00eacc"
},
{
"name": "type: feature-macro",
"description": "an entirely new feature or user experience",
"color": "00eacc"
},
{
"name": "type: feature-micro",
"description": "any feature that enhances an existing feature",
"color": "00eacc"
},
{
"name": "type: fix",
"description": "bugs and obvious fixes that need to be addressed",
"color": "ee0701"
}
]
.forEach(function(label) {
addLabel(label)
})
function updateLabel (label) {
var flag = false;
[].slice.call(document.querySelectorAll(".labels-list-item"))
.forEach(function(element) {
if (element.querySelector('.label-link').textContent.trim() === label.name) {
flag = true
element.querySelector('.js-edit-label').click()
element.querySelector('.js-new-label-name-input').value = label.name
element.querySelector('.js-new-label-description-input').value = label.description
element.querySelector('.js-new-label-color-input').value = '#' + label.color
element.querySelector('.js-edit-label-cancel ~ .btn-primary').click()
}
})
return flag
}
function addNewLabel (label) {
document.querySelector('.js-new-label-name-input').value = label.name
document.querySelector('.js-new-label-description-input').value = label.description
document.querySelector('.js-new-label-color-input').value = '#' + label.color
document.querySelector('.js-details-target ~ .btn-primary').disabled = false
document.querySelector('.js-details-target ~ .btn-primary').click()
}
function addLabel (label) {
if (!updateLabel(label)) addNewLabel(label)
}