Guest User

Untitled

a guest
Mar 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. // JavaScript Document
  2. (function($) {
  3.  
  4. Drupal.behaviors.quicktabsTabMemory = {
  5. attach: function(context, settings) {
  6. // The .each() is in case there is more than one quicktab on a page.
  7. $('.quicktabs-wrapper', context).each(function () {
  8.  
  9. var $this = $(this);
  10. var wrapperID = $this.attr('id');
  11.  
  12. var nid = settings.nordtec_klister['currentNid']; // getting the nid on the client side
  13.  
  14. var $activeTabLink = $('.quicktabs-tabs li.active a', context);
  15. var activeTabLinkID = $activeTabLink.attr('id');
  16.  
  17. // Use a unique cookie namespace for each set of Quicktabs, which
  18. // should allow for more than one set on a page.
  19. var cookieName = 'Drupal-quicktabs-active-tab-id-' + wrapperID + 'nid='+ nid;
  20. // Default cookie options.
  21. var cookieOptions = {path: '/'};
  22.  
  23. // Click the tab ID if a cookie exists otherwise set a cookie for
  24. // the default active tab.
  25. var $cookieValue = $.cookie(cookieName);
  26. if ($cookieValue) {
  27. $('#' + $cookieValue).click();
  28. }
  29. else {
  30. $.cookie(cookieName, activeTabLinkID, cookieOptions);
  31. }
  32.  
  33. // Set the click handler for all tabs, this updates the cookie on every
  34. // tab click.
  35. $this.find('ul.quicktabs-tabs a').click(function quicktabsCookieClickHandler() {
  36. $activeTabLink = $this.find('.quicktabs-tabs li.active a', context);
  37. activeTabLinkID = $activeTabLink.attr('id');
  38. $.cookie(cookieName, activeTabLinkID, cookieOptions);
  39. });
  40. });
  41. }
  42. };
  43.  
  44. })(jQuery);
  45.  
  46. ini_set('session.gc_maxlifetime', 28800);
  47. ini_set('session.cookie_lifetime', 28800);
Add Comment
Please, Sign In to add comment