Small optimization
authorMarcel Werk <burntime@woltlab.com>
Sun, 28 Apr 2013 14:50:09 +0000 (16:50 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 28 Apr 2013 14:50:09 +0000 (16:50 +0200)
com.woltlab.wcf/template/headInclude.tpl
wcfsetup/install/files/acp/templates/header.tpl
wcfsetup/install/files/js/WCF.js
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index a895266a7b57aa940d2e31ae814449b3e3fd7d3e..f46e6e724d62f1e67cf2320f41e8d0f6771b18d9 100644 (file)
@@ -51,6 +51,7 @@
                        '__daysShort': [ '{lang}wcf.date.day.sun{/lang}', '{lang}wcf.date.day.mon{/lang}', '{lang}wcf.date.day.tue{/lang}', '{lang}wcf.date.day.wed{/lang}', '{lang}wcf.date.day.thu{/lang}', '{lang}wcf.date.day.fri{/lang}', '{lang}wcf.date.day.sat{/lang}' ],
                        '__months': [ '{lang}wcf.date.month.january{/lang}', '{lang}wcf.date.month.february{/lang}', '{lang}wcf.date.month.march{/lang}', '{lang}wcf.date.month.april{/lang}', '{lang}wcf.date.month.may{/lang}', '{lang}wcf.date.month.june{/lang}', '{lang}wcf.date.month.july{/lang}', '{lang}wcf.date.month.august{/lang}', '{lang}wcf.date.month.september{/lang}', '{lang}wcf.date.month.october{/lang}', '{lang}wcf.date.month.november{/lang}', '{lang}wcf.date.month.december{/lang}' ], 
                        '__monthsShort': [ '{lang}wcf.date.month.jan{/lang}', '{lang}wcf.date.month.feb{/lang}', '{lang}wcf.date.month.mar{/lang}', '{lang}wcf.date.month.apr{/lang}', '{lang}wcf.date.month.may{/lang}', '{lang}wcf.date.month.jun{/lang}', '{lang}wcf.date.month.jul{/lang}', '{lang}wcf.date.month.aug{/lang}', '{lang}wcf.date.month.sep{/lang}', '{lang}wcf.date.month.oct{/lang}', '{lang}wcf.date.month.nov{/lang}', '{lang}wcf.date.month.dec{/lang}' ],
+                       'wcf.date.relative.now': '{lang}wcf.date.relative.now{/lang}',
                        'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}',
                        'wcf.date.relative.hours': '{capture assign=relativeHours}{lang}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}',
                        'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}',
index 448dc7e661f4b1e186ca0bef017c1f1033551309..a7b967b28837aa072d19f3f6775538fdbdcb75d7 100644 (file)
@@ -45,6 +45,7 @@
                                '__daysShort': [ '{lang}wcf.date.day.sun{/lang}', '{lang}wcf.date.day.mon{/lang}', '{lang}wcf.date.day.tue{/lang}', '{lang}wcf.date.day.wed{/lang}', '{lang}wcf.date.day.thu{/lang}', '{lang}wcf.date.day.fri{/lang}', '{lang}wcf.date.day.sat{/lang}' ],
                                '__months': [ '{lang}wcf.date.month.january{/lang}', '{lang}wcf.date.month.february{/lang}', '{lang}wcf.date.month.march{/lang}', '{lang}wcf.date.month.april{/lang}', '{lang}wcf.date.month.may{/lang}', '{lang}wcf.date.month.june{/lang}', '{lang}wcf.date.month.july{/lang}', '{lang}wcf.date.month.august{/lang}', '{lang}wcf.date.month.september{/lang}', '{lang}wcf.date.month.october{/lang}', '{lang}wcf.date.month.november{/lang}', '{lang}wcf.date.month.december{/lang}' ], 
                                '__monthsShort': [ '{lang}wcf.date.month.jan{/lang}', '{lang}wcf.date.month.feb{/lang}', '{lang}wcf.date.month.mar{/lang}', '{lang}wcf.date.month.apr{/lang}', '{lang}wcf.date.month.may{/lang}', '{lang}wcf.date.month.jun{/lang}', '{lang}wcf.date.month.jul{/lang}', '{lang}wcf.date.month.aug{/lang}', '{lang}wcf.date.month.sep{/lang}', '{lang}wcf.date.month.oct{/lang}', '{lang}wcf.date.month.nov{/lang}', '{lang}wcf.date.month.dec{/lang}' ],
+                               'wcf.date.relative.now': '{lang}wcf.date.relative.now{/lang}',
                                'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}',
                                'wcf.date.relative.hours': '{capture assign=relativeHours}{lang}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}',
                                'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}',
index df80ccbc497984bd12388cb67ecc431162f07c5c..ee19c5e77286f5eadcea649b1cdf4454c8d7377e 100755 (executable)
@@ -2402,8 +2402,12 @@ WCF.Date.Time = Class.extend({
                // skip for future dates
                if ($element.data('isFutureDate')) return;
                
+               // timestamp is less than 60 seconds ago
+               if ($timestamp >= this._timestamp || this._timestamp < ($timestamp + 60)) {
+                       $element.text(WCF.Language.get('wcf.date.relative.now'));
+               }
                // timestamp is less than 60 minutes ago (display 1 hour ago rather than 60 minutes ago)
-               if ($timestamp >= this._timestamp || this._timestamp < ($timestamp + 3540)) {
+               else if (this._timestamp < ($timestamp + 3540)) {
                        var $minutes = Math.max(Math.round((this._timestamp - $timestamp) / 60), 1);
                        $element.text(eval(WCF.Language.get('wcf.date.relative.minutes')));
                }
index 97d8e76f3bf37ee21fa4df93790ba7447f125a14..ac270b0201e364d97b42d0255074900c631e3e91 100644 (file)
                <item name="wcf.date.interval.years.future"><![CDATA[In {if $years > 1}{#$years} Jahren{else}einem Jahr{/if}]]></item>
                
                <!-- variables for dynamic javascript datetime -->
+               <item name="wcf.date.relative.now"><![CDATA[Vor einem Moment]]></item>
                <item name="wcf.date.relative.minutes"><![CDATA['Vor ' + (($minutes > 1) ? $minutes + ' Minuten' : 'einer Minute' )]]></item>
                <item name="wcf.date.relative.hours"><![CDATA['Vor ' + (($hours > 1) ? $hours + ' Stunden' : 'einer Stunde' )]]></item>
                <item name="wcf.date.relative.pastDays"><![CDATA[(($days > 1) ? '%day%' : 'Gestern' ) + ', %time%']]></item>
index dd4fd34ede22280c7abd9a8723a4a269f35d928f..98ea65bf185ceaf8bd4dee13e9acda4ed6669ba6 100644 (file)
                <item name="wcf.date.interval.years.future"><![CDATA[In {if $years > 1}{#$years} years{else}A year{/if}]]></item>
                
                <!-- variables for dynamic javascript datetime -->
+               <item name="wcf.date.relative.now"><![CDATA[A moment ago]]></item>
                <item name="wcf.date.relative.minutes"><![CDATA[(($minutes > 1) ? $minutes + ' minutes' : 'A minute') + ' ago']]></item>
                <item name="wcf.date.relative.hours"><![CDATA[(($hours > 1) ? $hours + ' hours' : 'An hour' ) + ' ago']]></item>
                <item name="wcf.date.relative.pastDays"><![CDATA[(($days > 1) ? '%day%' : 'Yesterday' ) + ', %time%']]></item>