diff --git a/web/share/js/wm.js b/web/share/js/wm.js
index 6ddb25c3..66cda3dc 100644
--- a/web/share/js/wm.js
+++ b/web/share/js/wm.js
@@ -230,7 +230,6 @@ function __WindowManager() {
self.info = (html, ...args) => __modalCodeDialog("Info", html, args.join("\n"), true, false);
self.error = (html, ...args) => __modalCodeDialog("Error", html, args.join("\n"), true, false);
self.confirm = (html, ...args) => __modalCodeDialog("Question", html, args.join("\n"), true, true);
- self.modal = (header, html, ok, cancel) => __modalDialog(header, html, ok, cancel);
var __modalCodeDialog = function(header, html, code, ok, cancel) {
let create_content = function(el_content) {
@@ -244,10 +243,10 @@ function __WindowManager() {
}
el_content.innerHTML = html;
};
- return __modalDialog(header, create_content, ok, cancel);
+ return self.modal(header, create_content, ok, cancel);
};
- var __modalDialog = function(header, html, ok, cancel, el_parent=null) {
+ self.modal = function(header, html, ok, cancel) {
let el_active_menu = (document.activeElement && document.activeElement.closest(".menu"));
let el_modal = document.createElement("div");
@@ -329,7 +328,7 @@ function __WindowManager() {
}
__windows.push(el_modal);
- (el_parent || document.fullscreenElement || document.body).appendChild(el_modal);
+ (document.fullscreenElement || document.body).appendChild(el_modal);
if (typeof html === "function") {
// Это должно быть здесь, потому что элемент должен иметь родителя чтобы существовать
html(el_content, el_ok_bt);
@@ -752,21 +751,23 @@ function __WindowManager() {
var __setFullScreenWindow = function(el_win) {
el_win.__before_full_screen_rect = el_win.getBoundingClientRect();
- el_win.requestFullscreen();
- if (navigator.keyboard && navigator.keyboard.lock) {
- navigator.keyboard.lock();
- } else {
- let msg = (
- "Shortcuts like Alt+Tab, Ctrl+W, Ctrl+N might not be captured.
"
- + "For best keyboard handling use any browser with
keyboard lock support from this list.
"
- + "In Chrome use HTTPS and enable system-keyboard-lock
"
- + "by putting at URL chrome://flags/#system-keyboard-lock"
- );
- __modalDialog("Keyboard lock is unsupported", msg, true, false, el_win);
- }
- el_win.focus(el_win); // Почему-то теряется фокус
+ el_win.requestFullscreen().then(function() {
+ el_win.focus(el_win); // Почему-то теряется фокус
+ if (navigator.keyboard && navigator.keyboard.lock) {
+ navigator.keyboard.lock();
+ } else {
+ let msg = (
+ "The Keyboard Lock API is not supported by this browser.
"
+ + "It means that shortcuts like Alt+Tab and Ctrl+W might not be captured.
"
+ + "For best keyboard handling use any browser with
keyboard lock support from this list.
"
+ + "In Chrome use HTTPS and enable system-keyboard-lock
"
+ + "by putting at URL chrome://flags/#system-keyboard-lock"
+ );
+ self.info(msg);
+ }
+ });
};
__init__();