Accueil/js/jquery.links.js

67 lines
1.8 KiB
JavaScript

$(document).ready(function(){
// Réglage des options
$('body').append('<img src="images/interface/link_edit.png" id="links-menu" />');
$('#menu-bar').prepend($('#links-menu'));
// Apparition de la reserve de liens
$('#links-menu').live('click', function(){
$('#reserve').show();
$.get('ajax/loadReserve.php', function(html){
$.fancybox(
html,
{
'autoDimensions' : false,
'width' : 400,
'height' : 'auto',
'showNavArrows' : false,
'transitionIn' : 'elastic'
}
);
});
});
// Passage Reserve => Liste
$('#reserveiconlist .item').live('click', function(e){
e.preventDefault();
$.post("ajax/reserveToList.php", {reserve: $(this).attr('id')});
$('#Entertainment').append($(this).parent().html());
$.fancybox.close();
});
//Passage Liste => Reserve
// ??
// Mouvement des liens avec enregistrement
$(".iconlist").sortable(
{
//distance: 45,
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");
},
stop: function(e) {
//$("a.popup").bind("click", function(e){ itemClickHandler(e, $(this)); });
//$("a.popup").click(itemClickHandler);
}
}
).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);
});
});
});