diff --git a/client/helpers/config.js b/client/helpers/config.js index 48e44adce..66614e4c8 100644 --- a/client/helpers/config.js +++ b/client/helpers/config.js @@ -20,7 +20,7 @@ SharrreOptions={ share: { googlePlus: true, // facebook: true, - twitter: true, + twitter: true }, buttons: { googlePlus: {size: 'tall', annotation:'bubble'}, diff --git a/client/views/comments/comment_edit.js b/client/views/comments/comment_edit.js index 3e5dd5138..7ade1ab7c 100644 --- a/client/views/comments/comment_edit.js +++ b/client/views/comments/comment_edit.js @@ -10,7 +10,7 @@ Template[getTemplate('comment_edit')].rendered = function(){ }); } } -} +}; Template[getTemplate('comment_edit')].events({ 'click input[type=submit]': function(e, instance){ @@ -38,7 +38,7 @@ Template[getTemplate('comment_edit')].events({ if(confirm(i18n.t("Are you sure?"))){ Meteor.call('removeComment', comment._id); - Router.go("/posts/"+comment.postId) + Router.go("/posts/"+comment.postId); throwError("Your comment has been deleted."); // Router.go("/comments/deleted"); } diff --git a/client/views/comments/comment_form.js b/client/views/comments/comment_form.js index 18a47fddc..83de2c482 100644 --- a/client/views/comments/comment_form.js +++ b/client/views/comments/comment_form.js @@ -2,7 +2,7 @@ Template[getTemplate('comment_form')].helpers({ canComment: function(){ return canComment(Meteor.user()); } -}) +}); Template[getTemplate('comment_form')].rendered = function(){ if(Meteor.user() && !this.editor){ @@ -11,7 +11,7 @@ Template[getTemplate('comment_form')].rendered = function(){ $(window.editor).closest('form').find('input[type="submit"]').click(); }); } -} +}; Template[getTemplate('comment_form')].events({ 'submit form': function(e, instance){ diff --git a/client/views/comments/comment_item.js b/client/views/comments/comment_item.js index 57fe48994..4f8112b26 100644 --- a/client/views/comments/comment_item.js +++ b/client/views/comments/comment_item.js @@ -60,7 +60,7 @@ Template[getTemplate('comment_item')].created = function() { // if comments are supposed to be queued, then queue this comment on create this.isQueued = window.queueComments; window.openedComments = []; -} +}; Template[getTemplate('comment_item')].helpers({ comment_item: function () { @@ -138,7 +138,7 @@ Template[getTemplate('comment_item')].rendered=function(){ // // TODO: take the user back to their previous scroll position // } // } -} +}; Template.comment_item.events({ 'click .queue-comment': function(e){ diff --git a/client/views/comments/comment_list.js b/client/views/comments/comment_list.js index 2bb1947f0..b87a37e9d 100644 --- a/client/views/comments/comment_list.js +++ b/client/views/comments/comment_list.js @@ -1,6 +1,6 @@ Template[getTemplate('comment_list')].created = function(){ postObject = this.data; -} +}; Template[getTemplate('comment_list')].helpers({ comment_item: function () { @@ -16,4 +16,4 @@ Template[getTemplate('comment_list')].helpers({ Template[getTemplate('comment_list')].rendered = function(){ // once all comments have been rendered, activate comment queuing for future real-time comments window.queueComments = true; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/client/views/common/error_item.js b/client/views/common/error_item.js index 42c693afc..ba209e730 100644 --- a/client/views/common/error_item.js +++ b/client/views/common/error_item.js @@ -1,10 +1,10 @@ Template[getTemplate('error_item')].helpers({ -}) +}); Template[getTemplate('error_item')].created = function(){ var error_id=this.data._id; Meteor.setTimeout(function(){ Errors.update(error_id, {$set: {seen:true}}); }, 100); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/client/views/common/layout.js b/client/views/common/layout.js index 7c15d6c7d..9b7f7af13 100644 --- a/client/views/common/layout.js +++ b/client/views/common/layout.js @@ -30,11 +30,11 @@ Template[getTemplate('layout')].helpers({ Template[getTemplate('layout')].created = function(){ Session.set('currentScroll', null); -} +}; Template[getTemplate('layout')].rendered = function(){ if(currentScroll=Session.get('currentScroll')){ $('body').scrollTop(currentScroll); Session.set('currentScroll', null); } -} +}; diff --git a/client/views/email/unsubscribe.js b/client/views/email/unsubscribe.js index e9c02bd6a..3acc0ad04 100644 --- a/client/views/email/unsubscribe.js +++ b/client/views/email/unsubscribe.js @@ -8,7 +8,7 @@ Template[getTemplate('unsubscribe')].created = function(){ } }); trackEvent('notificationsUnsubcribe', {hash: hash}); -} +}; Template[getTemplate('unsubscribe')].helpers({ unsubscribed : function(){ diff --git a/client/views/errors/loading.js b/client/views/errors/loading.js index 9fc349acb..c49a0040e 100644 --- a/client/views/errors/loading.js +++ b/client/views/errors/loading.js @@ -2,4 +2,4 @@ Template[getTemplate('loading')].helpers({ log: function () { console.log('loading…') } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/client/views/nav/mobile_nav.js b/client/views/nav/mobile_nav.js index b08610404..13390b898 100644 --- a/client/views/nav/mobile_nav.js +++ b/client/views/nav/mobile_nav.js @@ -20,14 +20,14 @@ Template[getTemplate('mobile_nav')].helpers({ }); Template[getTemplate('mobile_nav')].events({ - 'click .dropdown-sub-level':function(event){ + 'click .dropdown-sub-level': function () { $('body').toggleClass('mobile-nav-open'); } }); Template[getTemplate('mobile_nav')].rendered = function () { $('.mobile-nav .dropdown-menu').hide(); -} +}; Template[getTemplate('mobile_nav')].events({ 'click .dropdown-top-level': function (e) { diff --git a/client/views/nav/nav.js b/client/views/nav/nav.js index 301ae6297..3c7248c7a 100644 --- a/client/views/nav/nav.js +++ b/client/views/nav/nav.js @@ -62,7 +62,7 @@ Template[getTemplate('nav')].events({ e.preventDefault(); Router.go('/account'); }, - 'click #login-name-link': function(e){ + 'click #login-name-link': function(){ if(Meteor.user() && !$('account-link').exists()){ $('#login-buttons-logout').before('View Profile'); $('#login-buttons-logout').before('Edit Account'); diff --git a/client/views/posts/post_item.js b/client/views/posts/post_item.js index d23346890..48a446f17 100644 --- a/client/views/posts/post_item.js +++ b/client/views/posts/post_item.js @@ -1,7 +1,7 @@ var filteredModules = function (group) { // return the modules whose positions start with group return _.filter(postModules, function(module){return module.position.indexOf(group) == 0}); -} +}; var post = {}; diff --git a/client/views/posts/post_page.js b/client/views/posts/post_page.js index 75c5668f7..3cf622398 100644 --- a/client/views/posts/post_page.js +++ b/client/views/posts/post_page.js @@ -11,10 +11,10 @@ Template[getTemplate('post_page')].helpers({ comment_list: function () { return getTemplate('comment_list'); } -}) +}); Template[getTemplate('post_page')].rendered = function(){ $('body').scrollTop(0); if(this.data) // XXX document.title = $(".post-title").text(); -} +}; diff --git a/client/views/users/user_edit.js b/client/views/users/user_edit.js index 834749e87..11ad62d15 100644 --- a/client/views/users/user_edit.js +++ b/client/views/users/user_edit.js @@ -32,7 +32,7 @@ Template[getTemplate('user_edit')].helpers({ hasPassword: function () { return hasPassword(Meteor.user()); } -}) +}); Template[getTemplate('user_edit')].events({ 'submit #account-form': function(e){ diff --git a/client/views/users/user_item.js b/client/views/users/user_item.js index b6154f314..cfc566ef4 100644 --- a/client/views/users/user_item.js +++ b/client/views/users/user_item.js @@ -66,4 +66,4 @@ Template[getTemplate('user_item')].events({ if(confirm(i18n.t("Are you sure you want to delete ")+getDisplayName(instance.data)+"?")) Meteor.users.remove(instance.data._id); } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/client/views/users/user_profile.js b/client/views/users/user_profile.js index a970f51d5..d03739c00 100644 --- a/client/views/users/user_profile.js +++ b/client/views/users/user_profile.js @@ -3,7 +3,7 @@ Template[getTemplate('user_profile')].created = function () { Session.set('upvotedPostsShown', 5); Session.set('downvotedPostsShown', 5); Session.set('commentsShown', 5); -} +}; Template[getTemplate('user_profile')].helpers({ avatarUrl: function() { diff --git a/collections/comments.js b/collections/comments.js index 79273dd46..08be787ff 100644 --- a/collections/comments.js +++ b/collections/comments.js @@ -17,7 +17,7 @@ Comments = new Meteor.Collection("comments", { optional: true }, body: { - type: String, + type: String }, htmlBody: { type: String, @@ -102,9 +102,9 @@ Comments.before.update(function (userId, doc, fieldNames, modifier, options) { Meteor.methods({ comment: function(postId, parentCommentId, text){ var user = Meteor.user(), - post=Posts.findOne(postId), - postUser=Meteor.users.findOne(post.userId), - timeSinceLastComment=timeSinceLast(user, Comments), + post = Posts.findOne(postId), + postUser = Meteor.users.findOne(post.userId), + timeSinceLastComment = timeSinceLast(user, Comments), commentInterval = Math.abs(parseInt(getSetting('commentInterval',15))), now = new Date(); @@ -157,13 +157,13 @@ Meteor.methods({ var notificationProperties = { comment: _.pick(comment, '_id', 'userId', 'author', 'body'), post: _.pick(post, '_id', 'title', 'url') - } + }; if(!this.isSimulation){ if(parentCommentId){ // child comment - var parentComment=Comments.findOne(parentCommentId); - var parentUser=Meteor.users.findOne(parentComment.userId); + var parentComment = Comments.findOne(parentCommentId); + var parentUser = Meteor.users.findOne(parentComment.userId); notificationProperties.parentComment = _.pick(parentComment, '_id', 'userId', 'author'); @@ -187,7 +187,7 @@ Meteor.methods({ return comment; }, removeComment: function(commentId){ - var comment=Comments.findOne(commentId); + var comment = Comments.findOne(commentId); if(canEdit(Meteor.user(), comment)){ // decrement post comment count and remove user ID from post Posts.update(comment.postId, { diff --git a/collections/invites.js b/collections/invites.js index cbc8245ec..86485ec5a 100644 --- a/collections/invites.js +++ b/collections/invites.js @@ -27,5 +27,5 @@ Invites = new Meteor.Collection("invites", { Invites.deny({ insert: function(){ return true; }, update: function(){ return true; }, - remove: function(){ return true; }, + remove: function(){ return true; } }); \ No newline at end of file diff --git a/collections/notifications.js b/collections/notifications.js index 6ae3a0b2c..6c6e64e39 100644 --- a/collections/notifications.js +++ b/collections/notifications.js @@ -38,7 +38,7 @@ createNotification = function(event, properties, userToNotify) { properties: properties, read: false }; - var newNotificationId=Notifications.insert(notification); + var newNotificationId = Notifications.insert(notification); // 2. Send notification by email (if on server) if(Meteor.isServer && getUserSetting('notifications.replies', false, userToNotify)){ @@ -56,14 +56,14 @@ buildSiteNotification = function (notification) { post = notification.properties.post, userToNotify = Meteor.users.findOne(notification.userId), template, - html + html; var properties = { profileUrl: getProfileUrlById(comment.userId), author: comment.author, postCommentUrl: getPostCommentUrl(post._id, comment._id), postTitle: post.title - } + }; switch(event){ case 'newReply': diff --git a/collections/posts.js b/collections/posts.js index 618d029cc..d30e6b9b8 100644 --- a/collections/posts.js +++ b/collections/posts.js @@ -13,7 +13,7 @@ postSchemaObject = { }, title: { type: String, - label: "Title", + label: "Title" }, url: { type: String, @@ -119,7 +119,7 @@ clickedPosts = []; getPostProperties = function(post) { - var postAuthor = Meteor.users.findOne(post.userId) + var postAuthor = Meteor.users.findOne(post.userId); var p = { postAuthorName : getDisplayName(postAuthor), postTitle : cleanUp(post.title), @@ -136,7 +136,7 @@ getPostProperties = function(post) { p.htmlBody = post.htmlBody; return p; -} +}; getPostPageUrl = function(post){ return getSiteUrl()+'posts/'+post._id; @@ -149,7 +149,7 @@ getPostEditUrl = function(id){ // for a given post, return its link if it has one, or else its post page URL getPostLink = function (post) { return !!post.url ? getOutgoingUrl(post.url) : getPostPageUrl(post); -} +}; Posts.before.insert(function (userId, doc) { if(Meteor.isServer && !!doc.body) @@ -222,8 +222,8 @@ Meteor.methods({ commentsCount: 0, baseScore: 0, score: 0, - inactive: false, - } + inactive: false + }; // UserId if(isAdmin(Meteor.user()) && !!post.userId){ // only let admins post as other users @@ -288,7 +288,7 @@ Meteor.methods({ var postedAt = new Date(); // default to current date and time if(isAdmin(Meteor.user()) && typeof customPostedAt !== 'undefined') // if user is admin and a custom datetime has been set - var postedAt = customPostedAt; + postedAt = customPostedAt; Posts.update(post._id, {$set: {postedAt: postedAt}}); }, @@ -323,7 +323,7 @@ Meteor.methods({ // if(!this.isSimulation) { // Comments.remove({post: postId}); // } - // NOTE: actually, keep comments afer all + // NOTE: actually, keep comments after all // decrement post count var post = Posts.findOne({_id: postId}); diff --git a/collections/settings.js b/collections/settings.js index 0a07e66b1..83c373054 100644 --- a/collections/settings.js +++ b/collections/settings.js @@ -62,7 +62,7 @@ settingsSchemaObject = { label: view.label } }) - }, + } }, postInterval: { type: Number, diff --git a/lib/analytics.js b/lib/analytics.js index d034a42d7..53203ec6e 100644 --- a/lib/analytics.js +++ b/lib/analytics.js @@ -76,7 +76,7 @@ analyticsRequest = function() { // Google Analytics if (typeof window.ga !== 'undefined'){ ga('send', 'pageview', { - 'page': window.location.pathname, + 'page': window.location.pathname }); } diff --git a/lib/helpers.js b/lib/helpers.js index abbcdce52..7ff6803fd 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -1,6 +1,6 @@ cl = function(something){ console.log(l); -} +}; getCurrentTemplate = function() { return Router.current().lookupTemplate(); @@ -111,7 +111,7 @@ sanitize = function (s) { // console.log(s) } return s; -} +}; stripHTML = function(s){ return s.replace(/<(?:.|\n)*?>/gm, ''); }; diff --git a/lib/users.js b/lib/users.js index c3b1d003b..166ce6cb0 100644 --- a/lib/users.js +++ b/lib/users.js @@ -22,7 +22,7 @@ getUserName = function(user){ return user.services.twitter.screenName } catch (error){ - console.log(error) + console.log(error); return null; } }; @@ -143,17 +143,17 @@ setUserSetting = function (setting, value, userArgument) { } if(!user) - throw new Meteor.Error(500, 'User not defined') + throw new Meteor.Error(500, 'User not defined'); - console.log('Setting user setting "'+setting+'" to "'+value+'" for '+getUserName(user)) + console.log('Setting user setting "'+setting+'" to "'+value+'" for '+getUserName(user)); var find = {_id: user._id}; var field = {}; field['profile.'+setting] = value; var options = {$set: field}; - console.log(find) - console.log(options) + console.log(find); + console.log(options); var result = Meteor.users.update(find, options, {validate: false}); -} +}; getProperty = function(object, property){ // recursive function to get nested properties diff --git a/lib/vote.js b/lib/vote.js index eed27352e..0e7cdd595 100644 --- a/lib/vote.js +++ b/lib/vote.js @@ -29,7 +29,7 @@ var removeVote = function (userId, itemId, collection, upOrDown) { var field = 'votes.' + upOrDown + 'voted' + collection; var remove = {}; - remove[field] = {itemId: itemId} + remove[field] = {itemId: itemId}; Meteor.users.update({_id: userId}, { $pull: remove }); diff --git a/server/invites.js b/server/invites.js index 78dcc1021..7ec202705 100644 --- a/server/invites.js +++ b/server/invites.js @@ -68,7 +68,7 @@ Meteor.methods({ actionLink : user ? getSigninUrl() : getSignupUrl(), invitedBy : getDisplayName(currentUser), profileUrl : getProfileUrl(currentUser) - } + }; Meteor.setTimeout(function () { buildAndSendEmail(userEmail, emailSubject, getTemplate('emailInvite'), emailProperties); diff --git a/server/migrations.js b/server/migrations.js index b7774aaa2..5330abc6b 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -18,7 +18,7 @@ var runMigration = function (migrationName) { if (migration){ if(typeof migration.finishedAt === 'undefined'){ // if migration exists but hasn't finished, remove it and start fresh - console.log('!!! Found incomplete migration "'+migrationName+'", removing and running again.') + console.log('!!! Found incomplete migration "'+migrationName+'", removing and running again.'); Migrations.remove({name: migrationName}); }else{ // do nothing @@ -39,7 +39,7 @@ var runMigration = function (migrationName) { console.log("//----------------------------------------------------------------------//"); console.log("//------------// Ending "+migrationName+" Migration //-----------//"); console.log("//----------------------------------------------------------------------//"); -} +}; var migrationsList = { updatePostStatus: function () { @@ -119,7 +119,7 @@ var migrationsList = { i++; console.log('> Updating user '+user._id+' ('+user.username+')'); - var properties = {} + var properties = {}; // update user slug if(getUserName(user)) properties.slug = slugify(getUserName(user)); @@ -219,7 +219,7 @@ var migrationsList = { console.log("Posts: "+post.title); var createdAt = new Date(post.createdAt); var submitted = new Date(post.submitted); - console.log(createdAt) + console.log(createdAt); Posts.update(post._id, { $set: { 'createdAt': createdAt, submitted: submitted}}, {multi: true, validate: false}); console.log("---------------------"); } @@ -365,4 +365,4 @@ var migrationsList = { }); return i; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/server/notifications.js b/server/notifications.js index 73048d3c0..5ebdb99b0 100644 --- a/server/notifications.js +++ b/server/notifications.js @@ -40,7 +40,7 @@ buildEmailNotification = function (notification) { subject: subject, html: html } -} +}; newPostNotification = function(post, excludedIDs){ var excludedIDs = typeof excludedIDs == 'undefined' ? [] : excludedIDs; @@ -54,7 +54,7 @@ newPostNotification = function(post, excludedIDs){ if(excludedIDs.indexOf(user._id) == -1) sendEmail(getEmail(user), subject, html); }); -} +}; Meteor.methods({ unsubscribeUser : function(hash){ diff --git a/server/scoring.js b/server/scoring.js index e9dcd1510..986244fee 100644 --- a/server/scoring.js +++ b/server/scoring.js @@ -1,10 +1,10 @@ Meteor.startup(function () { var scoreInterval = getSetting("scoreUpdateInterval") || 30; - if(scoreInterval>0){ + if (scoreInterval > 0) { // active items get updated every N seconds - intervalId=Meteor.setInterval(function () { + intervalId = Meteor.setInterval(function () { var updatedPosts = 0; var updatedComments = 0; // console.log('tick ('+scoreInterval+')'); @@ -19,7 +19,7 @@ Meteor.startup(function () { }, scoreInterval * 1000); // inactive items get updated every hour - inactiveIntervalId=Meteor.setInterval(function () { + inactiveIntervalId = Meteor.setInterval(function () { var updatedPosts = 0; var updatedComments = 0; Posts.find({'inactive': true}).forEach(function (post) { diff --git a/server/users.js b/server/users.js index 01a838712..72c52086f 100644 --- a/server/users.js +++ b/server/users.js @@ -79,7 +79,7 @@ Accounts.onCreateUser(function(options, user){ var emailProperties = { profileUrl: getProfileUrl(user), username: getUserName(user) - } + }; var html = getEmailTemplate('emailNewUser')(emailProperties); sendEmail(getEmail(admin), 'New user account: '+getUserName(user), buildEmailTemplate(html)); }