diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index bba039ea66..24f1e2e105 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -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 + '/', ''); diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 44a11eaea9..6b25a85701 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -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) { diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index eb8d0f3e20..046a7e8186 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -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)) { diff --git a/public/src/forum/recent.js b/public/src/forum/recent.js index 6b162db34f..c883c9c54b 100644 --- a/public/src/forum/recent.js +++ b/public/src/forum/recent.js @@ -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() { diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index 6debeeba84..e0dd1dd7d7 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -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() { diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 2aeb2f02bf..8c3b551330 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -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/gi, '')); } else { - template = template.replace(matches[i], conditionalBlock[0]); + template = template.replace(matches[i], conditionalBlock[0].replace(//gi, '')); } } else { // regular if statement if (!value) { template = template.replace(matches[i], ''); + } else { + template = template.replace(matches[i], matches[i].replace(//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(//gi, ''); return template; diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index a9f51f2242..4434336ed8 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -59,7 +59,7 @@
-