You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodebb/public/src/forum/accountheader.js

41 lines
863 B
JavaScript

define(function() {
var AccountHeader = {};
AccountHeader.init = function() {
hideLinks();
selectActivePill();
};
function hideLinks() {
var yourid = ajaxify.variables.get('yourid'),
theirid = ajaxify.variables.get('theirid');
var editLink = $('#editLink');
var settingsLink = $('#settingsLink');
var favouritesLink = $('#favouritesLink');
if (parseInt(yourid, 10) === 0 || parseInt(yourid, 10) !== parseInt(theirid, 10)) {
editLink.hide();
settingsLink.hide();
favouritesLink.hide();
}
if(app.isAdmin) {
editLink.show();
}
}
function selectActivePill() {
$('.account-sub-links li').removeClass('active').each(function() {
var href = $(this).find('a').attr('href');
if (window.location.href.indexOf(href) !== -1) {
$(this).addClass('active');
return false;
}
});
}
return AccountHeader;
});