mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 17:35:46 +01:00
Merge branch 'master' of github.com:designcreateplay/NodeBB
This commit is contained in:
@@ -90,7 +90,7 @@ var ajaxify = {};
|
|||||||
|
|
||||||
translator.load(tpl_url);
|
translator.load(tpl_url);
|
||||||
|
|
||||||
jQuery('#footer, #content').addClass('ajaxifying');
|
jQuery('#footer, #content').removeClass('hide').addClass('ajaxifying');
|
||||||
|
|
||||||
templates.flush();
|
templates.flush();
|
||||||
templates.load_template(function () {
|
templates.load_template(function () {
|
||||||
@@ -154,7 +154,7 @@ var ajaxify = {};
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!e.ctrlKey && e.which === 1) {
|
if ((!e.ctrlKey && !e.shiftKey) && e.which === 1) {
|
||||||
if (this.host === window.location.host) {
|
if (this.host === window.location.host) {
|
||||||
// Internal link
|
// Internal link
|
||||||
var url = this.href.replace(rootUrl + '/', '');
|
var url = this.href.replace(rootUrl + '/', '');
|
||||||
|
|||||||
@@ -83,8 +83,10 @@ define(function () {
|
|||||||
Category.onNewTopic = function(data) {
|
Category.onNewTopic = function(data) {
|
||||||
var html = templates.prepare(templates['category'].blocks['topics']).parse({
|
var html = templates.prepare(templates['category'].blocks['topics']).parse({
|
||||||
topics: [data]
|
topics: [data]
|
||||||
}),
|
});
|
||||||
topic = $(html),
|
|
||||||
|
translator.translate(html, function(translatedHTML) {
|
||||||
|
var topic = $(translatedHTML),
|
||||||
container = $('#topics-container'),
|
container = $('#topics-container'),
|
||||||
topics = $('#topics-container').children('.category-item'),
|
topics = $('#topics-container').children('.category-item'),
|
||||||
numTopics = topics.length;
|
numTopics = topics.length;
|
||||||
@@ -113,6 +115,7 @@ define(function () {
|
|||||||
addActiveUser(data);
|
addActiveUser(data);
|
||||||
|
|
||||||
$('#topics-container span.timeago').timeago();
|
$('#topics-container span.timeago').timeago();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addActiveUser(data) {
|
function addActiveUser(data) {
|
||||||
@@ -131,20 +134,22 @@ define(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Category.onTopicsLoaded = function(topics) {
|
Category.onTopicsLoaded = function(topics) {
|
||||||
|
|
||||||
var html = templates.prepare(templates['category'].blocks['topics']).parse({
|
var html = templates.prepare(templates['category'].blocks['topics']).parse({
|
||||||
topics: topics
|
topics: topics
|
||||||
}),
|
});
|
||||||
container = $('#topics-container');
|
|
||||||
|
translator.translate(html, function(translatedHTML) {
|
||||||
|
var container = $('#topics-container');
|
||||||
|
|
||||||
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
|
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
|
||||||
jQuery('#category-no-topics').remove();
|
jQuery('#category-no-topics').remove();
|
||||||
|
|
||||||
html = $(html);
|
html = $(translatedHTML);
|
||||||
container.append(html);
|
container.append(html);
|
||||||
|
|
||||||
$('#topics-container span.timeago').timeago();
|
$('#topics-container span.timeago').timeago();
|
||||||
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Category.loadMoreTopics = function(cid) {
|
Category.loadMoreTopics = function(cid) {
|
||||||
|
|||||||
@@ -208,7 +208,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('chatMessage', function(data) {
|
socket.on('event:chats.receive', function(data) {
|
||||||
require(['chat'], function(chat) {
|
require(['chat'], function(chat) {
|
||||||
var modal = null;
|
var modal = null;
|
||||||
if (chat.modalExists(data.fromuid)) {
|
if (chat.modalExists(data.fromuid)) {
|
||||||
|
|||||||
@@ -81,11 +81,12 @@ define(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Recent.onTopicsLoaded = function(topics) {
|
Recent.onTopicsLoaded = function(topics) {
|
||||||
|
|
||||||
var html = templates.prepare(templates['recent'].blocks['topics']).parse({
|
var html = templates.prepare(templates['recent'].blocks['topics']).parse({
|
||||||
topics: topics
|
topics: topics
|
||||||
}),
|
});
|
||||||
container = $('#topics-container');
|
|
||||||
|
translator.translate(html, function(translatedHTML) {
|
||||||
|
var container = $('#topics-container');
|
||||||
|
|
||||||
$('#category-no-topics').remove();
|
$('#category-no-topics').remove();
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ define(function() {
|
|||||||
container.append(html);
|
container.append(html);
|
||||||
$('span.timeago').timeago();
|
$('span.timeago').timeago();
|
||||||
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Recent.loadMoreTopics = function() {
|
Recent.loadMoreTopics = function() {
|
||||||
|
|||||||
@@ -71,18 +71,20 @@ define(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function onTopicsLoaded(topics) {
|
function onTopicsLoaded(topics) {
|
||||||
|
|
||||||
var html = templates.prepare(templates['unread'].blocks['topics']).parse({
|
var html = templates.prepare(templates['unread'].blocks['topics']).parse({
|
||||||
topics: topics
|
topics: topics
|
||||||
}),
|
});
|
||||||
container = $('#topics-container');
|
|
||||||
|
translator.translate(html, function(translatedHTML) {
|
||||||
|
var container = $('#topics-container');
|
||||||
|
|
||||||
$('#category-no-topics').remove();
|
$('#category-no-topics').remove();
|
||||||
|
|
||||||
html = $(html);
|
html = $(translatedHTML);
|
||||||
container.append(html);
|
container.append(html);
|
||||||
$('span.timeago').timeago();
|
$('span.timeago').timeago();
|
||||||
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadMoreTopics() {
|
function loadMoreTopics() {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ define(['taskbar'], function(taskbar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getChatMessages(chatModal, callback) {
|
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) {
|
for(var i = 0; i<messages.length; ++i) {
|
||||||
module.appendChatMessage(chatModal, messages[i].content, messages[i].timestamp);
|
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());
|
var msg = app.strip_tags(chatModal.find('#chat-message-input').val());
|
||||||
if(msg.length) {
|
if(msg.length) {
|
||||||
msg = msg +'\n';
|
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('');
|
chatModal.find('#chat-message-input').val('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -320,14 +320,16 @@
|
|||||||
if (conditionalBlock[1]) {
|
if (conditionalBlock[1]) {
|
||||||
// there is an else statement
|
// there is an else statement
|
||||||
if (!value) {
|
if (!value) {
|
||||||
template = template.replace(matches[i], conditionalBlock[1]);
|
template = template.replace(matches[i], conditionalBlock[1].replace(/<!-- ((\IF\b)|(\bENDIF\b))(.*?)-->/gi, ''));
|
||||||
} else {
|
} else {
|
||||||
template = template.replace(matches[i], conditionalBlock[0]);
|
template = template.replace(matches[i], conditionalBlock[0].replace(/<!-- ((\IF\b)|(\bENDIF\b))(.*?)-->/gi, ''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// regular if statement
|
// regular if statement
|
||||||
if (!value) {
|
if (!value) {
|
||||||
template = template.replace(matches[i], '');
|
template = template.replace(matches[i], '');
|
||||||
|
} else {
|
||||||
|
template = template.replace(matches[i], matches[i].replace(/<!-- ((\IF\b)|(\bENDIF\b))(.*?)-->/gi, ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,6 +354,9 @@
|
|||||||
template = template.replace(regex, '');
|
template = template.replace(regex, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up all undefined conditionals
|
||||||
|
template = template.replace(/<!-- IF([\s\S]*?)ENDIF([\s\S]*?)-->/gi, '');
|
||||||
|
|
||||||
return template;
|
return template;
|
||||||
|
|
||||||
})(data, "", template);
|
})(data, "", template);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<div id="alert_window"></div>
|
<div id="alert_window"></div>
|
||||||
|
|
||||||
|
|
||||||
<footer id="footer" class="container footer">
|
<footer id="footer" class="container footer hide">
|
||||||
{footerHTML}
|
{footerHTML}
|
||||||
<div class="copyright">
|
<div class="copyright">
|
||||||
Copyright © 2013 <a target="_blank" href="http://www.nodebb.com">NodeBB Forums</a> | <a target="_blank" href="//github.com/designcreateplay/NodeBB/graphs/contributors">Contributors</a>
|
Copyright © 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.raw = JSON.stringify(stats, null, 4);
|
||||||
|
|
||||||
stats.mongo = true;
|
stats.mongo = true;
|
||||||
//remove this when andrew adds in undefined checking to templates
|
|
||||||
stats.redis = false;
|
|
||||||
callback(err, stats);
|
callback(err, stats);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -168,8 +168,6 @@
|
|||||||
}
|
}
|
||||||
redisData.raw = JSON.stringify(redisData, null, 4);
|
redisData.raw = JSON.stringify(redisData, null, 4);
|
||||||
redisData.redis = true;
|
redisData.redis = true;
|
||||||
//remove this when andrew adds in undefined checking to templates
|
|
||||||
redisData.mongo = false;
|
|
||||||
|
|
||||||
callback(null, redisData);
|
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;
|
var touid = data.touid;
|
||||||
Messaging.getMessages(uid, touid, function(err, messages) {
|
Messaging.getMessages(uid, touid, function(err, messages) {
|
||||||
if (err)
|
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;
|
var touid = data.touid;
|
||||||
if (touid === uid || uid === 0) {
|
if (touid === uid || uid === 0) {
|
||||||
@@ -696,9 +696,15 @@ websockets.init = function(io) {
|
|||||||
|
|
||||||
var msg = utils.strip_tags(data.message);
|
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,
|
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)) {
|
if (!isUserOnline(touid)) {
|
||||||
notifications.create(notifText, 'javascript:app.openChat('' + username + '', ' + uid + ');', 'notification_' + uid + '_' + touid, function(nid) {
|
notifications.create(notifText, 'javascript:app.openChat('' + username + '', ' + uid + ');', 'notification_' + uid + '_' + touid, function(nid) {
|
||||||
@@ -715,7 +721,7 @@ websockets.init = function(io) {
|
|||||||
numSockets = userSockets[touid].length;
|
numSockets = userSockets[touid].length;
|
||||||
|
|
||||||
for (var x = 0; x < numSockets; ++x) {
|
for (var x = 0; x < numSockets; ++x) {
|
||||||
userSockets[touid][x].emit('chatMessage', {
|
userSockets[touid][x].emit('event:chats.receive', {
|
||||||
fromuid: uid,
|
fromuid: uid,
|
||||||
username: username,
|
username: username,
|
||||||
message: finalMessage,
|
message: finalMessage,
|
||||||
@@ -729,9 +735,9 @@ websockets.init = function(io) {
|
|||||||
numSockets = userSockets[uid].length;
|
numSockets = userSockets[uid].length;
|
||||||
|
|
||||||
for (var x = 0; x < numSockets; ++x) {
|
for (var x = 0; x < numSockets; ++x) {
|
||||||
userSockets[uid][x].emit('chatMessage', {
|
userSockets[uid][x].emit('event:chats.receive', {
|
||||||
fromuid: touid,
|
fromuid: touid,
|
||||||
username: username,
|
username: toUsername,
|
||||||
message: 'You : ' + msg,
|
message: 'You : ' + msg,
|
||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user