2014-05-29 17:24:38 -04:00
|
|
|
define('forum/account/header', function() {
|
2013-10-03 15:04:25 -04:00
|
|
|
var AccountHeader = {};
|
2013-07-25 14:30:12 -04:00
|
|
|
|
2013-10-03 15:04:25 -04:00
|
|
|
AccountHeader.init = function() {
|
2014-05-09 12:56:51 -04:00
|
|
|
displayAccountMenus();
|
2014-02-04 17:31:05 -05:00
|
|
|
selectActivePill();
|
2014-02-26 21:55:29 -05:00
|
|
|
};
|
2014-02-04 17:31:05 -05:00
|
|
|
|
2014-05-09 12:56:51 -04:00
|
|
|
function displayAccountMenus() {
|
2014-03-28 13:02:13 -04:00
|
|
|
var yourid = ajaxify.variables.get('yourid'),
|
|
|
|
|
theirid = ajaxify.variables.get('theirid');
|
2014-02-04 17:31:05 -05:00
|
|
|
|
2014-05-09 12:56:51 -04:00
|
|
|
var editLink = $('#editLink'),
|
|
|
|
|
settingsLink = $('#settingsLink'),
|
|
|
|
|
favouritesLink = $('#favouritesLink');
|
2013-08-26 17:50:31 -04:00
|
|
|
|
2014-05-09 12:56:51 -04:00
|
|
|
if (parseInt(yourid, 10) !== 0 && parseInt(yourid, 10) === parseInt(theirid, 10)) {
|
2014-06-18 12:40:44 -04:00
|
|
|
$('#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
|
|
|
}
|
2014-02-11 20:39:07 -05:00
|
|
|
|
2014-06-18 12:40:44 -04:00
|
|
|
if (app.isAdmin) {
|
2014-05-09 12:56:51 -04:00
|
|
|
editLink.removeClass('hide');
|
2014-02-11 20:39:07 -05:00
|
|
|
}
|
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;
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-10-03 15:04:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AccountHeader;
|
2014-04-10 20:31:57 +01:00
|
|
|
});
|