UltrasonicNXT has submitted this change and it was merged.

Change subject: Don't auto scroll when the user is scrolled up
......................................................................


Don't auto scroll when the user is scrolled up

Very annoying!

Plus some other cleanup

Change-Id: I5ae504a853aea2af6cd61bdc6f12e34888b3aba2
---
M MediaWikiChat.js
M MediaWikiChat.php
2 files changed, 11 insertions(+), 8 deletions(-)

Approvals:
  UltrasonicNXT: Verified; Looks good to me, approved



diff --git a/MediaWikiChat.js b/MediaWikiChat.js
index a5babdb..6169722 100644
--- a/MediaWikiChat.js
+++ b/MediaWikiChat.js
@@ -225,7 +225,13 @@
 
        scrollToBottom: function() {
                var div = $( '#mwchat-content' );
-               div.animate( { 'scrollTop': div[0].scrollHeight }, 1000 );
+
+               if (
+                       div.scrollTop() > div[0].scrollHeight - div.height() - 
25 ||  // only if user is scrolled to bottom atm
+                       !MediaWikiChat.amI // or if this is the first poll 
request
+               ) {
+                       div.animate( { 'scrollTop': div[0].scrollHeight }, 1000 
);
+               }
        },
 
        showKickMessage: function( from, to, timestamp ) {
@@ -706,7 +712,7 @@
                                $( '#mwchat-type input' ).val( '' );
                        }
 
-                       $( '#mwchat-loading' ).attr('data-queue', parseInt($( 
'#mwchat-loading' ).attr( 'data-queue' ) ) + 1 )
+                       $( '#mwchat-loading' ).attr('data-queue', parseInt( $( 
'#mwchat-loading' ).attr( 'data-queue' ) ) + 1 )
                                             .animate( { opacity: $( 
'#mwchat-loading' ).attr( 'data-queue' ) } );
 
                        $.ajax( {
@@ -715,7 +721,7 @@
                                data: { 'action': 'chatsend', 'message': 
message, 'format': 'json' }
                        } ).done( function( msg ) {
                                MediaWikiChat.getNewReply( msg );
-                               $( '#mwchat-loading' ).attr('data-queue', 
parseInt($( '#mwchat-loading' ).attr( 'data-queue' ) ) - 1 )
+                               $( '#mwchat-loading' ).attr('data-queue', 
parseInt( $( '#mwchat-loading' ).attr( 'data-queue' ) ) - 1 )
                                                     .animate( { opacity: $( 
'#mwchat-loading' ).attr( 'data-queue' ) } );
 
                                window.clearInterval( MediaWikiChat.newInterval 
);
@@ -747,8 +753,6 @@
 
        MediaWikiChat.getNew();
 
-       setTimeout( MediaWikiChat.getNew, 2500 );
-
        MediaWikiChat.pollInterval = setInterval( MediaWikiChat.getNew, 
MediaWikiChat.interval );
        MediaWikiChat.redoInterval = setInterval( MediaWikiChat.redoTimestamps, 
10000 );
 
@@ -760,8 +764,7 @@
                $( '#mwchat-me' ).animate( { 'top': height }, 'fast' );
        } );
 
-       // Open any link in chat-topic in a new tab
-       $( '#mwchat-topic a').attr( 'target', '_blank');
+       $( '#mwchat-topic a').attr( 'target', '_blank'); // Open any link in 
chat-topic in a new tab
 } );
 
 $( window ).blur( function() {
diff --git a/MediaWikiChat.php b/MediaWikiChat.php
index 952ac69..2e6dcb1 100644
--- a/MediaWikiChat.php
+++ b/MediaWikiChat.php
@@ -16,7 +16,7 @@
 $wgExtensionCredits['specialpage'][] = array(
        'path' => __FILE__,
        'name' => 'MediaWikiChat',
-       'version' => '2.14.2',
+       'version' => '2.14.3',
        'author' => 'Adam Carter/UltrasonicNXT',
        'url' => 'https://www.mediawiki.org/wiki/Extension:MediaWikiChat',
        'descriptionmsg' => 'chat-desc',

-- 
To view, visit https://gerrit.wikimedia.org/r/186178
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5ae504a853aea2af6cd61bdc6f12e34888b3aba2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MediaWikiChat
Gerrit-Branch: master
Gerrit-Owner: UltrasonicNXT <[email protected]>
Gerrit-Reviewer: UltrasonicNXT <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to