From a00c5738661900ef91ca893cfc75b86b99dd4e15 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 16 Dec 2020 18:04:33 +0100 Subject: [PATCH] Add JS helpers to CombodoBackofficeToolbox to put/remove an element from fullscreen mode --- js/pages/backoffice/toolbox.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/js/pages/backoffice/toolbox.js b/js/pages/backoffice/toolbox.js index df7f11a1a..9a822516a 100644 --- a/js/pages/backoffice/toolbox.js +++ b/js/pages/backoffice/toolbox.js @@ -64,7 +64,34 @@ function SwitchTabMode() * @since 3.0.0 */ const CombodoBackofficeToolbox = { - + /** + * Set the oElem in fullscreen mode, meaning that it will take all the screen and be above everything else. + * + * @param {object} oElem The jQuery object of the element + * @constructor + */ + SetElementToFullscreenMode: function(oElem) { + oElem.parents().addClass('ibo-has-fullscreen-descendant'); + oElem.addClass('ibo-is-fullscreen'); + }, + /** + * Remove the oElem from fullscreen mode. + * If none passed, all fullscreen elements will be removed from it + * + * @param {object|null} oElem The jQuery object of the element + * @constructor + */ + RemoveElementFromFullscreenMode: function(oElem = null) { + // If no element passed, remove any element from fullscreen mode + if(oElem === null) { + $(document).find('.ibo-has-fullscreen-descendant').removeClass('ibo-has-fullscreen-descendant'); + $(document).find('.ibo-is-fullscreen').removeClass('ibo-is-fullscreen'); + } + else { + oElem.parents().removeClass('ibo-has-fullscreen-descendant'); + oElem.removeClass('ibo-is-fullscreen'); + } + } }; // Processing