Posted By

fauverism on 01/19/11


Tagged

jquery sharepoint2007


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jlaws0n


Sharepoint Down Arrow Parent Link Hack


 / Published in: JavaScript
 

  1. $(document).ready(function() {
  2. var searchTerm = window.location.search.substring(4);
  3. if (searchTerm!="")
  4. $('#content').highlight(searchTerm);
  5.  
  6. $('a[href^="http://purl.bms.com"]').attr("target","_blank");
  7.  
  8.  
  9. $('.left-navheader a').click(function(e) {
  10. // disable default functionality, if there's expand/contract arrow (indicating sub-pages)
  11. if ($(this).parent().next().is('.left-navheader-contract, .left-navheader-expand'))
  12. e.preventDefault();
  13.  
  14. /*
  15. ID of the arrow image - ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_imgTD_4df9ee39-e0e4-4be0-9d12-62ff1a8d6a421
  16. ID of the subnav DIV - ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_divNavigateCtrl_4df9ee39-e0e4-4be0-9d12-62ff1a8d6a421
  17. */
  18.  
  19. // set cookie
  20. // - find ID of sibling ... i.e. the arrow image
  21. var fullImgID = $(this).parent().next().attr('id');
  22. // - remove the prefix to find the part of the id we need ...
  23. var imgID = fullImgID.replace('ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_','');
  24. // get just the unique part of the ID that's common to both the IMG and DIV
  25. var navID = imgID.replace('imgTD_','');
  26. // - figure out the Subnav Div ID minus the prefix - since this is used as the cookie name, etc...
  27. var divID = 'divNavigateCtrl_'+navID;
  28. // figure out the ID of the div to toggle
  29. var fullSubnavID = 'ctl00_PlaceHolderLeftNavBar_idELPLeftNavigationUserControl_'+divID;
  30. // - set it, using plugin
  31. /*
  32. if ($(fullSubnavID).css('display')=="block") {
  33. $('#'+fullSubnavID).hide();
  34. $.cookie(divID,"none", { path: '/'});
  35. }
  36. else {
  37. $('#'+fullSubnavID).show();
  38. $.cookie(divID,"block", { path: '/'});
  39. }
  40. */
  41.  
  42. ShowHide(divID,imgID);
  43.  
  44. });
  45.  
  46. });

Report this snippet  

You need to login to post a comment.