Skip to content

Commit

Permalink
Auction: Show/Hide button remember selection
Browse files Browse the repository at this point in the history
Issue #167
  • Loading branch information
GreatApo committed Jul 10, 2020
1 parent 15f8115 commit 901ab07
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
6 changes: 3 additions & 3 deletions PROGRESS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Progress on Version 4.3.1 [Beta]

![version type](https://img.shields.io/badge/version-beta-yellow.svg?style=flat-square)
![improvements](https://img.shields.io/badge/improvements-0-green.svg?style=flat-square)
![improvements](https://img.shields.io/badge/improvements-1-green.svg?style=flat-square)
![bug fixes](https://img.shields.io/badge/bug%20fixes-1-red.svg?style=flat-square)
![translations](https://img.shields.io/badge/translations-1-blue.svg?style=flat-square)

### IMPROVEMENTS
- **General**
- [x] None
- **Auction**
- [x] Auction: Show/Hide button remember selection (Issue #167)


### BUG FIXES
Expand Down
41 changes: 26 additions & 15 deletions source/core/source/auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,11 @@ var gca_auction = {
let button = document.createElement("a");
button.className = "gca-auction-show-hide-button";
button.dataset.tooltip = '[[["'+ gca_locale.get("auction", "hide_your_gold_here") +'","#fff;font-size:12px;"]]]';
button.dataset.status = false;
button.style.filter = "grayscale(100%)";
button.addEventListener('click', function () {
// Show/hide items
if ( this.dataset.status == "false" ){
jQuery(".auction_bid_div:not(:has(.gca-auction-good-price))").closest("td").hide();
jQuery('input[name ="buyout"]').hide();
this.style.filter = "grayscale(0%)";
}else{
jQuery(".auction_bid_div:not(:has(.gca-auction-good-price))").closest("td").show();
jQuery('input[name ="buyout"]').show();
this.style.filter = "grayscale(100%)";
}
this.dataset.status = ( this.dataset.status == "false" );
}, false);
button.addEventListener('click', function(){
let status = gca_data.section.get("cache", "auction_show_hide_button_status", false );
gca_data.section.set("cache", "auction_show_hide_button_status", !status );
gca_auction.showHideNonHideYourGoldItems(this, !status);
} , false);
filters.appendChild(button);
filters.appendChild(document.createElement("br"));

Expand Down Expand Up @@ -195,6 +185,27 @@ var gca_auction = {
tmp = gca_tools.strings.removeDots(items[i].textContent).match(/\s*(\d+)\s*(\d+)\s*$/);
document.getElementsByName('buyout')[i].className += (gold < parseInt(tmp[1], 10) || rubies < parseInt(tmp[2], 10)) ? " gca-auction-can-not-buy" : " gca-auction-can-buy";
}

// Set button status
// True = hide items, False = do not hide
let status = gca_data.section.get("cache", "auction_show_hide_button_status", false);
if ( status )
this.showHideNonHideYourGoldItems(button, status);
else
button.style.filter = "grayscale(100%)";
},

showHideNonHideYourGoldItems : function(that, status) {
// Show/hide items
if ( status == true ){
jQuery(".auction_bid_div:not(:has(.gca-auction-good-price))").closest("td").hide();
jQuery('input[name ="buyout"]').hide();
that.style.filter = "grayscale(0%)";
}else{
jQuery(".auction_bid_div:not(:has(.gca-auction-good-price))").closest("td").show();
jQuery('input[name ="buyout"]').show();
that.style.filter = "grayscale(100%)";
}
},

itemsLevelShow : function() {
Expand Down

0 comments on commit 901ab07

Please sign in to comment.