jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/329718 )
Change subject: Jump to latest ...................................................................... Jump to latest Bug:T145303 Change-Id: I81645ce881e318d8a815abba8ff6098428b624b1 --- M MediaWikiChat.js M SpecialChat.template.php M extension.json M i18n/en.json M i18n/qqq.json 5 files changed, 23 insertions(+), 2 deletions(-) Approvals: UltrasonicNXT: Looks good to me, approved jenkins-bot: Verified diff --git a/MediaWikiChat.js b/MediaWikiChat.js index 8f295ae..7d03e00 100644 --- a/MediaWikiChat.js +++ b/MediaWikiChat.js @@ -230,9 +230,15 @@ scrollToBottom: function() { var div = $( '#mwchat-content' ); - if ( $( 'input[name=autoscroll]')[0].checked ) { + if ( $( 'input[name=autoscroll]' )[0].checked ) { div.animate( { 'scrollTop': div[0].scrollHeight }, 1000 ); } + }, + + jumpToLatest: function() { + $( 'input[name=autoscroll]' )[0].checked = true; + $( "#mwchat-jumptolatest-span" ).animate( { opacity: 0 } ); // should be done by the changed() statement at bottom but for some reason isn't + MediaWikiChat.scrollToBottom(); }, showKickMessage: function( from, to, timestamp ) { @@ -780,6 +786,18 @@ } ); $( '#mwchat-topic a').attr( 'target', '_blank'); // Open any link in chat-topic in a new tab + + $( 'input[name=autoscroll]' ).change( function() { + if ( this.checked ) { + $( "#mwchat-jumptolatest-span" ).animate( { opacity: 0 } ); + } else { + $( "#mwchat-jumptolatest-span" ).animate( { opacity: 1 } ); + } + } ); + + $( "#mwchat-jumptolatest-link" ).click( function() { + MediaWikiChat.jumpToLatest(); + } ); } ); $( window ).blur( function() { diff --git a/SpecialChat.template.php b/SpecialChat.template.php index 1955e24..cdaf2cf 100644 --- a/SpecialChat.template.php +++ b/SpecialChat.template.php @@ -44,6 +44,7 @@ </div> </div> <div id="mwchat-options"> + <span id="mwchat-jumptolatest-span" style="opacity:0;"><a id="mwchat-jumptolatest-link" href="javascript:;"><?php echo wfMessage( 'chat-jump-to-latest' )->plain(); ?></a> • </span> <?php echo wfMessage( 'chat-autoscroll' )->plain(); ?><input type="checkbox" name="autoscroll" checked="checked" /> • <a target="_blank" href="<?php echo SpecialPage::getTitleFor( 'Preferences', false, 'mw-prefsection-misc' )->getFullURL(); ?>"><?php echo wfMessage( 'chat-change-preferences' ); ?></a> </div> diff --git a/extension.json b/extension.json index fc44525..01514a3 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "MediaWikiChat", - "version": "2.19.4", + "version": "2.20.0", "author": [ "Adam Carter/UltrasonicNXT" ], diff --git a/i18n/en.json b/i18n/en.json index 5e93906..f9bc87b 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -21,6 +21,7 @@ "chat-kick": "kick", "chat-block": "block", "chat-autoscroll": "autoscroll", + "chat-jump-to-latest": "jump to latest", "chat-youve-been-kicked": "You have been {{GENDER:$2|kicked}} by $1. Refresh the page to chat.", "chat-you-kicked": "You {{GENDER:$2|kicked}} $1.", diff --git a/i18n/qqq.json b/i18n/qqq.json index e6eb02c..85e3ea2 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -28,6 +28,7 @@ "chat-kick": "{{Identical|Kick}}", "chat-block": "The link shown to chatmods to block a user.\n{{Identical|Block}}", "chat-autoscroll": "Label for checkbox for whether chat should scroll automatically", + "chat-jump-to-latest": "Label for link to take the user to the most recently sent message", "chat-youve-been-kicked": "Shown to users who have been kicked from the chat. Parameters:\n* $1 - the user who kicked from the chat\n* $2 - GENDER of the user who kicked\nSee also:\n* {{msg-mw|Chat-youve-been-blocked}}", "chat-you-kicked": "Shown when the current user kicked the user $1. Parameters:\n* $1 - username\n* $2 - GENDER\nSee also:\n* {{msg-mw|Chat-you-blocked}}\n* {{msg-mw|Chat-you-unblocked}}", "chat-kicked": "Shown when the user $1 kicked the user $2. Parameters:\n* $1 - the user who kicked\n* $2 - the user who was kicked\n* $3 - GENDER of the user who kicked\n* $4 - GENDER of the user who was kicked\nSee also:\n* {{msg-mw|Chat-blocked}}\n* {{msg-mw|Chat-unblocked}}\n{{Identical|Kicked}}", -- To view, visit https://gerrit.wikimedia.org/r/329718 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I81645ce881e318d8a815abba8ff6098428b624b1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MediaWikiChat Gerrit-Branch: master Gerrit-Owner: UltrasonicNXT <adamr_car...@btinternet.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: UltrasonicNXT <adamr_car...@btinternet.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits