From c5544349d2bc5981ed843a7f71c8326364da4a3e Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Wed, 14 Nov 2018 06:08:07 +0300 Subject: [PATCH] refactoring --- eslintrc.yaml | 1 + web/index.html | 3 ++- web/js/bb.js | 13 +++++++++++++ web/js/kvm/main.js | 9 +-------- 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 web/js/bb.js diff --git a/eslintrc.yaml b/eslintrc.yaml index 4ba71dda..8c3d07f9 100644 --- a/eslintrc.yaml +++ b/eslintrc.yaml @@ -9,6 +9,7 @@ globals: Ui: true ui: true tools: true + check_browser: true "$": true "$$": true diff --git a/web/index.html b/web/index.html index 20f25451..d8de279f 100644 --- a/web/index.html +++ b/web/index.html @@ -2,7 +2,7 @@ - Pi-KVM + Pi-KVM / Session @@ -27,6 +27,7 @@ + diff --git a/web/js/bb.js b/web/js/bb.js new file mode 100644 index 00000000..8d8590db --- /dev/null +++ b/web/js/bb.js @@ -0,0 +1,13 @@ +function check_browser() { + if ( + !window.navigator + || window.navigator.userAgent.indexOf("MSIE ") > 0 + || window.navigator.userAgent.indexOf("Trident/") > 0 + || window.navigator.userAgent.indexOf("Edge/") > 0 + ) { + $("bad-browser-modal").style.visibility = "visible"; + return false; + } else { + return true; + } +} diff --git a/web/js/kvm/main.js b/web/js/kvm/main.js index 3cb65402..4565ce3c 100644 --- a/web/js/kvm/main.js +++ b/web/js/kvm/main.js @@ -1,14 +1,7 @@ var ui; function main() { - if ( - !window.navigator - || window.navigator.userAgent.indexOf("MSIE ") > 0 - || window.navigator.userAgent.indexOf("Trident/") > 0 - || window.navigator.userAgent.indexOf("Edge/") > 0 - ) { - $("bad-browser-modal").style.visibility = "visible"; - } else { + if (check_browser()) { ui = new Ui(); tools.setOnClick($("show-about-button"), () => ui.showWindow($("about-window")));