From 39c81ccedf519943872d984e0ce6838fd4550953 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 14 Nov 2016 13:25:22 +0100 Subject: [PATCH] Fixed calculation of positions in IE11 --- .../files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js | 2 +- wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js | 4 ++-- .../files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js index 393204d929..089c1b6f96 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js @@ -136,7 +136,7 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'], var region = _stylePreviewRegions.get(lastValue); var rect = region.getBoundingClientRect(); - var top = rect.top + window.scrollY; + var top = rect.top + (window.scrollY || window.pageYOffset); DomUtil.setStyles(_stylePreviewRegionMarker, { height: (region.clientHeight + 20) + 'px', diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js index d7c0755865..91c691abb6 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js @@ -236,13 +236,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) < window.scrollY) { + if (bodyHeight - (bottom + elDimensions.height) < (window.scrollY || window.pageYOffset)) { result = false; } } else { top = refOffsets.top + refDimensions.height + verticalOffset; - if (top + elDimensions.height - window.scrollY > windowHeight) { + if (top + elDimensions.height - (window.scrollY || window.pageYOffset) > windowHeight) { result = false; } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js index a5f0ece54e..ae8c06301d 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js @@ -134,12 +134,12 @@ define(['Ajax', 'Environment', 'Ui/CloseOverlay'], function(Ajax, Environment, U // get the offsets of the bounding box of current text selection var rect = data.selection.getRangeAt(0).getBoundingClientRect(); var offsets = { - top: Math.round(rect.bottom) + window.scrollY, + top: Math.round(rect.bottom) + (window.scrollY || window.pageYOffset), left: Math.round(rect.left) + document.body.scrollLeft }; if (this._lineHeight === null) { - this._lineHeight = Math.round(rect.bottom - rect.top - window.scrollY); + this._lineHeight = Math.round(rect.bottom - rect.top - (window.scrollY || window.pageYOffset)); } // restore caret position @@ -311,7 +311,7 @@ define(['Ajax', 'Environment', 'Ui/CloseOverlay'], function(Ajax, Environment, U this._selectItem(0); - if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + window.scrollY) { + if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + (window.scrollY || window.pageYOffset)) { this._dropdownMenu.style.setProperty('top', offset.top - this._dropdownMenu.offsetHeight - 2 * this._lineHeight + 7 + 'px', ''); } }, -- 2.20.1