<commit_before>import Ember from 'ember';

export default Ember.Component.extend({
  tagName: 'nav',

  classNames: ['navbar', 'navbar-onedata'],

  userName: function() {
    return this.get('session.opData.sessionDetails.userName');
  }.property('session.opData'),

  didInsertElement() {
    let box = $('#navbar');
    let boxElement = box[0];

    box.mousewheel(function(e) {
      let isMobileMenu = $(this).hasClass('in');
      if (isMobileMenu) {
        let delta = e.originalEvent && e.deltaY;
        let scrollBegin = (this.scrollTop === 0);
        let scrollEnd = (boxElement.scrollHeight - boxElement.scrollTop === boxElement.clientHeight);
        let isScrollingUp = (delta > 0);
        if ((scrollBegin && isScrollingUp) || (scrollEnd && !isScrollingUp)) {
          e.preventDefault();
        }
      }
    });

    $('.global-fog').mousewheel(function(event) {
      event.preventDefault();
    });

    let toggleButton = $('.navbar-toggle')[0];

    $('.global-fog').click(function() {
      if ($(this).hasClass('active')) {
        toggleButton.click();
      }
    });

    $('#navbar a').click(function() {
      toggleButton.click();
    });
  }
});<commit_msg>VFS-1672: Fixed main menu blinking on click<commit_after>import Ember from 'ember';

export default Ember.Component.extend({
  tagName: 'nav',

  classNames: ['navbar', 'navbar-onedata'],

  userName: function() {
    return this.get('session.opData.sessionDetails.userName');
  }.property('session.opData'),

  didInsertElement() {
    let box = $('#navbar');
    let boxElement = box[0];

    box.mousewheel(function(e) {
      let isMobileMenu = $(this).hasClass('in');
      if (isMobileMenu) {
        let delta = e.originalEvent && e.deltaY;
        let scrollBegin = (this.scrollTop === 0);
        let scrollEnd = (boxElement.scrollHeight - boxElement.scrollTop === boxElement.clientHeight);
        let isScrollingUp = (delta > 0);
        if ((scrollBegin && isScrollingUp) || (scrollEnd && !isScrollingUp)) {
          e.preventDefault();
        }
      }
    });

    $('.global-fog').mousewheel(function(event) {
      event.preventDefault();
    });

    // use only one toggle button
    let toggleButton = $('.navbar-toggle')[0];

    $('.global-fog').click(function() {
      if ($(this).hasClass('active')) {
        toggleButton.click();
      }
    });

    // this should be the same code as in navbar-toggle...
    // maybe TODO: create: showMenu and hideMenu functions
    $('#navbar a').click(function() {
      $('.global-fog').removeClass('active');
    });
  }
});
{'fraction_non_alphanumeric': 0.17453560371517027, 'fraction_numerical': 0.0046439628482972135, 'mean_word_length': 2.8582089552238807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6631620', 'n_tokens_mistral': 808, 'n_tokens_neox': 775, 'n_words': 157}