Permalink
Browse files

Economy scroll on large rewards

  • Loading branch information...
Manuel-777 committed Oct 28, 2018
1 parent acd6528 commit 297f8a742411ef55c339ebc6917046d45c7ba8b0
Showing with 55 additions and 5 deletions.
  1. +21 −0 shared/shared.css
  2. +14 −2 shared/util.js
  3. +3 −0 window_background/background.js
  4. +8 −1 window_main/index.css
  5. +9 −2 window_main/renderer.js
@@ -70,6 +70,27 @@ label {
background: #B59579;
}
.tiny_scroll::-webkit-scrollbar {
height: 2px;
}
.tiny_scroll::-webkit-scrollbar-track {
background: #33281E;
border-radius: 2px;
margin-left: 2px;
}
.tiny_scroll::-webkit-scrollbar-thumb {
background: #c3a485;
border-radius: 2px;
}
.tiny_scroll::-webkit-scrollbar-thumb:hover {
background: #ffe9d3;
}
.loading_bar {
background-color: #B7C89E;
overflow: hidden;
@@ -493,12 +493,24 @@ function collectionSortSet(a, b) {
return 0;
}
function getRaritySortValue(rarity) {
rarity = rarity.toLowerCase();
switch (rarity) {
case 'land': return 1; break;
case 'common': return 2; break;
case 'uncommon': return 3; break;
case 'rare': return 4; break;
case 'mythic': return 5; break;
default: return 0; break;
}
}
//
function collectionSortRarity(a, b) {
a = cardsDb.get(a);
b = cardsDb.get(b);
if (a.rarity < b.rarity) return -1;
if (a.rarity > b.rarity) return 1;
if (getRaritySortValue(a.rarity) < getRaritySortValue(b.rarity)) return -1;
if (getRaritySortValue(a.rarity) > getRaritySortValue(b.rarity)) return 1;
if (a.set < b.set) return -1;
if (a.set > b.set) return 1;
@@ -1941,6 +1941,9 @@ function saveEconomy(json) {
if (ctx.indexOf("Event.PayEntry") !== -1) {
json.context = "Pay Event Entry";
}
if (ctx.indexOf("Event.GrantCardPool") !== -1) {
json.context = "Event Card Pool";
}
var economy_index = store.get('economy_index');
@@ -447,6 +447,13 @@ span i {
color: rgba(250, 229, 210, 1);
}
.list_economy_awarded {
margin: 0 24px;
align-items: center;
overflow: -webkit-paged-x;
display: flex;
max-width: calc(100% - 200px);
}
.list_event_expand {
width: calc(100% - 32px);
@@ -1058,7 +1065,7 @@ a:hover {
}
.economy_wc {
width: 24px;
min-width: 24px;
height: 24px;
background-size: contain;
background-repeat: no-repeat;
@@ -786,8 +786,8 @@ function setEconomy(loadMore) {
flb.classList.add("flex_bottom");
var flr = document.createElement("div");
flr.classList.add("flex_item");
flr.style.marginRight = "24px";
flr.classList.add("tiny_scroll");
flr.classList.add("list_economy_awarded");
checkGemsPaid = false;
checkGoldPaid = false;
@@ -993,6 +993,7 @@ function setEconomy(loadMore) {
}
if (checkCardsAdded && change.delta.cardsAdded != undefined) {
change.delta.cardsAdded.sort(collectionSortRarity);
change.delta.cardsAdded.forEach(function(grpId) {
var card = cardsDb.get(grpId);
@@ -1029,6 +1030,12 @@ function setEconomy(loadMore) {
mainDiv.appendChild(div);
$('.list_economy_awarded').on("mousewheel", function(e) {
var delta = (parseInt(e.originalEvent.deltaY)/40);
this.scrollLeft += delta;
e.preventDefault();
});
}
$(this).off();

0 comments on commit 297f8a7

Please sign in to comment.