diff --git a/.gitignore b/.gitignore
index 49f144eb0a..b5bda3e26f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ npm-debug.log
node_modules/
sftp-config.json
config.json
+public/src/nodebb.min.js
public/config.json
public/css/*.css
public/themes/*
@@ -15,4 +16,4 @@ public/themes/*
*.sublime-project
*.sublime-workspace
plugins/*
-.project
\ No newline at end of file
+.project
diff --git a/README.md b/README.md
index 4e55deda6c..f1f90f2a98 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
-Please support NodeBB development! Check out our IndieGoGo campaign and like, share, and follow us :)
-[NodeBB Homepage](http://www.nodebb.org/ "NodeBB") # [Follow on Twitter](http://www.twitter.com/NodeBB/ "NodeBB Twitter") # [Like us on Facebook](http://www.facebook.com/NodeBB/ "NodeBB Facebook")
# NodeBB
**NodeBB** is a robust Node.js driven forum built on a redis database. It is powered by web sockets, and is compatible down to IE8.
+* [NodeBB Homepage](http://www.nodebb.org/ "NodeBB")
+* [Follow on Twitter](http://www.twitter.com/NodeBB/ "NodeBB Twitter")
+* [Like us on Facebook](http://www.facebook.com/NodeBB/ "NodeBB Facebook")
+* [Join us on IRC](https://kiwiirc.com/client/irc.freenode.net/nodebb) - #nodebb on Freenode
+


diff --git a/app.js b/app.js
index 7b9196361c..343431e527 100644
--- a/app.js
+++ b/app.js
@@ -24,8 +24,10 @@
nconf.argv().env();
var fs = require('fs'),
+ async = require('async'),
winston = require('winston'),
pkg = require('./package.json'),
+ path = require('path'),
meta;
// Runtime environment
diff --git a/package.json b/package.json
index d34cef3a13..b82a2747be 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"socket.io": "~0.9.16",
"redis": "0.8.3",
"express": "3.2.0",
- "express-namespace": "0.1.1",
+ "express-namespace": "~0.1.1",
"emailjs": "0.3.4",
"cookie": "0.0.6",
"connect-redis": "1.4.5",
@@ -37,7 +37,9 @@
"nodebb-plugin-mentions": "~0.1.0",
"nodebb-plugin-markdown": "~0.1.0",
"rss": "~0.2.0",
- "prompt": "~0.2.11"
+ "prompt": "~0.2.11",
+ "uglify-js": "~2.4.0",
+ "validator": "~1.5.1"
},
"bugs": {
"url": "https://github.com/designcreateplay/NodeBB/issues"
diff --git a/public/language/en/users.json b/public/language/en/users.json
index c41127ad9d..0d86d2f19c 100644
--- a/public/language/en/users.json
+++ b/public/language/en/users.json
@@ -2,6 +2,7 @@
"latest_users": "Latest Users",
"top_posters": "Top Posters",
"most_reputation": "Most Reputation",
+ "online": "Online",
"search": "Search",
"enter_username": "Enter a username to search",
"load_more": "Load More"
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index e42e927274..38300a481d 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -62,9 +62,11 @@ var ajaxify = {};
if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) {
if (quiet !== true) {
- window.history.pushState({
- "url": url
- }, url, RELATIVE_PATH + "/" + url);
+ if (window.history && window.history.pushState) {
+ window.history.pushState({
+ "url": url
+ }, url, RELATIVE_PATH + "/" + url);
+ }
}
translator.load(tpl_url);
@@ -105,26 +107,29 @@ var ajaxify = {};
// Enhancing all anchors to ajaxify...
$(document.body).on('click', 'a', function (e) {
-
function hrefEmpty(href) {
return href == 'javascript:;' || href == window.location.href + "#" || href.slice(-1) === "#";
}
if (hrefEmpty(this.href)) return;
-
- var url = this.href.replace(rootUrl + '/', '');
-
if (this.target !== '') return;
+ if (this.protocol === 'javascript:') return;
if (!e.ctrlKey && e.which === 1) {
- if (ajaxify.go(url)) {
+ if (this.host === window.location.host) {
+ var url = this.href.replace(rootUrl + '/', '');
+
+ if (ajaxify.go(url)) {
+ e.preventDefault();
+ }
+ } else {
+ ajaxify.go('outgoing?url=' + encodeURIComponent(this.href));
e.preventDefault();
}
}
});
});
-
function exec_body_scripts(body_el) {
// modified from http://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml
@@ -156,7 +161,7 @@ var ajaxify = {};
var scripts = [],
script,
- children_nodes = body_el.childNodes,
+ children_nodes = $(body_el).children(),
child,
i;
diff --git a/public/src/app.js b/public/src/app.js
index 950b3b6d44..f9a793c055 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -7,7 +7,7 @@ var socket,
(function () {
var showWelcomeMessage = false;
- function loadConfig() {
+ app.loadConfig = function() {
$.ajax({
url: RELATIVE_PATH + '/api/config',
@@ -15,109 +15,114 @@ var socket,
API_URL = data.api_url;
config = data;
- socket = io.connect(config.socket.address);
+ if(socket) {
+ socket.disconnect();
+ socket.socket.connect();
+ } else {
+ socket = io.connect(config.socket.address);
- var reconnecting = false;
- var reconnectTries = 0;
+ var reconnecting = false;
+ var reconnectTries = 0;
- socket.on('event:connect', function (data) {
- console.log('connected to nodebb socket: ', data);
- app.username = data.username;
- app.showLoginMessage();
- });
-
- socket.on('event:alert', function (data) {
- app.alert(data);
- });
-
- socket.on('connect', function (data) {
- if (reconnecting) {
- setTimeout(function () {
- app.alert({
- alert_id: 'connection_alert',
- title: 'Connected',
- message: 'Connection successful.',
- type: 'success',
- timeout: 5000
- });
- }, 1000);
- reconnecting = false;
- reconnectTries = 0;
+ socket.on('event:connect', function (data) {
+ app.username = data.username;
+ app.showLoginMessage();
socket.emit('api:updateHeader', {
- fields: ['username', 'picture', 'userslug']
- });
- }
- });
-
- socket.on('reconnecting', function (data) {
- function showDisconnectModal() {
- $('#disconnect-modal').modal({
- backdrop: 'static',
- show: true
- });
-
- $('#reload-button').on('click', function () {
- $('#disconnect-modal').modal('hide');
- window.location.reload();
- });
- }
-
- reconnecting = true;
- reconnectTries++;
-
- if (reconnectTries > 4) {
- showDisconnectModal();
- return;
- }
-
- app.alert({
- alert_id: 'connection_alert',
- title: 'Reconnecting',
- message: 'You have disconnected from NodeBB, we will try to reconnect you.
',
- type: 'warning',
- timeout: 5000
+ fields: ['username', 'picture', 'userslug']
+ });
});
- });
- socket.on('api:user.get_online_users', function (users) {
- jQuery('a.username-field').each(function () {
- if (this.processed === true)
- return;
+ socket.on('event:alert', function (data) {
+ app.alert(data);
+ });
- var el = jQuery(this),
- uid = el.parents('li').attr('data-uid');
+ socket.on('connect', function (data) {
+ if (reconnecting) {
+ setTimeout(function () {
+ app.alert({
+ alert_id: 'connection_alert',
+ title: 'Connected',
+ message: 'Connection successful.',
+ type: 'success',
+ timeout: 5000
+ });
+ }, 1000);
+ reconnecting = false;
+ reconnectTries = 0;
+ socket.emit('api:updateHeader', {
+ fields: ['username', 'picture', 'userslug']
+ });
+ }
+ });
- if (uid && jQuery.inArray(uid, users) !== -1) {
- el.find('i').remove();
- el.prepend('');
- } else {
- el.find('i').remove();
- el.prepend('');
+ socket.on('reconnecting', function (data) {
+ function showDisconnectModal() {
+ $('#disconnect-modal').modal({
+ backdrop: 'static',
+ show: true
+ });
+
+ $('#reload-button').on('click', function () {
+ $('#disconnect-modal').modal('hide');
+ window.location.reload();
+ });
}
- el.processed = true;
- });
- jQuery('button .username-field').each(function () {
- //DRY FAIL
- if (this.processed === true)
+ reconnecting = true;
+ reconnectTries++;
+
+ if (reconnectTries > 4) {
+ showDisconnectModal();
return;
-
- var el = jQuery(this),
- uid = el.parents('li').attr('data-uid');
-
- if (uid && jQuery.inArray(uid, users) !== -1) {
- el.parent().addClass('btn-success');
- } else {
- el.parent().addClass('btn-danger');
}
- el.processed = true;
+ app.alert({
+ alert_id: 'connection_alert',
+ title: 'Reconnecting',
+ message: 'You have disconnected from NodeBB, we will try to reconnect you.
',
+ type: 'warning',
+ timeout: 5000
+ });
});
- });
- app.enter_room('global');
+ socket.on('api:user.get_online_users', function (users) {
+ jQuery('a.username-field').each(function () {
+ if (this.processed === true)
+ return;
+ var el = jQuery(this),
+ uid = el.parents('li').attr('data-uid');
+ if (uid && jQuery.inArray(uid, users) !== -1) {
+ el.find('i').remove();
+ el.prepend('');
+ } else {
+ el.find('i').remove();
+ el.prepend('');
+ }
+
+ el.processed = true;
+ });
+ jQuery('button .username-field').each(function () {
+ //DRY FAIL
+ if (this.processed === true)
+ return;
+
+ var el = jQuery(this),
+ uid = el.parents('li').attr('data-uid');
+
+ if (uid && jQuery.inArray(uid, users) !== -1) {
+ el.parent().addClass('btn-success');
+ } else {
+ el.parent().addClass('btn-danger');
+ }
+
+ el.processed = true;
+ });
+ });
+
+ app.enter_room('global');
+ }
},
async: false
});
@@ -275,7 +280,7 @@ var socket,
if (active) {
jQuery('#main-nav li a').each(function () {
var href = this.getAttribute('href');
- if (active == "sort-posts" || active == "sort-reputation" || active == "search" || active == "latest")
+ if (active == "sort-posts" || active == "sort-reputation" || active == "search" || active == "latest" || active == "online")
active = 'users';
if (href && href.match(active)) {
jQuery(this.parentNode).addClass('active');
@@ -286,6 +291,7 @@ var socket,
$('span.timeago').timeago();
+
setTimeout(function () {
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
}, 100);
@@ -402,7 +408,8 @@ var socket,
function animateScroll() {
$('body,html').animate({
scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() - $('#header-menu').height()
- });
+ }, 400);
+ //$('body,html').scrollTop(scrollTo.offset().top - container.offset().top + container.scrollTop() - $('#header-menu').height());
}
if (!scrollTo.length && tid) {
@@ -427,19 +434,16 @@ var socket,
}
jQuery('document').ready(function () {
- translator.load('global');
-
$('#search-form').on('submit', function () {
var input = $(this).find('input');
ajaxify.go("search/" + input.val(), null, "search");
input.val('');
return false;
- })
+ });
});
showWelcomeMessage = location.href.indexOf('loggedin') !== -1;
- loadConfig();
-
+ app.loadConfig();
}());
\ No newline at end of file
diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js
index 527eed2180..25c6018e91 100644
--- a/public/src/forum/accountedit.js
+++ b/public/src/forum/accountedit.js
@@ -27,6 +27,7 @@ $(document).ready(function() {
},
uploadProgress: function(event, position, total, percent) {
+ console.log(percent);
$('#upload-progress-bar').css('width', percent + '%');
},
@@ -60,25 +61,25 @@ $(document).ready(function() {
});
function hideAlerts() {
- $('#alert-status').hide();
- $('#alert-success').hide();
- $('#alert-error').hide();
- $('#upload-progress-box').hide();
+ $('#alert-status').addClass('hide');
+ $('#alert-success').addClass('hide');
+ $('#alert-error').addClass('hide');
+ $('#upload-progress-box').addClass('hide');
}
function status(message) {
hideAlerts();
- $('#alert-status').text(message).show();
+ $('#alert-status').text(message).removeClass('hide');
}
function success(message) {
hideAlerts();
- $('#alert-success').text(message).show();
+ $('#alert-success').text(message).removeClass('hide');
}
function error(message) {
hideAlerts();
- $('#alert-error').text(message).show();
+ $('#alert-error').text(message).removeClass('hide');
}
function changeUserPicture(type) {
diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js
index 254da9a2ce..3f91308384 100644
--- a/public/src/forum/footer.js
+++ b/public/src/forum/footer.js
@@ -26,7 +26,6 @@
fields: ['username', 'picture', 'userslug']
});
socket.on('api:updateHeader', function(data) {
-
jQuery('#search-button').on('click', function() {
jQuery('#search-fields').removeClass('hide').show();
jQuery(this).hide();
@@ -59,6 +58,7 @@
if (data['username'])
userLabel.find('span').html(data['username']);
} else {
+ rightMenu.empty();
var userli = $('
- Interesed in writing plugins for NodeBB? + Interested in writing plugins for NodeBB?
Full documentation regarding plugin authoring can be found in the NodeBB Wiki.
diff --git a/public/templates/admin/settings.tpl b/public/templates/admin/settings.tpl
index c048730ca1..68fbacd632 100644
--- a/public/templates/admin/settings.tpl
+++ b/public/templates/admin/settings.tpl
@@ -9,7 +9,9 @@
-
+
+
+
{topics.teaser_text}
-- {topics.teaser_username} posted -
+ +| t |