diff --git a/_config/comments.yml b/_config/comments.yml index cd0abb2..adb4bd8 100644 --- a/_config/comments.yml +++ b/_config/comments.yml @@ -7,3 +7,58 @@ only: SiteTree: comments: enabled_cms: true + +#TimeAgo locales +TimeAgo: + locales: + - af + - ar + - bg + - bs + - ca + - cs + - cy + - da + - de + - dv + - el + - en + - es + - et + - eu + - fa + - fi + - fr + - gl + - he + - hr + - hu + - hy + - id + - is + - it + - ja + - jv + - ko + - ky + - lt + - lv + - mk + - nl + - no + - pl + - pt + - ro + - rs + - ru + - rw + - si + - sk + - sl + - sv + - th + - tr + - uk + - uz + - vi + - zh diff --git a/code/controllers/CommentingController.php b/code/controllers/CommentingController.php index 8e17809..bab865a 100644 --- a/code/controllers/CommentingController.php +++ b/code/controllers/CommentingController.php @@ -629,7 +629,7 @@ class CommentingController extends Controller } elseif (!$comment->Moderated) { // Display the "awaiting moderation" text $holder = $this->getOption('comments_holder_id'); - $hash = "{$holder}_PostCommentForm_error"; + $hash = "moderated"; } else { // Link to the moderated, non-spam comment $hash = $comment->Permalink(); diff --git a/code/extensions/CommentsExtension.php b/code/extensions/CommentsExtension.php index 88ad47b..9d57ac2 100644 --- a/code/extensions/CommentsExtension.php +++ b/code/extensions/CommentsExtension.php @@ -451,12 +451,20 @@ class CommentsExtension extends DataExtension // Check if enabled $enabled = $this->getCommentsEnabled(); if ($enabled && $this->owner->getCommentsOption('include_js')) { - Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); - Requirements::javascript(THIRDPARTY_DIR . '/jquery-validate/lib/jquery.form.js'); - Requirements::javascript(COMMENTS_THIRDPARTY . '/jquery-validate/jquery.validate.min.js'); - Requirements::add_i18n_javascript('comments/javascript/lang'); + Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js'); + Requirements::javascript(THIRDPARTY_DIR.'/jquery-entwine/dist/jquery.entwine-dist.js'); + Requirements::javascript(THIRDPARTY_DIR.'/jquery-validate/lib/jquery.form.js'); + Requirements::javascript(COMMENTS_THIRDPARTY.'/jquery-validate/jquery.validate.min.js'); Requirements::javascript('comments/javascript/CommentsInterface.js'); + Requirements::javascript('comments/javascript/jquery.timeago.js'); + + // Use current locale or fall back to English + $locale = substr(i18n::default_locale(), 0, 2); + $available = Config::inst()->get('TimeAgo', 'locales'); + if (!in_array($locale, $available)) { + $locale = 'en'; + } + Requirements::javascript('comments/javascript/timeago-locales/jquery.timeago.'.$locale.'.js'); } $controller = CommentingController::create(); diff --git a/css/comments.css b/css/comments.css index dda755c..2added2 100644 --- a/css/comments.css +++ b/css/comments.css @@ -1,3 +1,7 @@ +.typography ul.comments-list { + list-style-type: none; +} + .comments-holder-container { clear: both; } @@ -62,11 +66,17 @@ margin-top: 10px; } +.timeago { + color: #999; + padding-left: 0px; + margin-left: 10px; +} + .comment { clear: both; list-style-type: none; overflow: hidden; - padding: 20px 0 20px 0; + padding: 20px 0 10px; position: relative; } .comment.author-comment:after { @@ -78,45 +88,49 @@ font-size: 1em; font-weight: bold; } -.comment.author-comment > .comment-text { +.comment.author-comment > .comment-text-box { border: 1px solid blue; } -.comment.spam .comment-text { +.comment.spam .comment-text-box { border: 1px dashed orange; } .comment img.gravatar { float: left; - margin: 20px; + margin: 0px 20px 20px 0px; width: 90px; height: 90px; border: none; } -.comment .comment-text { +.comment .comment-text-box { background-color: #fff; border: 1px solid #ddd; box-shadow: none; margin: 0; - padding: 0 20px 0 20px; min-height: 130px; - white-space: pre; - white-space: pre-wrap; - white-space: pre-line; - word-wrap: break-word; + padding: 20px; + /* + white-space: pre; + white-space: pre-wrap; + white-space: pre-line; + word-wrap: break-word; + */ } -.comment .comment-text p:last-child { +.comment .comment-text-box p:last-child { margin-bottom: 0; } -.comment .comment-text.hasGravatar { - padding: 0 20px 0 130px; +.comment .comment-text-box.hasGravatar { min-height: 130px; } +.comment .comment-text-box.hasGravatar .comment-text { + padding-left: 110px; +} .comment .date { font-size: 16px; } .comment .date:before { content: '\0000a0\0000a0\0000a0\0000a0'; } -.comment.unmoderated > .comment-text { +.comment.unmoderated > .comment-text-box { border: 1px solid yellow; } .comment .info { diff --git a/css/comments.css.map b/css/comments.css.map index 87afbf9..0f0ba43 100644 --- a/css/comments.css.map +++ b/css/comments.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "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", +"mappings": "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", "sources": ["../scss/comments.scss"], "names": [], "file": "comments.css" diff --git a/javascript/CommentsInterface.js b/javascript/CommentsInterface.js index 255b517..e420517 100755 --- a/javascript/CommentsInterface.js +++ b/javascript/CommentsInterface.js @@ -211,6 +211,11 @@ return false; });*/ }); + + // Initiate Time Ago + $(document).ready(function() { + $("time.timeago").timeago(); + }); })(jQuery); diff --git a/javascript/jquery.timeago.js b/javascript/jquery.timeago.js new file mode 100644 index 0000000..e63a8b3 --- /dev/null +++ b/javascript/jquery.timeago.js @@ -0,0 +1,225 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 1.5.1 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2015, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && typeof module.exports === 'object') { + factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowPast: true, + allowFuture: false, + localeTitle: false, + cutoff: 0, + autoDispose: true, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + inPast: 'any moment now', + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + wordSeparator: " ", + numbers: [] + } + }, + + inWords: function(distanceMillis) { + if (!this.settings.allowPast && ! this.settings.allowFuture) { + throw 'timeago allowPast and allowFuture settings can not both be set to false.'; + } + + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + if (!this.settings.allowPast && distanceMillis >= 0) { + return this.settings.strings.inPast; + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + // functions that can be called via $(el).timeago('action') + // init is default when no action is given + // functions are called with context of a single element + var functions = { + init: function() { + var refresh_el = $.proxy(refresh, this); + refresh_el(); + var $s = $t.settings; + if ($s.refreshMillis > 0) { + this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis); + } + }, + update: function(timestamp) { + var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp); + $(this).data('timeago', { datetime: date }); + if ($t.settings.localeTitle) $(this).attr("title", date.toLocaleString()); + refresh.apply(this); + }, + updateFromDOM: function() { + $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); + refresh.apply(this); + }, + dispose: function () { + if (this._timeagoInterval) { + window.clearInterval(this._timeagoInterval); + this._timeagoInterval = null; + } + } + }; + + $.fn.timeago = function(action, options) { + var fn = action ? functions[action] : functions.init; + if (!fn) { + throw new Error("Unknown function name '"+ action +"' for timeago"); + } + // each over objects here and call the requested function + this.each(function() { + fn.call(this, options); + }); + return this; + }; + + function refresh() { + var $s = $t.settings; + + //check if it's still visible + if ($s.autoDispose && !$.contains(document.documentElement,this)) { + //stop if it has been removed + $(this).timeago("dispose"); + return this; + } + + var data = prepareData(this); + + if (!isNaN(data.datetime)) { + if ( $s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) { + $(this).text(inWords(data.datetime)); + } + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if ($t.settings.localeTitle) { + element.attr("title", element.data('timeago').datetime.toLocaleString()); + } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})); diff --git a/javascript/timeago-locales/README.md b/javascript/timeago-locales/README.md new file mode 100644 index 0000000..7557112 --- /dev/null +++ b/javascript/timeago-locales/README.md @@ -0,0 +1,27 @@ +# Locale override examples for timeago + +You can represent time statements in most western languages where +a prefix and/or suffix is used. + +The default case is to use suffix only (as in English), which you +do by providing the `suffixAgo` and `suffixFromNow` settings in +the strings hash (earlier versions of timeago used the deprecated +`ago` and `fromNow` options). If present, they are used. + + 2 minutes [suffixAgo] + 2 minutes [suffixFromNow] + +In case you want to use prefix only instead of +suffix (e.g. Greek), you provide the `prefixAgo` and +`prefixFromNow` options in the strings hash and leave `suffixAgo` +and `suffixFromNow` empty or null. + + [prefixAgo] 2 minutes + [prefixFromNow] 2 minutes + +For languages where you want to use a prefix only for future +tense and prefix/suffix for past tense (for example swedish), you +can combine the prefix and suffixes as needed. + + [prefixAgo] 2 minutes [suffixAgo] + [prefixFromNow] 2 minutes diff --git a/javascript/timeago-locales/jquery.timeago.af.js b/javascript/timeago-locales/jquery.timeago.af.js new file mode 100644 index 0000000..ffb23e6 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.af.js @@ -0,0 +1,20 @@ +// Afrikaans +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "gelede", + suffixFromNow: "van nou af", + seconds: "%d sekondes", + minute: "1 minuut", + minutes: "%d minute", + hour: "1 uur", + hours: "%d ure", + day: "1 dag", + days: "%d dae", + month: "1 maand", + months: "%d maande", + year: "1 jaar", + years: "%d jaar", + wordSeparator: " ", + numbers: [] +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.ar.js b/javascript/timeago-locales/jquery.timeago.ar.js new file mode 100644 index 0000000..9e73d74 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ar.js @@ -0,0 +1,96 @@ +(function() { + function numpf(n, a) { + return a[plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5]; + } + +jQuery.timeago.settings.strings = { + prefixAgo: "منذ", + prefixFromNow: "بعد", + suffixAgo: null, + suffixFromNow: null, // null OR "من الآن" + second: function(value) { return numpf(value, [ + 'أقل من ثانية', + 'ثانية واحدة', + 'ثانيتين', + '%d ثوانٍ', + '%d ثانية', + '%d ثانية']); }, + seconds: function(value) { return numpf(value, [ + 'أقل من ثانية', + 'ثانية واحدة', + 'ثانيتين', + '%d ثوانٍ', + '%d ثانية', + '%d ثانية']); }, + minute: function(value) { return numpf(value, [ + 'أقل من دقيقة', + 'دقيقة واحدة', + 'دقيقتين', + '%d دقائق', + '%d دقيقة', + 'دقيقة']); }, + minutes: function(value) { return numpf(value, [ + 'أقل من دقيقة', + 'دقيقة واحدة', + 'دقيقتين', + '%d دقائق', + '%d دقيقة', + 'دقيقة']); }, + hour: function(value) { return numpf(value, [ + 'أقل من ساعة', + 'ساعة واحدة', + 'ساعتين', + '%d ساعات', + '%d ساعة', + '%d ساعة']); }, + hours: function(value) { return numpf(value, [ + 'أقل من ساعة', + 'ساعة واحدة', + 'ساعتين', + '%d ساعات', + '%d ساعة', + '%d ساعة']); }, + day: function(value) { return numpf(value, [ + 'أقل من يوم', + 'يوم واحد', + 'يومين', + '%d أيام', + '%d يومًا', + '%d يوم']); }, + days: function(value) { return numpf(value, [ + 'أقل من يوم', + 'يوم واحد', + 'يومين', + '%d أيام', + '%d يومًا', + '%d يوم']); }, + month: function(value) { return numpf(value, [ + 'أقل من شهر', + 'شهر واحد', + 'شهرين', + '%d أشهر', + '%d شهرًا', + '%d شهر']); }, + months: function(value) { return numpf(value, [ + 'أقل من شهر', + 'شهر واحد', + 'شهرين', + '%d أشهر', + '%d شهرًا', + '%d شهر']); }, + year: function(value) { return numpf(value, [ + 'أقل من عام', + 'عام واحد', + '%d عامين', + '%d أعوام', + '%d عامًا']); + }, + years: function(value) { return numpf(value, [ + 'أقل من عام', + 'عام واحد', + 'عامين', + '%d أعوام', + '%d عامًا', + '%d عام']);} + }; +})(); diff --git a/javascript/timeago-locales/jquery.timeago.bg.js b/javascript/timeago-locales/jquery.timeago.bg.js new file mode 100644 index 0000000..df6b865 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.bg.js @@ -0,0 +1,18 @@ +// Bulgarian +jQuery.timeago.settings.strings = { + prefixAgo: "преди", + prefixFromNow: "след", + suffixAgo: null, + suffixFromNow: null, + seconds: "по-малко от минута", + minute: "една минута", + minutes: "%d минути", + hour: "един час", + hours: "%d часа", + day: "един ден", + days: "%d дни", + month: "един месец", + months: "%d месеца", + year: "една година", + years: "%d години" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.bs.js b/javascript/timeago-locales/jquery.timeago.bs.js new file mode 100644 index 0000000..01530fe --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.bs.js @@ -0,0 +1,49 @@ +// Bosnian +(function() { + var numpf; + + numpf = function(n, f, s, t) { + var n10; + n10 = n % 10; + if (n10 === 1 && (n === 1 || n > 20)) { + return f; + } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) { + return s; + } else { + return t; + } + }; + + jQuery.timeago.settings.strings = { + prefixAgo: "prije", + prefixFromNow: "za", + suffixAgo: null, + suffixFromNow: null, + second: "sekund", + seconds: function(value) { + return numpf(value, "%d sekund", "%d sekunde", "%d sekundi"); + }, + minute: "oko minut", + minutes: function(value) { + return numpf(value, "%d minut", "%d minute", "%d minuta"); + }, + hour: "oko sat", + hours: function(value) { + return numpf(value, "%d sat", "%d sata", "%d sati"); + }, + day: "oko jednog dana", + days: function(value) { + return numpf(value, "%d dan", "%d dana", "%d dana"); + }, + month: "mjesec dana", + months: function(value) { + return numpf(value, "%d mjesec", "%d mjeseca", "%d mjeseci"); + }, + year: "prije godinu dana ", + years: function(value) { + return numpf(value, "%d godinu", "%d godine", "%d godina"); + }, + wordSeparator: " " + }; + +}).call(this); \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.ca.js b/javascript/timeago-locales/jquery.timeago.ca.js new file mode 100644 index 0000000..59014ea --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ca.js @@ -0,0 +1,18 @@ +// Catalan +jQuery.timeago.settings.strings = { + prefixAgo: "fa", + prefixFromNow: "d'aqui a", + suffixAgo: null, + suffixFromNow: null, + seconds: "menys d'1 minut", + minute: "1 minut", + minutes: "uns %d minuts", + hour: "1 hora", + hours: "unes %d hores", + day: "1 dia", + days: "%d dies", + month: "aproximadament un mes", + months: "%d mesos", + year: "aproximadament un any", + years: "%d anys" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.cs.js b/javascript/timeago-locales/jquery.timeago.cs.js new file mode 100644 index 0000000..0ce3469 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.cs.js @@ -0,0 +1,24 @@ +// Czech +(function() { + function f(n, d, a) { + return a[d>=0 ? 0 : a.length==2 || n<5 ? 1 : 2]; + } + + jQuery.timeago.settings.strings = { + prefixAgo: 'před', + prefixFromNow: 'za', + suffixAgo: null, + suffixFromNow: null, + seconds: function(n, d) {return f(n, d, ['méně než minutou', 'méně než minutu']);}, + minute: function(n, d) {return f(n, d, ['minutou', 'minutu']);}, + minutes: function(n, d) {return f(n, d, ['%d minutami', '%d minuty', '%d minut']);}, + hour: function(n, d) {return f(n, d, ['hodinou', 'hodinu']);}, + hours: function(n, d) {return f(n, d, ['%d hodinami', '%d hodiny', '%d hodin']);}, + day: function(n, d) {return f(n, d, ['%d dnem', '%d den']);}, + days: function(n, d) {return f(n, d, ['%d dny', '%d dny', '%d dní']);}, + month: function(n, d) {return f(n, d, ['%d měsícem', '%d měsíc']);}, + months: function(n, d) {return f(n, d, ['%d měsíci', '%d měsíce', '%d měsíců']);}, + year: function(n, d) {return f(n, d, ['%d rokem', '%d rok']);}, + years: function(n, d) {return f(n, d, ['%d lety', '%d roky', '%d let']);} + }; +})(); diff --git a/javascript/timeago-locales/jquery.timeago.cy.js b/javascript/timeago-locales/jquery.timeago.cy.js new file mode 100644 index 0000000..a285ff4 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.cy.js @@ -0,0 +1,20 @@ +// Welsh +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "yn ôl", + suffixFromNow: "o hyn", + seconds: "llai na munud", + minute: "am funud", + minutes: "%d munud", + hour: "tua awr", + hours: "am %d awr", + day: "y dydd", + days: "%d diwrnod", + month: "tua mis", + months: "%d mis", + year: "am y flwyddyn", + years: "%d blynedd", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.da.js b/javascript/timeago-locales/jquery.timeago.da.js new file mode 100644 index 0000000..ff50e87 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.da.js @@ -0,0 +1,18 @@ +// Danish +jQuery.timeago.settings.strings = { + prefixAgo: "for", + prefixFromNow: "om", + suffixAgo: "siden", + suffixFromNow: "", + seconds: "mindre end et minut", + minute: "ca. et minut", + minutes: "%d minutter", + hour: "ca. en time", + hours: "ca. %d timer", + day: "en dag", + days: "%d dage", + month: "ca. en måned", + months: "%d måneder", + year: "ca. et år", + years: "%d år" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.de.js b/javascript/timeago-locales/jquery.timeago.de.js new file mode 100644 index 0000000..f10b06e --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.de.js @@ -0,0 +1,18 @@ +// German +jQuery.timeago.settings.strings = { + prefixAgo: "vor", + prefixFromNow: "in", + suffixAgo: "", + suffixFromNow: "", + seconds: "wenigen Sekunden", + minute: "etwa einer Minute", + minutes: "%d Minuten", + hour: "etwa einer Stunde", + hours: "%d Stunden", + day: "etwa einem Tag", + days: "%d Tagen", + month: "etwa einem Monat", + months: "%d Monaten", + year: "etwa einem Jahr", + years: "%d Jahren" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.dv.js b/javascript/timeago-locales/jquery.timeago.dv.js new file mode 100644 index 0000000..9f2a9da --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.dv.js @@ -0,0 +1,22 @@ +/** + * Dhivehi time in Thaana for timeago.js + **/ +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ކުރިން", + suffixFromNow: "ފަހުން", + seconds: "ސިކުންތުކޮޅެއް", + minute: "މިނިޓެއްވަރު", + minutes: "%d މިނިޓު", + hour: "ގަޑިއެއްވަރު", + hours: "ގާތްގަނޑަކަށް %d ގަޑިއިރު", + day: "އެއް ދުވަސް", + days: "މީގެ %d ދުވަސް", + month: "މަހެއްވަރު", + months: "މީގެ %d މަސް", + year: "އަހަރެއްވަރު", + years: "މީގެ %d އަހަރު", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.el.js b/javascript/timeago-locales/jquery.timeago.el.js new file mode 100644 index 0000000..61aaafe --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.el.js @@ -0,0 +1,18 @@ +// Greek +jQuery.timeago.settings.strings = { + prefixAgo: "πριν", + prefixFromNow: "σε", + suffixAgo: "", + suffixFromNow: "", + seconds: "λιγότερο από ένα λεπτό", + minute: "περίπου ένα λεπτό", + minutes: "%d λεπτά", + hour: "περίπου μία ώρα", + hours: "περίπου %d ώρες", + day: "μία μέρα", + days: "%d μέρες", + month: "περίπου ένα μήνα", + months: "%d μήνες", + year: "περίπου ένα χρόνο", + years: "%d χρόνια" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.en-short.js b/javascript/timeago-locales/jquery.timeago.en-short.js new file mode 100644 index 0000000..4cab7ff --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.en-short.js @@ -0,0 +1,20 @@ +// English shortened +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "", + suffixFromNow: "", + seconds: "1m", + minute: "1m", + minutes: "%dm", + hour: "1h", + hours: "%dh", + day: "1d", + days: "%dd", + month: "1mo", + months: "%dmo", + year: "1yr", + years: "%dyr", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.en.js b/javascript/timeago-locales/jquery.timeago.en.js new file mode 100644 index 0000000..3d6652c --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.en.js @@ -0,0 +1,20 @@ +// English (Template) +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.es-short.js b/javascript/timeago-locales/jquery.timeago.es-short.js new file mode 100644 index 0000000..65d85c7 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.es-short.js @@ -0,0 +1,20 @@ +// Spanish shortened +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "", + suffixFromNow: "", + seconds: "1m", + minute: "1m", + minutes: "%dm", + hour: "1h", + hours: "%dh", + day: "1d", + days: "%dd", + month: "1me", + months: "%dme", + year: "1a", + years: "%da", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.es.js b/javascript/timeago-locales/jquery.timeago.es.js new file mode 100644 index 0000000..00c6d0a --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.es.js @@ -0,0 +1,18 @@ +// Spanish +jQuery.timeago.settings.strings = { + prefixAgo: "hace", + prefixFromNow: "dentro de", + suffixAgo: "", + suffixFromNow: "", + seconds: "menos de un minuto", + minute: "un minuto", + minutes: "unos %d minutos", + hour: "una hora", + hours: "%d horas", + day: "un día", + days: "%d días", + month: "un mes", + months: "%d meses", + year: "un año", + years: "%d años" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.et.js b/javascript/timeago-locales/jquery.timeago.et.js new file mode 100644 index 0000000..ca19648 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.et.js @@ -0,0 +1,18 @@ +// Estonian +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "tagasi", + suffixFromNow: "pärast", + seconds: function(n, d) { return d < 0 ? "vähem kui minuti aja" : "vähem kui minut aega"; }, + minute: function(n, d) { return d < 0 ? "umbes minuti aja" : "umbes minut aega"; }, + minutes: function(n, d) { return d < 0 ? "%d minuti" : "%d minutit"; }, + hour: function(n, d) { return d < 0 ? "umbes tunni aja" : "umbes tund aega"; }, + hours: function(n, d) { return d < 0 ? "%d tunni" : "%d tundi"; }, + day: function(n, d) { return d < 0 ? "umbes päeva" : "umbes päev"; }, + days: function(n, d) { return d < 0 ? "%d päeva" : "%d päeva"; }, + month: function(n, d) { return d < 0 ? "umbes kuu aja" : "umbes kuu aega"; }, + months: function(n, d) { return d < 0 ? "%d kuu" : "%d kuud"; }, + year: function(n, d) { return d < 0 ? "umbes aasta aja" : "umbes aasta aega"; }, + years: function(n, d) { return d < 0 ? "%d aasta" : "%d aastat"; } +}; diff --git a/javascript/timeago-locales/jquery.timeago.eu.js b/javascript/timeago-locales/jquery.timeago.eu.js new file mode 100644 index 0000000..4b2c91a --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.eu.js @@ -0,0 +1,17 @@ +jQuery.timeago.settings.strings = { + prefixAgo: "duela", + prefixFromNow: "hemendik", + suffixAgo: "", + suffixFromNow: "barru", + seconds: "minutu bat bainu gutxiago", + minute: "minutu bat", + minutes: "%d minutu inguru", + hour: "ordu bat", + hours: "%d ordu", + day: "egun bat", + days: "%d egun", + month: "hilabete bat", + months: "%d hilabete", + year: "urte bat", + years: "%d urte" +}; diff --git a/javascript/timeago-locales/jquery.timeago.fa-short.js b/javascript/timeago-locales/jquery.timeago.fa-short.js new file mode 100644 index 0000000..66d314c --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.fa-short.js @@ -0,0 +1,20 @@ +// persion shortened +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "", + suffixFromNow: "", + seconds: "1دقیقه", + minute: "1دقیقه", + minutes: "%dدقیقه", + hour: "1ساعت", + hours: "%dساعت", + day: "1روز", + days: "%dروز", + month: "1ماه", + months: "%dماه", + year: "1سال", + years: "%dسال", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.fa.js b/javascript/timeago-locales/jquery.timeago.fa.js new file mode 100644 index 0000000..0a70819 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.fa.js @@ -0,0 +1,22 @@ + +// Persian +// Use DIR attribute for RTL text in Persian Language for ABBR tag . +// By MB.seifollahi@gmail.com +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "پیش", + suffixFromNow: "از حال", + seconds: "کمتر از یک دقیقه", + minute: "حدود یک دقیقه", + minutes: "%d دقیقه", + hour: "حدود یک ساعت", + hours: "حدود %d ساعت", + day: "یک روز", + days: "%d روز", + month: "حدود یک ماه", + months: "%d ماه", + year: "حدود یک سال", + years: "%d سال", + wordSeparator: " " +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.fi.js b/javascript/timeago-locales/jquery.timeago.fi.js new file mode 100644 index 0000000..06b12ee --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.fi.js @@ -0,0 +1,28 @@ +// Finnish +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "sitten", + suffixFromNow: "tulevaisuudessa", + seconds: "alle minuutti", + minute: "minuutti", + minutes: "%d minuuttia", + hour: "tunti", + hours: "%d tuntia", + day: "päivä", + days: "%d päivää", + month: "kuukausi", + months: "%d kuukautta", + year: "vuosi", + years: "%d vuotta" +}; + +// The above is not a great localization because one would usually +// write "2 days ago" in Finnish as "2 päivää sitten", however +// one would write "2 days into the future" as "2:n päivän päästä" +// which cannot be achieved with localization support this simple. +// This is because Finnish has word suffixes (attached directly +// to the end of the word). The word "day" is "päivä" in Finnish. +// As workaround, the above localizations will say +// "2 päivää tulevaisuudessa" which is understandable but +// not as fluent. \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.fr-short.js b/javascript/timeago-locales/jquery.timeago.fr-short.js new file mode 100644 index 0000000..dbfe3bb --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.fr-short.js @@ -0,0 +1,16 @@ +// French shortened +jQuery.timeago.settings.strings = { + prefixAgo: "il y a", + prefixFromNow: "d'ici", + seconds: "moins d'une minute", + minute: "une minute", + minutes: "%d minutes", + hour: "une heure", + hours: "%d heures", + day: "un jour", + days: "%d jours", + month: "un mois", + months: "%d mois", + year: "un an", + years: "%d ans" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.fr.js b/javascript/timeago-locales/jquery.timeago.fr.js new file mode 100644 index 0000000..5028342 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.fr.js @@ -0,0 +1,17 @@ +// French +jQuery.timeago.settings.strings = { + // environ ~= about, it's optional + prefixAgo: "il y a", + prefixFromNow: "d'ici", + seconds: "moins d'une minute", + minute: "environ une minute", + minutes: "environ %d minutes", + hour: "environ une heure", + hours: "environ %d heures", + day: "environ un jour", + days: "environ %d jours", + month: "environ un mois", + months: "environ %d mois", + year: "un an", + years: "%d ans" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.gl.js b/javascript/timeago-locales/jquery.timeago.gl.js new file mode 100644 index 0000000..14bc56d --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.gl.js @@ -0,0 +1,18 @@ +// Galician +jQuery.timeago.settings.strings = { + prefixAgo: "hai", + prefixFromNow: "dentro de", + suffixAgo: "", + suffixFromNow: "", + seconds: "menos dun minuto", + minute: "un minuto", + minutes: "uns %d minutos", + hour: "unha hora", + hours: "%d horas", + day: "un día", + days: "%d días", + month: "un mes", + months: "%d meses", + year: "un ano", + years: "%d anos" +}; diff --git a/javascript/timeago-locales/jquery.timeago.he.js b/javascript/timeago-locales/jquery.timeago.he.js new file mode 100644 index 0000000..b9d89e1 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.he.js @@ -0,0 +1,16 @@ +// Hebrew +jQuery.timeago.settings.strings = { + prefixAgo: "לפני", + prefixFromNow: "עוד", + seconds: "פחות מדקה", + minute: "דקה", + minutes: "%d דקות", + hour: "שעה", + hours: function(number){return (number==2) ? "שעתיים" : "%d שעות";}, + day: "יום", + days: function(number){return (number==2) ? "יומיים" : "%d ימים";}, + month: "חודש", + months: function(number){return (number==2) ? "חודשיים" : "%d חודשים";}, + year: "שנה", + years: function(number){return (number==2) ? "שנתיים" : "%d שנים";} +}; diff --git a/javascript/timeago-locales/jquery.timeago.hr.js b/javascript/timeago-locales/jquery.timeago.hr.js new file mode 100644 index 0000000..a85bd80 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.hr.js @@ -0,0 +1,49 @@ +// Croatian +(function () { + var numpf; + + numpf = function (n, f, s, t) { + var n10; + n10 = n % 10; + if (n10 === 1 && (n === 1 || n > 20)) { + return f; + } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) { + return s; + } else { + return t; + } + }; + + jQuery.timeago.settings.strings = { + prefixAgo: "prije", + prefixFromNow: "za", + suffixAgo: null, + suffixFromNow: null, + second: "sekundu", + seconds: function (value) { + return numpf(value, "%d sekundu", "%d sekunde", "%d sekundi"); + }, + minute: "oko minutu", + minutes: function (value) { + return numpf(value, "%d minutu", "%d minute", "%d minuta"); + }, + hour: "oko jedan sat", + hours: function (value) { + return numpf(value, "%d sat", "%d sata", "%d sati"); + }, + day: "jedan dan", + days: function (value) { + return numpf(value, "%d dan", "%d dana", "%d dana"); + }, + month: "mjesec dana", + months: function (value) { + return numpf(value, "%d mjesec", "%d mjeseca", "%d mjeseci"); + }, + year: "prije godinu dana", + years: function (value) { + return numpf(value, "%d godinu", "%d godine", "%d godina"); + }, + wordSeparator: " " + }; + +}).call(this); \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.hu.js b/javascript/timeago-locales/jquery.timeago.hu.js new file mode 100644 index 0000000..3079c22 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.hu.js @@ -0,0 +1,18 @@ +// Hungarian +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: null, + suffixFromNow: null, + seconds: "kevesebb mint egy perce", + minute: "körülbelül egy perce", + minutes: "%d perce", + hour: "körülbelül egy órája", + hours: "körülbelül %d órája", + day: "körülbelül egy napja", + days: "%d napja", + month: "körülbelül egy hónapja", + months: "%d hónapja", + year: "körülbelül egy éve", + years: "%d éve" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.hy.js b/javascript/timeago-locales/jquery.timeago.hy.js new file mode 100644 index 0000000..cd6e195 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.hy.js @@ -0,0 +1,18 @@ +// Armenian +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "առաջ", + suffixFromNow: "հետո", + seconds: "վայրկյաններ", + minute: "մեկ րոպե", + minutes: "%d րոպե", + hour: "մեկ ժամ", + hours: "%d ժամ", + day: "մեկ օր", + days: "%d օր", + month: "մեկ ամիս", + months: "%d ամիս", + year: "մեկ տարի", + years: "%d տարի" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.id.js b/javascript/timeago-locales/jquery.timeago.id.js new file mode 100644 index 0000000..296d84e --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.id.js @@ -0,0 +1,18 @@ +// Indonesian +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "yang lalu", + suffixFromNow: "dari sekarang", + seconds: "kurang dari semenit", + minute: "sekitar satu menit", + minutes: "%d menit", + hour: "sekitar sejam", + hours: "sekitar %d jam", + day: "sehari", + days: "%d hari", + month: "sekitar sebulan", + months: "%d bulan", + year: "sekitar setahun", + years: "%d tahun" +}; diff --git a/javascript/timeago-locales/jquery.timeago.is.js b/javascript/timeago-locales/jquery.timeago.is.js new file mode 100644 index 0000000..d8074cf --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.is.js @@ -0,0 +1,19 @@ +jQuery.timeago.settings.strings = { + prefixAgo: "fyrir", + prefixFromNow: "eftir", + suffixAgo: "síðan", + suffixFromNow: null, + seconds: "minna en mínútu", + minute: "mínútu", + minutes: "%d mínútum", + hour: "klukkutíma", + hours: "um %d klukkutímum", + day: "degi", + days: "%d dögum", + month: "mánuði", + months: "%d mánuðum", + year: "ári", + years: "%d árum", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.it-short.js b/javascript/timeago-locales/jquery.timeago.it-short.js new file mode 100644 index 0000000..64328ba --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.it-short.js @@ -0,0 +1,20 @@ +// Italian shortened +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "", + suffixFromNow: "", + seconds: "1m", + minute: "1m", + minutes: "%dm", + hour: "1h", + hours: "%dh", + day: "1g", + days: "%dg", + month: "1me", + months: "%dme", + year: "1a", + years: "%da", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.it.js b/javascript/timeago-locales/jquery.timeago.it.js new file mode 100644 index 0000000..6308dd3 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.it.js @@ -0,0 +1,16 @@ +// Italian +jQuery.timeago.settings.strings = { + suffixAgo: "fa", + suffixFromNow: "da ora", + seconds: "meno di un minuto", + minute: "circa un minuto", + minutes: "%d minuti", + hour: "circa un'ora", + hours: "circa %d ore", + day: "un giorno", + days: "%d giorni", + month: "circa un mese", + months: "%d mesi", + year: "circa un anno", + years: "%d anni" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.ja.js b/javascript/timeago-locales/jquery.timeago.ja.js new file mode 100644 index 0000000..95a7cd2 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ja.js @@ -0,0 +1,19 @@ +// Japanese +jQuery.timeago.settings.strings = { + prefixAgo: "", + prefixFromNow: "今から", + suffixAgo: "前", + suffixFromNow: "後", + seconds: "1 分未満", + minute: "約 1 分", + minutes: "%d 分", + hour: "約 1 時間", + hours: "約 %d 時間", + day: "約 1 日", + days: "約 %d 日", + month: "約 1 ヶ月", + months: "約 %d ヶ月", + year: "約 1 年", + years: "約 %d 年", + wordSeparator: "" +}; diff --git a/javascript/timeago-locales/jquery.timeago.jv.js b/javascript/timeago-locales/jquery.timeago.jv.js new file mode 100644 index 0000000..98f43ef --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.jv.js @@ -0,0 +1,18 @@ +// Javanesse (Boso Jowo) +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "kepungkur", + suffixFromNow: "seko saiki", + seconds: "kurang seko sakmenit", + minute: "kurang luwih sakmenit", + minutes: "%d menit", + hour: "kurang luwih sakjam", + hours: "kurang luwih %d jam", + day: "sedina", + days: "%d dina", + month: "kurang luwih sewulan", + months: "%d wulan", + year: "kurang luwih setahun", + years: "%d tahun" +}; diff --git a/javascript/timeago-locales/jquery.timeago.ko.js b/javascript/timeago-locales/jquery.timeago.ko.js new file mode 100644 index 0000000..95f4f94 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ko.js @@ -0,0 +1,20 @@ +// Korean +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "전", + suffixFromNow: "후", + seconds: "1분", + minute: "약 1분", + minutes: "%d분", + hour: "약 1시간", + hours: "약 %d시간", + day: "하루", + days: "%d일", + month: "약 1개월", + months: "%d개월", + year: "약 1년", + years: "%d년", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.ky.js b/javascript/timeago-locales/jquery.timeago.ky.js new file mode 100644 index 0000000..8663fe0 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ky.js @@ -0,0 +1,34 @@ +// Russian +(function() { + function numpf(n, f, s, t) { + // f - 1, 21, 31, ... + // s - 2-4, 22-24, 32-34 ... + // t - 5-20, 25-30, ... + var n10 = n % 10; + if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) { + return f; + } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { + return s; + } else { + return t; + } + } + + jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "через", + suffixAgo: "мурун", + suffixFromNow: null, + seconds: "1 минуттан аз", + minute: "минута", + minutes: function(value) { return numpf(value, "%d минута", "%d минута", "%d минут"); }, + hour: "саат", + hours: function(value) { return numpf(value, "%d саат", "%d саат", "%d саат"); }, + day: "күн", + days: function(value) { return numpf(value, "%d күн", "%d күн", "%d күн"); }, + month: "ай", + months: function(value) { return numpf(value, "%d ай", "%d ай", "%d ай"); }, + year: "жыл", + years: function(value) { return numpf(value, "%d жыл", "%d жыл", "%d жыл"); } + }; +})(); \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.lt.js b/javascript/timeago-locales/jquery.timeago.lt.js new file mode 100644 index 0000000..0814555 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.lt.js @@ -0,0 +1,20 @@ +//Lithuanian +jQuery.timeago.settings.strings = { + prefixAgo: "prieš", + prefixFromNow: null, + suffixAgo: null, + suffixFromNow: "nuo dabar", + seconds: "%d sek.", + minute: "min.", + minutes: "%d min.", + hour: "val.", + hours: "%d val.", + day: "1 d.", + days: "%d d.", + month: "mėn.", + months: "%d mėn.", + year: "metus", + years: "%d metus", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.lv.js b/javascript/timeago-locales/jquery.timeago.lv.js new file mode 100644 index 0000000..eb02391 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.lv.js @@ -0,0 +1,20 @@ +//Latvian +jQuery.timeago.settings.strings = { + prefixAgo: "pirms", + prefixFromNow: null, + suffixAgo: null, + suffixFromNow: "no šī brīža", + seconds: "%d sek.", + minute: "min.", + minutes: "%d min.", + hour: "st.", + hours: "%d st.", + day: "1 d.", + days: "%d d.", + month: "mēnesis.", + months: "%d mēnesis.", + year: "gads", + years: "%d gads", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.mk.js b/javascript/timeago-locales/jquery.timeago.mk.js new file mode 100644 index 0000000..8d60a30 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.mk.js @@ -0,0 +1,20 @@ +// Macedonian +(function() { + jQuery.timeago.settings.strings={ + prefixAgo: "пред", + prefixFromNow: "за", + suffixAgo: null, + suffixFromNow: null, + seconds: "%d секунди", + minute: "%d минута", + minutes: "%d минути", + hour: "%d час", + hours: "%d часа", + day: "%d ден", + days: "%d денови" , + month: "%d месец", + months: "%d месеци", + year: "%d година", + years: "%d години" + }; +})(); diff --git a/javascript/timeago-locales/jquery.timeago.nl.js b/javascript/timeago-locales/jquery.timeago.nl.js new file mode 100644 index 0000000..74d3dc8 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.nl.js @@ -0,0 +1,20 @@ +// Dutch +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "over", + suffixAgo: "geleden", + suffixFromNow: null, + seconds: "minder dan een minuut", + minute: "ongeveer een minuut", + minutes: "%d minuten", + hour: "ongeveer een uur", + hours: "ongeveer %d uur", + day: "een dag", + days: "%d dagen", + month: "ongeveer een maand", + months: "%d maanden", + year: "ongeveer een jaar", + years: "%d jaar", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.no.js b/javascript/timeago-locales/jquery.timeago.no.js new file mode 100644 index 0000000..65d1b0d --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.no.js @@ -0,0 +1,18 @@ +// Norwegian +jQuery.timeago.settings.strings = { + prefixAgo: "for", + prefixFromNow: "om", + suffixAgo: "siden", + suffixFromNow: "", + seconds: "mindre enn et minutt", + minute: "ca. et minutt", + minutes: "%d minutter", + hour: "ca. en time", + hours: "ca. %d timer", + day: "en dag", + days: "%d dager", + month: "ca. en måned", + months: "%d måneder", + year: "ca. et år", + years: "%d år" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.pl.js b/javascript/timeago-locales/jquery.timeago.pl.js new file mode 100644 index 0000000..21d26fc --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.pl.js @@ -0,0 +1,31 @@ +// Polish +(function() { + function numpf(n, s, t) { + // s - 2-4, 22-24, 32-34 ... + // t - 5-21, 25-31, ... + var n10 = n % 10; + if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { + return s; + } else { + return t; + } + } + + jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "za", + suffixAgo: "temu", + suffixFromNow: null, + seconds: "mniej niż minutę", + minute: "minutę", + minutes: function(value) { return numpf(value, "%d minuty", "%d minut"); }, + hour: "godzinę", + hours: function(value) { return numpf(value, "%d godziny", "%d godzin"); }, + day: "dzień", + days: "%d dni", + month: "miesiąc", + months: function(value) { return numpf(value, "%d miesiące", "%d miesięcy"); }, + year: "rok", + years: function(value) { return numpf(value, "%d lata", "%d lat"); } + }; +})(); \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.pt-br-short.js b/javascript/timeago-locales/jquery.timeago.pt-br-short.js new file mode 100644 index 0000000..8f63db4 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.pt-br-short.js @@ -0,0 +1,20 @@ +// Portuguese Brasil shortened +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "", + suffixFromNow: "", + seconds: "1m", + minute: "1m", + minutes: "%dm", + hour: "1h", + hours: "%dh", + day: "1d", + days: "%dd", + month: "1M", + months: "%dM", + year: "1a", + years: "%da", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.pt-br.js b/javascript/timeago-locales/jquery.timeago.pt-br.js new file mode 100644 index 0000000..c72ea38 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.pt-br.js @@ -0,0 +1,18 @@ +// Brazilian Portuguese +jQuery.timeago.settings.strings = { + prefixAgo: "há", + prefixFromNow: "em", + suffixAgo: null, + suffixFromNow: null, + seconds: "alguns segundos", + minute: "um minuto", + minutes: "%d minutos", + hour: "uma hora", + hours: "%d horas", + day: "um dia", + days: "%d dias", + month: "um mês", + months: "%d meses", + year: "um ano", + years: "%d anos" +}; diff --git a/javascript/timeago-locales/jquery.timeago.pt-short.js b/javascript/timeago-locales/jquery.timeago.pt-short.js new file mode 100644 index 0000000..8f6ef76 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.pt-short.js @@ -0,0 +1,20 @@ +// Portuguese shortened +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "", + suffixFromNow: "", + seconds: "1m", + minute: "1m", + minutes: "%dm", + hour: "1h", + hours: "%dh", + day: "1d", + days: "%dd", + month: "1M", + months: "%dM", + year: "1a", + years: "%da", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.pt.js b/javascript/timeago-locales/jquery.timeago.pt.js new file mode 100644 index 0000000..416333c --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.pt.js @@ -0,0 +1,16 @@ +// Portuguese +jQuery.timeago.settings.strings = { + suffixAgo: "atrás", + suffixFromNow: "a partir de agora", + seconds: "menos de um minuto", + minute: "cerca de um minuto", + minutes: "%d minutos", + hour: "cerca de uma hora", + hours: "cerca de %d horas", + day: "um dia", + days: "%d dias", + month: "cerca de um mês", + months: "%d meses", + year: "cerca de um ano", + years: "%d anos" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.ro.js b/javascript/timeago-locales/jquery.timeago.ro.js new file mode 100644 index 0000000..2cee429 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ro.js @@ -0,0 +1,18 @@ +// Romanian +jQuery.timeago.settings.strings = { + prefixAgo: "acum", + prefixFromNow: "in timp de", + suffixAgo: "", + suffixFromNow: "", + seconds: "mai putin de un minut", + minute: "un minut", + minutes: "%d minute", + hour: "o ora", + hours: "%d ore", + day: "o zi", + days: "%d zile", + month: "o luna", + months: "%d luni", + year: "un an", + years: "%d ani" +}; diff --git a/javascript/timeago-locales/jquery.timeago.rs.js b/javascript/timeago-locales/jquery.timeago.rs.js new file mode 100644 index 0000000..0809c91 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.rs.js @@ -0,0 +1,49 @@ +// Serbian +(function () { + var numpf; + + numpf = function (n, f, s, t) { + var n10; + n10 = n % 10; + if (n10 === 1 && (n === 1 || n > 20)) { + return f; + } else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) { + return s; + } else { + return t; + } + }; + + jQuery.timeago.settings.strings = { + prefixAgo: "pre", + prefixFromNow: "za", + suffixAgo: null, + suffixFromNow: null, + second: "sekund", + seconds: function (value) { + return numpf(value, "%d sekund", "%d sekunde", "%d sekundi"); + }, + minute: "oko minut", + minutes: function (value) { + return numpf(value, "%d minut", "%d minuta", "%d minuta"); + }, + hour: "oko jedan sat", + hours: function (value) { + return numpf(value, "%d sat", "%d sata", "%d sati"); + }, + day: "jedan dan", + days: function (value) { + return numpf(value, "%d dan", "%d dana", "%d dana"); + }, + month: "mesec dana", + months: function (value) { + return numpf(value, "%d mesec", "%d meseca", "%d meseci"); + }, + year: "godinu dana", + years: function (value) { + return numpf(value, "%d godinu", "%d godine", "%d godina"); + }, + wordSeparator: " " + }; + +}).call(this); diff --git a/javascript/timeago-locales/jquery.timeago.ru.js b/javascript/timeago-locales/jquery.timeago.ru.js new file mode 100644 index 0000000..4cdc01b --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.ru.js @@ -0,0 +1,34 @@ +// Russian +(function() { + function numpf(n, f, s, t) { + // f - 1, 21, 31, ... + // s - 2-4, 22-24, 32-34 ... + // t - 5-20, 25-30, ... + var n10 = n % 10; + if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) { + return f; + } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { + return s; + } else { + return t; + } + } + + jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "через", + suffixAgo: "назад", + suffixFromNow: null, + seconds: "меньше минуты", + minute: "минуту", + minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); }, + hour: "час", + hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); }, + day: "день", + days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); }, + month: "месяц", + months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); }, + year: "год", + years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); } + }; +})(); \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.rw.js b/javascript/timeago-locales/jquery.timeago.rw.js new file mode 100644 index 0000000..1853767 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.rw.js @@ -0,0 +1,20 @@ +// Kinyarwanda +jQuery.timeago.settings.strings = { + prefixAgo: "hashize", + prefixFromNow: "mu", + suffixAgo: null, + suffixFromNow: null, + seconds: "amasegonda macye", + minute: "umunota", + minutes: "iminota %d", + hour: "isaha", + hours: "amasaha %d", + day: "umunsi", + days: "iminsi %d", + month: "ukwezi", + months: "amezi %d", + year: "umwaka", + years: "imyaka %d", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.si.js b/javascript/timeago-locales/jquery.timeago.si.js new file mode 100644 index 0000000..468bcd7 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.si.js @@ -0,0 +1,18 @@ +// Sinhalese (SI) +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "පෙර", + suffixFromNow: "පසුව", + seconds: "තත්පර කිහිපයකට", + minute: "මිනිත්තුවකට පමණ", + minutes: "මිනිත්තු %d කට", + hour: "පැයක් පමණ ", + hours: "පැය %d කට පමණ", + day: "දවසක ට", + days: "දවස් %d කට ", + month: "මාසයක් පමණ", + months: "මාස %d කට", + year: "වසරක් පමණ", + years: "වසරක් %d කට පමණ" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.sk.js b/javascript/timeago-locales/jquery.timeago.sk.js new file mode 100644 index 0000000..24493a2 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.sk.js @@ -0,0 +1,18 @@ +// Slovak +jQuery.timeago.settings.strings = { + prefixAgo: "pred", + prefixFromNow: null, + suffixAgo: null, + suffixFromNow: null, + seconds: "menej než minútou", + minute: "minútou", + minutes: "%d minútami", + hour: "hodinou", + hours: "%d hodinami", + day: "1 dňom", + days: "%d dňami", + month: "1 mesiacom", + months: "%d mesiacmi", + year: "1 rokom", + years: "%d rokmi" +}; diff --git a/javascript/timeago-locales/jquery.timeago.sl.js b/javascript/timeago-locales/jquery.timeago.sl.js new file mode 100644 index 0000000..57d4f60 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.sl.js @@ -0,0 +1,40 @@ +// Slovenian with support for dual +(function () { + var numpf; + numpf = function (n, a) { + return a[n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0]; + }; + + jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "čez", + suffixAgo: "nazaj", + suffixFromNow: null, + second: "sekundo", + seconds: function (value) { + return numpf(value, ["%d sekund", "%d sekundo", "%d sekundi", "%d sekunde"]); + }, + minute: "minuto", + minutes: function (value) { + return numpf(value, ["%d minut", "%d minuto", "%d minuti", "%d minute"]); + }, + hour: "eno uro", + hours: function (value) { + return numpf(value, ["%d ur", "%d uro", "%d uri", "%d ure"]); + }, + day: "en dan", + days: function (value) { + return numpf(value, ["%d dni", "%d dan", "%d dneva", "%d dni"]); + }, + month: "en mesec", + months: function (value) { + return numpf(value, ["%d mescov", "%d mesec", "%d mesca", "%d mesce"]); + }, + year: "eno leto", + years: function (value) { + return numpf(value, ["%d let", "%d leto", "%d leti", "%d leta"]); + }, + wordSeparator: " " + }; + +}).call(this); diff --git a/javascript/timeago-locales/jquery.timeago.sv.js b/javascript/timeago-locales/jquery.timeago.sv.js new file mode 100644 index 0000000..b5c3947 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.sv.js @@ -0,0 +1,18 @@ +// Swedish +jQuery.timeago.settings.strings = { + prefixAgo: "för", + prefixFromNow: "om", + suffixAgo: "sedan", + suffixFromNow: "", + seconds: "mindre än en minut", + minute: "ungefär en minut", + minutes: "%d minuter", + hour: "ungefär en timme", + hours: "ungefär %d timmar", + day: "en dag", + days: "%d dagar", + month: "ungefär en månad", + months: "%d månader", + year: "ungefär ett år", + years: "%d år" +}; \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.th.js b/javascript/timeago-locales/jquery.timeago.th.js new file mode 100644 index 0000000..894bf7f --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.th.js @@ -0,0 +1,20 @@ +// Thai +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ที่แล้ว", + suffixFromNow: "จากตอนนี้", + seconds: "น้อยกว่าหนึ่งนาที", + minute: "ประมาณหนึ่งนาที", + minutes: "%d นาที", + hour: "ประมาณหนึ่งชั่วโมง", + hours: "ประมาณ %d ชั่วโมง", + day: "หนึ่งวัน", + days: "%d วัน", + month: "ประมาณหนึ่งเดือน", + months: "%d เดือน", + year: "ประมาณหนึ่งปี", + years: "%d ปี", + wordSeparator: "", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.tr.js b/javascript/timeago-locales/jquery.timeago.tr.js new file mode 100644 index 0000000..160190d --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.tr.js @@ -0,0 +1,16 @@ +// Turkish +jQuery.timeago.settings.strings = { + suffixAgo: 'önce', + suffixFromNow: null, + seconds: '1 dakikadan', + minute: '1 dakika', + minutes: '%d dakika', + hour: '1 saat', + hours: '%d saat', + day: '1 gün', + days: '%d gün', + month: '1 ay', + months: '%d ay', + year: '1 yıl', + years: '%d yıl' +}; diff --git a/javascript/timeago-locales/jquery.timeago.uk.js b/javascript/timeago-locales/jquery.timeago.uk.js new file mode 100644 index 0000000..4382549 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.uk.js @@ -0,0 +1,34 @@ +// Ukrainian +(function() { + function numpf(n, f, s, t) { + // f - 1, 21, 31, ... + // s - 2-4, 22-24, 32-34 ... + // t - 5-20, 25-30, ... + var n10 = n % 10; + if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) { + return f; + } else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) { + return s; + } else { + return t; + } + } + + jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "через", + suffixAgo: "тому", + suffixFromNow: null, + seconds: "менше хвилини", + minute: "хвилина", + minutes: function(value) { return numpf(value, "%d хвилина", "%d хвилини", "%d хвилин"); }, + hour: "година", + hours: function(value) { return numpf(value, "%d година", "%d години", "%d годин"); }, + day: "день", + days: function(value) { return numpf(value, "%d день", "%d дні", "%d днів"); }, + month: "місяць", + months: function(value) { return numpf(value, "%d місяць", "%d місяці", "%d місяців"); }, + year: "рік", + years: function(value) { return numpf(value, "%d рік", "%d роки", "%d років"); } + }; +})(); \ No newline at end of file diff --git a/javascript/timeago-locales/jquery.timeago.uz.js b/javascript/timeago-locales/jquery.timeago.uz.js new file mode 100755 index 0000000..a226b29 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.uz.js @@ -0,0 +1,19 @@ +//Uzbek +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "keyin", + suffixAgo: "avval", + suffixFromNow: null, + seconds: "bir necha soniya", + minute: "1 daqiqa", + minutes: function(value) { return "%d daqiqa"; }, + hour: "1 soat", + hours: function(value) { return "%d soat"; }, + day: "1 kun", + days: function(value) { return "%d kun"; }, + month: "1 oy", + months: function(value) { return "%d oy"; }, + year: "1 yil", + years: function(value) { return "%d yil"; }, + wordSeparator: " " +}; diff --git a/javascript/timeago-locales/jquery.timeago.vi.js b/javascript/timeago-locales/jquery.timeago.vi.js new file mode 100644 index 0000000..84d6618 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.vi.js @@ -0,0 +1,20 @@ +// Vietnamese +jQuery.timeago.settings.strings = { + prefixAgo: 'cách đây', + prefixFromNow: null, + suffixAgo: null, + suffixFromNow: "trước", + seconds: "chưa đến một phút", + minute: "khoảng một phút", + minutes: "%d phút", + hour: "khoảng một tiếng", + hours: "khoảng %d tiếng", + day: "một ngày", + days: "%d ngày", + month: "khoảng một tháng", + months: "%d tháng", + year: "khoảng một năm", + years: "%d năm", + wordSeparator: " ", + numbers: [] +}; diff --git a/javascript/timeago-locales/jquery.timeago.zh-CN.js b/javascript/timeago-locales/jquery.timeago.zh-CN.js new file mode 100644 index 0000000..f7b9797 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.zh-CN.js @@ -0,0 +1,20 @@ +// Simplified Chinese +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "从现在开始", + suffixAgo: "之前", + suffixFromNow: null, + seconds: "不到1分钟", + minute: "大约1分钟", + minutes: "%d分钟", + hour: "大约1小时", + hours: "大约%d小时", + day: "1天", + days: "%d天", + month: "大约1个月", + months: "%d月", + year: "大约1年", + years: "%d年", + numbers: [], + wordSeparator: "" +}; diff --git a/javascript/timeago-locales/jquery.timeago.zh-TW.js b/javascript/timeago-locales/jquery.timeago.zh-TW.js new file mode 100644 index 0000000..5263390 --- /dev/null +++ b/javascript/timeago-locales/jquery.timeago.zh-TW.js @@ -0,0 +1,20 @@ +// Traditional Chinese, zh-tw +jQuery.timeago.settings.strings = { + prefixAgo: null, + prefixFromNow: "從現在開始", + suffixAgo: "之前", + suffixFromNow: null, + seconds: "不到1分鐘", + minute: "大約1分鐘", + minutes: "%d分鐘", + hour: "大約1小時", + hours: "%d小時", + day: "大約1天", + days: "%d天", + month: "大約1個月", + months: "%d個月", + year: "大約1年", + years: "%d年", + numbers: [], + wordSeparator: "" +}; diff --git a/scss/comments.scss b/scss/comments.scss index 7ff8c1b..249fd38 100644 --- a/scss/comments.scss +++ b/scss/comments.scss @@ -1,3 +1,7 @@ +.typography ul.comments-list { + list-style-type: none; +} + .comments-holder-container { clear: both; @@ -80,12 +84,18 @@ } } +.timeago { + color: #999; + padding-left: 0px; + margin-left: 10px; +} + // A published comment .comment { clear:both; list-style-type: none; overflow: hidden; - padding: 20px 0 20px 0; + padding: 20px 0 10px; position: relative; &.author-comment { @@ -99,49 +109,53 @@ font-weight: bold; } - > .comment-text { + > .comment-text-box { border: 1px solid blue; } } &.spam { - .comment-text { + .comment-text-box { border: 1px dashed orange; } } img.gravatar { float: left; - margin: 20px; + margin: 0px 20px 20px 0px; width: 90px; height: 90px; border: none; } - .comment-text { + .comment-text-box { background-color: #fff; border: 1px solid #ddd; box-shadow: none; margin: 0; - padding: 0 20px 0 20px; min-height: 130px; + padding: 20px; + /* white-space: pre; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; + */ p:last-child { margin-bottom: 0; } } - .comment-text.hasGravatar { - // leave enough space on the left for the default gravatar size - padding: 0 20px 0 130px; - + .comment-text-box.hasGravatar { // Ensure there is enough vertical space for the Gravatar min-height: 130px; + + // leave enough space on the left for the default gravatar size + .comment-text { + padding-left: 110px; + } } .date { @@ -153,7 +167,7 @@ } &.unmoderated { - > .comment-text { + > .comment-text-box { border: 1px solid yellow; } } diff --git a/templates/CommentsInterface_singlecomment.ss b/templates/CommentsInterface_singlecomment.ss index 7182bca..423180f 100755 --- a/templates/CommentsInterface_singlecomment.ss +++ b/templates/CommentsInterface_singlecomment.ss @@ -1,18 +1,16 @@ -<% if not $isPreview %> - -<% end_if %> -<% if $Gravatar %> - Gravatar for $Name.ATT -<% end_if %> -
-

$EscapedComment

+
+ <% if $Gravatar %> + Gravatar for $Name.ATT + <% end_if %> + +

$EscapedComment

<% if not $isPreview %> diff --git a/tests/CommentsExtensionTest.php b/tests/CommentsExtensionTest.php index 7c1bf29..be94259 100644 --- a/tests/CommentsExtensionTest.php +++ b/tests/CommentsExtensionTest.php @@ -266,9 +266,10 @@ class CommentsExtensionTest extends SapphireTest 'framework/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js', 'framework/thirdparty/jquery-validate/lib/jquery.form.js', 'comments/thirdparty/jquery-validate/jquery.validate.min.js', - 'framework/javascript/i18n.js', - 'comments/javascript/lang/en.js', - 'comments/javascript/CommentsInterface.js' + 'comments/javascript/CommentsInterface.js', + 'comments/javascript/jquery.timeago.js', + 'comments/javascript/timeago-locales/jquery.timeago.en.js', + 'comments/javascript/comments.timeago.js', ), $backend->get_javascript() );