mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
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=function(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}(d);var e=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.fullscreen,e=void 0===b?!0:b,h=a.showLoader,i=void 0===h?!1:h,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);g();d.trapFocus(l);var m=f(l,d,k);if(i){m.showLoadingIcon()}if(e){m.requestFullscreen()}return m},f=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)}},i=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()}},j=function(){var a=f.lastElementChild;while(a){f.removeChild(a);a=f.lastElementChild}};return{close:function close(){i();h();c.untrapFocus();a.remove();if(d){try{d.focus()}catch(a){}}},toggleFullscreen:function toggleFullscreen(){if(document.exitRequestFullScreen){if(document.fullScreenElement===a){i()}else{g()}}else if(document.msExitFullscreen){if(document.msFullscreenElement===a){i()}else{g()}}else if(document.mozCancelFullScreen){if(document.mozFullScreenElement===a){i()}else{g()}}else if(document.webkitExitFullscreen){if(document.webkitFullscreenElement===a){i()}else{g()}}},requestFullscreen:g,exitFullscreen:i,getContainer:function getContainer(){return e},setContent:function setContent(a){j();var b=e.lastElementChild;while(b){e.removeChild(b);b=e.lastElementChild}e.append(a)},showLoadingIcon:function showLoadingIcon(){(0,b.addIconToContainer)(f)},hideLoadingIcon:j}},g=function(){document.querySelector("body").classList.add("overflow-hidden")},h=function(){document.querySelector("body").classList.remove("overflow-hidden")};a.createLayout=e});
|
|
//# sourceMappingURL=fullscreen.min.js.map
|