client/general: fix jscs warnings
This commit is contained in:
parent
0547ec5aa2
commit
3cbcbf1140
10 changed files with 45 additions and 43 deletions
|
@ -51,7 +51,8 @@ class PostsController {
|
|||
requestPage: pageController.createHistoryCacheProxy(
|
||||
ctx,
|
||||
page => {
|
||||
const text = this._decorateSearchQuery(ctx.searchQuery.text);
|
||||
const text
|
||||
= this._decorateSearchQuery(ctx.searchQuery.text);
|
||||
return api.get(
|
||||
`/posts/?query=${text}&page=${page}&pageSize=40` +
|
||||
'&fields=id,type,tags,score,favoriteCount,' +
|
||||
|
@ -69,8 +70,8 @@ class PostsController {
|
|||
topNavController.activate('posts');
|
||||
Promise.all([
|
||||
api.get('/post/' + id),
|
||||
api.get(`/post/${id}/around?fields=id&query=`
|
||||
+ this._decorateSearchQuery('')),
|
||||
api.get(`/post/${id}/around?fields=id&query=` +
|
||||
this._decorateSearchQuery('')),
|
||||
]).then(responses => {
|
||||
const [postResponse, aroundResponse] = responses;
|
||||
this._postView.render({
|
||||
|
|
|
@ -212,8 +212,9 @@ class TagsController {
|
|||
page => {
|
||||
const text = ctx.searchQuery.text;
|
||||
return api.get(
|
||||
`/tags/?query=${text}&page=${page}&pageSize=50&fields=` +
|
||||
`names,suggestions,implications,lastEditTime,usages`);
|
||||
`/tags/?query=${text}&page=${page}&pageSize=50` +
|
||||
'&fields=names,suggestions,implications,' +
|
||||
'lastEditTime,usages');
|
||||
}),
|
||||
headerRenderer: this._tagsHeaderView,
|
||||
pageRenderer: this._tagsPageView,
|
||||
|
|
|
@ -62,8 +62,8 @@ class CommentFormControl {
|
|||
this._hostNode.querySelector('.tabs-wrapper').style.minHeight = null;
|
||||
misc.disableExitConfirmation();
|
||||
views.clearMessages(this._hostNode);
|
||||
this._hostNode.querySelector('.edit.tab textarea').value
|
||||
= this._comment.text;
|
||||
this._hostNode.querySelector('.edit.tab textarea').value =
|
||||
this._comment.text;
|
||||
}
|
||||
|
||||
get _textareaNode() {
|
||||
|
@ -85,8 +85,8 @@ class CommentFormControl {
|
|||
|
||||
_evtPreviewClick(e) {
|
||||
e.preventDefault();
|
||||
this._contentNode.innerHTML
|
||||
= misc.formatMarkdown(this._textareaNode.value);
|
||||
this._contentNode.innerHTML =
|
||||
misc.formatMarkdown(this._textareaNode.value);
|
||||
this._freezeTabHeights();
|
||||
this._selectTab('preview');
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ class CommentFormControl {
|
|||
}
|
||||
|
||||
_growTextArea() {
|
||||
this._textareaNode.style.height
|
||||
= Math.max(
|
||||
this._textareaNode.style.height =
|
||||
Math.max(
|
||||
this._settings.minHeight || 0,
|
||||
this._textareaNode.scrollHeight) + 'px';
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class FileDropperControl {
|
|||
files.map(file => file.name).join(', ');
|
||||
}
|
||||
this._options.resolve(files);
|
||||
};
|
||||
}
|
||||
|
||||
_evtFileChange(e) {
|
||||
this._resolve(e.target.files);
|
||||
|
|
|
@ -15,8 +15,8 @@ class PostNotesOverlayControl {
|
|||
const bodyRect = document.body.getBoundingClientRect();
|
||||
const svgRect = this._svgNode.getBoundingClientRect();
|
||||
const polygonRect = e.target.getBBox();
|
||||
this._textNode.querySelector('.wrapper').innerHTML
|
||||
= misc.formatMarkdown(e.target.getAttribute('data-text'));
|
||||
this._textNode.querySelector('.wrapper').innerHTML =
|
||||
misc.formatMarkdown(e.target.getAttribute('data-text'));
|
||||
const x = (
|
||||
-bodyRect.left + svgRect.left + svgRect.width * polygonRect.x);
|
||||
const y = (
|
||||
|
@ -30,9 +30,9 @@ class PostNotesOverlayControl {
|
|||
_evtMouseLeave(e) {
|
||||
const newElement = e.relatedTarget;
|
||||
if (newElement === this._svgNode ||
|
||||
(!this._svgNode.contains(newElement)
|
||||
&& !this._textNode.contains(newElement)
|
||||
&& newElement !== this._textNode)) {
|
||||
(!this._svgNode.contains(newElement) &&
|
||||
!this._textNode.contains(newElement) &&
|
||||
newElement !== this._textNode)) {
|
||||
this._textNode.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ class PostReadonlySidebarControl {
|
|||
}));
|
||||
|
||||
const upvoteButton = sourceNode.querySelector('.upvote');
|
||||
const downvoteButton = sourceNode.querySelector('.downvote')
|
||||
const addFavButton = sourceNode.querySelector('.add-favorite')
|
||||
const downvoteButton = sourceNode.querySelector('.downvote');
|
||||
const addFavButton = sourceNode.querySelector('.add-favorite');
|
||||
const remFavButton = sourceNode.querySelector('.remove-favorite');
|
||||
const fitBothButton = sourceNode.querySelector('.fit-both')
|
||||
const fitBothButton = sourceNode.querySelector('.fit-both');
|
||||
const fitOriginalButton = sourceNode.querySelector('.fit-original');
|
||||
const fitWidthButton = sourceNode.querySelector('.fit-width')
|
||||
const fitWidthButton = sourceNode.querySelector('.fit-width');
|
||||
const fitHeightButton = sourceNode.querySelector('.fit-height');
|
||||
|
||||
if (upvoteButton) {
|
||||
|
@ -105,7 +105,7 @@ class PostReadonlySidebarControl {
|
|||
promise().then(() => {
|
||||
this.install();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_syncFitButton() {
|
||||
|
@ -153,7 +153,7 @@ class PostReadonlySidebarControl {
|
|||
return new Promise((resolve, reject) => {
|
||||
requestPromise()
|
||||
.then(
|
||||
response => { return api.get('/post/' + this._post.id) },
|
||||
response => { return api.get('/post/' + this._post.id); },
|
||||
response => { return Promise.reject(response); })
|
||||
.then(
|
||||
response => {
|
||||
|
|
|
@ -183,7 +183,7 @@ function unindent(callSite, ...args) {
|
|||
if (size < 0) {
|
||||
size = m1.replace(/\t/g, ' ').length;
|
||||
}
|
||||
return "\n" + m1.slice(Math.min(m1.length, size));
|
||||
return '\n' + m1.slice(Math.min(m1.length, size));
|
||||
});
|
||||
}
|
||||
if (typeof callSite === 'string') {
|
||||
|
|
|
@ -14,7 +14,7 @@ NodeList.prototype.querySelector = function(...args) {
|
|||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// non standard
|
||||
Node.prototype.prependChild = function(child) {
|
||||
|
|
|
@ -5,12 +5,12 @@ const router = require('../router.js');
|
|||
const views = require('../util/views.js');
|
||||
const keyboard = require('../util/keyboard.js');
|
||||
const PostContentControl = require('../controls/post_content_control.js');
|
||||
const PostNotesOverlayControl
|
||||
= require('../controls/post_notes_overlay_control.js');
|
||||
const PostReadonlySidebarControl
|
||||
= require('../controls/post_readonly_sidebar_control.js');
|
||||
const PostEditSidebarControl
|
||||
= require('../controls/post_edit_sidebar_control.js');
|
||||
const PostNotesOverlayControl =
|
||||
require('../controls/post_notes_overlay_control.js');
|
||||
const PostReadonlySidebarControl =
|
||||
require('../controls/post_readonly_sidebar_control.js');
|
||||
const PostEditSidebarControl =
|
||||
require('../controls/post_edit_sidebar_control.js');
|
||||
const CommentListControl = require('../controls/comment_list_control.js');
|
||||
const CommentFormControl = require('../controls/comment_form_control.js');
|
||||
|
||||
|
@ -33,20 +33,20 @@ class PostView {
|
|||
const postViewNode = document.body.querySelector('.content-wrapper');
|
||||
|
||||
const margin = (
|
||||
postViewNode.getBoundingClientRect().top
|
||||
- topNavNode.getBoundingClientRect().height);
|
||||
postViewNode.getBoundingClientRect().top -
|
||||
topNavNode.getBoundingClientRect().height);
|
||||
|
||||
this._postContentControl = new PostContentControl(
|
||||
postContainerNode,
|
||||
ctx.post,
|
||||
() => {
|
||||
return [
|
||||
window.innerWidth
|
||||
- postContainerNode.getBoundingClientRect().left
|
||||
- margin,
|
||||
window.innerHeight
|
||||
- topNavNode.getBoundingClientRect().height
|
||||
- margin * 2,
|
||||
window.innerWidth -
|
||||
postContainerNode.getBoundingClientRect().left -
|
||||
margin,
|
||||
window.innerHeight -
|
||||
topNavNode.getBoundingClientRect().height -
|
||||
margin * 2,
|
||||
];
|
||||
});
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ class PostsHeaderView {
|
|||
});
|
||||
|
||||
keyboard.bind('p', () => {
|
||||
const firstPostNode
|
||||
= document.body.querySelector('.post-list li:first-child a');
|
||||
const firstPostNode =
|
||||
document.body.querySelector('.post-list li:first-child a');
|
||||
if (firstPostNode) {
|
||||
firstPostNode.focus();
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ class PostsHeaderView {
|
|||
e.target.classList.toggle('disabled');
|
||||
const safety = e.target.getAttribute('data-safety');
|
||||
let browsingSettings = settings.getSettings();
|
||||
browsingSettings.listPosts[safety]
|
||||
= !browsingSettings.listPosts[safety];
|
||||
browsingSettings.listPosts[safety] =
|
||||
!browsingSettings.listPosts[safety];
|
||||
settings.saveSettings(browsingSettings, true);
|
||||
router.show(url.replace(/{page}/, 1));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue