Add badges to profile page (#2)
This commit is contained in:
parent
b1552857c0
commit
504924c4e2
@ -52,3 +52,16 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||||||
.flex-wrap {
|
.flex-wrap {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badges .badge {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badges .badge i {
|
||||||
|
font-size: 35px;
|
||||||
|
}
|
@ -16,6 +16,27 @@ function loadProfile() {
|
|||||||
$("#playericon .usericon").html(getAvatarIcon(data.profile.id, data.profile.teamid));
|
$("#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);
|
$("#playerteaminfo").html("<i class='" + SETTINGS.teams[data.profile.teamid].icon + "'></i> " + SETTINGS.teams[data.profile.teamid].name);
|
||||||
$("#playerlevelinfo").html("Level " + data.profile.level * 1);
|
$("#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) {
|
}, function (err) {
|
||||||
app.dialog.alert(msg, "Error");
|
app.dialog.alert(msg, "Error");
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<div class="display-flex flex-wrap playerinfoflex">
|
<div class="row justify-content-start">
|
||||||
|
<div class="display-flex flex-wrap playerinfoflex col-100 tablet-50 desktop-33">
|
||||||
<div id="playericon" class="margin-right">
|
<div id="playericon" class="margin-right">
|
||||||
<div class="usericon usericon-2x"></div>
|
<div class="usericon usericon-2x"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -24,6 +25,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="display-flex flex-wrap margin-top badges col-100 tablet-50 desktop-33" id="badgebin">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ var routes = [
|
|||||||
pageAfterIn: function () {
|
pageAfterIn: function () {
|
||||||
function tryToLoadInventory() {
|
function tryToLoadInventory() {
|
||||||
if (typeof loadInventory != "function") {
|
if (typeof loadInventory != "function") {
|
||||||
setTimeout(loadInventory, 100);
|
setTimeout(tryToLoadInventory, 100);
|
||||||
} else {
|
} else {
|
||||||
loadInventory(function () {});
|
loadInventory(function () {});
|
||||||
}
|
}
|
||||||
@ -48,10 +48,10 @@ var routes = [
|
|||||||
on: {
|
on: {
|
||||||
pageAfterIn: function () {
|
pageAfterIn: function () {
|
||||||
function tryToLoadProfile() {
|
function tryToLoadProfile() {
|
||||||
if (typeof loadProfile != "function") {
|
if (typeof loadProfile === "function") {
|
||||||
setTimeout(loadProfile, 100);
|
|
||||||
} else {
|
|
||||||
loadProfile(function () {});
|
loadProfile(function () {});
|
||||||
|
} else {
|
||||||
|
setTimeout(tryToLoadProfile, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tryToLoadProfile();
|
tryToLoadProfile();
|
||||||
@ -91,7 +91,7 @@ var routes = [
|
|||||||
pageAfterIn: function () {
|
pageAfterIn: function () {
|
||||||
function tryToLoadSettings() {
|
function tryToLoadSettings() {
|
||||||
if (typeof loadSettings != "function") {
|
if (typeof loadSettings != "function") {
|
||||||
setTimeout(loadSettings, 500);
|
setTimeout(tryToLoadSettings, 500);
|
||||||
} else {
|
} else {
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user