user = { login:function(){ var user_login=$("#user_login").val(); var user_passw=$("#user_passw").val(); $.ajax({ type: "POST", url: "ajax/login.php", data: {user_login: user_login, user_passw: user_passw }, error:function(msg){ alert( "Erreur : " + msg ); }, success:function(data){ eval(data); }}); return false; }, fb_login:function(){ FB.login(function(response) { if (response.authResponse) { FB.api('/me', function(response) { if(typeof response.id != 'undefined'){ $.ajax({ type: "POST", url: "ajax/login.php", data: {fb_id: response.id, fb_name: response.name, fb_email: response.email, fb_locale: response.locale }, error:function(msg){ alert( "Erreur : " + msg ); }, success:function(data){ eval(data); }}); } }); } }, {scope: 'email'}); return false; } } function checkSelection(text_err_msg,toon_err_msg){ if((document.getElementById('toon_id').value=='')&&(document.getElementById('img_id').value=='')){ alert(toon_err_msg); }else if(document.selection.signature.value==''){ alert(text_err_msg); }else{ document.selection.submit(); } return false; } function checkText(text_err_msg){ if(document.selection.text.value==''){ alert(text_err_msg); return false; } document.selection.submit(); return false; } function switch_toon(toon_id,img_id,adjust_x,adjust_y){ var previous_toon_id=document.getElementById('toon_id').value; document.getElementById('img_'+previous_toon_id).className='unselected'; document.getElementById('img_'+toon_id).className='selected'; document.getElementById('toon_id').value=toon_id; if(img_id!=''){ document.getElementById('img_id').value=img_id; document.getElementById('adjust_x').value=adjust_x; document.getElementById('adjust_y').value=adjust_y; } return false; } function manage_toon_status(img_id,status){ ajax_send('POST','service.php','action=manage_toon_status&img_id='+img_id+'&status='+status); return false; } function changeFontName(lang){ var font_args=document.selection.font_args.value.split(','); adjustFontSize(font_args[1],font_args[2],font_args[3]); document.images['font_preview'].src='font_preview.php?lang='+lang+'&font_id='+font_args[0]+'&font_size='+font_args[1]+'&img_width=280&img_height=58'; } function changeFontSize(lang){ var font_args=document.selection.font_args.value.split(','); document.images['font_preview'].src='font_preview.php?lang='+lang+'&font_id='+font_args[0]+'&font_size='+document.selection.font_size.value+'&img_width=280&img_height=58'; } function adjustFontSize(size_default,size_min,size_max){ document.selection.font_size.options.length = 0; for(var size=size_min;size<=size_max;size++){ if(eval(document.all)){ var elOption=document.createElement("OPTION"); elOption.text=size; elOption.value=size; elOption.selected=(size==size_default); document.selection.font_size.options.add(elOption); }else{ var elOption=new Option; elOption.text=size; elOption.value=size; elOption.selected=(size==size_default); document.selection.font_size.options[document.selection.font_size.length]=elOption; } } } function update_preview(img_id,err_msg,is_logged,button_value,adjust_notice){ if(img_id!=''){ document.getElementById('img_id').value=img_id; document.getElementById('user_button').value=button_value; document.getElementById('user_link').style.display='none'; adjust_preview(4,4,is_logged,adjust_notice); }else{ alert(err_msg); } document.getElementById('fichier').value=''; } function adjust_preview(adjust_x,adjust_y,is_logged,adjust_notice){ var img_id=document.getElementById('img_id').value; document.getElementById('adjust_x').value=adjust_x; document.getElementById('adjust_y').value=adjust_y; document.getElementById('adjust_advice').innerHTML=decodeURIComponent(adjust_notice); document.getElementById('toon_preview').src='toon_adjust.php?img_id='+img_id+'&x='+adjust_x+'&y='+adjust_y; document.getElementById('toon_preview').className='selected'; document.getElementById('toon_preview').style.backgroundImage='url(uploads/'+img_id+'.gif)'; document.getElementById('toon_preview').style.backgroundRepeat='no-repeat'; document.getElementById('toon_preview').style.backgroundPosition='center center'; if(is_logged=='1'){ document.getElementById('user_button').style.display='block'; document.getElementById('user_share_p').style.display='block'; } } function user_add_figurine(lang,user_id){ var img_id=document.getElementById('img_id').value; var adjust_x=document.getElementById('adjust_x').value; var adjust_y=document.getElementById('adjust_y').value; var shared=document.getElementById('user_share_c').checked ? 1 : 0; ajax_send('POST','service.php','action=add_figurine&lang='+lang+'&user_id='+user_id+'&img_id='+img_id+'&adjust_x='+adjust_x+'&adjust_y='+adjust_y+'&shared='+shared); return false; } function user_add_signature(lang,img_id,user_id){ ajax_send('POST','service.php','action=add_signature&lang='+lang+'&img_id='+img_id+'&user_id='+user_id); return false; } function user_switch_toon(upload_id,img_id,adjust_x,adjust_y,button_value,adjust_notice,shared){ document.getElementById('adjust_advice').innerHTML=adjust_notice; document.getElementById('toon_preview').src='toon_adjust.php?img_id='+img_id+'&x='+adjust_x+'&y='+adjust_y; document.getElementById('toon_preview').className='selected'; document.getElementById('toon_preview').style.backgroundImage='url(uploads/'+img_id+'.gif)'; document.getElementById('toon_preview').style.backgroundRepeat='no-repeat'; document.getElementById('toon_preview').style.backgroundPosition='center center'; document.getElementById('img_id').value=img_id; document.getElementById('adjust_x').value=adjust_x; document.getElementById('adjust_y').value=adjust_y; document.getElementById('user_button').value=button_value; document.getElementById('user_button').style.display='block'; document.getElementById('user_share_p').style.display='block'; document.getElementById('user_share_c').checked=(shared==1); document.getElementById('user_link').style.display='block'; document.location.href='#preview_loc'; return false; } function user_delete_figurine(lang,confirm_txt,user_id){ if(confirm(confirm_txt)){ var img_id=document.getElementById('img_id').value; ajax_send('POST','service.php','action=delete_figurine&lang='+lang+'&user_id='+user_id+'&img_id='+img_id); } return false; } function user_delete_favorite(lang,confirm_txt,img_id,user_id){ if(confirm(confirm_txt)){ ajax_send('POST','service.php','action=delete_favorite&lang='+lang+'&img_id='+img_id+'&user_id='+user_id); } return false; } var regexp_email=/^[a-z0-9\-_\.]+@[a-z0-9\-_\.]+$/i; function egal(valeur, regularExpression) { var resultat = valeur.match(regularExpression); if(resultat!=null && resultat.length==1) return true; else return false; } function send_email(lang,email_address,result_id,invite_msg,title_msg,error_msg){ var is_valid; do{ email_address=jsprompt(invite_msg,title_msg,email_address) if(email_address!=null){ is_valid=egal(email_address,regexp_email); if(is_valid){ ajax_send('POST','service.php','action=send_email&lang='+lang+'&email_address='+email_address+'&result_id='+result_id); }else{ alert(error_msg); } } }while(email_address!=null && !is_valid); return false; } function send_email2(lang,from_name,from_mail,dest_name,dest_mail,subject,html_content){ var err_msg=''; if(!egal(from_mail,regexp_email)){ err_msg+=from_email_invalid_msg+'\n'; } if(!egal(dest_mail,regexp_email)){ err_msg+=dest_email_invalid_msg+'\n'; } if(err_msg!=''){ alert(err_msg); enable_send_button(true); return false; } ajax_send('POST','service.php','action=send_email2&lang='+lang+'&from_name='+escape(from_name)+'&from_mail='+escape(from_mail)+'&dest_name='+escape(dest_name)+'&dest_mail='+escape(dest_mail)+'&subject='+escape(subject)+'&html_content='+escape(html_content)); return false; } function display_content(sendmail){ document.getElementById('content_download').style.display=(sendmail ? 'none' : 'block'); document.getElementById('content_sendmail').style.display=(sendmail ? 'block' : 'none'); if(sendmail){ enable_send_button(true); document.getElementById('content').focus(); } return false; } function enable_send_button(enabled){ document.getElementById('send_button').disabled=!enabled; } function change_code(){ ajax_send('POST','service.php','action=change_code'); return false; } function jsprompt(sentence,title,defval){ if(document.all){ return vbprompt(sentence,title,defval); }else{ return prompt(sentence,defval); } } function ajax_send(method,url,data){ var xmlhttp=ajax_object(); if (!xmlhttp){ return false; } if(method=="GET"){ if(data == 'null'){ xmlhttp.open("GET",url,true); }else{ xmlhttp.open("GET",url+"?"+data,true); } xmlhttp.send(null); }else if(method == "POST"){ xmlhttp.open("POST",url,true); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlhttp.send(data); } return true; } function ajax_object(){ var xmlhttp = false; /*@cc_on @if (@_jscript_version >= 5) try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttp = false; } } @else xmlhttp = false; @end @*/ if(!xmlhttp && typeof XMLHttpRequest!='undefined'){ try{ xmlhttp=new XMLHttpRequest(); }catch(e){ xmlhttp=false; } } if(xmlhttp){ xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ if(xmlhttp.status==200) { ajax_response(xmlhttp.responseText); } } } } return xmlhttp; } function ajax_response(d){ var a=new Array(); var r=d.split('&'); var p; a['response']=d; for(var i in r){ p=r[i].split('='); a[p[0]]=p[1]; } receive_data(a); return false; } function receive_data(data){ //alert(data['response']); if(data['action']=='send_email'){ alert(decodeURIComponent(data['message'])); }else if(data['action']=='send_email2'){ display_content(false); enable_send_button(true); alert(decodeURIComponent(data['message'])); }else if(data['action']=='change_code'){ document.getElementById('captcha_id').value=data['captcha_id']; document.getElementById('captcha_img').src='inc/captcha.php?captcha_id='+data['captcha_id']; }else if(data['action']=='add_figurine'){ if(data['message']!=''){ alert(decodeURIComponent(data['message'])); }else{ document.getElementById('user_collection').innerHTML=decodeURIComponent(data['user_collection']); document.getElementById('user_button').value=decodeURIComponent(data['button_value']); document.getElementById('user_link').style.display='block'; } }else if(data['action']=='delete_figurine'){ document.getElementById('user_collection').innerHTML=decodeURIComponent(data['user_collection']); document.getElementById('user_button').value=decodeURIComponent(data['button_value']); document.getElementById('user_link').style.display='none'; }else if(data['action']=='add_signature'){ if(data['message']!=''){ alert(decodeURIComponent(data['message'])); } }else if(data['action']=='delete_favorite'){ document.getElementById('user_favorites').innerHTML=decodeURIComponent(data['user_favorites']); }else if(data['action']=='manage_toon_status'){ if(data['message']!=''){ alert(decodeURIComponent(data['message'])); } } } function addFavorites(){ if(document.all) window.external.AddFavorite('http://www.gif-mania.net/signatures-animees/', 'Gif-mania.net - Tes signatures animées'); else alert('Vous pouvez saisir CTRL+D pour ajouter cette page dans vos signets, ou favoris'); return false; } function makeHomePage(obj){ if(document.all && document.getElementById){ obj.style.behavior='url(#default#homepage)'; obj.setHomePage('http://www.gif-mania.net/signatures-animees/'); }else{ alert('Désolé, cette fonction n\'est disponible qu\'avec Internet Explorer 5+'); } return false; } function maintenance_alert(){ alert('Une opération de maintenance est en cours, et ce service est temporairement désactivé. Merci de votre compréhension.'); return false; }