#HTTP_HEADER{Content-Type: text/javascript} ;if(window.jQuery) (function($){ $(document).ready(function(){ dessiner_repere = function($id, $position, $distance) { $ou = 'top'; $l = 'h'; if ($position == 'vertical') { $ou = 'left'; $l = 'v';} return ''; } deplacements_reperes = function() { $('#reperes .horizontal').draggable({ axis: 'y', cursor: 'row-resize', drag: function(event, ui) { $('#' + event.target.id + ' span').html('top ' + event.target.offsetTop + 'px'); }, stop: function(event, ui) { $('#' + event.target.id + ' span').html('top ' + event.target.offsetTop + 'px'); $.post('#URL_ACTION_AUTEUR{reperes}', { id: event.target.id.substring(9), type: 'horizontal', valeur: event.target.offsetTop }); } }) .dblclick(function(event){ $id = event.target.id; if (!$id) { $id = event.target.parentNode.id; } $.post('#URL_ACTION_AUTEUR{reperes}', { id: '-' + $id.substring(9), type: 'horizontal', }, function (data){ recuperer_reperes(); }); }); $('#reperes .vertical').draggable({ axis: 'x', cursor: 'col-resize', drag: function(event, ui) { $('#' + event.target.id + ' span').html('left ' + event.target.offsetLeft + 'px'); }, stop: function(event, ui) { $('#' + event.target.id + ' span').html('left ' + event.target.offsetLeft + 'px'); $.post('#URL_ACTION_AUTEUR{reperes}', { id: event.target.id.substring(9), type: 'vertical', valeur: event.target.offsetLeft }); } }) .dblclick(function(event){ $id = event.target.id; if (!$id) { $id = event.target.parentNode.id; } $.post('#URL_ACTION_AUTEUR{reperes}', { id: '-' + $id.substring(9), type: 'vertical', }, function (data){ recuperer_reperes(); }); }); } recuperer_reperes = function() { $.ajax({ url:'#URL_ACTION_AUTEUR{reperes}', cache:false, dataType:'json', success: function(data) { if (data) { $('#reperes').remove(); $('[(#CONFIG{reperes/calque/selecteur})]').[(#CONFIG{reperes/calque/position})]('
'); $reperes = $('#reperes'); if (typeof(data.horizontal) != 'undefined') { $.each(data.horizontal, function(key, def) { if (def) { $reperes.append(dessiner_repere(key, 'horizontal', def.distance)); } }); } if (typeof(data.vertical) != 'undefined') { $.each(data.vertical, function(key, def) { if (def) { $reperes.append(dessiner_repere(key, 'vertical', def.distance)); } }); } deplacements_reperes(); } } }); } recuperer_reperes(); $('body').append('
'); $('#repere_vertical_plus') .click(function(){ $.post('#URL_ACTION_AUTEUR{reperes}', { type: 'vertical', valeur: 100 }, function (data){ recuperer_reperes(); }); }); $('#repere_horizontal_plus') .click(function(){ $.post('#URL_ACTION_AUTEUR{reperes}', { type: 'horizontal', valeur: 100 }, function (data){ recuperer_reperes(); }); }); }); })(jQuery);