From 8a7d85a62875f30e587f0b144cf24cc44155d07a Mon Sep 17 00:00:00 2001 From: Yichuan Shen Date: Fri, 9 Sep 2016 12:13:27 +0200 Subject: [PATCH] Fix missing preview images in #gamechooser when filtering --- view/index.view.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/view/index.view.js b/view/index.view.js index a28765760..bc832f212 100644 --- a/view/index.view.js +++ b/view/index.view.js @@ -724,7 +724,7 @@ function prepareGameChooser() { $('#gamechooser > input').on('input', function() { var value = this.value - $('#gamechooser .games-list li:not(.add)').get().forEach(function(li) { + $('#gamechooser .games-list li').get().forEach(function(li) { if ($(li).find('span').get().some(function(span) { return $(span).text().toLowerCase().indexOf(value.toLowerCase()) >= 0 })) $(li).removeClass('hide') @@ -733,6 +733,13 @@ function prepareGameChooser() { var $gamesList = $('#gamechooser .games-list') $gamesList.data('scrollbar').update() + + var $scrollContainer = $([ + '#gamechooser .games-list.gm-scrollbar-container', + '#gamechooser .games-list.gm-prevented .gm-scroll-view' + ].join(', ')) + + $scrollContainer.scrollTop(0).trigger('scroll') }) } @@ -1543,9 +1550,10 @@ function showGameChooser(restoreScrollbarPos) { if (restoreScrollbarPos == null) restoreScrollbarPos = true - var $scrollContainer = $('#gamechooser .games-list') - if ($scrollContainer.hasClass('gm-scrollbar-container')) - $scrollContainer = $scrollContainer.find('.gm-scroll-view') + var $scrollContainer = $([ + '#gamechooser .games-list.gm-prevented', + '#gamechooser .games-list.gm-scrollbar-container .gm-scroll-view' + ].join(', ')) var scrollbarPos = restoreScrollbarPos ? $scrollContainer.scrollTop() : 0