mirror of
https://github.com/flarum/core.git
synced 2025-08-07 17:07:19 +02:00
Fix JSHint errors
This commit is contained in:
@@ -2,7 +2,6 @@ import Ember from 'ember';
|
||||
|
||||
import TaggedArray from '../../utils/tagged-array';
|
||||
import ActionButton from '../ui/controls/action-button';
|
||||
import SeparatorItem from '../ui/items/separator-item';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
|
||||
@@ -23,11 +22,11 @@ export default Ember.Component.extend({
|
||||
}.property('childViews.@each.active'),
|
||||
|
||||
displayUnread: function() {
|
||||
return this.get('countType') == 'unread' && this.get('discussion.isUnread');
|
||||
return this.get('countType') === 'unread' && this.get('discussion.isUnread');
|
||||
}.property('countType', 'discussion.isUnread'),
|
||||
|
||||
displayLastPost: function() {
|
||||
return this.get('terminalPostType') == 'last' && this.get('discussion.repliesCount');
|
||||
return this.get('terminalPostType') === 'last' && this.get('discussion.repliesCount');
|
||||
}.property('terminalPostType', 'discussion.repliesCount'),
|
||||
|
||||
start: function() {
|
||||
@@ -37,11 +36,13 @@ export default Ember.Component.extend({
|
||||
discussionId: Ember.computed.alias('discussion.id'),
|
||||
|
||||
relevantPosts: function() {
|
||||
if (this.get('controller.show') != 'posts') return [];
|
||||
if (this.get('controller.show') !== 'posts') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (this.get('controller.searchQuery')) {
|
||||
return this.get('discussion.relevantPosts');
|
||||
} else if (this.get('controller.sort') == 'newest' || this.get('controller.sort') == 'oldest') {
|
||||
} else if (this.get('controller.sort') === 'newest' || this.get('controller.sort') === 'oldest') {
|
||||
return [this.get('discussion.startPost')];
|
||||
} else {
|
||||
return [this.get('discussion.lastPost')];
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
import TaggedArray from '../../utils/tagged-array';
|
||||
import ActionButton from '../ui/controls/action-button';
|
||||
// import TaggedArray from '../../utils/tagged-array';
|
||||
// import ActionButton from '../ui/controls/action-button';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'article',
|
||||
@@ -45,18 +45,18 @@ export default Ember.Component.extend({
|
||||
}, 100);
|
||||
},
|
||||
|
||||
addControl: function(tag, title, icon, permissionAttribute) {
|
||||
if (permissionAttribute && ! this.get('post').get(permissionAttribute)) {
|
||||
return;
|
||||
}
|
||||
// addControl: function(tag, title, icon, permissionAttribute) {
|
||||
// if (permissionAttribute && ! this.get('post').get(permissionAttribute)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
var self = this;
|
||||
var action = function(post) {
|
||||
self.get('controller').send(actionName, post);
|
||||
};
|
||||
// var self = this;
|
||||
// var action = function(post) {
|
||||
// self.get('controller').send(actionName, post);
|
||||
// };
|
||||
|
||||
var item = MenuItem.extend({title: title, icon: icon, action: action});
|
||||
this.get('controls').addItem(tag, item);
|
||||
}
|
||||
// var item = MenuItem.extend({title: title, icon: icon, action: action});
|
||||
// this.get('controls').addItem(tag, item);
|
||||
// }
|
||||
|
||||
});
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
|
||||
classNames: ['stream'],
|
||||
@@ -177,7 +179,7 @@ export default Ember.Component.extend({
|
||||
if ($item.length) {
|
||||
var marginTop = this.getMarginTop();
|
||||
var scrollTop = $item.is(':first-child') ? 0 : $item.offset().top - marginTop;
|
||||
if (scrollTop != $(document).scrollTop()) {
|
||||
if (scrollTop !== $(document).scrollTop()) {
|
||||
$container.stop(true).animate({scrollTop: scrollTop});
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
// A discussion 'item' represents one item in the post stream. In other words, a
|
||||
// single item may represent a single post, or it may represent a gap of many
|
||||
// posts which have not been loaded.
|
||||
@@ -38,7 +40,7 @@ export default Ember.Component.extend({
|
||||
if (this.get('loading')) {
|
||||
buffer.push(' ');
|
||||
} else {
|
||||
buffer.push(this.get('count')+' more post'+(this.get('count') != 1 ? 's' : ''));
|
||||
buffer.push(this.get('count')+' more post'+(this.get('count') !== 1 ? 's' : ''));
|
||||
}
|
||||
buffer.push('</span>');
|
||||
},
|
||||
@@ -93,9 +95,7 @@ export default Ember.Component.extend({
|
||||
// anchor (i.e. this gap is terminal,) then we'll scroll to the
|
||||
// bottom of the document.
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
$('body').scrollTop(anchor.length
|
||||
? anchor.offset().top - scrollOffset
|
||||
: $('body').height());
|
||||
$('body').scrollTop(anchor.length ? anchor.offset().top - scrollOffset : $('body').height());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
layoutName: 'components/discussions/stream-scrubber',
|
||||
classNames: ['scrubber', 'stream-scrubber'],
|
||||
@@ -245,7 +247,7 @@ export default Ember.Component.extend({
|
||||
// Now loop through each of the items in the discussion. An 'item' is
|
||||
// either a single post or a 'gap' of one or more posts that haven't
|
||||
// been loaded yet.
|
||||
$items.each(function(k) {
|
||||
$items.each(function() {
|
||||
var $this = $(this),
|
||||
top = $this.offset().top,
|
||||
height = $this.outerHeight(true);
|
||||
@@ -319,7 +321,7 @@ export default Ember.Component.extend({
|
||||
|
||||
// jQuery likes to put overflow:hidden, but because the scrollbar
|
||||
// handle has a negative margin-left, we need to override.
|
||||
if (func == 'animate') {
|
||||
if (func === 'animate') {
|
||||
$part.css('overflow', 'visible');
|
||||
}
|
||||
}
|
||||
@@ -369,7 +371,7 @@ export default Ember.Component.extend({
|
||||
// percentage to account for it.
|
||||
var minPercentVisible = 50 / this.$('.scrubber-scrollbar').outerHeight() * 100;
|
||||
var percentPerVisiblePost = Math.max(100 / count, minPercentVisible / visible);
|
||||
var percentPerPost = count == visible ? 0 : (100 - percentPerVisiblePost * visible) / (count - visible);
|
||||
var percentPerPost = count === visible ? 0 : (100 - percentPerVisiblePost * visible) / (count - visible);
|
||||
|
||||
return {
|
||||
index: percentPerPost,
|
||||
|
@@ -19,9 +19,9 @@ export default Ember.Component.extend({
|
||||
click: function(e) {
|
||||
e.preventDefault();
|
||||
var action = this.get('action');
|
||||
if (typeof action == 'string') {
|
||||
if (typeof action === 'string') {
|
||||
this.sendAction('action');
|
||||
} else if (typeof action == 'function') {
|
||||
} else if (typeof action === 'function') {
|
||||
action();
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
import DropdownButton from './dropdown-button';
|
||||
|
||||
export default DropdownButton.extend({
|
||||
|
@@ -7,10 +7,12 @@ export default Ember.Component.extend({
|
||||
layoutName: 'components/ui/controls/item-list',
|
||||
|
||||
listItems: function() {
|
||||
if (!Ember.isArray(this.get('items'))) return [];
|
||||
if (!Ember.isArray(this.get('items'))) {
|
||||
return [];
|
||||
}
|
||||
var listItems = [];
|
||||
this.get('items').forEach(function(item) {
|
||||
if (item.tagName != 'li') {
|
||||
if (item.tagName !== 'li') {
|
||||
item = ComponentItem.extend({component: item});
|
||||
}
|
||||
listItems.push(item);
|
||||
|
@@ -9,7 +9,7 @@ export default Ember.Component.extend({
|
||||
didInsertElement: function() {
|
||||
var self = this;
|
||||
this.$().find('input').on('keydown', function(e) {
|
||||
if (e.which == 27) {
|
||||
if (e.which === 27) {
|
||||
self.clear();
|
||||
}
|
||||
});
|
||||
@@ -18,7 +18,7 @@ export default Ember.Component.extend({
|
||||
}).on('click', function(e) {
|
||||
e.preventDefault();
|
||||
self.clear();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
|
Reference in New Issue
Block a user