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

40 lines
928 B
JavaScript
Raw Normal View History

define(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.removeClass('hide');
settingsLink.removeClass('hide');
favouritesLink.removeClass('hide');
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
});