Issue #2914723 by droplet, dawehner: JS codestyle: no-mixed-operators

8.5.x
Alex Pott 2017-10-12 11:20:47 +01:00
parent b61c2592f0
commit e113f8fbab
7 changed files with 15 additions and 12 deletions

View File

@ -8,7 +8,6 @@
"no-restricted-syntax": "off",
"no-new": "off",
"no-multi-assign": "off",
"no-mixed-operators": "off",
"no-empty": "off",
"no-continue": "off",
"new-cap": "off",

View File

@ -713,7 +713,8 @@
// Stop any current scrolling.
clearInterval(self.scrollInterval);
// Continue scrolling if the mouse has moved in the scroll direction.
if (scrollAmount > 0 && self.rowObject.direction === 'down' || scrollAmount < 0 && self.rowObject.direction === 'up') {
if ((scrollAmount > 0 && self.rowObject.direction === 'down')
|| (scrollAmount < 0 && self.rowObject.direction === 'up')) {
self.setScroll(scrollAmount);
}
@ -827,8 +828,8 @@
return { x: event.pageX, y: event.pageY };
}
return {
x: event.clientX + document.body.scrollLeft - document.body.clientLeft,
y: event.clientY + document.body.scrollTop - document.body.clientTop,
x: (event.clientX + document.body.scrollLeft) - document.body.clientLeft,
y: (event.clientY + document.body.scrollTop) - document.body.clientTop,
};
};
@ -1119,7 +1120,7 @@
// Return a scroll speed relative to the edge of the screen.
if (cursorY - scrollY > windowHeight - trigger) {
delta = trigger / (windowHeight + scrollY - cursorY);
delta = trigger / ((windowHeight + scrollY) - cursorY);
delta = (delta > 0 && delta < trigger) ? delta : trigger;
return delta * this.scrollSettings.amount;
}
@ -1144,7 +1145,8 @@
self.checkScroll(self.currentPointerCoords.y);
const aboveTable = self.scrollY > self.table.topY;
const belowTable = self.scrollY + self.windowHeight < self.table.bottomY;
if (scrollAmount > 0 && belowTable || scrollAmount < 0 && aboveTable) {
if ((scrollAmount > 0 && belowTable)
|| (scrollAmount < 0 && aboveTable)) {
window.scrollBy(0, scrollAmount);
}
}, this.scrollSettings.interval);

View File

@ -91,7 +91,7 @@
// Just scrolling the document.body will not work in Firefox. The html
// element is needed as well.
$('html, body').animate({
scrollTop: $('.js-block-placed').offset().top - $container.offset().top + $container.scrollTop(),
scrollTop: ($('.js-block-placed').offset().top - $container.offset().top) + $container.scrollTop(),
}, 500);
});
}

View File

@ -124,7 +124,7 @@
given[1] /= d;
}
else {
given[1] = 1 - (1 - given[1]) * d;
given[1] = 1 - ((1 - given[1]) * d);
}
}
@ -138,7 +138,7 @@
given[2] /= d;
}
else {
given[2] = 1 - (1 - given[2]) * d;
given[2] = 1 - ((1 - given[2]) * d);
}
}

View File

@ -10,7 +10,8 @@
// Any comment that is older than 30 days is automatically considered read,
// so for these we don't need to perform a request at all!
const thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - 30 * 24 * 60 * 60;
const secondsIn30Days = 2592000;
const thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - secondsIn30Days;
// Use the data embedded in the page, if available.
let embeddedLastReadTimestamps = false;

View File

@ -8,7 +8,8 @@
(function ($, Drupal, drupalSettings, storage) {
var currentUserID = parseInt(drupalSettings.user.uid, 10);
var thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - 30 * 24 * 60 * 60;
var secondsIn30Days = 2592000;
var thirtyDaysAgo = Math.round(new Date().getTime() / 1000) - secondsIn30Days;
var embeddedLastReadTimestamps = false;
if (drupalSettings.history && drupalSettings.history.lastReadTimestamps) {

View File

@ -296,7 +296,7 @@
suggested.top = fenceTop;
}
else if ((suggested.top + toolbarHeight) > (fenceTop + fenceHeight)) {
suggested.top = fenceTop + fenceHeight - toolbarHeight;
suggested.top = (fenceTop + fenceHeight) - toolbarHeight;
}
// Position the toolbar.
info.element.element.css({