diff --git a/www/js/my.full.js b/www/js/my.full.js index 104ac49e1b..5e43f76527 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1470,6 +1470,46 @@ function fixedTheadOfList(tableID) }); } +/** + * Init prioprity selectors + * @return void + */ +function initPrioritySelector() +{ + $('.dropdown-pris').each(function() + { + var $dropdown = $(this); + var $select = $dropdown.find('select'); + var selectVal = parseInt($select.val()); + var $menu = $dropdown.children('.dropdown-menu'); + if(!$menu.length) + { + $menu = $(''); + $dropdown.append($menu); + } + if(!$menu.children('li').length) + { + var set = $dropdown.data('set').split(',') || [0,1,2,3,4]; + for(var i = 0; i < set.length; ++i) + { + $menu.append('
  • ' + (i ? i : '') + '
  • '); + } + } + $menu.find('a[data-pri="' + selectVal + '"]').parent().addClass('active'); + $dropdown.find('.pri-text').html('' + (selectVal ? selectVal : '') + ''); + + $dropdown.on('click', '.dropdown-menu > li > a', function() + { + var $a = $(this); + $menu.children('li.active').removeClass('active'); + $a.parent().addClass('active'); + selectVal = $a.data('pri'); + $select.val(selectVal); + $dropdown.find('.pri-text').html('' + (selectVal ? selectVal : '') + ''); + }); + }); +} + /* Ping the server every some minutes to keep the session. */ needPing = true; @@ -1517,6 +1557,8 @@ $(document).ready(function() if(checkeds != '') checkeds = checkeds.substring(0, checkeds.length - 1); $.cookie('checkedItem', checkeds, {expires:config.cookieLife, path:config.webRoot}); }); + + initPrioritySelector(); }); /* CTRL+g, auto focus on the search box. */