Extract reapplication of saved filter state

Change-Id: If770e0cb52034a5f52bc8bb3639c9dccdf64b683
This commit is contained in:
WMDE-Fisch 2019-04-01 18:25:11 +02:00
parent d4a3ec243e
commit 98c33c4731

View file

@ -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
*/