UltrasonicNXT has uploaded a new change for review.
https://gerrit.wikimedia.org/r/186178
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
1 file changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiChat
refs/changes/78/186178/1
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() {
--
To view, visit https://gerrit.wikimedia.org/r/186178
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ae504a853aea2af6cd61bdc6f12e34888b3aba2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MediaWikiChat
Gerrit-Branch: master
Gerrit-Owner: UltrasonicNXT <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits