Last active
August 13, 2018 12:58
-
-
Save DavidSteinbauer/761f940788081d009b59e6481e873c66 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
[ | |
{ | |
"name": "0 - Backlog", | |
"color": "CCCCCC" | |
}, | |
{ | |
"name": "1 - Ready", | |
"color": "CCCCCC" | |
}, | |
{ | |
"name": "2 - Working <= 5", | |
"color": "CCCCCC" | |
}, | |
{ | |
"name": "3 - Review", | |
"color": "CCCCCC" | |
}, | |
{ | |
"name": "4 - Done", | |
"color": "CCCCCC" | |
}, | |
{ | |
"name": "duplicate", | |
"color": "cfd3d7" | |
}, | |
{ | |
"name": "help wanted", | |
"color": "008672" | |
}, | |
{ | |
"name": "invalid", | |
"color": "e4e669" | |
}, | |
{ | |
"name": "point: 1", | |
"color": "daeda8" | |
}, | |
{ | |
"name": "point: 2", | |
"color": "adda92" | |
}, | |
{ | |
"name": "point: 3", | |
"color": "76c37d" | |
}, | |
{ | |
"name": "point: 5", | |
"color": "3da861" | |
}, | |
{ | |
"name": "point: 8", | |
"color": "1e8146" | |
}, | |
{ | |
"name": "point: 13", | |
"color": "00663a" | |
}, | |
{ | |
"name": "point: 21", | |
"color": "00442b" | |
}, | |
{ | |
"name": "Points", | |
"color": "32a803" | |
}, | |
{ | |
"name": "priority: high", | |
"color": "B20000" | |
}, | |
{ | |
"name": "priority: highest", | |
"color": "E50000" | |
}, | |
{ | |
"name": "priority: low", | |
"color": "660000" | |
}, | |
{ | |
"name": "priority: lowest", | |
"color": "4C0000" | |
}, | |
{ | |
"name": "priority: medium", | |
"color": "990000" | |
}, | |
{ | |
"name": "question", | |
"color": "d876e3" | |
}, | |
{ | |
"name": "support", | |
"color": "7057ff" | |
}, | |
{ | |
"name": "type:bug", | |
"color": "003468" | |
}, | |
{ | |
"name": "type:chore", | |
"color": "005599" | |
}, | |
{ | |
"name": "type:feature", | |
"color": "0374b2" | |
}, | |
{ | |
"name": "type:infrastructure", | |
"color": "3694c4" | |
}, | |
{ | |
"name": "type:performance", | |
"color": "64afd4" | |
} | |
].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-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-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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment