Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 12 years ago
commit 6de3dba239

@ -90,7 +90,7 @@ var ajaxify = {};
translator.load(tpl_url);
jQuery('#footer, #content').addClass('ajaxifying');
jQuery('#footer, #content').removeClass('hide').addClass('ajaxifying');
templates.flush();
templates.load_template(function () {
@ -154,7 +154,7 @@ var ajaxify = {};
return;
}
if (!e.ctrlKey && e.which === 1) {
if ((!e.ctrlKey && !e.shiftKey) && e.which === 1) {
if (this.host === window.location.host) {
// Internal link
var url = this.href.replace(rootUrl + '/', '');

@ -83,36 +83,39 @@ define(function () {
Category.onNewTopic = function(data) {
var html = templates.prepare(templates['category'].blocks['topics']).parse({
topics: [data]
}),
topic = $(html),
container = $('#topics-container'),
topics = $('#topics-container').children('.category-item'),
numTopics = topics.length;
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
if (numTopics > 0) {
for (var x = 0; x < numTopics; x++) {
if ($(topics[x]).find('.fa-thumb-tack').length) {
if(x === numTopics - 1) {
topic.insertAfter(topics[x]);
});
translator.translate(html, function(translatedHTML) {
var topic = $(translatedHTML),
container = $('#topics-container'),
topics = $('#topics-container').children('.category-item'),
numTopics = topics.length;
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
if (numTopics > 0) {
for (var x = 0; x < numTopics; x++) {
if ($(topics[x]).find('.fa-thumb-tack').length) {
if(x === numTopics - 1) {
topic.insertAfter(topics[x]);
}
continue;
}
continue;
topic.insertBefore(topics[x]);
break;
}
topic.insertBefore(topics[x]);
break;
} else {
container.append(topic);
}
} else {
container.append(topic);
}
topic.hide().fadeIn('slow');
socket.emit('api:categories.getRecentReplies', templates.get('category_id'));
topic.hide().fadeIn('slow');
socket.emit('api:categories.getRecentReplies', templates.get('category_id'));
addActiveUser(data);
addActiveUser(data);
$('#topics-container span.timeago').timeago();
$('#topics-container span.timeago').timeago();
});
}
function addActiveUser(data) {
@ -131,20 +134,22 @@ define(function () {
}
Category.onTopicsLoaded = function(topics) {
var html = templates.prepare(templates['category'].blocks['topics']).parse({
topics: topics
}),
container = $('#topics-container');
});
translator.translate(html, function(translatedHTML) {
var container = $('#topics-container');
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
html = $(html);
container.append(html);
html = $(translatedHTML);
container.append(html);
$('#topics-container span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
$('#topics-container span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
});
}
Category.loadMoreTopics = function(cid) {

@ -208,7 +208,7 @@
});
});
socket.on('chatMessage', function(data) {
socket.on('event:chats.receive', function(data) {
require(['chat'], function(chat) {
var modal = null;
if (chat.modalExists(data.fromuid)) {

@ -81,18 +81,20 @@ define(function() {
}
Recent.onTopicsLoaded = function(topics) {
var html = templates.prepare(templates['recent'].blocks['topics']).parse({
topics: topics
}),
container = $('#topics-container');
});
translator.translate(html, function(translatedHTML) {
var container = $('#topics-container');
$('#category-no-topics').remove();
$('#category-no-topics').remove();
html = $(html);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
html = $(html);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
});
}
Recent.loadMoreTopics = function() {

@ -71,18 +71,20 @@ define(function() {
});
function onTopicsLoaded(topics) {
var html = templates.prepare(templates['unread'].blocks['topics']).parse({
topics: topics
}),
container = $('#topics-container');
});
$('#category-no-topics').remove();
translator.translate(html, function(translatedHTML) {
var container = $('#topics-container');
html = $(html);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
$('#category-no-topics').remove();
html = $(translatedHTML);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
});
}
function loadMoreTopics() {

@ -114,7 +114,7 @@ define(['taskbar'], function(taskbar) {
}
function getChatMessages(chatModal, callback) {
socket.emit('getChatMessages', {touid:chatModal.touid}, function(messages) {
socket.emit('api:chats.get', {touid:chatModal.touid}, function(messages) {
for(var i = 0; i<messages.length; ++i) {
module.appendChatMessage(chatModal, messages[i].content, messages[i].timestamp);
}
@ -141,7 +141,7 @@ define(['taskbar'], function(taskbar) {
var msg = app.strip_tags(chatModal.find('#chat-message-input').val());
if(msg.length) {
msg = msg +'\n';
socket.emit('sendChatMessage', { touid:chatModal.touid, message:msg});
socket.emit('api:chats.send', { touid:chatModal.touid, message:msg});
chatModal.find('#chat-message-input').val('');
}
}

@ -320,14 +320,16 @@
if (conditionalBlock[1]) {
// there is an else statement
if (!value) {
template = template.replace(matches[i], conditionalBlock[1]);
template = template.replace(matches[i], conditionalBlock[1].replace(/<!-- ((\IF\b)|(\bENDIF\b))(.*?)-->/gi, ''));
} else {
template = template.replace(matches[i], conditionalBlock[0]);
template = template.replace(matches[i], conditionalBlock[0].replace(/<!-- ((\IF\b)|(\bENDIF\b))(.*?)-->/gi, ''));
}
} else {
// regular if statement
if (!value) {
template = template.replace(matches[i], '');
} else {
template = template.replace(matches[i], matches[i].replace(/<!-- ((\IF\b)|(\bENDIF\b))(.*?)-->/gi, ''));
}
}
}
@ -351,6 +353,9 @@
var regex = new RegExp("{" + namespace + "[\\s\\S]*?}", 'g');
template = template.replace(regex, '');
}
// clean up all undefined conditionals
template = template.replace(/<!-- IF([\s\S]*?)ENDIF([\s\S]*?)-->/gi, '');
return template;

@ -59,7 +59,7 @@
<div id="alert_window"></div>
<footer id="footer" class="container footer">
<footer id="footer" class="container footer hide">
{footerHTML}
<div class="copyright">
Copyright &copy; 2013 <a target="_blank" href="http://www.nodebb.com">NodeBB Forums</a> | <a target="_blank" href="//github.com/designcreateplay/NodeBB/graphs/contributors">Contributors</a>

@ -188,8 +188,7 @@
stats.raw = JSON.stringify(stats, null, 4);
stats.mongo = true;
//remove this when andrew adds in undefined checking to templates
stats.redis = false;
callback(err, stats);
});

@ -168,8 +168,6 @@
}
redisData.raw = JSON.stringify(redisData, null, 4);
redisData.redis = true;
//remove this when andrew adds in undefined checking to templates
redisData.mongo = false;
callback(null, redisData);
});

@ -677,7 +677,7 @@ websockets.init = function(io) {
});
});
socket.on('getChatMessages', function(data, callback) {
socket.on('api:chats.get', function(data, callback) {
var touid = data.touid;
Messaging.getMessages(uid, touid, function(err, messages) {
if (err)
@ -687,7 +687,7 @@ websockets.init = function(io) {
});
});
socket.on('sendChatMessage', function(data) {
socket.on('api:chats.send', function(data) {
var touid = data.touid;
if (touid === uid || uid === 0) {
@ -696,9 +696,15 @@ websockets.init = function(io) {
var msg = utils.strip_tags(data.message);
user.getUserField(uid, 'username', function(err, username) {
user.getMultipleUserFields([uid, touid], ['username'], function(err, usersData) {
if(err) {
return;
}
var finalMessage = username + ' : ' + msg,
notifText = 'New message from <strong>' + username + '</strong>';
notifText = 'New message from <strong>' + username + '</strong>',
username = usersData[0].username,
toUsername = usersData[1].username;
if (!isUserOnline(touid)) {
notifications.create(notifText, 'javascript:app.openChat(&apos;' + username + '&apos;, ' + uid + ');', 'notification_' + uid + '_' + touid, function(nid) {
@ -715,7 +721,7 @@ websockets.init = function(io) {
numSockets = userSockets[touid].length;
for (var x = 0; x < numSockets; ++x) {
userSockets[touid][x].emit('chatMessage', {
userSockets[touid][x].emit('event:chats.receive', {
fromuid: uid,
username: username,
message: finalMessage,
@ -729,9 +735,9 @@ websockets.init = function(io) {
numSockets = userSockets[uid].length;
for (var x = 0; x < numSockets; ++x) {
userSockets[uid][x].emit('chatMessage', {
userSockets[uid][x].emit('event:chats.receive', {
fromuid: touid,
username: username,
username: toUsername,
message: 'You : ' + msg,
timestamp: Date.now()
});

Loading…
Cancel
Save