Hide category names in „Group By“ view

SharePoint by default shows the category names you filter for in front of the columns. That does not look very professional and can be irritating. Here is a script I found that removes the category names. 

Thanks to Jonathan Snook, http://www.snook.ca/jonathan and Robert Nyman, http://www.robertnyman.com

_spBodyOnLoadFunctionNames.push(“HideHeaders”);

function HideHeaders()

{

  var elements = getElementsByClassName(document, “td”, “ms-gb”);

  var elem;

  for(var i=0;i<elements.length;i++)

   {

     elem = elements[i];

// This hides the category element 

                elem.childNodes[3].style.display = “none”;

// This hides the colon element

                elem.childNodes[4].nodeValue = elem.childNodes[4].nodeValue.replace(‘:’, ”);

   }

  elements = getElementsByClassName(document, “td”, “ms-gb2″);

  for(var i=0;i<elements.length;i++)

   {

     elem = elements[i];

// This hides the category element

                elem.childNodes[3].style.display = “none”;

// This hides the colon element

                elem.childNodes[4].nodeValue = elem.childNodes[4].nodeValue.replace(‘:’, ”);

   }

  elements = getElementsByClassName(document, “tr”, “ms-viewheadertr”);

  for(var i=0;i<elements.length;i++)

   {

     elem = elements[i];

     elem.style.display = “none”;

   }

}

/*

    Written by Jonathan Snook, http://www.snook.ca/jonathan

    Add-ons by Robert Nyman, http://www.robertnyman.com

*/

function getElementsByClassName(oElm, strTagName, strClassName){

    var arrElements = (strTagName == “*” && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);

    var arrReturnElements = new Array();

    strClassName = strClassName.replace(/\-/g, “\\-“);

    var oRegExp = new RegExp(“(^|\\s)” + strClassName + “(\\s|$)”);

    var oElement;

    for(var i=0; i<arrElements.length; i++){

        oElement = arrElements[i];

        if(oRegExp.test(oElement.className)){

            arrReturnElements.push(oElement);

        }

    }

    return (arrReturnElements)

}

Is this Pages usefull? Usefull Useless 0 of 0 people say this Pages is usefull.