this._bindListener();
- document.documentElement.classList.add('pageOverlayActive');
+ require(['Ui/Screen'], function(UiScreen) {
+ UiScreen.pageOverlayOpen();
+ });
return true;
},
WCF.System.DisableScrolling.enable();
WCF.System.DisableZoom.enable();
- document.documentElement.classList.remove('pageOverlayActive');
+ require(['Ui/Screen'], function(UiScreen) {
+ UiScreen.pageOverlayClose();
+ });
return true;
},
'Ajax', 'Core', 'Dictionary', 'EventHandler',
'Language', 'List', 'ObjectMap', 'Dom/ChangeListener',
'Dom/Traverse', 'Dom/Util', 'Ui/Confirmation', 'Ui/SimpleDropdown',
- 'WoltLabSuite/Core/Ui/Page/Action'
+ 'WoltLabSuite/Core/Ui/Page/Action', 'Ui/Screen'
],
function(
Ajax, Core, Dictionary, EventHandler,
Language, List, ObjectMap, DomChangeListener,
DomTraverse, DomUtil, UiConfirmation, UiSimpleDropdown,
- UiPageAction
+ UiPageAction, UiScreen
)
{
"use strict";
var _callbackItem = null;
var _callbackUnmarkAll = null;
- var _addPageOverlayActiveClass = false;
var _specialCheckboxSelector = '.messageCheckboxLabel > input[type="checkbox"], .message .messageClipboardCheckbox > input[type="checkbox"], .messageGroupList .columnMark > label > input[type="checkbox"]';
/**
hideEditor: function(objectType) {
UiPageAction.remove('wcfClipboard-' + objectType);
- if (_addPageOverlayActiveClass) {
- _addPageOverlayActiveClass = false;
-
- document.documentElement.classList.add('pageOverlayActive');
- }
+ UiScreen.pageOverlayOpen();
},
/**
showEditor: function() {
this._loadMarkedItems();
- if (document.documentElement.classList.contains('pageOverlayActive')) {
- document.documentElement.classList.remove('pageOverlayActive');
-
- _addPageOverlayActiveClass = true;
- }
+ UiScreen.pageOverlayClose();
},
/**
* @return {object<string, *>} dialog data
*/
openStatic: function(id, html, options, createOnly) {
- document.documentElement.classList.add('pageOverlayActive');
+ UiScreen.pageOverlayOpen();
if (Environment.platform() !== 'desktop') {
if (!this.isOpen(id)) {
if (data.closable) {
window.removeEventListener('keyup', _keyupListener);
}
- document.documentElement.classList.remove('pageOverlayActive');
+
+ UiScreen.pageOverlayClose();
}
else {
data = _dialogs.get(_activeDialog);
_pageContainer.classList.add('menuOverlay-' + this._menu.id);
- document.documentElement.classList.add('pageOverlayActive');
+ UiScreen.pageOverlayOpen();
return true;
},
this._menu.classList.remove('open');
UiScreen.scrollEnable();
+ UiScreen.pageOverlayClose();
_pageContainer.classList.remove('menuOverlay-' + this._menu.id);
- document.documentElement.classList.remove('pageOverlayActive');
-
return true;
}
// break if no edge has been touched
if (!isLeftEdge && !isRightEdge) return;
// break if a different menu is open
- if (document.documentElement.classList.contains('pageOverlayActive')) {
+ if (UiScreen.pageOverlayIsActive()) {
var found = false;
for (var i = 0; i < _pageContainer.classList.length; i++) {
if (_pageContainer.classList[i] === 'menuOverlay-' + this._menu.id) {
var _scrollDisableCounter = 0;
var _scrollOffsetFrom = null;
var _scrollTop = 0;
+ var _pageOverlayCounter = 0;
var _mqMap = Dictionary.fromObject({
'screen-xs': '(max-width: 544px)', /* smartphone */
}
},
+ /**
+ * Indicates that at least one page overlay is currently open.
+ */
+ pageOverlayOpen: function() {
+ if (_pageOverlayCounter === 0) {
+ document.documentElement.classList.add('pageOverlayActive');
+ }
+
+ _pageOverlayCounter++;
+ },
+
+ /**
+ * Marks one page overlay as closed.
+ */
+ pageOverlayClose: function() {
+ if (_pageOverlayCounter) {
+ _pageOverlayCounter--;
+
+ if (_pageOverlayCounter === 0) {
+ document.documentElement.classList.remove('pageOverlayActive');
+ }
+ }
+ },
+
+ /**
+ * Returns true if at least one page overlay is currently open.
+ *
+ * @returns {boolean}
+ */
+ pageOverlayIsActive: function() {
+ return _pageOverlayCounter > 0;
+ },
+
/**
* Sets the dialog container element. This method is used to
* circumvent a possible circular dependency, due to `Ui/Dialog`