Last active
April 18, 2021 06:43
-
-
Save hasibomi/35d61c65355c1da0a6f17283b4d377bf to your computer and use it in GitHub Desktop.
Get the list of all projects of Azure DevOps with JavaScript. Forget manual counting ;-)
This file contains 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
/** | |
* Get the list of all projects of Azure DevOps. | |
* | |
* Example output inside browser console: | |
* 1. Example 1 | |
* 2. Example 2 | |
* 3. Example 3 | |
* and so on. | |
*/ | |
function azure_devops_project_list() { | |
var project_list = []; | |
var projects = document.getElementsByClassName('project-list')[0].childNodes[0].getElementsByClassName('project-name'); | |
for (var i in projects) { | |
var p = projects[i]; | |
if (p.innerHTML !== undefined) { | |
project_list.push(p.innerHTML); | |
} | |
} | |
var project_list = project_list.map(function (value, index) { | |
return (index + 1) + '. ' + value; | |
}).join('\n'); | |
console.log(project_list); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment