dennisshen7 / Highlight Tasks

// ==UserScript==
// @name        Highlight Tasks
// @namespace   --
// @include       http*://*aspsoft/dispatcher.aspx?nextPID=showProjectTask*
// @include       http*://*aspsoft/dispatcher.aspx?nextPID=listProjectResource*
// @include       http*://*aspsoft/dispatcher.aspx?nextPID=listProjectMilestone*
// @include       http*://*/Genie/ListMilestone.aspx?nextPID=listMilestone_p*
// @version     0.2
// ==/UserScript==
//this.$ = this.jQuery = jQuery.noConflict(true);
var $ = unsafeWindow.jQuery;
$(document).ready(function()
{
  var uname = $('label#ctl00_lblUsername').text();
  $('table[objectname=listProjectTask] span[objectname=resource_type], table[objectname=listProjectTask] span[objectname=approve_by_type]').each(function(idx){
    if($(this).text().indexOf(uname)>-1){
      var tarTR = $(this).closest('tr');
      var tarTD = $(this).closest('td');
      var idx = tarTR.find('td').index(tarTD);
      var headerText = $('table[objectname=listProjectTask] tr:first>th:eq('+idx+')').text();

      if(headerText.indexOf('Approve By Type')>-1){               
       tarTR.css('background-color','#CCFF99');
      }
      if(headerText.indexOf('Resource Type')>-1){               
       tarTR.css('background-color','#FFDDAA');
      }
    }
  });
  
  //listProjectResource
  $('table[objectname=listProjectResource] span[objectname=staff_id]').each(function(idx){
    if($(this).text().indexOf(uname)>-1){
      $(this).closest('tr').css('background-color','yellow')
    }
  });
  
  //listProjectMilestone
    $('table[objectname=listProjectMilestone] span[objectname=assign_to]').each(function(idx){
    if($(this).text().indexOf(uname)>-1){
      $(this).closest('tr').css('background-color','yellow')
    }
  });
  
  //#ctl00_ContentPlaceHolder1_InfoGridView1
    $('table#ctl00_ContentPlaceHolder1_InfoGridView1 span').each(function(idx){
    if($(this).text().indexOf(uname)>-1){
      $(this).closest('tr').css('background-color','yellow')
    }
  });
  
});