diff --git a/public/src/forum/admin/themes.js b/public/src/forum/admin/themes.js index 4bbb903def..2aa4bc8861 100644 --- a/public/src/forum/admin/themes.js +++ b/public/src/forum/admin/themes.js @@ -1,3 +1,6 @@ +"use strict"; +/*global define, socket, app, bootbox, tabIndent, config, RELATIVE_PATH*/ + define(['forum/admin/settings'], function(Settings) { var Themes = {}; @@ -266,10 +269,10 @@ define(['forum/admin/settings'], function(Settings) { for (var i in area.data) { if (area.data.hasOwnProperty(i)) { - var data = area.data[i], - widgetEl = $('.available-widgets [data-widget="' + data.widget + '"]').clone(); + var widgetData = area.data[i], + widgetEl = $('.available-widgets [data-widget="' + widgetData.widget + '"]').clone(); - widgetArea.append(populateWidget(widgetEl, data.data)); + widgetArea.append(populateWidget(widgetEl, widgetData.data)); appendToggle(widgetEl); } } diff --git a/src/notifications.js b/src/notifications.js index 66eed78704..90e4dd9678 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -1,3 +1,5 @@ +'use strict'; + var async = require('async'), winston = require('winston'), cron = require('cron').CronJob, @@ -8,7 +10,6 @@ var async = require('async'), User = require('./user'); (function(Notifications) { - "use strict"; Notifications.init = function() { if (process.env.NODE_ENV === 'development') { @@ -63,11 +64,11 @@ var async = require('async'), Notifications.create = function(data, callback) { /** - * data.uniqueId is used solely to override stale nids. - * If a new nid is pushed to a user and an existing nid in the user's - * (un)read list contains the same uniqueId, it will be removed, and - * the new one put in its place. - */ + *data.uniqueId is used solely to override stale nids. + * If a new nid is pushed to a user and an existing nid in the user's + * (un)read list contains the same uniqueId, it will be removed, and + * the new one put in its place. + */ // Add default values to data Object if not already set var defaults = { @@ -249,10 +250,10 @@ var async = require('async'), async.each(expiredNids, function(nid, next) { async.parallel([ function(next) { - db.setRemove('notifications', nid, next) + db.setRemove('notifications', nid, next); }, function(next) { - db.delete('notifications:' + nid, next) + db.delete('notifications:' + nid, next); } ], function(err) { numPruned++; diff --git a/src/routes/index.js b/src/routes/index.js index 80c3b45055..8dc5be4200 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -12,12 +12,8 @@ var nconf = require('nconf'), pluginRoutes = require('./plugins'); -/** -* Every view has an associated API route. -* -*/ + function mainRoutes(app, middleware, controllers) { - /* Main */ app.get('/', middleware.buildHeader, controllers.home); app.get('/api/home', controllers.home); @@ -38,8 +34,9 @@ function mainRoutes(app, middleware, controllers) { app.get('/reset/:code?', middleware.buildHeader, controllers.reset); app.get('/api/reset/:code?', controllers.reset); +} - /* Static Pages */ +function staticRoutes(app, middleware, controllers) { app.get('/404', middleware.buildHeader, controllers.static['404']); app.get('/api/404', controllers.static['404']); @@ -48,12 +45,14 @@ function mainRoutes(app, middleware, controllers) { app.get('/500', middleware.buildHeader, controllers.static['500']); app.get('/api/500', controllers.static['500']); +} - /* Topics */ +function topicRoutes(app, middleware, controllers) { app.get('/topic/:topic_id/:slug?', middleware.buildHeader, controllers.topics.get); app.get('/api/topic/:topic_id/:slug?', controllers.topics.get); +} - /* Categories */ +function categoryRoutes(app, middleware, controllers) { app.get('/popular/:set?', middleware.buildHeader, controllers.categories.popular); app.get('/api/popular/:set?', controllers.categories.popular); @@ -68,8 +67,9 @@ function mainRoutes(app, middleware, controllers) { app.get('/category/:category_id/:slug?', middleware.buildHeader, controllers.categories.get); app.get('/api/category/:category_id/:slug?', controllers.categories.get); +} - /* Accounts */ +function accountRoutes(app, middleware, controllers) { app.get('/user/:userslug', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.accounts.getAccount); app.get('/api/user/:userslug', middleware.checkGlobalPrivacySettings, controllers.accounts.getAccount); @@ -94,8 +94,9 @@ function mainRoutes(app, middleware, controllers) { app.get('/notifications', middleware.buildHeader, middleware.authenticate, controllers.accounts.getNotifications); app.get('/api/notifications', middleware.authenticate, controllers.accounts.getNotifications); +} - /* Users */ +function userRoutes(app, middleware, controllers) { app.get('/users', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.users.getOnlineUsers); app.get('/api/users', middleware.checkGlobalPrivacySettings, controllers.users.getOnlineUsers); @@ -128,7 +129,18 @@ module.exports = function(app, middleware) { apiRoutes(app, middleware, controllers); feedRoutes(app, middleware, controllers); pluginRoutes(app, middleware, controllers); + + /** + * Every view has an associated API route. + * + */ mainRoutes(app, middleware, controllers); + staticRoutes(app, middleware, controllers); + topicRoutes(app, middleware, controllers); + categoryRoutes(app, middleware, controllers); + accountRoutes(app, middleware, controllers); + userRoutes(app, middleware, controllers); + }); if (process.env.NODE_ENV === 'development') {