Skip to content

Instantly share code, notes, and snippets.

@v2keener
Last active December 21, 2015 10:58
Show Gist options
  • Select an option

  • Save v2keener/6295117 to your computer and use it in GitHub Desktop.

Select an option

Save v2keener/6295117 to your computer and use it in GitHub Desktop.
Expand All, Collapse All for TFS Web Portal
window.tfs_toggle = null;
(function(){
alert('initing toggle');
var expanded = false;
// Support TFS Web Portal Work Item query expand/collapse all functionality
var toggle = function(){
var collapse = function(){
$('.tswa-qrgminus').each(function(){ $(this).trigger("click"); });
},
expand = function(){
$('.tswa-qrgplus').each(function(){ $(this).trigger("click"); });
};
// Based on bool, expand or collapse
if(expanded){
collapse();
window.setTimeout(function(){ collapse(); }, 1);
}
else{
expand();
window.setTimeout(function(){ expand(); }, 1);
}
// Toggle our bool
expanded = !expanded;
};
toggle();
window.tfs_toggle = toggle;
alert('toggle initialized');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment