Serghey Rodin 10 жил өмнө
parent
commit
a35fa78389

+ 9 - 4
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;
 }

+ 76 - 0
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();
+
+