| 222 | // var LocalTimeElement$getFormattedDate = LocalTimeElement.prototype.getFormattedDate; |
| 223 | |
| 224 | var RelativeTime = function (str, el) { // 相对时间解析 |
| 225 | if (/^on ([\w ]+)$/.test(str)) { |
| 226 | return '于 ' + el.title.replace(/ .+$/, ''); |
| 227 | } |
| 228 | |
| 229 | return str.replace(/just now|(an?|\d+) (second|minute|hour|day|month|year)s? ago/, function (m, d, t) { |
| 230 | if (m === 'just now') { |
| 231 | return '刚刚'; |
| 232 | } |
| 233 | |
| 234 | if (d[0] === 'a') { |
| 235 | d = '1'; |
| 236 | } // a, an 修改为 1 |
| 237 | |
| 238 | var dt = {second: '秒', minute: '分钟', hour: '小时', day: '天', month: '个月', year: '年'}; |
| 239 | |
| 240 | return d + ' ' + dt[t] + '之前'; |
| 241 | }); |
| 242 | }; |
| 243 | |
| 244 | RelativeTimeElement.prototype.getFormattedDate = function () { |
| 245 | var str = RelativeTimeElement$getFormattedDate.call(this); |