Don't attempt purchase of sold out items

This commit is contained in:
David Kelly 2018-10-30 08:01:22 -07:00
parent db87fe9696
commit 015b5fa681

View file

@ -312,11 +312,12 @@
var getString = "GET"; var getString = "GET";
// Protection against the button getting stuck in the "BUY"/"GET" state. // Protection against the button getting stuck in the "BUY"/"GET" state.
// That happens when the browser gets two MOUSEENTER events before getting a // That happens when the browser gets two MOUSEENTER events before getting a
// MOUSELEAVE event. // MOUSELEAVE event. Also, if not available for sale, just return.
if ($this.text() === buyString || $this.text() === getString) { if ($this.text() === buyString ||
return; $this.text() === getString ||
} $this.text() === 'invalidated' ||
if ($this.text() === 'invalidated') { $this.text() === 'sold out' ||
$this.text() === 'not for sale' ) {
return; return;
} }
$this.data('initialHtml', $this.html()); $this.data('initialHtml', $this.html());
@ -337,7 +338,10 @@
$('.grid-item').find('#price-or-edit').find('a').on('click', function () { $('.grid-item').find('#price-or-edit').find('a').on('click', function () {
if ($(this).closest('.grid-item').find('.price').text() === 'invalidated') { var price = $(this).closest('.grid-item').find('.price').text();
if (price === 'invalidated' ||
price === 'sold out' ||
price === 'not for sale') {
return false; return false;
} }
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'), buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),