'); timer = setTimeout(function() { clearTimeout(timer); $('.loading-overlay').addClass('toggle'); },50); } } var fichier = ''; var fichier_uploader; var filesName = ''; function closeOverlay() { fichier_uploader.destroy(); $('body').removeClass('open-fichier'); $('body').off('mousedown.fichierOverlay'); $('body').off('click.fichierOverlay'); } var has_init = false; var iup=0; var iupMax = 1; function openOverlay(data) { if(has_init == true) { fichier_uploader.destroy(); } has_init = true; fichier_uploader = new plupload.Uploader({ runtimes: 'html5,html4,flash', browse_button: 'js-upload-btn', unique_names : false, multiple_queues : true, multi_selection : true, multipart: true, max_file_count : 2, url: _SITE_URL + fichier, multipart_params: { 'a': 'UploadFile' }, 'filters': { 'max_file_size': '20mb', 'mime_types': [{ 'extensions': 'pdf,doc,docx,odf,png,jpg'}] } }); fichier_uploader.bind('Error', function(up, ErrorObj) { console.log(ErrorObj.code); throwMessage('Format de fichier invalide.',true,'upload-format'); }); fichier_uploader.bind('FilesAdded', function(up, files) { for(var i=0; i <= files.length; i++ ){ if(iupMax == 1){ photos = iupMax + ' photo'; }else{ photos = iupMax + ' photos'; } if(iup>iupMax){ throwMessage('Maximum '+photos,true,'upload-format'); }else{ filesName = filesName + files[i]['name'] + ''; $('.input-wrapper .files-name').html(filesName); if(iupMax == 1){ $('.input-wrapper.import-wrapper > input').val('Importer votre CV (.word ou .pdf)'); }else{ $('.input-wrapper.import-wrapper > input').val('Importer 1 à 6 photo(s)'); } iup ++; } } }); var upload_complete; fichier_uploader.bind('FileUploaded', function() { popup('','',0); sw_message('Votre formulaire à été envoyé avec succès. Merci.',false,'upload-success'); }); fichier_uploader.init(); } var current_slide = 0; var slider_timer; function popup(message,clic_close,bind_upload) { clic_close = (typeof clic_close !== 'undefined') ? clic_close : false; var close_class = 'close-popup'; if(clic_close == false) { close_class = ''; } if(!message) { $('.popup-overlay,body').removeClass('trigger'); $('body').removeClass('back-active'); setTimeout(function() { $('.popup-overlay').remove(); }, 500); } else { if($('.popup-overlay.trigger').length) { $('.popup-overlay').removeClass('trigger'); setTimeout(function() { $('.popup-overlay').remove(); $('body').append(''); setTimeout(function() { $('.popup-overlay').addClass('trigger'); }, 100); if(bind_upload){ setTimeout(function() {openOverlay(); },300); } }, 500); } else { $('body').append(''); setTimeout(function() { $('.popup-overlay,body').addClass('trigger'); if(bind_upload){ setTimeout(function() {openOverlay(); },300); }}, 500); } } } $('body').on('click','.icon-cancel',function() { popup('','',0); return false; }); var input_timer; var input_delay = 300; function saveFieldEntreprise(input,value) { clearTimeout(input_timer); input_timer = setTimeout(function() { $.post(_SITE_URL + 'mod/act_p/EntrepriseAct.php', { a: 'saveInput', value: value, input: input }, function(data) {}); },input_delay); } var input_timer; var input_delay = 300; function saveFieldTravailleur(input,value) { console.log(value); clearTimeout(input_timer); input_timer = setTimeout(function() { $.post(_SITE_URL + 'mod/act_p/TravailleurAct.php', { a: 'saveInput', value: value, input: input }, function(data) {}); },input_delay); } var input_timer; var input_delay = 300; function saveFieldArticle(input,value) { clearTimeout(input_timer); input_timer = setTimeout(function() { $.post(_SITE_URL + 'mod/act_p/ArticleAct.php', { a: 'saveInput', value: value, input: input }, function(data) {}); },input_delay); } var onloadCallback = function() { grecaptcha.render('captcha', { 'sitekey' : '6Lf8UlUUAAAAAAurxeWbqR94n-I51GSQxSkcMDUC' }); };