var tag_debug = false; var tag_timer; var tag_deja = false; var tag_etat; var photo_tag_no_more = false; function photo_get_tag(photo_liste, size, produit_id, force, tag) { // IL Y A DES REGLES STRCITES // 1 - LA PHOTO DOIT ETRE DANS UN DIV DONT L'ID EST image_container_XXX OU XX EST L'ID DE LA PHOTO // 2 - LA PHOTO DOIT AVOIR L'ID image_XXX // Size : 16 ou 32 // Force = true, ca disparait pas // Size : la taille des pastilles : 16 ou 32 (32 par defaut) if(size != 16) size = 32; // Produit_id = on met un produit en avant if(!vn(produit_id)) produit_id = 0; // Force ? si force = 1, on laisse les tags toujours affichés // Tag = petit tag a rajouter au ID des elements pour differencier les photos et les modifications (quand on modifie des tags sur la page viewer par exemple) if(!tag) tag = ''; else tag = tag+'_'; // On efface la variable des etat delete tag_etat; if(tag_debug) { console.log('Tag lib OK'); } if(tag_debug) { console.log('Photo_liste : '+photo_liste); } photo_liste = photo_liste+''; photo_array = photo_liste.split('-'); if(photo_array.length <= 0) return(false); // On va chercher les informations file2('//www.forumpiscine.com/photos/ajax.php?content=photo_item&photo_id='+photo_liste, function() { if(html != '') { photo_data = jQuery.parseJSON(html); if(tag_debug) { console.log('AJAX : OK / Donnees = '+photo_data); } for(a=0;a 0 && pos_y > 0) { // On calcule le point X var reel_x = (image_width/100)*pos_x; var reel_x = Math.round(reel_x); // On calcule le point Y var reel_y = (image_height/100)*pos_y; var reel_y = Math.round(reel_y); // Image_nom color = 'bleue'; if(this_produit_id == produit_id) color = 'rouge'; var image_url = '//www.forumpiscine.com/img/icpa/loupe'+color+'_'+size+'.png'; // ID de la loupe loupe_id = 'image_loupe_'+photo_id+'_'+tag+this_produit_id; // On place $('#'+loupe_id).remove(); container.append(''); var loupe = $('#'+loupe_id); //$('#image_container_'+photo_id).css('border', '1px solid red') // On place et on style loupe.css('position', 'absolute'); loupe.css('top', reel_y-(size/2)); loupe.css('left', reel_x-(size/2)); loupe.css('cursor', 'pointer'); if(tag_debug) { console.log('\t[PHOTO '+photo_id+'] Creation dans '+container.id+' pour le produit '+this_produit_id+' a la position x de '+(reel_x-(size/2))+' et la position y de '+reel_y); } } } tag_etat = true; // On fait disparaitre les tags au bout de 3 secondes if(!force && photo_array.length == 1) { var delai = 2000; if(tag_deja) delai = 1000; tag_timer = setTimeout(function() { photo_tag_affiche(photo_id, false); }, delai); container.mousemove(function() { clearTimeout(tag_timer); photo_tag_affiche(photo_id, true); tag_timer = setTimeout(function() { photo_tag_affiche(photo_id, false); }, 1000); }) // On affiche l'astuce ? if(!tag_deja) notification(' Astuce : Eloignez votre souris de la photo pour cacher les pastilles d\'achat !', 5000); tag_deja = true; } //$('#image_container_'+photo_id).hover(function() { clearTimeout(tag_timer);if(tag_debug) { console.log('Hover annule timer'); } }) } } else { if(tag_debug) { console.log('\t[PHOTO '+photo_id+'] Pas de données pour la photo'); } } } } else { // Rien dans cette photo if(tag_debug) { console.log('Pas de produit dans la photo' ); } } }) } /* SUPPRESSION DE TAG */ function photo_delete_tag(produit_id, photo_id) { if(!vn(photo_id)) return(0); if(!vn(produit_id)) return(0); // On balance :) file2('//www.forumpiscine.com/recits/sl_add_ajax.php?content=position_clic&photo_id='+photo_id+'&produit_id='+produit_id+'&del=1', function() { if(html == 'ok') { // L'effacement est ok // On change le texte du lien $('.image_loupe[produit_id='+produit_id+']').remove(); // On ferme la box si elle existe closeBox(''); } else { // C'est pas OK alert(html); } }); } function photo_tag_affiche(photo_id, etat) { if(!vn(photo_id)) return(false); elem = $('.image_loupe[photo_id='+photo_id+']'); if(!vn(photo_id)) elem = $('.image_loupe'); if(etat && elem.css('display') == 'none') { // On affiche elem.fadeIn('fast'); clearTimeout(tag_timer); tag_etat = true; } else if(!etat && !affiche_box_state && elem.css('display') != 'none') { // On cache clearTimeout(tag_timer); elem.fadeOut('slow'); tag_etat = false; } if(tag_debug) console.log('etat = '+etat+' / tag_etat = '+tag_etat) } var photo_tag_tab = []; var photo_tag_state = []; var photo_tag_nb = 0; var photo_tag_scroll_timer; var photo_tag_toggle_timer; var photo_liste = ''; function photo_tag_reader(size) { // Cette fonction permet de lancer la recherche de photo, et d'afficher les tags au defilement de la page. // On liste toutes les images image_liste = $('img.photo_to_tag'); image_liste.each(function() { photo_id = $(this).attr('photo_id'); if(vn(photo_id)) { // On choppe la position de la photo var position = $(this).offset(); var photo_top = position.top; photo_tag_tab[photo_id] = photo_top; photo_tag_nb++; if(tag_debug) console.log('Photo : '+photo_id+' top : '+photo_tag_tab[photo_id]); if(photo_liste != '') photo_liste += '-'; photo_liste += photo_id; } }) if(tag_debug) console.log('Il y a '+photo_tag_nb+' photos : '+photo_liste); if(photo_tag_nb > 0) { photo_get_tag(photo_liste, size, 0, true); } } function photo_no_more_tag() { photo_tag_no_more = true; file2('//www.forumpiscine.com/photos/ajax.php?content=no_more_tag', function() { }) } photo_affiche_detail_list = Array; function photo_affiche_detaille(actual_recit_id) { /* CE FICHIER EST A APPELER SUR LES PAGES QUI AFFICHENT DES PHOTOS */ /* ELLE TRANSFORME LES PHOTOS SIMPLES ET BLOC DETAILLE */ //return(false); /* exemple Sans descriptionmagdi */ if(!vn(actual_recit_id)) actual_recit_id = 0; $('a.recit_photo_formated').each(function() { href = $(this).attr('href'); photo_id = $(this).find('img').attr('photo_id'); console.log('Image trouvee '+photo_id); recit = $(this).find('img').attr('recit'); recit_id = $(this).find('img').attr('recit_id'); description = striptags($(this).find('img').attr('alt')); auteur = $(this).find('img').attr('auteur'); auteur_id = $(this).find('img').attr('auteur_id'); image_url = $(this).find('img').attr('src'); image_full = ((image_url.indexOf('/small/')>0)?false:true); html = ''; nb = Math.round(Math.random() * (9999999999 - 1) + 1); if(vn(photo_id)) { // Description description_ok = ''; if(description == 'Sans description') description_html = 'Pas de description Picto paslol
'; else if(description != '') { var max_length_description = 18; if(!image_full && description.length > max_length_description) description_ok = description.substr(0, (max_length_description-5))+'...'; else description_ok = description; description_html = '« '+description_ok+' »
'; } html = '
'; // '+((image_full)?'style="display:block"':'')+' html += '
'; // Pinit pinit_lien_texte = ''; /*if(image_full) pinit_lien_texte = 'Enregistrer';*/ if(image_full) html += ''+pinit_lien_texte+''; html += ''+description+''; if(image_full) html += ''; html += '
'; if(description != '' || (recit != '' && vn(recit_id) && actual_recit_id != recit_id)) { // On affiche un autre bloc pour la description html += ''; // Description html += description_html; if(recit != '' && vn(recit_id) && actual_recit_id != recit_id) html += 'Récit «'+recit+'» par '+auteur+''; html += ''; } html += ''; // love html += ''; html += ''; if(image_full) { // Exporter html += ' Publier / recommander cette photo'; // Dans le forum html += ' '; // Avis html += ' Laisser un message sur cette photo'; } html += ''; html += '
'; $(this).after(html); // On vire l'image de base $(this).remove(); } }); if(vn(max_largeur_image)) { // POur ce con de IE, on reforce la taille maxi des images $('.signature_de_message_du_forum img').css('max-width', max_largeur_image+'px'); $('.message_du_forum img').css('max-width', max_largeur_image+'px'); } }