From a35fa78389f484fdd60be21c4bb730abc8e3bc59 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Thu, 15 Oct 2015 15:03:59 +0300 Subject: [PATCH] FileManager stuff --- web/css/styles.min.css | 13 +++++--- web/js/events.js | 76 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 4 deletions(-) diff --git a/web/css/styles.min.css b/web/css/styles.min.css index 85834f5e..5aeee4f9 100644 --- a/web/css/styles.min.css +++ b/web/css/styles.min.css @@ -711,6 +711,10 @@ input[type="checkbox"] { background-color: #ff6701; } +.l-menu.active .l-menu__item.focus a { + text-decoration: underline; + color: #5edad0; +} .lang-ua .l-menu__item a, .lang-nl .l-menu__item a, @@ -808,14 +812,15 @@ input[type="checkbox"] { border-bottom: 3px solid #ff6e42; } -.l-stat__col.focus { - background-color: #ddd; +.l-stat.active .l-stat__col.focus a { + border-bottom: 3px solid #5edad0; } -.l-stat__col.focus a { - border-bottom: 3px solid #AACC0D; +.l-stat.active .l-stat__col.focus a .l-stat__col-title { + color: #36B3A9; } + .l-stat__col a:hover .l-stat__col-title { color: #ff6701; } diff --git a/web/js/events.js b/web/js/events.js index 23cc9e47..9b7ceb38 100644 --- a/web/js/events.js +++ b/web/js/events.js @@ -1,6 +1,13 @@ // Init kinda namespace object var VE = { // Vesta Events object core: {}, // core functions + navigation: { + state: { + active_menu: 1, + menu_selector: '.l-stat__col', + menu_active_selector: '.l-stat__col--active' + } + }, // menu and element navigation functions callbacks: { // events callback functions click: {}, mouseover: {}, @@ -225,6 +232,75 @@ VE.helpers.refresh_timer = { } } +VE.navigation.enter_focused = function() { + if($(VE.navigation.state.menu_selector + '.focus a').attr('href')){ + location.href=($(VE.navigation.state.menu_selector + '.focus a').attr('href')); + } +} +VE.navigation.move_focus_left = function(){ + var index = parseInt($(VE.navigation.state.menu_selector).index($(VE.navigation.state.menu_selector+'.focus'))); + if(index == -1) + index = parseInt($(VE.navigation.state.menu_selector).index($(VE.navigation.state.menu_active_selector))); + if(index > 0){ + $(VE.navigation.state.menu_selector).removeClass('focus'); + $($(VE.navigation.state.menu_selector)[index-1]).addClass('focus'); + } else { + $($(VE.navigation.state.menu_selector)[0]).addClass('focus'); + } +} + +VE.navigation.move_focus_right = function(){ + var max_index = $(VE.navigation.state.menu_selector).length-1; + var index = parseInt($(VE.navigation.state.menu_selector).index($(VE.navigation.state.menu_selector+'.focus'))); + if(index == -1) + index = parseInt($(VE.navigation.state.menu_selector).index($(VE.navigation.state.menu_active_selector))) || 0; + + if(index < max_index){ + $(VE.navigation.state.menu_selector).removeClass('focus'); + $($(VE.navigation.state.menu_selector)[index+1]).addClass('focus'); + } +} + +VE.navigation.switch_menu = function(){ + if(VE.navigation.state.active_menu == 0){ + VE.navigation.state.active_menu = 1; + VE.navigation.state.menu_selector = '.l-stat__col'; + VE.navigation.state.menu_active_selector = '.l-stat__col--active'; + $('.l-menu').removeClass('active'); + $('.l-stat').addClass('active'); + } else { + VE.navigation.state.active_menu = 0; + VE.navigation.state.menu_selector = '.l-menu__item'; + VE.navigation.state.menu_active_selector = '.l-menu__item--active'; + $('.l-menu').addClass('active'); + $('.l-stat').removeClass('active'); + } + + + var index = parseInt($(VE.navigation.state.menu_selector).index($(VE.navigation.state.menu_selector+'.focus'))); + if(index == -1){ + index = parseInt($(VE.navigation.state.menu_selector).index($(VE.navigation.state.menu_active_selector))) || 0; + if(index == -1) + index = 0; + $($(VE.navigation.state.menu_selector)[index]).addClass('focus'); + } +} + +VE.navigation.init = function(){ + if($('.l-menu__item.l-menu__item--active').length){ +// VE.navigation.switch_menu(); + VE.navigation.state.active_menu = 0; + VE.navigation.state.menu_selector = '.l-menu__item'; + VE.navigation.state.menu_active_selector = '.l-menu__item--active'; + $('.l-menu').addClass('active'); + $('.l-stat').removeClass('active'); + + } else { + $('.l-stat').addClass('active'); + } +} VE.helpers.extendPasswordFields(); + +