Last active
August 29, 2015 13:57
-
-
Save fzawada/9489330 to your computer and use it in GitHub Desktop.
TFS board sorting
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
function doit() { | |
function rem(el) { | |
el.parentNode.removeChild(el); | |
} | |
var taskboard = JSON.parse(document.querySelector('#taskboard script').innerHTML); | |
var data = taskboard.payload.data | |
var pbis_and_ranks = []; | |
for (prop in data) { | |
var current = data[prop]; | |
if (current[1] != "Product Backlog Item"){ | |
continue; | |
} | |
var newel = {pbi: current[0], rank: current[6]}; | |
pbis_and_ranks.push(newel); | |
} | |
pbis_and_ranks.sort(function (a, b) { | |
if (a.rank < b.rank) return -1; | |
if (a.rank == b.rank) return 0; | |
return 1;}); | |
for(var i = 0; i < pbis_and_ranks.length; i++) { | |
var c = pbis_and_ranks[i]; | |
console.log(c.pbi + " " + c.rank); | |
var tr = document.getElementById('taskboard-table_p' + c.pbi).parentElement; | |
var foldedTr = tr.nextSibling; | |
var parent = tr.parentElement; | |
parent.appendChild(tr); | |
parent.appendChild(foldedTr); | |
} | |
//remove top elements | |
rem(document.querySelectorAll('.header-section')[0]); | |
rem(document.querySelectorAll('.hub-title')[0]); | |
rem(document.querySelectorAll('.hub-pivot')[0]); | |
document.querySelectorAll('.content-section')[0].style.top = '1px'; | |
document.querySelectorAll('.hub-content')[0].style.top = '1px'; | |
document.querySelectorAll('.hub-pivot-content')[0].style.top = '1px'; | |
//resize columns | |
document.getElementById('taskboard-table_s0').style.width = '35%'; | |
document.getElementById('taskboard-table_s1').style.width = '15%'; | |
document.getElementById('taskboard-table_s2').style.width = '15%'; | |
document.getElementById('taskboard-table_s3').style.width = '35%'; | |
document.body.style.zoom=0.8;this.blur(); | |
} | |
setTimeout(doit, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment