Commit e113f8fb authored by alexpott's avatar alexpott

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

parent b61c2592
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"no-restricted-syntax": "off", "no-restricted-syntax": "off",
"no-new": "off", "no-new": "off",
"no-multi-assign": "off", "no-multi-assign": "off",
"no-mixed-operators": "off",
"no-empty": "off", "no-empty": "off",
"no-continue": "off", "no-continue": "off",
"new-cap": "off", "new-cap": "off",
......
...@@ -713,7 +713,8 @@ ...@@ -713,7 +713,8 @@
// Stop any current scrolling. // Stop any current scrolling.
clearInterval(self.scrollInterval); clearInterval(self.scrollInterval);
// Continue scrolling if the mouse has moved in the scroll direction. // 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); self.setScroll(scrollAmount);
} }
...@@ -827,8 +828,8 @@ ...@@ -827,8 +828,8 @@
return { x: event.pageX, y: event.pageY }; return { x: event.pageX, y: event.pageY };
} }
return { return {
x: event.clientX + document.body.scrollLeft - document.body.clientLeft, x: (event.clientX + document.body.scrollLeft) - document.body.clientLeft,
y: event.clientY + document.body.scrollTop - document.body.clientTop, y: (event.clientY + document.body.scrollTop) - document.body.clientTop,
}; };
}; };
...@@ -1119,7 +1120,7 @@ ...@@ -1119,7 +1120,7 @@
// Return a scroll speed relative to the edge of the screen. // Return a scroll speed relative to the edge of the screen.
if (cursorY - scrollY > windowHeight - trigger) { if (cursorY - scrollY > windowHeight - trigger) {
delta = trigger / (windowHeight + scrollY - cursorY); delta = trigger / ((windowHeight + scrollY) - cursorY);
delta = (delta > 0 && delta < trigger) ? delta : trigger; delta = (delta > 0 && delta < trigger) ? delta : trigger;
return delta * this.scrollSettings.amount; return delta * this.scrollSettings.amount;
} }
...@@ -1144,7 +1145,8 @@ ...@@ -1144,7 +1145,8 @@
self.checkScroll(self.currentPointerCoords.y); self.checkScroll(self.currentPointerCoords.y);
const aboveTable = self.scrollY > self.table.topY; const aboveTable = self.scrollY > self.table.topY;
const belowTable = self.scrollY + self.windowHeight < self.table.bottomY; 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); window.scrollBy(0, scrollAmount);
} }
}, this.scrollSettings.interval); }, this.scrollSettings.interval);
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
// Just scrolling the document.body will not work in Firefox. The html // Just scrolling the document.body will not work in Firefox. The html
// element is needed as well. // element is needed as well.
$('html, body').animate({ $('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); }, 500);
}); });
} }
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
given[1] /= d; given[1] /= d;
} }
else { else {
given[1] = 1 - (1 - given[1]) * d; given[1] = 1 - ((1 - given[1]) * d);
} }
} }
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
given[2] /= d; given[2] /= d;
} }
else { else {
given[2] = 1 - (1 - given[2]) * d; given[2] = 1 - ((1 - given[2]) * d);
} }
} }
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
// Any comment that is older than 30 days is automatically considered read, // 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! // 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. // Use the data embedded in the page, if available.
let embeddedLastReadTimestamps = false; let embeddedLastReadTimestamps = false;
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
(function ($, Drupal, drupalSettings, storage) { (function ($, Drupal, drupalSettings, storage) {
var currentUserID = parseInt(drupalSettings.user.uid, 10); 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; var embeddedLastReadTimestamps = false;
if (drupalSettings.history && drupalSettings.history.lastReadTimestamps) { if (drupalSettings.history && drupalSettings.history.lastReadTimestamps) {
......
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
suggested.top = fenceTop; suggested.top = fenceTop;
} }
else if ((suggested.top + toolbarHeight) > (fenceTop + fenceHeight)) { else if ((suggested.top + toolbarHeight) > (fenceTop + fenceHeight)) {
suggested.top = fenceTop + fenceHeight - toolbarHeight; suggested.top = (fenceTop + fenceHeight) - toolbarHeight;
} }
// Position the toolbar. // Position the toolbar.
info.element.element.css({ info.element.element.css({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment