$(document).ready(function(){ // Réglage des options $('body').append(''); $('#menu-bar').prepend($('#links-menu')); // Apparition de la reserve de liens $('#links-menu').live('click', function(){ $.get('ajax/loadReserve.php', function(html){ $.fancybox( html, { 'autoDimensions' : false, 'width' : 400, 'height' : 'auto', 'showNavArrows' : false, 'transitionIn' : 'elastic' } ); }); }); // Passage Reserve => Liste $('#reserveiconlist .iconitem').live('click', function(e){ e.preventDefault(); $.post("ajax/reserveToList.php", {reserve: $(this).attr('id')}); $('.iconlist').last().append('
  • '+$(this).html()+'
  • '); $.fancybox.close(); }); //Passage Liste => Reserve $('.iconitem').mouseover(function(){ $(this).children('.deleteLink').show(); }); $('.iconitem').mouseout(function(){ $(this).children('.deleteLink').hide(); }); $('.deleteLink').click(function(){ $.post("ajax/listToReserve.php", {reserve: $(this).parent().attr('id')}); $(this).parent().fadeOut(); }); // Mouvement des liens avec enregistrement $(".iconlist").sortable( { connectWith: '.iconlist', update: function(event,ui){ var linkOrder = $(this).sortable('toArray').toString(); var label = $(ui.item).parent()[0].id; var itemMoved = $(ui.item)[0].id; $.post("ajax/update-links-order.php", {order: linkOrder, label : label, itemMoved: itemMoved}); }, start: function(e) { // have to remvoe click handler off item so drop doesn't click $("a.popup").unbind("click"); } } ).disableSelection().mouseout(function(){ // reattach the item click handler $('a.popup').unbind("click").bind("click", function(e){ e.preventDefault(); var url = $(this).attr('href'); spawnURL(url); }); }); });