From f946918176de45f7eaca6138a68ddc10b312dc51 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 1 Nov 2013 14:08:39 -0400 Subject: [PATCH 01/15] fixed anon images in topic view, anon users arent added to active users for a category --- src/categories.js | 3 ++- src/topics.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/categories.js b/src/categories.js index 95baee275e..61dbbfb82f 100644 --- a/src/categories.js +++ b/src/categories.js @@ -425,7 +425,8 @@ var RDB = require('./redis.js'), }; Categories.addActiveUser = function(cid, uid) { - RDB.sadd('cid:' + cid + ':active_users', uid); + if(parseInt(uid, 10)) + RDB.sadd('cid:' + cid + ':active_users', uid); }; Categories.removeActiveUser = function(cid, uid) { diff --git a/src/topics.js b/src/topics.js index c95b3be200..1fd5dbc94b 100644 --- a/src/topics.js +++ b/src/topics.js @@ -336,7 +336,7 @@ var RDB = require('./redis.js'), topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important'; topicData.teaser_text = topicInfo.teaserInfo.text || '', topicData.teaser_username = topicInfo.teaserInfo.username || ''; - topicData.teaser_userpicture = topicInfo.teaserInfo.picture || ''; + topicData.teaser_userpicture = topicInfo.teaserInfo.picture || require('gravatar').url('', {}, https = nconf.get('https')); topicData.teaser_pid = topicInfo.teaserInfo.pid; topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? (new Date(parseInt(topicInfo.teaserInfo.timestamp, 10)).toISOString()) : ''; From 404865c32ec2e0b8cc41dd4989d668b875369db2 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 1 Nov 2013 14:55:55 -0400 Subject: [PATCH 02/15] closes #429 --- public/src/forum/footer.js | 24 ------------------------ public/src/forum/home.js | 30 ++++++++++++++++++++++++++++++ public/templates/footer.tpl | 23 ----------------------- public/templates/home.tpl | 25 ++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 48 deletions(-) create mode 100644 public/src/forum/home.js diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index fa2240a93c..df9c52ac6f 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -1,28 +1,4 @@ (function() { - var stats_users = document.getElementById('stats_users'), - stats_topics = document.getElementById('stats_topics'), - stats_posts = document.getElementById('stats_posts'), - stats_online = document.getElementById('stats_online'), - user_label = document.getElementById('user_label'); - - socket.emit('user.count', {}); - socket.on('user.count', function(data) { - stats_users.innerHTML = utils.makeNumberHumanReadable(data.count); - stats_users.title = data.count; - }); - - socket.emit('post.stats'); - socket.on('post.stats', function(data) { - stats_topics.innerHTML = utils.makeNumberHumanReadable(data.topics); - stats_topics.title = data.topics; - stats_posts.innerHTML = utils.makeNumberHumanReadable(data.posts); - stats_posts.title = data.posts; - }); - - socket.emit('api:user.active.get'); - socket.on('api:user.active.get', function(data) { - stats_online.innerHTML = data.users; - }); socket.emit('api:updateHeader', { fields: ['username', 'picture', 'userslug'] diff --git a/public/src/forum/home.js b/public/src/forum/home.js new file mode 100644 index 0000000000..971be662a6 --- /dev/null +++ b/public/src/forum/home.js @@ -0,0 +1,30 @@ +define(function() { + var home = {}; + + home.init = function() { + + ajaxify.register_events([ + 'user.count', + 'post.stats', + 'api:user.active.get' + ]); + + socket.emit('user.count', {}); + socket.on('user.count', function(data) { + $('#stats_users').html(utils.makeNumberHumanReadable(data.count)).attr('title', data.count); + }); + + socket.emit('post.stats'); + socket.on('post.stats', function(data) { + $('#stats_topics').html(utils.makeNumberHumanReadable(data.topics)).attr('title', data.topics); + $('#stats_posts').html(utils.makeNumberHumanReadable(data.posts)).attr('title', data.posts); + }); + + socket.emit('api:user.active.get'); + socket.on('api:user.active.get', function(data) { + $('#stats_online').html(data.users); + }); + } + + return home; +}); diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index 85d380fbc2..85343f1e32 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -60,29 +60,6 @@ diff --git a/public/templates/home.tpl b/public/templates/home.tpl index da640ebdc7..48032a83b3 100644 --- a/public/templates/home.tpl +++ b/public/templates/home.tpl @@ -26,4 +26,27 @@ - \ No newline at end of file + + + From e12d02f29ca2f047ef123537b99e27d2b8e6172b Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 1 Nov 2013 15:04:54 -0400 Subject: [PATCH 03/15] jquery best --- public/src/forum/category.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 07d64471d3..db38581b5c 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -27,8 +27,7 @@ define(function () { return false; }); - var new_post = document.getElementById('new_post'); - new_post.onclick = function () { + $('#new_post').on('click', function () { require(['composer'], function (cmp) { cmp.push(0, cid); }); From 6931695e647c3750fe8158b622a5656614ffbde1 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 1 Nov 2013 15:07:41 -0400 Subject: [PATCH 04/15] when you type correctly --- public/src/forum/category.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/src/forum/category.js b/public/src/forum/category.js index db38581b5c..4990ca2814 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -31,7 +31,7 @@ define(function () { require(['composer'], function (cmp) { cmp.push(0, cid); }); - } + }); ajaxify.register_events([ 'event:new_topic' @@ -80,6 +80,7 @@ define(function () { }; Category.onNewTopic = function(data) { + console.log(data); var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }), From a21d91d8706fefebb82b1a1f696d22466314ce12 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 1 Nov 2013 16:01:48 -0400 Subject: [PATCH 05/15] closes #476 --- public/src/forum/category.js | 19 ++++++++++++++++++- public/templates/category.tpl | 4 ++-- src/categories.js | 2 +- src/topics.js | 4 +++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 4990ca2814..4eaa500191 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -80,7 +80,6 @@ define(function () { }; Category.onNewTopic = function(data) { - console.log(data); var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }), @@ -106,9 +105,27 @@ define(function () { } socket.emit('api:categories.getRecentReplies', templates.get('category_id')); + + addActiveUser(data); + $('#topics-container span.timeago').timeago(); } + function addActiveUser(data) { + var activeUser = $('.category-sidebar .active-users').find('a[data-uid="' + data.uid + '"]'); + if(!activeUser.length) { + var newUser = templates.prepare(templates['category'].blocks['active_users']).parse({ + active_users: [{ + uid: data.uid, + username: data.username, + userslug: data.userslug, + picture: data.teaser_userpicture + }] + }); + $(newUser).appendTo($('.category-sidebar .active-users')); + } + } + Category.onTopicsLoaded = function(topics) { var html = templates.prepare(templates['category'].blocks['topics']).parse({ diff --git a/public/templates/category.tpl b/public/templates/category.tpl index 5efceef0c8..6d23ffc495 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -76,9 +76,9 @@
[[category:sidebar.active_participants]]
-
+
- +
diff --git a/src/categories.js b/src/categories.js index 61dbbfb82f..d39dc1a729 100644 --- a/src/categories.js +++ b/src/categories.js @@ -96,7 +96,7 @@ var RDB = require('./redis.js'), } function getActiveUsers(next) { - user.getMultipleUserFields(active_users, ['username', 'userslug', 'picture'], function(err, users) { + user.getMultipleUserFields(active_users, ['uid', 'username', 'userslug', 'picture'], function(err, users) { next(err, users); }); } diff --git a/src/topics.js b/src/topics.js index 1fd5dbc94b..57c500b4c9 100644 --- a/src/topics.js +++ b/src/topics.js @@ -461,6 +461,7 @@ var RDB = require('./redis.js'), topicData.badgeclass = hasRead ? '' : 'badge-important'; topicData.teaser_text = teaser.text || ''; topicData.teaser_username = teaser.username || ''; + topicData.userslug = teaser.userslug || ''; topicData.teaser_timestamp = teaser.timestamp ? (new Date(parseInt(teaser.timestamp,10)).toISOString()) : ''; topicData.teaser_userpicture = teaser.picture; @@ -606,7 +607,7 @@ var RDB = require('./redis.js'), if (!err) { posts.getPostFields(pid, ['pid', 'content', 'uid', 'timestamp'], function(postData) { - user.getUserFields(postData.uid, ['username', 'picture'], function(err, userData) { + user.getUserFields(postData.uid, ['username', 'userslug', 'picture'], function(err, userData) { if (err) return callback(err, null); @@ -615,6 +616,7 @@ var RDB = require('./redis.js'), returnObj = { "pid": postData.pid, "username": userData.username, + "userslug": userData.userslug, "picture": userData.picture, "timestamp": timestamp }; From 7296b701fa40e9995bc63e77dc8a4cd4da26d004 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Fri, 1 Nov 2013 16:25:48 -0400 Subject: [PATCH 06/15] recent reply style change --- public/src/forum/category.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 4eaa500191..c3d0799c26 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -58,11 +58,12 @@ define(function () { li.innerHTML = '' + '' + + ''+ posts[i].username + '' + '

' + posts[i].content + '

' + - '

' + posts[i].username + ' -

' + - '
'; + '' + + ''; frag.appendChild(li.cloneNode(true)); recent_replies.appendChild(frag); From 5a96f5f64bc8b26578acfa09a25d958fd47c44e3 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 11:53:44 -0500 Subject: [PATCH 07/15] removed filterBannedPosts method that seemed unused -- monkey-patching install script to remember old values (if present, otherwise use defaults) --- app.js | 4 ++++ src/install.js | 16 ++++++++-------- src/posts.js | 11 +++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app.js b/app.js index e8b662bbd4..2a4fb645ec 100644 --- a/app.js +++ b/app.js @@ -121,6 +121,10 @@ winston.warn('Configuration not found, starting NodeBB setup'); } + nconf.file({ + file: __dirname + '/config.json' + }); + var install = require('./src/install'); winston.info('Welcome to NodeBB!'); diff --git a/src/install.js b/src/install.js index 01a3806656..8541a0e15e 100644 --- a/src/install.js +++ b/src/install.js @@ -12,44 +12,44 @@ var async = require('async'), questions: [{ name: 'base_url', description: 'URL of this installation', - 'default': 'http://localhost', + 'default': nconf.get('base_url') || 'http://localhost', pattern: /^http(?:s)?:\/\//, message: 'Base URL must begin with \'http://\' or \'https://\'', }, { name: 'port', description: 'Port number of your NodeBB', - 'default': 4567, + 'default': nconf.get('port') || 4567, pattern: /[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]/, message: 'Please enter a value betweeen 1 and 65535' }, { name: 'use_port', description: 'Use a port number to access NodeBB?', - 'default': 'y', + 'default': (nconf.get('use_port') ? 'y' : 'n') || 'y', pattern: /y[es]*|n[o]?/, message: 'Please enter \'yes\' or \'no\'', }, { name: 'secret', description: 'Please enter a NodeBB secret', - 'default': utils.generateUUID() + 'default': nconf.get('secret') || utils.generateUUID() }, { name: 'redis:host', description: 'Host IP or address of your Redis instance', - 'default': '127.0.0.1' + 'default': nconf.get('redis:host') || '127.0.0.1' }, { name: 'redis:port', description: 'Host port of your Redis instance', - 'default': 6379 + 'default': nconf.get('redis:port') || 6379 }, { name: 'redis:password', description: 'Password of your Redis database' }, { name: "redis:database", description: "Which database to use (0..n)", - 'default': 0 + 'default': nconf.get('redis:database') || 0 }, { name: 'bind_address', description: 'IP or Hostname to bind to', - 'default': '0.0.0.0' + 'default': nconf.get('bind_address') || '0.0.0.0' }], setup: function (callback) { async.series([ diff --git a/src/posts.js b/src/posts.js index 06bac443b2..4c428e68fc 100644 --- a/src/posts.js +++ b/src/posts.js @@ -132,12 +132,6 @@ var RDB = require('./redis.js'), }); }; - Posts.filterBannedPosts = function(posts) { - return posts.filter(function(post) { - return post.user_banned === '0'; - }); - } - // TODO: this function is never called except from some debug route. clean up? Posts.getPostData = function(pid, callback) { RDB.hgetall('post:' + pid, function(err, data) { @@ -146,8 +140,9 @@ var RDB = require('./redis.js'), if (!err) callback(newData); else callback(data); }); - } else - console.log(err); + } else { + winston.error(err); + } }); } From e480b1bace23c8228c7ecc6b58dcbbbe721a3f51 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 12:39:24 -0500 Subject: [PATCH 08/15] - removed reference to deprecated local modules folder in plugins.init --- src/plugins.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index 51e45716b7..fe63e8f35c 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -27,10 +27,8 @@ var fs = require('fs'), function(plugins, next) { if (plugins && Array.isArray(plugins) && plugins.length > 0) { async.each(plugins, function(plugin, next) { - var pluginPath = path.join(__dirname, '../plugins/', plugin), - modulePath = path.join(__dirname, '../node_modules/', plugin); - if (fs.existsSync(pluginPath)) _self.loadPlugin(pluginPath, next); - else if (fs.existsSync(modulePath)) _self.loadPlugin(modulePath, next); + var modulePath = path.join(__dirname, '../node_modules/', plugin); + if (fs.existsSync(modulePath)) _self.loadPlugin(modulePath, next); else { if (global.env === 'development') winston.warn('[plugins] Plugin \'' + plugin + '\' not found'); next(); // Ignore this plugin silently From 4353a9da25d26cbfc681b78ca525abe9627447df Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 17:15:18 -0500 Subject: [PATCH 09/15] issue #478 - hot-swapping of plugins --- .gitignore | 12 +++------- src/plugins.js | 53 ++++++++++++++++++++++++++++--------------- src/routes/plugins.js | 25 ++++++++++++++++++++ src/webserver.js | 16 +++---------- 4 files changed, 66 insertions(+), 40 deletions(-) create mode 100644 src/routes/plugins.js diff --git a/.gitignore b/.gitignore index 40ea2a6a86..478600f89f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,3 @@ -################# -## npm -################# - npm-debug.log node_modules/ sftp-config.json @@ -9,12 +5,10 @@ config.json public/src/nodebb.min.js public/config.json public/css/*.css -public/themes/* -!/public/themes/vanilla -!/public/themes/cerulean -!/public/themes/modern *.sublime-project *.sublime-workspace -plugins/* .project *.swp +Vagrantfile +.vagrant +provision.sh \ No newline at end of file diff --git a/src/plugins.js b/src/plugins.js index fe63e8f35c..4ce5104d9a 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -17,8 +17,31 @@ var fs = require('fs'), if (this.initialized) return; if (global.env === 'development') winston.info('[plugins] Initializing plugins system'); + this.reload(function(err) { + if (err) { + if (global.env === 'development') winston.info('[plugins] NodeBB encountered a problem while loading plugins', err.message); + return; + } + + if (global.env === 'development') winston.info('[plugins] Plugins OK'); + + plugins.initialized = true; + plugins.readyEvent.emit('ready'); + }); + }, + ready: function(callback) { + if (!this.initialized) this.readyEvent.once('ready', callback); + else callback(); + }, + initialized: false, + reload: function(callback) { var _self = this; + // Resetting all local plugin data + this.loadedHooks = {}; + this.staticDirs = {}; + this.cssFiles.length = 0; + // Read the list of activated plugins and require their libraries async.waterfall([ function(next) { @@ -47,23 +70,8 @@ var fs = require('fs'), next(); } - ], function(err) { - if (err) { - if (global.env === 'development') winston.info('[plugins] NodeBB encountered a problem while loading plugins', err.message); - return; - } - - if (global.env === 'development') winston.info('[plugins] Plugins OK'); - - _self.initialized = true; - _self.readyEvent.emit('ready'); - }); - }, - ready: function(callback) { - if (!this.initialized) this.readyEvent.once('ready', callback); - else callback(); + ], callback); }, - initialized: false, loadPlugin: function(pluginPath, callback) { var _self = this; @@ -80,16 +88,25 @@ var fs = require('fs'), fs.exists(libraryPath, function(exists) { if (exists) { - _self.libraries[pluginData.id] = require(libraryPath); + if (!_self.libraries[pluginData.id]) { + _self.libraries[pluginData.id] = require(libraryPath); + } + // Register hooks for this plugin if (pluginData.hooks && Array.isArray(pluginData.hooks) && pluginData.hooks.length > 0) { async.each(pluginData.hooks, function(hook, next) { _self.registerHook(pluginData.id, hook, next); }, next); } + } else { + winston.warn('[plugins.reload] Library not found for plugin: ' + pluginData.id); + next(); } }); - } else next(); + } else { + winston.warn('[plugins.reload] Library not found for plugin: ' + pluginData.id); + next(); + } }, function(next) { // Static Directories for Plugins diff --git a/src/routes/plugins.js b/src/routes/plugins.js new file mode 100644 index 0000000000..33e384e8d2 --- /dev/null +++ b/src/routes/plugins.js @@ -0,0 +1,25 @@ +var nconf = require('nconf'), + path = require('path'), + fs = require('fs'), + Plugins = require('../plugins'), + + PluginRoutes = function(app) { + // Static Assets + app.get('/plugins/:id/*', function(req, res) { + var relPath = req.url.replace('/plugins/' + req.params.id, ''); + if (Plugins.staticDirs[req.params.id]) { + var fullPath = path.join(Plugins.staticDirs[req.params.id], relPath); + fs.exists(fullPath, function(exists) { + if (exists) { + res.sendfile(fullPath); + } else { + res.redirect('/404'); + } + }) + } else { + res.redirect('/404'); + } + }); + }; + +module.exports = PluginRoutes; \ No newline at end of file diff --git a/src/webserver.js b/src/webserver.js index f82c01fa29..bf847d960f 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -151,19 +151,6 @@ var express = require('express'), }, function(next) { async.parallel([ - function(next) { - // Static Directories for NodeBB Plugins - plugins.ready(function () { - for (d in plugins.staticDirs) { - app.use(nconf.get('relative_path') + '/plugins/' + d, express.static(plugins.staticDirs[d])); - if (process.env.NODE_ENV === 'development') { - winston.info('Static directory routed for plugin: ' + d); - } - } - - next(); - }); - }, function(next) { // Theme configuration RDB.hmget('config', 'theme:type', 'theme:id', 'theme:staticDir', 'theme:templates', function(err, themeData) { @@ -701,6 +688,9 @@ var express = require('express'), }); }); + // Other routes + require('./routes/plugins')(app); + // Debug routes if (process.env.NODE_ENV === 'development') { require('./routes/debug')(app); From 1e2100902ca3cb91e4480f205a5c1a3da6dff518 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 17:25:07 -0500 Subject: [PATCH 10/15] closed #478 --- src/plugins.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index 4ce5104d9a..1f39c5e5a7 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -237,12 +237,15 @@ var fs = require('fs'), // (De)activation Hooks plugins.fireHook('action:plugin.' + (active ? 'de' : '') + 'activate', id); - if (callback) { - callback({ - id: id, - active: !active - }); - } + // Reload meta data + plugins.reload(function() { + if (callback) { + callback({ + id: id, + active: !active + }); + } + }); }); }); }, From cc78f6f155d98b14965dd4015da250fbf8fb80e6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 17:29:14 -0500 Subject: [PATCH 11/15] moved firing of plugin activation to after a plugin reload --- src/plugins.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index 1f39c5e5a7..97394884db 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -234,11 +234,11 @@ var fs = require('fs'), return; } - // (De)activation Hooks - plugins.fireHook('action:plugin.' + (active ? 'de' : '') + 'activate', id); - // Reload meta data plugins.reload(function() { + // (De)activation Hooks + plugins.fireHook('action:plugin.' + (active ? 'de' : '') + 'activate', id); + if (callback) { callback({ id: id, From d69847c54ead0869b38f4969acbd1d171d3bb78c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 17:49:03 -0500 Subject: [PATCH 12/15] NodeBB will now fire hooks if a config setting changes --- src/websockets.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/websockets.js b/src/websockets.js index ea3bd0dca0..aa650d4173 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -666,10 +666,17 @@ module.exports.init = function(io) { socket.on('api:config.set', function(data) { meta.configs.set(data.key, data.value, function(err) { - if (!err) socket.emit('api:config.set', { - status: 'ok' - }); - /* Another hook, for my (adarqui's) logger module */ + if (!err) { + socket.emit('api:config.set', { + status: 'ok' + }); + + plugins.fireHook('action:config.set', { + key: data.key, + value: data.value + }); + } + logger.monitorConfig(this, data); }); }); From 01f0131f5d4cc6e81020d910503f30744cda990a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 3 Nov 2013 17:50:16 -0500 Subject: [PATCH 13/15] upping markdown minver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 168983c9cd..b59f9c96bd 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "uglify-js": "~2.4.0", "validator": "~1.5.1", "nodebb-plugin-mentions": "~0.1.14", - "nodebb-plugin-markdown": "~0.1.7", + "nodebb-plugin-markdown": "~0.1.8", "nodebb-theme-vanilla": "designcreateplay/nodebb-theme-vanilla", "nodebb-theme-cerulean": "0.0.5", "cron": "~1.0.1" From d9e364cd86f672caca38ef360b8e6a82d6dab6f1 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 4 Nov 2013 12:14:36 -0500 Subject: [PATCH 14/15] fixes #480 --- public/src/translator.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/src/translator.js b/public/src/translator.js index 237969f609..43dc448b37 100644 --- a/public/src/translator.js +++ b/public/src/translator.js @@ -80,9 +80,10 @@ if (keys.hasOwnProperty(key)) { var variables = keys[key].split(/[,][?\s+]/); - var parsedKey = keys[key].replace('[[', '').replace(']]', '').split(':'), - languageFile = parsedKey[0]; - + var parsedKey = keys[key].replace('[[', '').replace(']]', '').split(':'); + if (!(parsedKey[0] && parsedKey[1])) continue; + + var languageFile = parsedKey[0]; parsedKey = parsedKey[1].split(',')[0]; if (files.loaded[languageFile]) { From bbb045698d954112086fe2abcec9f057a0efbc13 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Mon, 4 Nov 2013 12:37:06 -0500 Subject: [PATCH 15/15] closes #481 --- public/src/app.js | 1 + public/src/modules/chat.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index eb4cf4a028..026c66496c 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -339,6 +339,7 @@ var socket, chatModal = chat.getModal(touid); } chat.load(chatModal.attr('UUID')); + chat.center(chatModal); }); } diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index aad7331faf..7239b20db7 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -85,7 +85,7 @@ define(['taskbar'], function(taskbar) { return chatModal; } - function center(chatModal) { + module.center = function(chatModal) { chatModal.css("position", "fixed"); chatModal.css("top", "100px"); chatModal.css("left", Math.max(0, (($(window).width() - $(chatModal).outerWidth()) / 2) + $(window).scrollLeft()) + "px"); @@ -95,7 +95,6 @@ define(['taskbar'], function(taskbar) { module.load = function(uuid) { var chatModal = $('div[UUID="'+uuid+'"]'); chatModal.show(); - center(chatModal); module.bringModalToTop(chatModal); checkOnlineStatus(chatModal); }