| Total Complexity | 5 |
| Complexity/F | 1.67 |
| Lines of Code | 36 |
| Function Count | 3 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | $(document).ready(function() { |
||
| 2 | $('<div></div>') |
||
| 3 | .attr('id', 'midgard_admin_asgard_resizer') |
||
| 4 | .css('left', $('#content').css('margin-left')) |
||
| 5 | .appendTo('#container-wrapper'); |
||
| 6 | |||
| 7 | $('#midgard_admin_asgard_resizer').draggable({ |
||
| 8 | axis: 'axis-x', |
||
| 9 | containment: '#container-wrapper', |
||
| 10 | stop: function(event, ui) { |
||
| 11 | var offset = ui.offset.left, |
||
| 12 | navigation_width = offset - 31, |
||
| 13 | content_margin_left = offset + 1; |
||
| 14 | |||
| 15 | if (offset < 0) { |
||
| 16 | offset = 0; |
||
| 17 | } |
||
| 18 | |||
| 19 | $('#navigation').css('width', navigation_width + 'px'); |
||
| 20 | $('#content').css('margin-left', content_margin_left + 'px'); |
||
| 21 | |||
| 22 | $.post(MIDCOM_PAGE_PREFIX + '__mfa/asgard/preferences/ajax/', {offset: offset}); |
||
| 23 | } |
||
| 24 | }); |
||
| 25 | |||
| 26 | $('body').on('click', '.section_content a', function() { |
||
| 27 | var scroll_top = $('#navigation').scrollTop(), |
||
| 28 | section = $('#navigation .section.expanded').find('h3').text(); |
||
| 29 | sessionStorage.setItem(section + '_scrolltop', scroll_top); |
||
| 30 | }); |
||
| 31 | |||
| 32 | var section = $('#navigation .section.expanded').find('h3').text(); |
||
| 33 | if (sessionStorage.getItem(section + '_scrolltop')) { |
||
| 34 | $('#navigation').scrollTop(sessionStorage.getItem(section + '_scrolltop')); |
||
| 35 | } |
||
| 36 | }); |
||
| 37 |