The Developer Dashboard has undergone some significant changes in 2013. E.g. it is now running in a separate browser window and also allows to show ULS log entries related to the current request.

The following article gives a brief overview of the new functionality:

http://blah.winsmarts.com/2012-7-SharePoint_2013_Developer_dashboard.aspx

Beside these changes, the Developer Dashboard can now be extended by injecting custom JavaScript code into the developer dashboard window.

Two steps are necessary to achieve this:

  1. Custom JavaScript code, which interacts with the developer dashboard DOM, has to be added to a script file that can be accessed from the Developer Dashboard page. E.g. by placing the script file into the _layouts/15 directory
  2. The custom script file(s) have to be registered to be loaded into the Developer Dashboard page.

Below is a short example, which hides the ULS tab in the Developer Dashboard. This example also shows how to use jquery within the Developer Dashboard.

Create the custom logic in a script file

Create a "hideULSTab.js" inside the layouts/15 directory (program files\common files\microsoft shared\web server extensions\15\template\layouts) and add the following script code to it:

// register a code block that runs after the page is loaded

$(document).ready(function()

{

   // iterate over all tabs (identified by CSS class "ms-dd-Tab")

   $('.ms-dd-Tab').each(function(index, para)

   {

      // look for the tab which has "ULS" title

      if ($(para).text().indexOf("ULS") !== -1)

      {

         // hide the title

         $(para).hide();

      }

   });

});

 

Register the script files with the Developer Dashboard

Our custom script code requires the jquery library – so we have to register two script files with the developer dashboard. That can be done using the following powershell commands:

$contentSvc = ([Microsoft.SharePoint.Administration.SPWebService]::ContentService)

$DevDashboardSettings = $contentSvc.DeveloperDashboardSettings

$DevDashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On

 

$DevDashboardSettings.userscripts.Add("http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.0.min.js")

$DevDashboardSettings.userscripts.Add("/_layouts/15/hideULSTab.js")

 

$DevDashboardSettings.Update()

As you can see we are registering two different script files: first the jquery library from an external site and second the script file we created earlier.

The powershell script will also enable the Developer Dashboard by setting the DisplayLevel to On.