From bac40290d6c564214f5f3221dc9dfbe8c704eb57 Mon Sep 17 00:00:00 2001 From: grandeljay Date: Thu, 7 Apr 2022 19:03:32 +0200 Subject: [PATCH] Disable channel settings on PWA --- src/assets/js/profile.js | 18 +++++++++++++++++- src/pages/profile.php | 6 +++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/assets/js/profile.js b/src/assets/js/profile.js index e9b06b3f..dbcedbe4 100644 --- a/src/assets/js/profile.js +++ b/src/assets/js/profile.js @@ -25,9 +25,25 @@ $(function() { } }); - $('.ui.dropdown').dropdown(); + $('.ui.dropdown.channel').dropdown(); $('.ui.dropdown.locale').dropdown({ sortSelect : 'natural', }); $('.ui.progress').progress(); + + var isPWA = window.matchMedia('(display-mode: standalone)').matches; + + if (isPWA) { + $('.ui.dropdown.channel').dropdown('set selected', 'stable'); + $('.ui.dropdown.channel').addClass('disabled'); + $('.ui.dropdown.channel').find('select').removeAttr('name'); + + if ('undefined' !== typeof CHANNELS) { + CHANNELS.forEach(channel => { + if (channel.host === location.host) { + $('.ui.dropdown.channel').dropdown('set selected', channel.branch); + } + }); + } + } }); diff --git a/src/pages/profile.php b/src/pages/profile.php index 1d0a069d..2344ca9f 100644 --- a/src/pages/profile.php +++ b/src/pages/profile.php @@ -260,10 +260,14 @@ $page->navigation(); + +
-