Skip to content

Commit

Permalink
fixes #95
Browse files Browse the repository at this point in the history
  • Loading branch information
henriyli committed Sep 23, 2014
1 parent 0ae83d6 commit 528d806
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions resource/js/docready.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $(function() { // DOCUMENT READY
});
}
// Sidenav actions only happen when doing other queries than the autocomplete.
if (settings.url.indexOf('index') !== -1 || settings.url.indexOf('groups') !== -1 || settings.url.indexOf('hierarchy') !== -1) {
if (settings.url.indexOf('topConcepts') === -1 || settings.url.indexOf('index') === -1 || settings.url.indexOf('groups') !== -1 || settings.url.indexOf('hierarchy') !== -1) {
var snap = (settings.url.indexOf('hierarchy') !== -1) ? 18 : 15;
$(".sidebar-grey").mCustomScrollbar({
alwaysShowScrollbar: 1,
Expand All @@ -97,7 +97,6 @@ $(function() { // DOCUMENT READY
snapAmount: snap,
snapOffset: 0
});
countAndSetOffset();
if (settings.url.indexOf('hierarchy') !== -1)
$(".sidebar-grey").mCustomScrollbar('scrollTo', scrollToConcept());
}
Expand All @@ -120,25 +119,6 @@ $(function() { // DOCUMENT READY
invokeParentTree(getTreeConfiguration());
}

// if we are on the vocab front page initialize the hierarchy view with a top concept.
$(document).on('click', '#hier-trigger', function () {
var $content = $('.sidebar-grey');
$content.empty().prepend(spinner);
if($('.uri-input-box').length === 0) { // if on the vocabulary front page
$('.active').removeClass('active');
$('#hier-trigger').parent().addClass('active');
$content.removeClass('sidebar-grey-alpha');
$('.pagination').hide();
$content.append('<div class="hierarchy-bar-tree"></div>');
invokeParentTree(getTreeConfiguration(true));
$('#hier-trigger').attr('href', '#');
return false;
}
var uri = $('.uri-input-box').html();
var redirectUrl = 'http://' + base_url + vocab + '/' + lang + '/page/' + uri.split('/')[uri.split('/').length-1];
window.location.replace(encodeURI(redirectUrl));
});

var textColor = $('.search-parameter-highlight').css('color');
countAndSetOffset();

Expand Down Expand Up @@ -365,6 +345,25 @@ $(function() { // DOCUMENT READY
return false;
}
);

// if we are on the vocab front page initialize the hierarchy view with a top concept.
$(document).on('click', '#hier-trigger',
function (event) {
var $content = $('#sidebar');
if($('.uri-input-box').length === 0) { // if on the vocabulary front page
$('.sidebar-grey').remove();
$('.active').removeClass('active');
$('#hier-trigger').parent().addClass('active');
$('.pagination').hide();
$content.append('<div class="sidebar-grey"><div class="hierarchy-bar-tree"></div></div>');
invokeParentTree(getTreeConfiguration(true));
$('#hier-trigger').attr('href', '#');
return false;
}
var uri = $('.uri-input-box').html();
var redirectUrl = 'http://' + base_url + vocab + '/' + lang + '/page/' + uri.split('/')[uri.split('/').length-1];
window.location.replace(encodeURI(redirectUrl));
});

// event handler for clicking the group index tab
$(document).on('click', '.nav-tabs a[href$="groups"]',
Expand Down

0 comments on commit 528d806

Please sign in to comment.