Last active
August 13, 2018 12:24
-
-
Save bastsoft/67737ef0c3a12f5fb577ecd189fb51ac to your computer and use it in GitHub Desktop.
for automation youTrack
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
var issueId = document.querySelector('.issueId').innerText; | |
var issueSummary = document.querySelector('.issue-summary').innerText; | |
var typeRus = document.querySelectorAll('.fsi-property .attribute')[2].innerText.trim(); | |
var scope = document.querySelectorAll('.fsi-property .attribute')[5].innerText.trim(); | |
var mapType = { | |
"Функциональность": "feature", | |
"Ошибка": "bugfix", | |
"Документация": "docs", | |
"Косметика": "style", | |
"Проблема удобства использования":"refactor", | |
"Проблема производительности":"perf", | |
"Тестирование":"test", | |
"tools chore":"chore" | |
} | |
var type = mapType[typeRus]; | |
var xhr = new XMLHttpRequest(); | |
var keyApi = window.keyAPIT; | |
var data = "key=" + keyApi + "&text=" + issueSummary + "&lang=ru-en&format=html"; | |
xhr.open("POST", 'https://translate.yandex.net/api/v1.5/tr.json/translate', true); | |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
xhr.send(data); | |
xhr.onreadystatechange = function () { | |
if (this.readyState == 4 && this.status == 200) { | |
var res = JSON.parse(this.responseText); | |
var rusText = res.text[0]; | |
var rusTextChange = rusText. | |
toLowerCase(). | |
replace(/\.|\,|\'|\"|\(|\)|^\ /g, ''). | |
replace(/\ a\ |\ the\ |^the\ |\ of\ |\ on\ |\ \ /g, ' '). | |
replace(/\ a\ |\ the\ |^the\ |\ of\ |\ on\ |\ \ /g, ' '). | |
trim().replace(/\ /g, '-'); | |
var otherGitCmd = "git checkout develop && git pull && git remote update -p && git branch"; | |
issueBranchName = otherGitCmd + ' && ' + 'git checkout -b ' + type + '/' + issueId + '_' + rusTextChange; | |
prompt("Copy to clipboard: Ctrl+C, Enter", issueBranchName); | |
} | |
}; |
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
var issueId = document.querySelector('.issueId').innerText; | |
var issueSummary = document.querySelector('.issue-summary').innerText; | |
var typeRus = document.querySelectorAll('.fsi-property .attribute')[2].innerText.trim(); | |
var scope = document.querySelectorAll('.fsi-property .attribute')[5].innerText.trim(); | |
var mapType = { | |
"Функциональность": "feat", | |
"Ошибка": "fix", | |
"Документация": "docs", | |
"Косметика": "style", | |
"Проблема удобства использования":"refactor", | |
"Проблема производительности":"perf", | |
"Тестирование":"test", | |
"tools chore":"chore" | |
} | |
var type = mapType[typeRus]; | |
var xhr = new XMLHttpRequest(); | |
var keyApi = window.keyAPIT; | |
var data = "key=" + keyApi + "&text=" + issueSummary + "&lang=ru-en&format=html"; | |
xhr.open("POST", 'https://translate.yandex.net/api/v1.5/tr.json/translate', true); | |
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
xhr.send(data); | |
xhr.onreadystatechange = function () { | |
if (this.readyState == 4 && this.status == 200) { | |
var res = JSON.parse(this.responseText); | |
var rusText = res.text[0]; | |
var rusTextChange = rusText. | |
toLowerCase(). | |
replace(/\.|\,|\'|\"|\(|\)|^\ /g, ''). | |
replace(/\ a\ |\ the\ |^the\ |\ of\ |\ on\ |\ \ /g, ' '). | |
replace(/\ a\ |\ the\ |^the\ |\ of\ |\ on\ |\ \ /g, ' '). | |
trim(); | |
issueBranchName = "git commit -m \"" + type + '(' + scope + '):' + issueId + '-' + rusTextChange + "\""; | |
prompt("Copy to clipboard: Ctrl+C, Enter", issueBranchName); | |
} | |
}; |
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
var list = document.queryAll('.yt-swimlane-column')[2]. | |
queryAll('yt-agile-card').map(function(item, i){ | |
return (i + 1) + '. ' + item.query('.yt-agile-card__summary').innerText | |
}); | |
console.log(list.join('\n')); |
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
var list = document.queryAll('.yt-swimlane-column')[0]. | |
queryAll('yt-agile-card').map(function(item, i){ | |
return (i + 1) + '. ' + item.query('.yt-agile-card__summary').innerText | |
}); | |
console.log(list.join('\n')); |
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
btr.loadGist({ url: 'https://gist.github.com/', id: '67737ef0c3a12f5fb577ecd189fb51ac'}, function(){ | |
btr.contextMenu('body', { | |
getCommitStringForGit : btr.functionGist('getCommitName.js'), | |
getChekcoutStringForGit : btr.functionGist('getBranchName.js'), | |
getTodayListInConsole : btr.functionGist('getTodayListInConsole.js'), | |
getWeekListInConsole : btr.functionGist('getWeekListInConsole.js') | |
}); | |
alert('done'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment