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.

41 lines
1.7 KiB
JavaScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function loadProfile() {
callAPI("getprofile", {
id: $(".page[data-name=profile]").data("playerid")
}, function (data) {
console.log(data);
$(".playerinfoflex").addClass("color-theme-" + SETTINGS.teams[data.profile.teamid].color);
$("#playericon .usericon").html(getAvatarIcon(data.profile.id, data.profile.teamid));
$("#playerteaminfo").html("<i class='" + SETTINGS.teams[data.profile.teamid].icon + "'></i> " + SETTINGS.teams[data.profile.teamid].name);
$("#playerlevelinfo").html("Level " + data.profile.level * 1);
data.profile.badges.forEach(function (badge) {
$("#badgebin").append('<div class="badge" data-name="' + badge.name + '" data-desc="' + badge.desc + '" style="color: ' + badge.color + '; background: ' + badge.background + '"><i class="' + badge.icon + '"></i></div>');
});
$("#badgebin").on("click", ".badge", function () {
var name = $(this).data("name");
var desc = $(this).data("desc");
app.popover.create({
targetEl: this,
backdrop: false,
content: '<div class="popover">'+
'<div class="popover-inner">'+
'<div class="block">'+
'<b>' + name + '</b>'+
'<p>' + desc + '</p>'+
'</div>'+
'</div>'+
'</div>'
}).open();
});
}, function (err) {
app.dialog.alert(msg, "Error");
});
}