Files
NodeBB/public/src/forum/account/header.js

43 lines
1.0 KiB
JavaScript
Raw Normal View History

define('forum/account/header', function() {
var AccountHeader = {};
2013-07-25 14:30:12 -04:00
AccountHeader.init = function() {
displayAccountMenus();
2014-02-04 17:31:05 -05:00
selectActivePill();
};
2014-02-04 17:31:05 -05:00
function displayAccountMenus() {
var yourid = ajaxify.variables.get('yourid'),
theirid = ajaxify.variables.get('theirid');
2014-02-04 17:31:05 -05:00
var editLink = $('#editLink'),
settingsLink = $('#settingsLink'),
favouritesLink = $('#favouritesLink');
2013-08-26 17:50:31 -04:00
if (parseInt(yourid, 10) !== 0 && parseInt(yourid, 10) === parseInt(theirid, 10)) {
$('#editLink, #settingsLink, #favouritesLink').removeClass('hide');
} else {
$('.account-sub-links .plugin-link').each(function() {
$this = $(this);
$this.toggleClass('hide', $this.hasClass('private'));
});
2013-07-25 14:30:12 -04:00
}
if (app.isAdmin) {
editLink.removeClass('hide');
}
2014-02-04 17:31:05 -05:00
}
2013-08-26 17:50:31 -04:00
2014-02-04 17:31:05 -05:00
function selectActivePill() {
$('.account-sub-links li').removeClass('active').each(function() {
var href = $(this).find('a').attr('href');
2013-08-26 17:50:31 -04:00
if (window.location.href.indexOf(href) !== -1) {
2014-02-04 17:31:05 -05:00
$(this).addClass('active');
2013-08-26 17:50:31 -04:00
return false;
}
});
}
return AccountHeader;
2014-04-10 20:31:57 +01:00
});