Current Path : /var/www/ljmtc/cbt/mod/forum/amd/build/local/layout/ |
Current File : /var/www/ljmtc/cbt/mod/forum/amd/build/local/layout/fullscreen.min.js |
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("mod_forum/local/layout/fullscreen",["exports","core/loadingicon","core/toast","core/local/aria/focuslock"],function(a,b,c,d){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.createLayout=void 0;d=f(d);function e(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;e=function(){return a};return a}function f(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=e();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a){if(Object.prototype.hasOwnProperty.call(a,f)){var g=d?Object.getOwnPropertyDescriptor(a,f):null;if(g&&(g.get||g.set)){Object.defineProperty(c,f,g)}else{c[f]=a[f]}}}c.default=a;if(b){b.set(a,c)}return c}var g=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.fullscreen,e=void 0===b?!0:b,f=a.showLoader,g=void 0===f?!1:f,j=a.focusOnClose,k=void 0===j?null:j,l=document.createElement("div");document.body.append(l);l.classList.add("layout");l.classList.add("fullscreen");l.setAttribute("role","application");(0,c.addToastRegion)(l);i();d.trapFocus(l);var m=h(l,d,k);if(g){m.showLoadingIcon()}if(e){m.requestFullscreen()}return m},h=function(a,c,d){var e=document.createElement("div");a.append(e);var f=document.createElement("div");a.append(f);var g=function(){if(a.requestFullscreen){a.requestFullscreen()}else if(a.msRequestFullscreen){a.msRequestFullscreen()}else if(a.mozRequestFullscreen){a.mozRequestFullscreen()}else if(a.webkitRequestFullscreen){a.webkitRequestFullscreen()}else{a.setTop(0)}},h=function(){if(document.exitRequestFullScreen){if(document.fullScreenElement!==a){return}document.exitRequestFullScreen()}else if(document.msExitFullscreen){if(document.msFullscreenElement!==a){return}document.msExitFullscreen()}else if(document.mozCancelFullScreen){if(document.mozFullScreenElement!==a){return}document.mozCancelFullScreen()}else if(document.webkitExitFullscreen){if(document.webkitFullscreenElement!==a){return}document.webkitExitFullscreen()}},i=function(){var a=f.lastElementChild;while(a){f.removeChild(a);a=f.lastElementChild}};return{close:function close(){h();j();c.untrapFocus();a.remove();if(d){try{d.focus()}catch(a){}}},toggleFullscreen:function toggleFullscreen(){if(document.exitRequestFullScreen){if(document.fullScreenElement===a){h()}else{g()}}else if(document.msExitFullscreen){if(document.msFullscreenElement===a){h()}else{g()}}else if(document.mozCancelFullScreen){if(document.mozFullScreenElement===a){h()}else{g()}}else if(document.webkitExitFullscreen){if(document.webkitFullscreenElement===a){h()}else{g()}}},requestFullscreen:g,exitFullscreen:h,getContainer:function getContainer(){return e},setContent:function setContent(a){i();var b=e.lastElementChild;while(b){e.removeChild(b);b=e.lastElementChild}e.append(a)},showLoadingIcon:function showLoadingIcon(){(0,b.addIconToContainer)(f)},hideLoadingIcon:i}},i=function(){document.querySelector("body").classList.add("overflow-hidden")},j=function(){document.querySelector("body").classList.remove("overflow-hidden")};a.createLayout=g}); //# sourceMappingURL=fullscreen.min.js.map