// Permet ne pas entrer en conflict avec d'autre framework var $j = jQuery.noConflict(); $j(document).ready(function(){ /** * BASE DU CMS */ if($j().datepicker) { $j(".datePicker").datepicker({ dateFormat: 'dd.mm.yy', showOn: "button", buttonImage: '../images/jqueryTheme/calendar.png', buttonImageOnly: true }); } if($j().Tree) { $j('#tree').Tree(); } $j('#navPrinc li:has(ul)').children('a').click(function(e) { e.preventDefault(); firstLevel = $j(this).parent('li'); if (firstLevel.hasClass('navClose')){ firstLevel.removeClass('navClose'); firstLevel.addClass('navOpen'); }else{ firstLevel.removeClass('navOpen'); firstLevel.addClass('navClose'); } $j(this).next().slideToggle('fast'); //Refermer les autres div //$j('ul',$j(this).parent().siblings()).slideUp(); }); if( $j().slides ) { $j("#slides").slides({ play: 8000, slideSpeed: 8000, prev: 'prev', next: 'next', effect: 'fade', generatePagination:false }); }; /** * APPARTEMENT */ if($j().sortable) { $j( "#appartements tbody" ).sortable({ }); } $j("#addAppartement").click(function (e) { $j('#appartements tbody tr:last').clone(true).insertAfter('#appartements tbody tr:last'); $j('#appartements tbody tr:last').find('input').each(function() { $j(this).val(""); }); }); $j("a.deleteAppartement").click(function (e) { e.preventDefault(); nbLigne = $j('#appartements tbody tr').length; if (nbLigne > 1){ $j(this).parents("tr").eq(0).remove(); } }); /** * PHOTOS */ if($j().sortable) { $j( "#photoAppartement tbody" ).sortable({ }); } $j("#addPhotoAppartement").click(function (e) { $j('#photoAppartement tbody tr:last').clone(true).insertAfter('#photoAppartement tbody tr:last'); $j('#photoAppartement tbody tr:last').find('input').each(function() { $j(this).val(""); }); $j('#photoAppartement tbody tr:last').find('img.previewPhoto, span.blocDeletePhoto').each(function() { $j(this).css("display","none"); }); }); $j("a.deletephotoAppartement").click(function (e) { e.preventDefault(); nbLigne = $j('#photoAppartement tbody tr').length; if (nbLigne > 1){ $j(this).parents("tr").eq(0).remove(); } }); /***************************************************/ /*//Traductions*/ /***************************************************/ $j("button.addPageSite").click(function (e) { $j('#pageSite tbody tr:first').clone(true).insertAfter('#pageSite tbody tr:last'); $j('#pageSite tbody tr:last').css("display",""); }); $j("button.addModule").click(function (e) { $j('#moduleSite tbody tr:first').clone(true).insertAfter('#moduleSite tbody tr:last'); $j('#moduleSite tbody tr:last').css("display",""); }); $j(".deleteTr").click(function (e) { e.preventDefault(); $j(this).parents("tr").eq(0).remove(); }); }); function checkHover() { if (obj) { obj.find('ul').fadeOut('fast'); } } // Notification lorsqu'on enregistre l'�diteur function showConfirm(title,text){ $j.pnotify({ pnotify_title: title, pnotify_text: text, pnotify_notice_icon:"", pnotify_animation:"slide", pnotify_animate_speed: 'fast', pnotify_delay :3000, pnotify_history:false }); } function affPopupContent(idPage, reference){ $j.ajax({ type: "POST", url: "./include/ajax/affPopupContent.php", data: "idPage="+idPage+"&reference="+reference, async:false, success: function(msg){ $j('#affPopupContent').html(msg); $j('#affPopupContent').dialog({ width: 700, height:500, modal: true, closeText: '', buttons: { Fermer: function() { $j(this).dialog('close'); } } }); } }); }