mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
added profile func, shorter getRecentReplies
This commit is contained in:
@@ -15,6 +15,8 @@ define(['composer'], function(composer) {
|
|||||||
|
|
||||||
app.enterRoom('category_' + cid);
|
app.enterRoom('category_' + cid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
twitterEl.on('click', function () {
|
twitterEl.on('click', function () {
|
||||||
window.open(twitterUrl, '_blank', 'width=550,height=420,scrollbars=no,status=no');
|
window.open(twitterUrl, '_blank', 'width=550,height=420,scrollbars=no,status=no');
|
||||||
return false;
|
return false;
|
||||||
@@ -143,29 +145,22 @@ define(['composer'], function(composer) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var recent_replies = document.getElementById('category_recent_replies');
|
var recentReplies = $('#category_recent_replies');
|
||||||
|
var reply;
|
||||||
|
for (var i = 0, numPosts = posts.length; i < numPosts; ++i) {
|
||||||
|
|
||||||
recent_replies.innerHTML = '';
|
reply = $('<li data-pid="'+ posts[i].pid +'">' +
|
||||||
|
'<a href="' + RELATIVE_PATH + '/user/' + posts[i].userslug + '"><img title="' + posts[i].username + '" class="img-rounded user-img" src="' + posts[i].picture + '"/></a>' +
|
||||||
var frag = document.createDocumentFragment(),
|
|
||||||
li = document.createElement('li');
|
|
||||||
for (var i = 0, numPosts = posts.length; i < numPosts; i++) {
|
|
||||||
|
|
||||||
li.setAttribute('data-pid', posts[i].pid);
|
|
||||||
|
|
||||||
|
|
||||||
li.innerHTML = '<a href="' + RELATIVE_PATH + '/user/' + posts[i].userslug + '"><img title="' + posts[i].username + '" class="img-rounded user-img" src="' + posts[i].picture + '"/></a>' +
|
|
||||||
'<a href="' + RELATIVE_PATH + '/topic/' + posts[i].topicSlug + '#' + posts[i].pid + '">' +
|
'<a href="' + RELATIVE_PATH + '/topic/' + posts[i].topicSlug + '#' + posts[i].pid + '">' +
|
||||||
'<strong><span>'+ posts[i].username + '</span></strong>' +
|
'<strong><span>'+ posts[i].username + '</span></strong>' +
|
||||||
'<p>' +
|
'<p>' + posts[i].content + '</p>' +
|
||||||
posts[i].content +
|
|
||||||
'</p>' +
|
|
||||||
'</a>' +
|
'</a>' +
|
||||||
'<span class="timeago pull-right" title="' + posts[i].relativeTime + '"></span>';
|
'<span class="timeago pull-right" title="' + posts[i].relativeTime + '"></span>' +
|
||||||
|
'</li>');
|
||||||
|
|
||||||
frag.appendChild(li.cloneNode(true));
|
recentReplies.append(reply);
|
||||||
recent_replies.appendChild(frag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#category_recent_replies span.timeago').timeago();
|
$('#category_recent_replies span.timeago').timeago();
|
||||||
app.createUserTooltips();
|
app.createUserTooltips();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,12 @@
|
|||||||
if ('undefined' === typeof window) {
|
if ('undefined' === typeof window) {
|
||||||
fs = require('fs');
|
fs = require('fs');
|
||||||
XRegExp = require('xregexp').XRegExp;
|
XRegExp = require('xregexp').XRegExp;
|
||||||
|
|
||||||
|
process.profile = function(operation, start) {
|
||||||
|
var diff = process.hrtime(start);
|
||||||
|
console.log('%s took %d milliseconds', operation, diff[0] * 1e3 + diff[1] / 1e6);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
XRegExp = window.XRegExp;
|
XRegExp = window.XRegExp;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user