Add JS helpers to CombodoBackofficeToolbox to put/remove an element from fullscreen mode

This commit is contained in:
Molkobain
2020-12-16 18:04:33 +01:00
parent 745ffc7cd2
commit a00c573866

View File

@@ -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