Sha256: 7c51139390d9e2ce7f0f3d8bbabfa2efc441e7fd64b664cb6c486c0299206f27

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

$(document).ready(function() {
  $.getScript('/javascripts/jquery.hoverIntent.minified.js', function() {
    function linkHover() {
      $(this).next().addClass('link_hover');
    }

    function linkUnhover() {
      if (!$(this).next().hasClass('pop_up_hover'))
        $(this).next().removeClass('link_hover');
    }

    function popUpHover() {
      $(this).removeClass('link_hover');
      $(this).addClass('pop_up_hover');
    }

    function popUpUnhover() {
      $(this).removeClass('pop_up_hover');
    }

    var linkConfig = {
      interval: 200,
      out: linkUnhover,
      over: linkHover,
      sensitivity: 4,
      timeout: 250
    };

    var popUpConfig = {
      interval: 0,
      out: popUpUnhover,
      over: popUpHover,
      sensitivity: 4,
      timeout: 250
    };

    $('.mega_menu').hoverIntent(linkConfig);
    $('.mega_menu_links').hoverIntent(popUpConfig);
  });

  $.getScript('/javascripts/jquery.ui.nestedSortable.js', function() {
    $('#menu').nestedSortable({
      disableNesting: 'item',
      forcePlaceholderSize: true,
      handle: '.handle',
      items: 'li',
      opacity: .6,
      placeholder: 'placeholder',
      tabSize: 25,
      tolerance: 'pointer',
      toleranceElement: '> div',
      update: function(event, ui) {
        $.ajax({
          type: 'put',
          url: this.getAttribute('data-url'),
          data: { moved: ui.item[0].id, tree: $('#menu').nestedSortable('serialize') }
        });
      }
    });
  });

  $('#menu .toggle').click(function() {
    $(this).toggleClass('open');
    $(this).toggleClass('closed');
    $(this).parent().next('ol').toggle();
  });
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sortable_nested_set-0.2.2 public/javascripts/sortable_nested_set.js