$(document).ready(function(){ // Réglage des options $('body').append(''); $('body').append(''); $('#menu-bar').prepend($('#links-menu')); $('#menu-bar').prepend($('#links-add-menu')); $('#links-add-fancy').append('




'); // Apparition du menu d'ajout de lien $('#links-add-menu').live('click', function(){ $.fancybox( $('#links-add-fancy').html() ); }); // Apparition de la reserve de liens $('#links-menu').live('click', function(){ $.get('modules/links/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("modules/links/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("modules/links/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("modules/links/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); }); }); });