Sha256: 11e2e19c16aa03550ccfc16abf71ed0c78c635bfce60a4fa80ec18e82aa9f981

Contents?: true

Size: 1013 Bytes

Versions: 20

Compression:

Stored size: 1013 Bytes

Contents

// This code is to implement the tabs on the home page

// navigate to the selected tab or the first tab
function tabNavigation(e) {
    var activeTab = $('[href="' + location.hash + '"]');
    if (activeTab.length) {
        activeTab.tab('show');
    } else {
        var firstTab = $('.nav-tabs a:first');
        // select the first tab if it has an id and is expected to be selected
        if ((firstTab[0] !== undefined) && (firstTab[0].id != "")){
          $(firstTab).tab('show');
        }
    }
}

Blacklight.onLoad(function () {
  // When we visit a link to a tab, open that tab.
  var url = document.location.toString();
  if (url.match('#')) {
    $('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
  }

  // Change the url when a tab is clicked.
  $('a[data-toggle="tab"]').on('click', function(e) {
    history.pushState(null, null, $(this).attr('href'));
  });
  // navigate to a tab when the history changes (back button)
  window.addEventListener("popstate", tabNavigation);
});

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
hyrax-1.1.1 app/assets/javascripts/hyrax/tabs.js
hyrax-1.1.0 app/assets/javascripts/hyrax/tabs.js
sufia-7.4.1 app/assets/javascripts/sufia/tabs.js
hyrax-1.0.5 app/assets/javascripts/hyrax/tabs.js
sufia-7.4.0 app/assets/javascripts/sufia/tabs.js
hyrax-1.0.4 app/assets/javascripts/hyrax/tabs.js
hyrax-1.0.3 app/assets/javascripts/hyrax/tabs.js
hyrax-1.0.2 app/assets/javascripts/hyrax/tabs.js
hyrax-1.0.1 app/assets/javascripts/hyrax/tabs.js
hyrax-1.0.0.rc2 app/assets/javascripts/hyrax/tabs.js
sufia-7.3.1 app/assets/javascripts/sufia/tabs.js
hyrax-1.0.0.rc1 app/assets/javascripts/hyrax/tabs.js
sufia-7.3.0 app/assets/javascripts/sufia/tabs.js
sufia-7.3.0.rc3 app/assets/javascripts/sufia/tabs.js
sufia-7.3.0.rc2 app/assets/javascripts/sufia/tabs.js
sufia-7.3.0.rc1 app/assets/javascripts/sufia/tabs.js
test_hyrax-0.0.1.alpha app/assets/javascripts/hyrax/tabs.js
sufia-7.2.0 app/assets/javascripts/sufia/tabs.js
sufia-7.1.0 app/assets/javascripts/sufia/tabs.js
sufia-7.0.0 app/assets/javascripts/sufia/tabs.js