UltrasonicNXT has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/105510


Change subject: Simlify prettyTimestamps
......................................................................

Simlify prettyTimestamps

Remove some 'wordy' messages, and just show absolute minutes, rather than
minutes rounded to 35, 40, etc

Change-Id: Ie5eb021edcff0d19a67a07a308f2c32e1fc81417
---
M MediaWikiChat.i18n.php
M MediaWikiChat.js
2 files changed, 4 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiChat 
refs/changes/10/105510/1

diff --git a/MediaWikiChat.i18n.php b/MediaWikiChat.i18n.php
index edc4c02..520a6aa 100644
--- a/MediaWikiChat.i18n.php
+++ b/MediaWikiChat.i18n.php
@@ -20,9 +20,6 @@
        'chat-not-allowed' => 'You are not allowed to chat, try logging in 
first',
        'chat-just-now' => 'just now',
        'chat-a-minute-ago' => 'a minute ago',
-       'chat-quarter-of-an-hour-ago' => 'quarter of an hour ago',
-       'chat-half-an-hour-ago' => 'half an hour ago',
-       'chat-an-hour-ago' => 'an hour ago',
        'chat-minutes-ago' => '$1 minutes ago',
        'chat-yesterday' => 'yesterday',
        'chat-youve-been-kicked' => 'You have been kicked by $1. Refresh the 
page to chat',
@@ -82,8 +79,6 @@
        'chat-just-now' => 'Timestamps: shown when a message was sent in the 
last 30 seconds',
        'chat-a-minute-ago' => 'Timestamps: shown when the message was shown a 
minute ago',
        'chat-minutes-ago' => 'Timestamps: the message was sent $1 minutes ago',
-       'chat-half-an-hour-ago' => 'Timestamps: the message was sent half an 
hour ago',
-       'chat-an-hour-ago' => 'Timestamps: the message was sent an hour ago',
        'chat-yesterday' => 'Timestamps: the message was sent yesterday',
        'chat-youve-been-kicked' => 'Shown to users who have been kicked from 
the chat, $1 being the user who kicked them',
        'chat-you-kicked' => 'Shown when the current user kicked the user $1',
diff --git a/MediaWikiChat.js b/MediaWikiChat.js
index 38e4d75..9284fde 100644
--- a/MediaWikiChat.js
+++ b/MediaWikiChat.js
@@ -68,34 +68,10 @@
 
                if ( diff < 30 ) {
                        return mw.message( 'chat-just-now' ).text();
-               } else if ( diff < 90 ) {
+               } else if ( diff < 2 * 60 ) {
                        return mw.message( 'chat-a-minute-ago' ).text();
-               } else if ( diff < 3 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 2 ).text();
-               } else if ( diff < 7 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 5 ).text();
-               } else if ( diff < 12 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 10 ).text();
-               } else if ( diff < 17 * 60 ) {
-                       return mw.message( 'chat-quarter-of-an-hour-ago' 
).text();
-               } else if ( diff < 23 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 20 ).text();
-               } else if ( diff < 27 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 25 ).text();
-               } else if ( diff < 33 * 60 ) {
-                       return mw.message( 'chat-half-an-hour-ago' ).text();
-               } else if ( diff < 37 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 35 ).text();
-               } else if ( diff < 42 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 40 ).text();
-               } else if ( diff < 47 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 45 ).text();
-               } else if ( diff < 52 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 50 ).text();
-               } else if ( diff < 57 * 60 ) {
-                       return mw.message( 'chat-minutes-ago', 55 ).text();
-               } else if ( diff < 90 * 60 ) {
-                       return mw.message( 'chat-an-hour-ago' ).text();
+               } else if ( diff < 60 * 60 ) {
+                       return mw.message( 'chat-minutes-ago', Math.floor( diff 
/ 60 ) ).text();
                } else {
                        if ( dayNow == dayThen ) {
                                return MediaWikiChat.pad( dateThen.getHours(), 
2 ) + ':' + MediaWikiChat.pad( dateThen.getMinutes(), 2 );
@@ -104,8 +80,7 @@
                                        return mw.message( 'chat-yesterday' 
).text().toLowerCase() + ', ' + MediaWikiChat.pad( dateThen.getHours(), 2 ) + 
':' + MediaWikiChat.pad( dateThen.getMinutes(), 2 );
                                } else {
                                        var day;
-                                       var days = [ 'sunday', 'monday', 
'tuesday', 'wednesday',
-                                               'thursday', 'friday', 
'saturday', 'sunday' ];
+                                       var days = [ 'sunday', 'monday', 
'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday' ];
                                        day = mw.message( 
days[dateThen.getDay()] ).text().toLowerCase();
                                        return day + ', ' +
                                                MediaWikiChat.pad( 
dateThen.getHours(), 2 ) + ':' +

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5eb021edcff0d19a67a07a308f2c32e1fc81417
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MediaWikiChat
Gerrit-Branch: master
Gerrit-Owner: UltrasonicNXT <adamr_car...@btinternet.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to