/** * @author: iull * @desc: loader de la bibliothèque utilisant jquery et des fonctions associées * v. 1.0 */ var $j = jQuery.noConflict(); $j(document).ready(function(){ if($j('#labId').length){ $j.getScript('/admin/getJs.php?js=labs/'+$j('#labId').val()+'.js&t=1510966977', function(){ initiate(); }); } }); jQuery.extend({ getScript: function(url, callback){ var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = url; // Handle Script loading { var done = false; // Attach handlers for all browsers script.onload = script.onreadystatechange = function(){ if ( !done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ){ done = true; if (callback) callback(); // Handle memory leak in IE script.onload = script.onreadystatechange = null; } }; } head.appendChild(script); // We handle everything using the script element injection return undefined; } }); // function openLab(file, callback, folder){ var lab = file; if(folder){ lab = folder+'/'+file; } $j.getScript('getJs.php?js=labs/'+lab+'&t=1510966977', function(){ initiate(); if (callback!=null){ callback(); } }); } /*------------------------------------------------------------------------------*/ // BG animated plugins /*------------------------------------------------------------------------------*/ (function($){ $.extend($.fx.step,{ backgroundPosition: function(fx){ if (fx.state === 0 && typeof fx.end == 'string'){ var start = $.curCSS(fx.elem,'backgroundPosition'); start = toArray(start); fx.start = [start[0],start[2]]; var end = toArray(fx.end); fx.end = [end[0],end[2]]; fx.unit = [end[1],end[3]]; } var nowPosX = []; nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0]; nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1]; fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1]; function toArray(strg){ strg = strg.replace(/left|top/g,'0px'); strg = strg.replace(/right|bottom/g,'100%'); strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2"); var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/); return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]]; } } }); })(jQuery); //equivalent du label pour les participants à une formation function selectParticipant(id) { var idReservation = $j('#idReservation').val(); if(!$j("#"+id).hasClass("offre_box_simple_selected")) { $j("#"+id).addClass("offre_box_simple_selected"); $j("#"+id).parent().addClass("active"); var data_url = 'mode=formations-addNegoReservation&idReservation='+idReservation+'&idNego='+id; if($j("#"+id).hasClass('typenego')) data_url+='&type=nego'; if($j("#"+id).hasClass('typeagenceseule')) data_url+='&type=agenceseule'; if($j("#"+id).hasClass('typemandataire')) data_url+='&type=mandataire'; if($j("#"+id).hasClass('typeagence')) data_url+='&type=agence'; if($j("#"+id).hasClass('typesecretaire')) data_url+='&type=secretaire'; if($j("#"+id).hasClass('typeadmin')) data_url+='&type=admin'; $j.ajax({ type: "GET", url: "xmlrpc.php", data: data_url, success: function(data){ } }); } else { $j("#"+id).removeClass("offre_box_simple_selected"); $j("#"+id).parent().removeClass("active"); var data_url = 'mode=formations-removeNegoReservation&idReservation='+idReservation+'&idNego='+id; if($j("#"+id).hasClass('typenego')) data_url+='&type=nego'; if($j("#"+id).hasClass('typeagenceseule')) data_url+='&type=agenceseule'; if($j("#"+id).hasClass('typemandataire')) data_url+='&type=mandataire'; if($j("#"+id).hasClass('typeagence')) data_url+='&type=agence'; if($j("#"+id).hasClass('typeadmin')) data_url+='&type=admin'; $j.ajax({ type: "GET", url: "xmlrpc.php", data: data_url, success: function(data){ } }); return true; } }