如何快速创建Airplake标签 - airplake/home GitHub Wiki
你一定觉得Airplake的标签十分方(Gao)便(Da)快(Shang)捷! 但是每次微服务框架下,你可能会有很多个项目仓库,每次新建项目都要添加那么多标签一定会很慢。于是Airplaker工程师Hack了一下GitHub的标签页,写下了下面这个脚本:传说中的一键 “Airplake” 的JS代码
怎么使用
使用的方法其实很简单,你看到的就是一段很简单的JS代码,进到对应仓库的issues页面
点击 “Labels” 进入到 标签页,
清空所有自带的标签
Inspect Element -> 打开Console Log -> 把整段JS代码粘贴进去,然后回车运行,Bam!所有标签都会添加到这个仓库,You are Airplaked!
说人话就是,把这段JS代码在你仓库对应的“标签页”Console里面运行!
代码在哪里? ——> 传说中的一键 “Airplake” 的JS代码
好吧,Gist需要翻墙,我粘过来。。。
[
{
"name": "Epic: Airplake Guideline",
"color": "5319e7"
},
{
"name": "Magt: Salary Checked",
"color": "0052cc"
},
{
"name": "Priority: Blocked",
"color": "B71C1C"
},
{
"name": "Priority: Critical",
"color": "E53935"
},
{
"name": "Priority: High",
"color": "EF5350"
},
{
"name": "Priority: Low",
"color": "FFEBEE"
},
{
"name": "Priority: Medium",
"color": "EF9A9A"
},
{
"name": "Status: Backlog",
"color": "5319e7"
},
{
"name": "Status: Done",
"color": "33691E"
},
{
"name": "Status: In progress",
"color": "AED581"
},
{
"name": "Status: In review",
"color": "7CB342"
},
{
"name": "Status: QA",
"color": "006b75"
},
{
"name": "Type: Bug",
"color": "FFFF00"
},
{
"name": "Type: Enhancement",
"color": "FFD600"
},
{
"name": "Type: Question",
"color": "FFFF8D"
},
{
"name": "Type: Task",
"color": "FFEA00"
}
].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('.label-edit-name').value = label.name
element.querySelector('.color-editor-input').value = '#' + label.color
element.querySelector('.new-label-actions .btn-primary').click()
}
})
return flag
}
function addNewLabel (label) {
document.querySelector('.new-label input#label-').value = label.name
document.querySelector('.new-label input#edit-label-color-new').value = '#' + label.color
document.querySelector('.new-label-actions .btn-primary').click()
}
function addLabel (label) {
if (!updateLabel(label)) addNewLabel(label)
}
undefined