From 98c33c47310553adb5f85a8c16a801a9111a035e Mon Sep 17 00:00:00 2001 From: WMDE-Fisch Date: Mon, 1 Apr 2019 18:25:11 +0200 Subject: [PATCH] Extract reapplication of saved filter state Change-Id: If770e0cb52034a5f52bc8bb3639c9dccdf64b683 --- .../ext.RevisionSlider.RevisionListView.js | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/ext.RevisionSlider.RevisionListView.js b/modules/ext.RevisionSlider.RevisionListView.js index 59d0a751..e4f6aea4 100644 --- a/modules/ext.RevisionSlider.RevisionListView.js +++ b/modules/ext.RevisionSlider.RevisionListView.js @@ -436,14 +436,7 @@ self.highlightSameUserRevisions( userName ); break; case 'mouseleave': - $userLine.removeClass( 'mw-revslider-highlight' ); - $userBubble.removeClass( 'mw-revslider-highlite-bubble' ); - if ( self.selectedUser ) { - self.highlightSameUserRevisions( self.selectedUser ); - } - if ( self.selectedTag ) { - self.highlightSameTagRevisions( self.selectedTag ); - } + self.reApplySavedHighlighting( $userLine, $userBubble ); break; case 'click': oldUser = self.selectedUser; @@ -571,14 +564,7 @@ self.highlightSameTagRevisions( tagName ); break; case 'mouseleave': - $tagLine.removeClass( 'mw-revslider-highlight' ); - $tagBubble.removeClass( 'mw-revslider-highlite-bubble' ); - if ( self.selectedTag ) { - self.highlightSameTagRevisions( self.selectedTag ); - } - if ( self.selectedUser ) { - self.highlightSameUserRevisions( self.selectedUser ); - } + self.reApplySavedHighlighting( $tagLine, $tagBubble ); break; case 'click': oldTag = self.selectedTag; @@ -614,6 +600,22 @@ } }, + /** + * Re-apply highlighting from saved state + * @param {jQuery} $line + * @param {jQuery} $bubble + */ + reApplySavedHighlighting: function ( $line, $bubble ) { + $line.removeClass( 'mw-revslider-highlight' ); + $bubble.removeClass( 'mw-revslider-highlite-bubble' ); + if ( self.selectedTag ) { + self.highlightSameTagRevisions( self.selectedTag ); + } + if ( self.selectedUser ) { + self.highlightSameUserRevisions( self.selectedUser ); + } + }, + /** * Removes the highlighting from the revisions */