From a5ef3fa729d5b61e74ad609e3736249b33eb9cf8 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 11 Jun 2018 12:00:51 -0700 Subject: [PATCH] Fix MS14129: Prevent Marketplace buttons from getting stuck on hover state --- scripts/system/html/js/marketplacesInject.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index 799a974fd6..9b91d06d41 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -306,13 +306,21 @@ // change pricing to GET/BUY on button hover $('body').on('mouseenter', '#price-or-edit .price', function () { var $this = $(this); + var buyString = "BUY"; + var getString = "GET"; + // Protection against the button getting stuck in the "BUY"/"GET" state. + // That happens when the browser gets two MOUSEENTER events before getting a + // MOUSELEAVE event. + if ($this.text() === buyString || $this.text() === getString) { + return; + } $this.data('initialHtml', $this.html()); var cost = $(this).parent().siblings().text(); if (parseInt(cost) > 0) { - $this.text('BUY'); + $this.text(buyString); } else { - $this.text('GET'); + $this.text(getString); } });