diff --git a/db/zm_update-1.39.4.sql b/db/zm_update-1.39.4.sql index d871f17e4..06980c1e8 100644 --- a/db/zm_update-1.39.4.sql +++ b/db/zm_update-1.39.4.sql @@ -17,3 +17,17 @@ UPDATE Config SET No: Checkbox is shown and unchecked by default. Users may check it to persist the session. ' WHERE Name = 'ZM_OPT_USE_REMEMBER_ME'; + +-- +-- Add ZM_WEB_BUTTON_STYLE config option +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM Config WHERE Name = 'ZM_WEB_BUTTON_STYLE') > 0, +"SELECT 'ZM_WEB_BUTTON_STYLE already exists'", +"INSERT INTO Config SET Id = 251, Name = 'ZM_WEB_BUTTON_STYLE', Value = 'icons+text', Type = 'string', DefaultValue = 'icons+text', Hint = 'icons+text|icons|text', Pattern = '(?^i:^([it]))', Format = ' $1 ', Prompt = 'How to display toolbar buttons throughout the interface', Help = 'Controls the display of toolbar buttons across the web interface. Icons + Text: Show both icon and label (default). Icons Only: Show only the icon; labels are hidden. Text Only: Show only the label; icons are hidden on buttons that have labels.', Category = 'web', Readonly = '0', Requires = ''" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index 2dd5bbcf9..2a38aa4d6 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -3017,6 +3017,24 @@ our @options = ( requires => [ { name=>'ZM_WEB_NAVBAR_TYPE', value=>'left' } ], category => 'web', }, + { + name => 'ZM_WEB_BUTTON_STYLE', + default => 'icons+text', + description => 'How to display toolbar buttons throughout the interface.', + help => q` + Controls the display of toolbar buttons across the web interface. + Icons + Text: Show both icon and label (default). + Icons Only: Show only the icon; labels are hidden. + Text Only: Show only the label; icons are hidden on buttons that have labels. + `, + type => { + db_type => 'string', + hint => 'icons+text|icons|text', + pattern => qr|^([it])|i, + format => q( $1 ) + }, + category => 'web', + }, { name => 'ZM_WEB_H_REFRESH_MAIN', default => '240', diff --git a/web/skins/classic/css/base/skin.css b/web/skins/classic/css/base/skin.css index 4bd62222c..cdd695a5b 100644 --- a/web/skins/classic/css/base/skin.css +++ b/web/skins/classic/css/base/skin.css @@ -1633,4 +1633,18 @@ video-stream[id^='liveStream'] video{ .invisible { visibility: hidden; } + +/* Button style: icons only — hide text labels */ +.btn-icons-only button .text, +.btn-icons-only .btn .text { + display: none; +} + +/* Button style: text only — hide icons on buttons that have a text label */ +.btn-text-only button:has(.text) > i.material-icons, +.btn-text-only button:has(.text) > i.fa, +.btn-text-only .btn:has(.text) > i.material-icons, +.btn-text-only .btn:has(.text) > i.fa { + display: none; +} /* --- This block should always be located at the end! */ diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index d5207ec7f..ae2c42d2f 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -159,6 +159,8 @@ function getBodyTopHTML() { $classes = $view.'-page'; if (defined('ZM_WEB_NAVBAR_STICKY') and ZM_WEB_NAVBAR_STICKY) $classes .= ' sticky'; if (defined('ZM_WEB_FILTER_SETTINGS_POSITION') and ZM_WEB_FILTER_SETTINGS_POSITION == 'inline') $classes .= ' filter-inline'; + if (defined('ZM_WEB_BUTTON_STYLE') and ZM_WEB_BUTTON_STYLE == 'icons') $classes .= ' btn-icons-only'; + else if (defined('ZM_WEB_BUTTON_STYLE') and ZM_WEB_BUTTON_STYLE == 'text') $classes .= ' btn-text-only'; $classHTML = ' class="'.$classes.'"'; echo ' diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index 94da205ed..b71e12c59 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -847,8 +847,7 @@ function isJSON(str) { const result = JSON.parse(str); const type = Object.prototype.toString.call(result); return type === '[object Object]' || type === '[object Array]'; // We only pass objects and arrays - } catch (e) { - console.log('This is not JSON', str, e); + } catch { return false; // This is also not JSON } } diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 3b1338b3c..57e49ad53 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -190,31 +190,31 @@ echo $navbar ?> } ?> - - - -
-