diff --git a/public/src/app.js b/public/src/app.js index 7c0849faac..00aaf7c47c 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -284,6 +284,8 @@ var socket, }); } + $('span.timeago').timeago(); + setTimeout(function() { window.scrollTo(0, 1); // rehide address bar on mobile after page load completes. }, 100); @@ -346,6 +348,7 @@ var socket, app.populate_online_users(); app.addCommasToNumbers(); + $('span.timeago').timeago(); } app.infiniteLoaderActive = false; diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 24a059ae42..b477083764 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -81,7 +81,7 @@ var frag = document.createDocumentFragment(), li = document.createElement('li'); for (var i = 0, numPosts = posts.length; i < numPosts; i++) { - var dateString = utils.relativeTime(posts[i].timestamp); + li.setAttribute('data-pid', posts[i].pid); @@ -90,12 +90,13 @@ '

' + posts[i].content + '

' + - '' + posts[i].username + ' - ' + utils.relativeTime(posts[i].timestamp) + ' ago' + + '' + posts[i].username + ' -' + ''; frag.appendChild(li.cloneNode(true)); recent_replies.appendChild(frag); } + $('#category_recent_replies span.timeago').timeago(); }); function onTopicsLoaded(topics) { @@ -109,8 +110,9 @@ jQuery('#category-no-topics').remove(); container.append(html); - } + $('#topics-container span.timeago').timeago(); + } function loadMoreTopics(cid) { @@ -135,4 +137,4 @@ }); -})(); \ No newline at end of file +})(); diff --git a/public/templates/account.tpl b/public/templates/account.tpl index b052bf7b49..929771940b 100644 --- a/public/templates/account.tpl +++ b/public/templates/account.tpl @@ -47,8 +47,8 @@ {age}

- member for - {joindate} + joined +
profile views @@ -84,7 +84,7 @@
{posts.content} - {posts.relativeTime} ago +
diff --git a/public/templates/category.tpl b/public/templates/category.tpl index e12b3898bc..41f5cbd021 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -36,14 +36,14 @@

{topics.teaser_text}

- {topics.teaser_username} posted {topics.teaser_timestamp} ago + {topics.teaser_username} posted

{topics.postcount}{topics.title}

- Posted {topics.relativeTime} ago by + Posted by {topics.username}.
diff --git a/public/templates/favourites.tpl b/public/templates/favourites.tpl index 7bd01e7556..1d124e4710 100644 --- a/public/templates/favourites.tpl +++ b/public/templates/favourites.tpl @@ -14,7 +14,7 @@ {posts.username} : {posts.content}
- {posts.relativeTime} ago +

diff --git a/public/templates/header.tpl b/public/templates/header.tpl index 13db3b7e57..0efb66394d 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -10,6 +10,7 @@ + diff --git a/public/templates/recent.tpl b/public/templates/recent.tpl index 020372658a..42463f0bfc 100644 --- a/public/templates/recent.tpl +++ b/public/templates/recent.tpl @@ -24,14 +24,15 @@

{topics.teaser_username}: {topics.teaser_text}

- posted {topics.teaser_timestamp} ago + posted +

{topics.postcount}{topics.title}

- Posted {topics.relativeTime} ago by + Posted by {topics.username}.
diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index b569dbf4d2..3c03a5cad7 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -59,8 +59,9 @@
{main_posts.signature}
- posted {main_posts.relativeTime} ago - | last edited by {main_posts.editorname} {main_posts.relativeEditTime} ago + posted + | last edited by {main_posts.editorname} +
@@ -114,8 +115,9 @@
{posts.signature}
- posted {posts.relativeTime} ago - | last edited by {posts.editorname} {posts.relativeEditTime} ago + posted + | last edited by {posts.editorname} +
diff --git a/public/themes/vanilla/category.less b/public/themes/vanilla/category.less index b9f7c2b78f..f4f230b39d 100644 --- a/public/themes/vanilla/category.less +++ b/public/themes/vanilla/category.less @@ -103,7 +103,6 @@ span { display: block; float: left; - width: 70%; margin-left: 10px; overflow: hidden; height: 16px; @@ -147,7 +146,6 @@ } span { font-size: 12px; - display: block; overflow: hidden; height: 16px; padding-left: 8px; diff --git a/src/admin/categories.js b/src/admin/categories.js index 4f4dc682a7..405f180cdc 100644 --- a/src/admin/categories.js +++ b/src/admin/categories.js @@ -21,7 +21,6 @@ var RDB = require('./../redis.js'), // reset slugs if name is updated var slug = cid + '/' + utils.slugify(category[key]); RDB.hset('category:' + cid, 'slug', slug); - RDB.set('categoryslug:' + slug + ':cid', cid); } } diff --git a/src/posts.js b/src/posts.js index aff11e21e9..dee76c0474 100644 --- a/src/posts.js +++ b/src/posts.js @@ -70,7 +70,7 @@ var RDB = require('./redis.js'), Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) { if (postData.deleted === '1') return callback(null); else { - postData.relativeTime = utils.relativeTime(postData.timestamp); + postData.relativeTime = new Date(parseInt(postData.timestamp, 10)).toISOString(); next(null, postData); } }); @@ -159,10 +159,10 @@ var RDB = require('./redis.js'), async.eachSeries(pids, function(pid, callback) { Posts.getPostData(pid, function(postData) { if (postData) { - postData.relativeTime = utils.relativeTime(postData.timestamp); + postData.relativeTime = new Date(parseInt(postData.timestamp,10)).toISOString(); postData.post_rep = postData.reputation; postData['edited-class'] = postData.editor !== '' ? '' : 'none'; - postData['relativeEditTime'] = postData.edited !== '0' ? utils.relativeTime(postData.edited) : ''; + postData['relativeEditTime'] = postData.edited !== '0' ? (new Date(parseInt(postData.edited,10)).toISOString()) : ''; postTools.toHTML(postData.content, function(err, content) { postData.content = content; @@ -285,7 +285,7 @@ var RDB = require('./redis.js'), 'fav_button_class': '', 'fav_star_class': 'icon-star-empty', 'show_banned': 'hide', - 'relativeTime': '0 seconds', + 'relativeTime': new Date(timestamp).toISOString(), 'post_rep': '0', 'edited-class': 'none', 'relativeEditTime': '' diff --git a/src/routes/user.js b/src/routes/user.js index 8fdfd9a85a..1c60e247d4 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -482,7 +482,7 @@ var user = require('./../user.js'), user.getUserData(uid, function(err, data) { if (data) { - data.joindate = utils.relativeTime(data.joindate); + data.joindate = new Date(parseInt(data.joindate, 10)).toISOString(); if (!data.birthday) { data.age = ''; diff --git a/src/topics.js b/src/topics.js index 49d2274b86..baaa608948 100644 --- a/src/topics.js +++ b/src/topics.js @@ -305,14 +305,15 @@ schema = require('./schema.js'), topicData['lock-icon'] = topicData.locked === '1' ? 'icon-lock' : 'none'; topicData['deleted-class'] = topicData.deleted === '1' ? 'deleted' : ''; - topicData.relativeTime = utils.relativeTime(topicData.timestamp); + topicData.relativeTime = new Date(parseInt(topicData.timestamp, 10)).toISOString(); topicData.username = topicInfo.username; topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important'; topicData.teaser_text = topicInfo.teaserInfo.text || '', topicData.teaser_username = topicInfo.teaserInfo.username || ''; topicData.teaser_userpicture = topicInfo.teaserInfo.picture || ''; - topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? utils.relativeTime(topicInfo.teaserInfo.timestamp) : ''; + + topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? (new Date(parseInt(topicInfo.teaserInfo.timestamp, 10)).toISOString()) : ''; if (isTopicVisible(topicData, topicInfo)) retrieved_topics.push(topicData); @@ -426,11 +427,11 @@ schema = require('./schema.js'), hasRead = results[1], teaser = results[2]; - topicData.relativeTime = utils.relativeTime(topicData.timestamp); + topicData.relativeTime = new Date(parseInt(topicData.timestamp,10)).toISOString(); topicData.badgeclass = hasRead ? '' : 'badge-important'; topicData.teaser_text = teaser.text || ''; topicData.teaser_username = teaser.username || ''; - topicData.teaser_timestamp = teaser.timestamp ? utils.relativeTime(teaser.timestamp) : ''; + topicData.teaser_timestamp = teaser.timestamp ? (new Date(parseInt(teaser.timestamp,10)).toISOString()) : ''; topicData.teaser_userpicture = teaser.picture; callback(topicData);