Fix space-before-function-paren linter rule

This commit is contained in:
HeeL
2016-10-13 11:43:39 +02:00
parent 3fa1c1f927
commit 4a3c31b2dc
385 changed files with 6621 additions and 6622 deletions

View File

@@ -8,13 +8,13 @@ define('forum/topic/posts', [
'forum/topic/postTools',
'navigator',
'components'
], function(pagination, infinitescroll, postTools, navigator, components) {
], function (pagination, infinitescroll, postTools, navigator, components) {
var Posts = {
_imageLoaderTimeout: undefined
};
Posts.onNewPost = function(data) {
Posts.onNewPost = function (data) {
if (!data || !data.posts || !data.posts.length) {
return;
}
@@ -25,7 +25,7 @@ define('forum/topic/posts', [
data.loggedIn = app.user.uid ? true : false;
data.privileges = ajaxify.data.privileges;
data.posts.forEach(function(post) {
data.posts.forEach(function (post) {
post.selfPost = !!app.user.uid && parseInt(post.uid, 10) === parseInt(app.user.uid, 10);
post.display_edit_tools = (ajaxify.data.privileges['posts:edit'] && post.selfPost) || ajaxify.data.privileges.isAdminOrMod;
post.display_delete_tools = (ajaxify.data.privileges['posts:delete'] && post.selfPost) || ajaxify.data.privileges.isAdminOrMod;
@@ -72,7 +72,7 @@ define('forum/topic/posts', [
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, scrollToPost);
} else if (ajaxify.data.scrollToMyPost && parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) {
// https://github.com/NodeBB/NodeBB/issues/5004#issuecomment-247157441
setTimeout(function() {
setTimeout(function () {
pagination.loadPage(ajaxify.data.pagination.pageCount, scrollToPost);
}, 250);
} else {
@@ -81,8 +81,8 @@ define('forum/topic/posts', [
}
function updatePagination() {
$.get(config.relative_path + '/api/topic/pagination/' + ajaxify.data.tid, {page: ajaxify.data.pagination.currentPage}, function(paginationData) {
app.parseAndTranslate('partials/paginator', {pagination: paginationData}, function(html) {
$.get(config.relative_path + '/api/topic/pagination/' + ajaxify.data.tid, {page: ajaxify.data.pagination.currentPage}, function (paginationData) {
app.parseAndTranslate('partials/paginator', {pagination: paginationData}, function (html) {
$('[component="pagination"]').after(html).remove();
});
});
@@ -91,7 +91,7 @@ define('forum/topic/posts', [
function onNewPostInfiniteScroll(data) {
var direction = config.topicPostSort === 'oldest_to_newest' || config.topicPostSort === 'most_votes' ? 1 : -1;
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, function(html) {
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, function (html) {
if (html) {
html.addClass('new');
}
@@ -111,7 +111,7 @@ define('forum/topic/posts', [
}
function createNewPosts(data, repliesSelector, direction, callback) {
callback = callback || function() {};
callback = callback || function () {};
if (!data || (data.posts && !data.posts.length)) {
return callback();
}
@@ -121,14 +121,14 @@ define('forum/topic/posts', [
if (newPosts.length === data.posts.length) {
var allSamePids = true;
newPosts.each(function(index, el) {
newPosts.each(function (index, el) {
if (parseInt($(el).attr('data-pid'), 10) !== parseInt(data.posts[index].pid, 10)) {
allSamePids = false;
}
});
if (allSamePids) {
newPosts.each(function() {
newPosts.each(function () {
$(this).removeClass('new');
});
data.posts.length = 0;
@@ -137,7 +137,7 @@ define('forum/topic/posts', [
}
if (newPosts.length && data.posts.length > 1) {
data.posts.forEach(function(post) {
data.posts.forEach(function (post) {
var p = components.get('post', 'pid', post.pid);
if (p.hasClass('new')) {
p.remove();
@@ -145,7 +145,7 @@ define('forum/topic/posts', [
});
}
data.posts = data.posts.filter(function(post) {
data.posts = data.posts.filter(function (post) {
return $('[component="post"][data-pid="' + post.pid + '"]').length === 0;
});
}
@@ -168,9 +168,9 @@ define('forum/topic/posts', [
$(window).trigger('action:posts.loading', {posts: data.posts, after: after, before: before});
app.parseAndTranslate('topic', 'posts', data, function(html) {
app.parseAndTranslate('topic', 'posts', data, function (html) {
html = html.filter(function() {
html = html.filter(function () {
var pid = $(this).attr('data-pid');
return pid && $('[component="post"][data-pid="' + pid + '"]').length === 0;
});
@@ -200,12 +200,12 @@ define('forum/topic/posts', [
});
}
Posts.loadMorePosts = function(direction) {
Posts.loadMorePosts = function (direction) {
if (!components.get('topic').length || navigator.scrollActive || Posts._infiniteScrollTimeout) {
return;
}
Posts._infiniteScrollTimeout = setTimeout(function() {
Posts._infiniteScrollTimeout = setTimeout(function () {
delete Posts._infiniteScrollTimeout;
}, 1000);
var replies = components.get('post').not('[data-index=0]').not('.new');
@@ -239,7 +239,7 @@ define('forum/topic/posts', [
});
};
Posts.processPage = function(posts) {
Posts.processPage = function (posts) {
Posts.unloadImages(posts);
Posts.showBottomPostBar();
posts.find('[component="post/content"] img:not(.not-responsive)').addClass('img-responsive');
@@ -253,11 +253,11 @@ define('forum/topic/posts', [
hidePostToolsForDeletedPosts(posts);
};
Posts.unloadImages = function(posts) {
Posts.unloadImages = function (posts) {
var images = posts.find('[component="post/content"] img:not(.not-responsive)');
if (config.delayImageLoading) {
images.each(function() {
images.each(function () {
$(this).attr('data-src', $(this).attr('src'));
}).attr('data-state', 'unloaded').attr('src', 'about:blank');
} else {
@@ -266,12 +266,12 @@ define('forum/topic/posts', [
}
};
Posts.loadImages = function(threshold) {
Posts.loadImages = function (threshold) {
if (Posts._imageLoaderTimeout) {
clearTimeout(Posts._imageLoaderTimeout);
}
Posts._imageLoaderTimeout = setTimeout(function() {
Posts._imageLoaderTimeout = setTimeout(function () {
/*
If threshold is defined, images loaded above this threshold will modify
the user's scroll position so they are not scrolled away from content
@@ -282,16 +282,16 @@ define('forum/topic/posts', [
*/
var images = components.get('post/content').find('img[data-state="unloaded"]'),
visible = images.filter(function() {
visible = images.filter(function () {
return utils.isElementInViewport(this);
}),
posts = $.unique(visible.map(function() {
posts = $.unique(visible.map(function () {
return $(this).parents('[component="post"]').get(0);
})),
scrollTop = $(window).scrollTop(),
adjusting = false,
adjustQueue = [],
adjustPosition = function() {
adjustPosition = function () {
adjusting = true;
oldHeight = document.body.clientHeight;
@@ -318,10 +318,10 @@ define('forum/topic/posts', [
// For each image, reset the source and adjust scrollTop when loaded
visible.attr('data-state', 'loading');
visible.each(function(index, image) {
visible.each(function (index, image) {
image = $(image);
image.on('load', function() {
image.on('load', function () {
if (!adjusting) {
adjustPosition.call(this);
} else {
@@ -335,8 +335,8 @@ define('forum/topic/posts', [
}, 250);
};
Posts.wrapImagesInLinks = function(posts) {
posts.find('[component="post/content"] img:not(.emoji)').each(function() {
Posts.wrapImagesInLinks = function (posts) {
posts.find('[component="post/content"] img:not(.emoji)').each(function () {
var $this = $(this),
src = $this.attr('src'),
suffixRegex = /-resized(\.[\w]+)?$/;
@@ -355,7 +355,7 @@ define('forum/topic/posts', [
});
};
Posts.showBottomPostBar = function() {
Posts.showBottomPostBar = function () {
var mainPost = components.get('post', 'index', 0);
var placeHolder = $('.post-bar-placeholder');
var posts = $('[component="post"]');
@@ -368,7 +368,7 @@ define('forum/topic/posts', [
};
function hidePostToolsForDeletedPosts(posts) {
posts.each(function() {
posts.each(function () {
if ($(this).hasClass('deleted')) {
postTools.toggle($(this).attr('data-pid'), true);
}
@@ -376,7 +376,7 @@ define('forum/topic/posts', [
}
function addBlockquoteEllipses(blockquotes) {
blockquotes.each(function() {
blockquotes.each(function () {
var $this = $(this);
if ($this.find(':hidden:not(br)').length && !$this.find('.toggle').length) {
$this.append('<i class="fa fa-angle-down pointer toggle"></i>');