From 177f10e438ef44e9f11e1fbd2f600235b4e5cbaa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 25 Mar 2016 19:58:11 +0100 Subject: [PATCH] Replace document.body.scrollTop with window.scrollY see 13d884839f750cc42a21c4b6c55dce5cf9229d0f --- .../install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js | 2 +- wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js | 4 ++-- .../install/files/js/WoltLab/WCF/Ui/Page/Header/Fixed.js | 2 +- .../install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js | 6 +++--- wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Quote.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js index 08b42edda5..c8729168db 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js @@ -130,7 +130,7 @@ define(['Ajax', 'Dictionary', 'Dom/Util', 'EventHandler'], function(Ajax, Dictio var region = _stylePreviewRegions.get(lastValue); var rect = region.getBoundingClientRect(); - var top = rect.top + document.body.scrollTop; + var top = rect.top + window.scrollY; DomUtil.setStyles(_stylePreviewRegionMarker, { height: (region.clientHeight + 20) + 'px', diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js index 344d3199e4..87888f78b4 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js @@ -226,13 +226,13 @@ define(['Core', 'Language', 'Dom/Traverse', 'Dom/Util'], function(Core, Language if (align === 'top') { var bodyHeight = document.body.clientHeight; bottom = (bodyHeight - refOffsets.top) + verticalOffset; - if (bodyHeight - (bottom + elDimensions.height) < document.body.scrollTop) { + if (bodyHeight - (bottom + elDimensions.height) < window.scrollY) { result = false; } } else { top = refOffsets.top + refDimensions.height + verticalOffset; - if (top + elDimensions.height - document.body.scrollTop > windowHeight) { + if (top + elDimensions.height - window.scrollY > windowHeight) { result = false; } } diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/Header/Fixed.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/Header/Fixed.js index 6e512ee3c1..a0c8a437ef 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/Header/Fixed.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/Header/Fixed.js @@ -79,7 +79,7 @@ define(['Core', 'EventHandler', 'Ui/CloseOverlay', 'Ui/Screen', 'Ui/SimpleDropdo * @protected */ _scroll: function() { - _isFixed = (document.body.scrollTop > 50); + _isFixed = (window.scrollY > 50); _pageHeader.classList[_isFixed ? 'add' : 'remove']('sticky'); _pageHeaderContainer.classList[_isFixed ? 'add' : 'remove']('stickyPageHeader'); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js index 9c8f43ece1..557aada936 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js @@ -275,12 +275,12 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E // get the offsets of the bounding box of current text selection var rect = selection.getRangeAt(0).getBoundingClientRect(); var offsets = { - top: Math.round(rect.bottom) + document.body.scrollTop, + top: Math.round(rect.bottom) + window.scrollY, left: Math.round(rect.left) + document.body.scrollLeft }; if (this._lineHeight === null) { - this._lineHeight = Math.round(rect.bottom - rect.top - document.body.scrollTop); + this._lineHeight = Math.round(rect.bottom - rect.top - window.scrollY); } // restore caret position @@ -301,7 +301,7 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E this._selectItem(0); - if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + document.body.scrollTop) { + if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + window.scrollY) { this._dropdownMenu.classList.add('dropdownArrowBottom'); this._dropdownMenu.style.setProperty('top', offset.top - this._dropdownMenu.offsetHeight - 2 * this._lineHeight + 7 + 'px', ''); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Quote.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Quote.js index 1c7db1bdf7..e5ecf762d7 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Quote.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Quote.js @@ -66,7 +66,7 @@ define(['EventHandler', 'Language', 'Dom/Util', 'Ui/Dialog'], function(EventHand if (typeof event === 'object') { // check if click occured within the ::before pseudo element var rect = DomUtil.offset(element); - if ((event.clientY + document.body.scrollTop) > (rect.top + _quotePaddingTop + _titleHeight)) { + if ((event.clientY + window.scrollY) > (rect.top + _quotePaddingTop + _titleHeight)) { return; } -- 2.20.1