From: Marcel Werk Date: Sun, 28 Apr 2013 14:50:09 +0000 (+0200) Subject: Small optimization X-Git-Tag: 2.0.0_Beta_1~286 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=270599e26455d36d2991f6e15bf37f1c218ec060;p=GitHub%2FWoltLab%2FWCF.git Small optimization --- diff --git a/com.woltlab.wcf/template/headInclude.tpl b/com.woltlab.wcf/template/headInclude.tpl index a895266a7b..f46e6e724d 100644 --- a/com.woltlab.wcf/template/headInclude.tpl +++ b/com.woltlab.wcf/template/headInclude.tpl @@ -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}', diff --git a/wcfsetup/install/files/acp/templates/header.tpl b/wcfsetup/install/files/acp/templates/header.tpl index 448dc7e661..a7b967b288 100644 --- a/wcfsetup/install/files/acp/templates/header.tpl +++ b/wcfsetup/install/files/acp/templates/header.tpl @@ -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}', diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index df80ccbc49..ee19c5e772 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -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'))); } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 97d8e76f3b..ac270b0201 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -816,6 +816,7 @@ 1}{#$years} Jahren{else}einem Jahr{/if}]]> + 1) ? $minutes + ' Minuten' : 'einer Minute' )]]> 1) ? $hours + ' Stunden' : 'einer Stunde' )]]> 1) ? '%day%' : 'Gestern' ) + ', %time%']]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index dd4fd34ede..98ea65bf18 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -816,6 +816,7 @@ 1}{#$years} years{else}A year{/if}]]> + 1) ? $minutes + ' minutes' : 'A minute') + ' ago']]> 1) ? $hours + ' hours' : 'An hour' ) + ' ago']]> 1) ? '%day%' : 'Yesterday' ) + ', %time%']]>