Subversion Repositories eFlore/Applications.cel

Rev

Rev 3827 | Rev 3832 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3827 Rev 3829
1
function WidgetPhotoPopup( proprietes ) {
1
function WidgetPhotoPopup( proprietes ) {
2
	if( this.valOk( proprietes ) ) {
2
	if( this.valOk( proprietes ) ) {
3
		this.urlWidget                    = proprietes.urlWidget;
3
		this.urlWidget                    = proprietes.urlWidget;
4
		this.urls                         = proprietes.urls;
4
		this.urls                         = proprietes.urls;
5
		this.infos_images                 = proprietes.infos_images;
5
		this.infos_images                 = proprietes.infos_images;
6
		this.indexImage                   = proprietes.indexImage;
6
		this.indexImage                   = proprietes.indexImage;
7
		this.urlImage                     = proprietes.urlImage;
7
		this.urlImage                     = proprietes.urlImage;
8
		this.tailleMax                    = proprietes.tailleMax;
8
		this.tailleMax                    = proprietes.tailleMax;
9
		this.popupUrl                     = proprietes.popupUrl;
9
		this.popupUrl                     = proprietes.popupUrl;
10
		this.urlBaseTelechargement        = proprietes.urlBaseTelechargement;
10
		this.urlBaseTelechargement        = proprietes.urlBaseTelechargement;
11
		this.urlServiceRegenererMiniature = proprietes.urlServiceRegenererMiniature;
11
		this.urlServiceRegenererMiniature = proprietes.urlServiceRegenererMiniature;
12
	}
12
	}
13
 
13
 
14
	this.mettreAJourInfosImage();
14
	this.mettreAJourInfosImage();
15
}
15
}
16
 
16
 
17
WidgetPhotoPopup.prototype = new WidgetPhotoCommun();
17
WidgetPhotoPopup.prototype = new WidgetPhotoCommun();
18
 
18
 
19
WidgetPhotoPopup.prototype.initTpl = function() {
19
WidgetPhotoPopup.prototype.initTpl = function() {
20
	this.redimensionnerGalerie();
20
	this.redimensionnerGalerie();
21
	if( this.valOk( this.urlImage, false, 'null' ) ) {
21
	if( this.valOk( this.urlImage, false, 'null' ) ) {
22
 
22
 
23
		this.indexImage = this.urls.indexOf( this.urlImage );
23
		this.indexImage = this.urls.indexOf( this.urlImage );
24
 
24
 
25
		$( '#info-img-galerie' ).find( '.active' ).removeClass( 'active' );
25
		$( '#info-img-galerie' ).find( '.active' ).removeClass( 'active' );
26
		$( '#img-cadre-' + this.indexImage + ',#indicateur-img-' + this.indexImage ).addClass( 'active' );
26
		$( '#img-cadre-' + this.indexImage + ',#indicateur-img-' + this.indexImage ).addClass( 'active' );
27
 
27
 
28
		this.mettreAJourPopup();
28
		this.mettreAJourPopup();
29
	}
29
	}
30
 
30
 
31
	this.redimentionnerModaleCarousel();
31
	this.redimentionnerModaleCarousel();
32
};
32
};
33
 
33
 
34
WidgetPhotoPopup.prototype.initEvts = function() {
34
WidgetPhotoPopup.prototype.initEvts = function() {
35
	const lthis = this;
35
	const lthis = this;
36
 
36
 
37
	this.initEvtsDefilerImage();
37
	this.initEvtsDefilerImage();
38
	this.initEvtsContact();
38
	this.initEvtsContact();
39
	$( window ).on( 'resize', lthis.redimentionnerModaleCarousel.bind( lthis ) );
39
	$( window ).on( 'resize', lthis.redimentionnerModaleCarousel.bind( lthis ) );
40
	this.initEvtsFonctionsPhoto();
40
	this.initEvtsFonctionsPhoto();
41
	this.initEvtsRetourGalerieResponsive();
41
	this.initEvtsRetourGalerieResponsive();
42
	this.initEvtsTagsPF();
42
	this.initEvtsTagsPF();
43
};
43
};
44
 
44
 
45
WidgetPhotoPopup.prototype.mettreAJourPopup = function() {
45
WidgetPhotoPopup.prototype.mettreAJourPopup = function() {
46
	this.mettreAJourInfosImage();
46
	this.mettreAJourInfosImage();
47
	this.afficherTitreImage();
47
	this.afficherTitreImage();
48
	this.traiterMetas();
48
	this.traiterMetas();
49
	this.regenererMiniature();
49
	this.regenererMiniature();
50
	this.fournirLienIdentiplante();
50
	this.fournirLienIdentiplante();
51
};
51
};
52
 
52
 
53
WidgetPhotoPopup.prototype.mettreAJourInfosImage = function() {
53
WidgetPhotoPopup.prototype.mettreAJourInfosImage = function() {
54
	this.item          = this.infos_images[this.urls[this.indexImage]];
54
	this.item          = this.infos_images[this.urls[this.indexImage]];
55
	this.titreImage    = this.item['titre'];
55
	this.titreImage    = this.item['titre'];
56
	this.urlLienEflore = this.item['lien'];
56
	this.urlLienEflore = this.item['lien'];
57
	this.idImage       = this.item['id_photo'];
57
	this.idImage       = this.item['id_photo'];
58
	this.urlThisImage  = this.item['url_photo']+'.jpg';
58
	this.urlThisImage  = this.item['url_photo']+'.jpg';
59
	this.obs           = this.item['obs'];
59
	this.obs           = this.item['obs'];
60
	this.nn            = '[nn' + this.obs['nom_sel_nn']+']';
60
	this.nn            = '[nn' + this.obs['nom_sel_nn']+']';
61
	this.urlIP         = this.obs['url_ip'];
61
	this.urlIP         = this.obs['url_ip'];
62
	this.tagsImage     = this.tagsToArray( this.item['tags_photo'] );
62
	this.tagsImage     = this.tagsToArray( this.item['tags_photo'] );
63
	this.tagsObs       = this.tagsToArray( this.obs['tags_obs'] );
63
	this.tagsObs       = this.tagsToArray( this.obs['tags_obs'] );
64
	this.auteur        = this.item['utilisateur']['nom_utilisateur'];
64
	this.auteur        = this.item['utilisateur']['nom_utilisateur'];
65
	this.date          = this.item['date'];
65
	this.date          = this.item['date'];
66
};
66
};
67
 
67
 
68
WidgetPhotoPopup.prototype.tagsToArray = function( tags ) {
68
WidgetPhotoPopup.prototype.tagsToArray = function( tags ) {
69
	tags = tags.replace( new RegExp('\\.'), '' ).split( ',' );
69
	tags = tags.replace( new RegExp('\\.'), '' ).split( ',' );
70
 
70
 
71
	let cleanTags       = [],
71
	let cleanTags       = [],
72
		nbTags          = tags.length,
72
		nbTags          = tags.length,
73
		tag             = '',
73
		tag             = '',
74
		tagsSansEspaces = '',
74
		tagsSansEspaces = '',
75
		cleanTagIndex   = 0;
75
		cleanTagIndex   = 0;
76
 
76
 
77
	for(let i = 0; i < nbTags; i++) {
77
	for(let i = 0; i < nbTags; i++) {
78
		tag = tags[i];
78
		tag = tags[i];
79
		tagsSansEspaces = tag.replace( ' ', '');
79
		tagsSansEspaces = tag.replace( ' ', '');
80
		if( '' !== tagsSansEspaces ) {
80
		if( '' !== tagsSansEspaces ) {
81
			cleanTags.push( tag.trim() );
81
			cleanTags.push( tag.trim() );
82
		}
82
		}
83
	}
83
	}
84
 
84
 
85
	return cleanTags;
85
	return cleanTags;
86
};
86
};
87
 
87
 
88
WidgetPhotoPopup.prototype.initEvtsDefilerImage = function() {
88
WidgetPhotoPopup.prototype.initEvtsDefilerImage = function() {
89
	const lthis = this;
89
	const lthis = this;
90
 
90
 
91
	$( '#precedent, #suivant' ).on( 'click', function() {
91
	$( '#precedent, #suivant' ).on( 'click', function() {
92
		lthis.defilerImage( this.id );
92
		lthis.defilerImage( this.id );
93
	});
93
	});
94
 
94
 
95
	$( '#print_content:not(saisir-tag)' ).on( 'keydown', function( event ) {
95
	$( '#print_content:not(saisir-tag)' ).on( 'keydown', function( event ) {
96
 
96
 
97
		const determinerSens = function( enventKey, left, right ) {
97
		const determinerSens = function( enventKey, left, right ) {
98
			switch ( enventKey ) {
98
			switch ( enventKey ) {
99
				case left:
99
				case left:
100
					return 'suivant';
100
					return 'suivant';
101
				case right:
101
				case right:
102
					return 'precedent';
102
					return 'precedent';
103
				default:
103
				default:
104
					break;
104
					break;
105
			}
105
			}
106
 
106
 
107
			return;
107
			return;
108
		}
108
		}
109
 
109
 
110
		event = (event || window.event);
110
		event = (event || window.event);
111
		// event.keyCode déprécié, on tente d'abord event.key
111
		// event.keyCode déprécié, on tente d'abord event.key
112
		let sens = ( 'key' in event ) ? determinerSens( event.key, 'ArrowLeft', 'ArrowRight' ) : determinerSens( event.keyCode, 37, 39 );;
112
		let sens = ( 'key' in event ) ? determinerSens( event.key, 'ArrowLeft', 'ArrowRight' ) : determinerSens( event.keyCode, 37, 39 );;
113
 
113
 
114
		if ( lthis.valOk( sens ) ) {
114
		if ( lthis.valOk( sens ) ) {
115
			lthis.defilerImage( sens );
115
			lthis.defilerImage( sens );
116
		}
116
		}
117
	});
117
	});
118
};
118
};
119
 
119
 
120
WidgetPhotoPopup.prototype.initEvtsContact = function() {
120
WidgetPhotoPopup.prototype.initEvtsContact = function() {
121
	const lthis = this;
121
	const lthis = this;
122
 
122
 
123
	$( '#bloc-infos-img' ).on( 'click', '.lien_contact', function( event ) {
123
	$( '#bloc-infos-img' ).on( 'click', '.lien_contact', function( event ) {
124
		event.preventDefault();
124
		event.preventDefault();
125
		lthis.chargerContenuModale( this.href );
125
		lthis.chargerContenuModale( this.href );
126
	});
126
	});
127
};
127
};
128
 
128
 
129
WidgetPhotoPopup.prototype.initEvtsFonctionsPhoto = function() {
129
WidgetPhotoPopup.prototype.initEvtsFonctionsPhoto = function() {
130
	const lthis = this;
130
	const lthis = this;
131
 
131
 
132
	$( '#boutons-footer #bloc-fct a, #retour-metas' ).on( 'click', function( event ){
132
	$( '#boutons-footer #bloc-fct a, #retour-metas' ).on( 'click', function( event ){
133
		event.preventDefault();
133
		event.preventDefault();
134
		var voletAOuvrir = $( this ).data( 'volet' ),
134
		var voletAOuvrir = $( this ).data( 'volet' ),
135
			voletAFermer = $( '.bloc-volet:not(.hidden)' ).data( 'volet' );
135
			voletAFermer = $( '.bloc-volet:not(.hidden)' ).data( 'volet' );
136
 
136
 
137
		lthis.ouvrirVoletFct( voletAOuvrir, voletAFermer );
137
		lthis.ouvrirVoletFct( voletAOuvrir, voletAFermer );
138
		if ( window.matchMedia( '(max-width: 991px)' ).matches ) {
138
		if ( window.matchMedia( '(max-width: 991px)' ).matches ) {
139
			$( '#info-img-galerie' ).addClass( 'hidden' );
139
			$( '#info-img-galerie' ).addClass( 'hidden' );
140
			$( '#volet, #retour-galerie' ).removeClass( 'hidden' );
140
			$( '#volet, #retour-galerie' ).removeClass( 'hidden' );
141
		}
141
		}
142
	});
142
	});
143
};
143
};
144
 
144
 
145
WidgetPhotoPopup.prototype.initEvtsRetourGalerieResponsive = function() {
145
WidgetPhotoPopup.prototype.initEvtsRetourGalerieResponsive = function() {
146
	$( '#retour-galerie' ).on( 'click', function( event ) {
146
	$( '#retour-galerie' ).on( 'click', function( event ) {
147
		event.preventDefault();
147
		event.preventDefault();
148
		$( '#info-img-galerie' ).removeClass( 'hidden' );
148
		$( '#info-img-galerie' ).removeClass( 'hidden' );
149
		$( this ).addClass( 'hidden' );
149
		$( this ).addClass( 'hidden' );
150
		if ( window.matchMedia( '(max-width: 991px)' ).matches ) {
150
		if ( window.matchMedia( '(max-width: 991px)' ).matches ) {
151
			$( '#volet' ).addClass( 'hidden' );
151
			$( '#volet' ).addClass( 'hidden' );
152
			$( '.bouton-fct.actif' ).removeClass( 'actif' );
152
			$( '.bouton-fct.actif' ).removeClass( 'actif' );
153
		}
153
		}
154
	});
154
	});
155
};
155
};
156
 
156
 
157
WidgetPhotoPopup.prototype.initEvtsTagsPF = function() {
157
WidgetPhotoPopup.prototype.initEvtsTagsPF = function() {
158
	//recupérer tags en ajax (voir pictoflora, peut-être dans le php?)
158
	//recupérer tags en ajax (voir pictoflora, peut-être dans le php?)
159
	//	_OPTIONS
159
	//	_OPTIONS
160
	// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
160
	// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
161
	//	_GET
161
	//	_GET
162
	// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
162
	// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
163
	this.tagsPfCustom();
163
	this.tagsPfCustom();
164
	$( '#bloc-tags' ).on( 'click', '.tag', function( event ) {
164
	$( '#bloc-tags' ).on( 'click', '.tag', function( event ) {
165
		event.preventDefault();
165
		event.preventDefault();
166
		$( this ).toggleClass( 'actif' );
166
		$( this ).toggleClass( 'actif' );
167
	});
167
	});
168
	$( '#bloc-tags' ).on( 'click', '.custom-tag.actif .fermer', function( event ) {
168
	$( '#bloc-tags' ).on( 'click', '.custom-tag.actif .fermer', function( event ) {
169
		event.preventDefault();
169
		event.preventDefault();
170
		//			Supprimer un custom-tag
170
		//			Supprimer un custom-tag
171
		//	_OPTIONS
171
		//	_OPTIONS
172
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
172
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
173
		// 	_paramètres
173
		// 	_paramètres
174
		// L'id du tag à la fin de l'url
174
		// L'id du tag à la fin de l'url
175
		//	_DELETE
175
		//	_DELETE
176
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
176
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
177
		// 	_réponse:
177
		// 	_réponse:
178
		// ""
178
		// ""
179
		// 			Mettre à jour les mots cles
179
		// 			Mettre à jour les mots cles
180
		//	_OPTIONS
180
		//	_OPTIONS
181
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
181
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
182
		//	_GET
182
		//	_GET
183
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
183
		// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
184
		$( this ).parent( '.custom-tag' ).remove();
184
		$( this ).parent( '.custom-tag' ).remove();
185
	});
185
	});
186
 
186
 
187
	$( '#bloc-tags' ).on( 'keyup', '.custom-tag.actif', function( event ) {
187
	$( '#bloc-tags' ).on( 'keyup', '.custom-tag.actif', function( event ) {
188
		let supprimerTag = false;
188
		let supprimerTag = false;
189
 
189
 
190
		event = ( event || window.event );
190
		event = ( event || window.event );
191
		// event.keyCode déprécié, on tente d'abord event.key
191
		// event.keyCode déprécié, on tente d'abord event.key
192
		if ( 'key' in event ) {
192
		if ( 'key' in event ) {
193
			supprimerTag = ( 'Delete' === event.key || 'Backspace' === event.key );
193
			supprimerTag = ( 'Delete' === event.key || 'Backspace' === event.key );
194
		} else {
194
		} else {
195
			supprimerTag = ( 46 === event.keyCode || 8 === event.keyCode );
195
			supprimerTag = ( 46 === event.keyCode || 8 === event.keyCode );
196
		}
196
		}
197
		if ( supprimerTag ) {
197
		if ( supprimerTag ) {
198
			//			Supprimer un custom-tag
198
			//			Supprimer un custom-tag
199
			//	_OPTIONS
199
			//	_OPTIONS
200
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
200
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
201
			// 	_paramètres
201
			// 	_paramètres
202
			// L'id du tag à la fin de l'url
202
			// L'id du tag à la fin de l'url
203
			//	_DELETE
203
			//	_DELETE
204
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
204
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/38368
205
			// 	_réponse:
205
			// 	_réponse:
206
			// ""
206
			// ""
207
			// 			Mettre à jour les mots cles
207
			// 			Mettre à jour les mots cles
208
			//	_OPTIONS
208
			//	_OPTIONS
209
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
209
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
210
			//	_GET
210
			//	_GET
211
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
211
			// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
212
			$( this ).parent( '.custom-tag' ).remove();
212
			$( this ).parent( '.custom-tag' ).remove();
213
		}
213
		}
214
	});
214
	});
215
};
215
};
216
 
216
 
217
WidgetPhotoPopup.prototype.defilerImage = function( sens ) {
217
WidgetPhotoPopup.prototype.defilerImage = function( sens ) {
218
	if ( 'suivant' === sens ) {
218
	if ( 'suivant' === sens ) {
219
		this.indexImage++ ;
219
		this.indexImage++ ;
220
		if( this.indexImage >= this.urls.length ) {
220
		if( this.indexImage >= this.urls.length ) {
221
			this.indexImage = 0;
221
			this.indexImage = 0;
222
		}
222
		}
223
	} else if ( 'precedent' === sens ) {
223
	} else if ( 'precedent' === sens ) {
224
		this.indexImage--;
224
		this.indexImage--;
225
		if( this.indexImage <= 0 ) {
225
		if( this.indexImage <= 0 ) {
226
			this.indexImage = this.urls.length -1;
226
			this.indexImage = this.urls.length -1;
227
		}
227
		}
228
	}
228
	}
229
	// @TODO: Modifier l'attr content de 'meta[property=og:image]' et y mettre l'url de l'image
229
	// @TODO: Modifier l'attr content de 'meta[property=og:image]' et y mettre l'url de l'image
230
	this.mettreAJourPopup();
230
	this.mettreAJourPopup();
231
};
231
};
232
 
232
 
233
WidgetPhotoPopup.prototype.afficherTitreImage = function() {
233
WidgetPhotoPopup.prototype.afficherTitreImage = function() {
234
	let lienContact  =
234
	let lienContact  =
235
			this.urlWidget +'?mode=contact&nn=' + this.nn +
235
			this.urlWidget +'?mode=contact&nn=' + this.nn +
236
			'&nom_sci=' + this.obs['nom_sel'] +
236
			'&nom_sci=' + this.obs['nom_sel'] +
237
			'&date=' + this.date +
237
			'&date=' + this.date +
238
			'&localisation=' + this.obs['localisation'] +
238
			'&localisation=' + this.obs['localisation'] +
239
			'&id_image=' + this.idImage +
239
			'&id_image=' + this.idImage +
240
			'&auteur=' + this.auteur;
240
			'&auteur=' + this.auteur;
241
 
241
 
242
	if ( this.valOk( this.popupUrl ) ) {
242
	if ( this.valOk( this.popupUrl ) ) {
243
		if (! this.popupUrl.match( new RegExp( 'img:' + this.idImage ) ) ) {
243
		if (! this.popupUrl.match( new RegExp( 'img:' + this.idImage ) ) ) {
244
			this.popupUrl = this.actualiserPopupUrl( this.popupUrl, this.urlThisImage );
244
			this.popupUrl = this.actualiserPopupUrl( this.popupUrl, this.urlThisImage );
245
		}
245
		}
246
		lienContact += '&popup_url=' + encodeURIComponent( this.popupUrl );
246
		lienContact += '&popup_url=' + encodeURIComponent( this.popupUrl );
247
	}
247
	}
248
 
248
 
249
	$( '#bloc-infos-img' ).html(
249
	$( '#bloc-infos-img' ).html(
250
		this.afficherLien( this.urlLienEflore, this.obs['nom_sel'] )+
250
		this.afficherLien( this.urlLienEflore, this.obs['nom_sel'] )+
251
		' par '+
251
		' par '+
252
		'<a class="lien_contact" href="' + lienContact + '">' + this.auteur + '</a> '+
252
		'<a class="lien_contact" href="' + lienContact + '">' + this.auteur + '</a> '+
253
		' le ' + this.date + ' - ' + this.obs['localisation']
253
		' le ' + this.date + ' - ' + this.obs['localisation']
254
	);
254
	);
255
};
255
};
256
 
256
 
257
WidgetPhotoPopup.prototype.actualiserPopupUrl = function( queryString, remplacement ) {
257
WidgetPhotoPopup.prototype.actualiserPopupUrl = function( queryString, remplacement ) {
258
	let queryStringParsee = queryString.substring(1).split('&');
258
	let queryStringParsee = queryString.substring(1).split('&');
259
 
259
 
260
	$.each( queryStringParsee,  function( i, param ) {
260
	$.each( queryStringParsee,  function( i, param ) {
261
		if( /url_image/.test( param ) ) {
261
		if( /url_image/.test( param ) ) {
262
			queryString = queryString.replace( param, 'url_image=' + remplacement );
262
			queryString = queryString.replace( param, 'url_image=' + remplacement );
263
			return false;
263
			return false;
264
		}
264
		}
265
	});
265
	});
266
	return queryString;
266
	return queryString;
267
};
267
};
268
 
268
 
269
WidgetPhotoPopup.prototype.redimentionnerModaleCarousel = function() {
269
WidgetPhotoPopup.prototype.redimentionnerModaleCarousel = function() {
270
	this.redimensionnerGalerie();
270
	this.redimensionnerGalerie();
271
	if ( window.matchMedia( '(max-width: 991px)' ).matches ) {
271
	if ( window.matchMedia( '(max-width: 991px)' ).matches ) {
272
		$( '#volet, #retour-galerie' ).addClass( 'hidden' );
272
		$( '#volet, #retour-galerie' ).addClass( 'hidden' );
273
		$( '#info-img-galerie' ).removeClass( 'hidden' );
273
		$( '#info-img-galerie' ).removeClass( 'hidden' );
274
		$( '.bouton-fct.actif' ).removeClass( 'actif' );
274
		$( '.bouton-fct.actif' ).removeClass( 'actif' );
275
		$( '.nettoyage-volet.haut' ).text( $( '#bloc-infos-img' ).text() );
275
		$( '.nettoyage-volet.haut' ).text( $( '#bloc-infos-img' ).text() );
276
		$( '#boutons-footer, #info-img-galerie' ).removeClass( 'col-lg-8' );
276
		$( '#boutons-footer, #info-img-galerie' ).removeClass( 'col-lg-8' );
277
		$( '#bloc-infos-img, #volet' ).removeClass( 'col-lg-4' );
277
		$( '#bloc-infos-img, #volet' ).removeClass( 'col-lg-4' );
278
	} else {
278
	} else {
279
		$( '#volet, #info-img-galerie' ).removeClass( 'hidden' );
279
		$( '#volet, #info-img-galerie' ).removeClass( 'hidden' );
280
		if ( this.valOk( $( '.bloc-volet:not(.hidden)' ) ) ) {
280
		if ( this.valOk( $( '.bloc-volet:not(.hidden)' ) ) ) {
281
			$( '.bouton-fct.' + $( '.bloc-volet:not(.hidden)' ).data( 'volet' ) ).addClass( 'actif' );
281
			$( '.bouton-fct.' + $( '.bloc-volet:not(.hidden)' ).data( 'volet' ) ).addClass( 'actif' );
282
		}
282
		}
283
		$( '.nettoyage-volet.bas' ).text( $( '#bloc-infos-img' ).text() );
283
		$( '.nettoyage-volet.bas' ).text( $( '#bloc-infos-img' ).text() );
284
		$( '#boutons-footer, #info-img-galerie' ).addClass( 'col-lg-8' );
284
		$( '#boutons-footer, #info-img-galerie' ).addClass( 'col-lg-8' );
285
		$( '#bloc-infos-img, #volet' ).addClass( 'col-lg-4' );
285
		$( '#bloc-infos-img, #volet' ).addClass( 'col-lg-4' );
286
		$( '#retour-galerie' ).addClass( 'hidden' );
286
		$( '#retour-galerie' ).addClass( 'hidden' );
287
	}
287
	}
288
};
288
};
289
 
289
 
290
WidgetPhotoPopup.prototype.redimensionnerGalerie = function() {
290
WidgetPhotoPopup.prototype.redimensionnerGalerie = function() {
291
	var maxSize = ( $( window ).width() / $( window ).height() ) < 1 ? $( window ).width() : $( window ).height();
291
	var maxSize = ( $( window ).width() / $( window ).height() ) < 1 ? $( window ).width() : $( window ).height();
292
 
292
 
293
	maxSize -= 30;
293
	maxSize -= 30;
294
	$( '.carousel-item img' ).each( function( index, image ) {
294
	$( '.carousel-item img' ).each( function( index, image ) {
295
		var proportion  = image.dataset.width / image.dataset.height,
295
		var proportion  = image.dataset.width / image.dataset.height,
296
			cssResize   = {};
296
			cssResize   = {};
297
 
297
 
298
		if ( proportion >= 1 ) {
298
		if ( proportion >= 1 ) {
299
			cssResize['width'] = maxSize;
299
			cssResize['width'] = maxSize;
300
		}
300
		}
301
		if ( proportion <= 1) {
301
		if ( proportion <= 1) {
302
			cssResize['height'] = maxSize;
302
			cssResize['height'] = maxSize;
303
		}
303
		}
304
		$( image ).css( cssResize );
304
		$( image ).css( cssResize );
305
	});
305
	});
306
};
306
};
307
 
307
 
308
WidgetPhotoPopup.prototype.ouvrirVoletFct = function( voletAOuvrir, voletAFermer ) {
308
WidgetPhotoPopup.prototype.ouvrirVoletFct = function( voletAOuvrir, voletAFermer ) {
309
	if( voletAOuvrir !== voletAFermer ) {
309
	if( voletAOuvrir !== voletAFermer ) {
310
		$( '#boutons-footer  .' + voletAFermer ).removeClass( 'actif' );
310
		$( '#boutons-footer  .' + voletAFermer ).removeClass( 'actif' );
311
		$( '#boutons-footer  .' + voletAOuvrir ).addClass( 'actif' );
311
		$( '#boutons-footer  .' + voletAOuvrir ).addClass( 'actif' );
312
		$( '#bloc-' + voletAFermer ).addClass( 'hidden' );
312
		$( '#bloc-' + voletAFermer ).addClass( 'hidden' );
313
		$( '#bloc-' + voletAOuvrir ).removeClass( 'hidden' );
313
		$( '#bloc-' + voletAOuvrir ).removeClass( 'hidden' );
314
		$( '#volet' ).scrollTop(0);
314
		$( '#volet' ).scrollTop(0);
315
		$( '#retour-metas' ).removeClass( 'hidden', 'meta' === voletAOuvrir );
315
		$( '#retour-metas' ).removeClass( 'hidden', 'meta' === voletAOuvrir );
316
	}
316
	}
317
};
317
};
318
 
318
 
319
WidgetPhotoPopup.prototype.tagsPfCustom = function() {
319
WidgetPhotoPopup.prototype.tagsPfCustom = function() {
320
	const lthis = this;
320
	const lthis = this;
321
 
321
 
322
	$( '#saisir-tag' ).on( 'blur keyup', function( event ) {
322
	$( '#saisir-tag' ).on( 'blur keyup', function( event ) {
323
		event = ( event || window.event );
323
		event = ( event || window.event );
324
 
324
 
325
		var ajouterTag = ( 'blur' === event.type );
325
		var ajouterTag = ( 'blur' === event.type );
326
 
326
 
327
		// event.keyCode déprécié, on tente d'abord event.key
327
		// event.keyCode déprécié, on tente d'abord event.key
328
		if ( 'key' in event  ) {
328
		if ( 'key' in event  ) {
329
			if ( 'Enter' === event.key ) {
329
			if ( 'Enter' === event.key ) {
330
				ajouterTag = true;
330
				ajouterTag = true;
331
			}
331
			}
332
		} else if ( 13 === event.keyCode ) {
332
		} else if ( 13 === event.keyCode ) {
333
			ajouterTag = true;
333
			ajouterTag = true;
334
		}
334
		}
335
		if	( ajouterTag ) {
335
		if	( ajouterTag ) {
336
			var nouveauTag     = $( this ).val(),
336
			var nouveauTag     = $( this ).val(),
337
				nouveauTagAttr = lthis.chaineValableAttributsHtml( nouveauTag.toLowerCase() );
337
				nouveauTagAttr = lthis.chaineValableAttributsHtml( nouveauTag.toLowerCase() );
338
 
338
 
339
			if( lthis.valOk( nouveauTagAttr ) && !lthis.valOk( $( '#' + nouveauTagAttr + '.tag' ) ) ) {
339
			if( lthis.valOk( nouveauTagAttr ) && !lthis.valOk( $( '#' + nouveauTagAttr + '.tag' ) ) ) {
340
				// 			Envoyer tags en ajax :
340
				// 			Envoyer tags en ajax :
341
				// 	_OPTIONS
341
				// 	_OPTIONS
342
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/
342
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/
343
				//  _paramètres :
343
				//  _paramètres :
344
				//rien
344
				//rien
345
				// 	_PUT
345
				// 	_PUT
346
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/
346
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles/
347
				// 	_paramètres :
347
				// 	_paramètres :
348
				// image=197938&mot_cle=motcleperso&auteur.id=44084
348
				// image=197938&mot_cle=motcleperso&auteur.id=44084
349
				// 			Mettre à jour les mots cles
349
				// 			Mettre à jour les mots cles
350
				//	_OPTIONS
350
				//	_OPTIONS
351
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
351
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
352
				//	_GET
352
				//	_GET
353
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
353
				// https://api-test.tela-botanica.org/service:del:0.1/mots-cles?image=197938
354
				$( '#tags-pf-supp' ).append(
354
				$( '#tags-pf-supp' ).append(
355
					'<a id="' + nouveauTagAttr + '" class="btn tag custom-tag actif">' +
355
					'<a id="' + nouveauTagAttr + '" class="btn tag custom-tag actif">' +
356
						nouveauTag + '&nbsp;<i class="fas fa-times-circle fermer"></i>' +
356
						nouveauTag + '&nbsp;<i class="fas fa-times-circle fermer"></i>' +
357
					'</a>'
357
					'</a>'
358
				);
358
				);
359
				$( '#form-tags-auteur' )[0].reset();
359
				$( '#form-tags-auteur' )[0].reset();
360
				$( this ).val( '' );
360
				$( this ).val( '' );
361
			}
361
			}
362
		}
362
		}
363
	});
363
	});
364
};
364
};
365
 
365
 
366
WidgetPhotoPopup.prototype.traiterMetas = function() {
366
WidgetPhotoPopup.prototype.traiterMetas = function() {
367
	this.afficherMetas();
367
	this.afficherMetas();
368
	this.afficherPopupLocalisation();
368
	this.afficherPopupLocalisation();
369
	this.afficherMetasPlus();
369
	this.afficherMetasPlus();
370
	this.fournirLienTelechargement();
370
	this.fournirLienTelechargement();
371
};
371
};
372
 
372
 
373
WidgetPhotoPopup.prototype.afficherMetas = function() {
373
WidgetPhotoPopup.prototype.afficherMetas = function() {
374
	const lthis         = this;
374
	const lthis         = this;
375
	const META_CONTENUS = {
375
	const META_CONTENUS = {
376
		'nom' : this.afficherLien( this.urlLienEflore, this.obs['nom_sel'] ),
376
		'nom' : this.afficherLien( this.urlLienEflore, this.obs['nom_sel'] ),
377
		'localisation' : this.obs['localisation'],
377
		'localisation' : this.obs['localisation'],
378
		'auteur' : this.auteur,
378
		'auteur' : this.auteur,
379
		'date-obs' : this.date,
379
		'date-obs' : this.date,
380
		'commentaire' : this.obs['commentaire'],
380
		'commentaire' : this.obs['commentaire'],
381
		'certitude' : this.obs['certitude'],
381
		'certitude' : this.obs['certitude'],
382
		'fiabilite' : this.obs['fiabilite'],
382
		'fiabilite' : this.obs['fiabilite'],
383
		'num-photo' : this.idImage,
383
		'num-photo' : this.idImage,
384
		'titre-original' : this.item['nom_original'],
384
		'titre-original' : this.item['nom_original'],
385
		'date-photo' : this.formaterDate( this.item['date_photo'] ),
385
		'date-photo' : this.formaterDate( this.item['date_photo'] ),
386
		'attribution-copy' : this.item['attribution'],
386
		'attribution-copy' : this.item['attribution'],
387
		'url-copy' : this.urlThisImage
387
		'url-copy' : this.urlThisImage
388
	};
388
	};
389
 
389
 
390
	$.each( META_CONTENUS, function( attrId, contenu ) {
390
	$.each( META_CONTENUS, function( attrId, contenu ) {
391
		let $metaContainer = $( '#bloc-meta #'+attrId );
391
		let $metaContainer = $( '#bloc-meta #'+attrId );
392
 
392
 
393
		if ( lthis.valOk( contenu ) ) {
393
		if ( lthis.valOk( contenu ) ) {
394
			switch( attrId ) {
394
			switch( attrId ) {
395
				case 'attribution-copy' :
395
				case 'attribution-copy' :
396
				case 'url-copy' :
396
				case 'url-copy' :
397
					$metaContainer.val( contenu );
397
					$metaContainer.val( contenu );
398
					lthis.copieAutoChamp( $metaContainer );
398
					lthis.copieAutoChamp( $metaContainer );
399
					break;
399
					break;
400
				case 'nom' :
400
				case 'nom' :
401
					$( '.contenu', $metaContainer ).html( contenu );
401
					$( '.contenu', $metaContainer ).html( contenu );
402
					$( '.bouton', $metaContainer ).attr( 'href', lthis.urlLienEflore );
402
					$( '.bouton', $metaContainer ).attr( 'href', lthis.urlLienEflore );
403
					break;
403
					break;
404
				case 'auteur' :
404
				case 'auteur' :
405
					$( '.bouton', $metaContainer ).attr( 'href', lthis.item['urlProfil'] );
405
					$( '.bouton', $metaContainer ).attr( 'href', lthis.item['urlProfil'] );
406
				default:
406
				default:
407
					$( '.contenu', $metaContainer ).text( contenu );
407
					$( '.contenu', $metaContainer ).text( contenu );
408
					break;
408
					break;
409
			}
409
			}
410
		}
410
		}
411
	});
411
	});
412
};
412
};
413
 
413
 
414
WidgetPhotoPopup.prototype.copieAutoChamp = function( $champACopier ) {
414
WidgetPhotoPopup.prototype.copieAutoChamp = function( $champACopier ) {
415
	$champACopier.on( 'click', function() {
415
	$champACopier.on( 'click', function() {
416
 
416
 
417
		$( this ).select();
417
		$( this ).select();
418
		document.execCommand( 'copy' );
418
		document.execCommand( 'copy' );
419
 
419
 
420
		$( this ).after(
420
		$( this ).after(
421
			'<p class="copy-message alert-success" style="width: 100%; height:' + $( this ).outerHeight() + 'px; margin: 0; display:flex;">'+
421
			'<p class="copy-message alert-success" style="width: 100%; height:' + $( this ).outerHeight() + 'px; margin: 0; display:flex;">'+
422
				'<span style="margin:auto; font-size:1rem;">Copié dans le presse papier</span>'+
422
				'<span style="margin:auto; font-size:1rem;">Copié dans le presse papier</span>'+
423
			'</p>'
423
			'</p>'
424
		).addClass( 'hidden' );
424
		).addClass( 'hidden' );
425
 
425
 
426
		setTimeout( function() {
426
		setTimeout( function() {
427
			$( '.copy-message' ).remove();
427
			$( '.copy-message' ).remove();
428
			$champACopier.removeClass( 'hidden' );
428
			$champACopier.removeClass( 'hidden' );
429
		}, 1000 );
429
		}, 1000 );
430
	});
430
	});
431
};
431
};
432
 
432
 
433
WidgetPhotoPopup.prototype.afficherMetasPlus = function() {
433
WidgetPhotoPopup.prototype.afficherMetasPlus = function() {
434
	const lthis         = this;
434
	const lthis         = this;
435
	const META_LABELS  = {
435
	const META_LABELS  = {
436
		'id_obs' : 'observation n°',
436
		'id_obs' : 'observation n°',
437
		'projet' : 'projet',
437
		'projet' : 'projet',
438
		'nom_referentiel' : 'réferentiel',
438
		'nom_referentiel' : 'réferentiel',
439
		'date_obs' : 'date d´observation',
439
		'date_obs' : 'date d´observation',
440
		'nom_sel': 'nom scientifique',
440
		'nom_sel': 'nom scientifique',
441
		'nom_sel_nn' : 'nom scientifique n°',
441
		'nom_sel_nn' : 'nom scientifique n°',
442
		'nom_ret' : 'nom retenu',
442
		'nom_ret' : 'nom retenu',
443
		'nom_ret_nn' : 'nom retenu n°',
443
		'nom_ret_nn' : 'nom retenu n°',
444
		'famille' : 'famille',
444
		'famille' : 'famille',
445
		'tags_obs' : 'tags de l´observation',
445
		'tags_obs' : 'tags de l´observation',
446
		'lieudit' : 'lieu dit',
446
		'lieudit' : 'lieu dit',
447
		'station' : 'station',
447
		'station' : 'station',
448
		'milieu' : 'milieu',
448
		'milieu' : 'milieu',
449
		'latitude' : 'latitude',
449
		'latitude' : 'latitude',
450
		'longitude' : 'longitude',
450
		'longitude' : 'longitude',
451
		'altitude' : 'altitude',
451
		'altitude' : 'altitude',
452
		'localisation_precision': 'précision de la localisation',
452
		'localisation_precision': 'précision de la localisation',
453
		'code_insee' : 'code insee de la commune',
453
		'code_insee' : 'code insee de la commune',
454
		'dept' : 'département',
454
		'dept' : 'département',
455
		'pays' : 'pays',
455
		'pays' : 'pays',
456
		'est_ip_valide' : 'validée sur identiplante',
456
		'est_ip_valide' : 'validée sur identiplante',
457
		'score_ip' : 'score identiplante',
457
		'score_ip' : 'score identiplante',
458
		'url_ip' : 'url identiplante',
458
		'url_ip' : 'url identiplante',
459
		'abondance' : 'abondance',
459
		'abondance' : 'abondance',
460
		'phenologie' : 'phénologie',
460
		'phenologie' : 'phénologie',
461
		'spontaneite' : 'spontaneite',
461
		'spontaneite' : 'spontaneite',
462
		'type_donnees' : 'type de donnees',
462
		'type_donnees' : 'type de donnees',
463
		'biblio' : 'bibliographie',
463
		'biblio' : 'bibliographie',
464
		'source' : 'source',
464
		'source' : 'source',
465
		'herbier' : 'herbier',
465
		'herbier' : 'herbier',
466
		'observateur' : 'observateur',
466
		'observateur' : 'observateur',
467
		'observateur_structure' : 'structure'
467
		'observateur_structure' : 'structure'
468
	};
468
	};
469
 
469
 
470
	const $contenuPlusMeta  = $( '#contenu-meta-plus' );
470
	const $contenuPlusMeta  = $( '#contenu-meta-plus' );
471
	let degres = $contenuPlusMeta.is( ':visible' ) ? '180' : '0';
471
	let degres = $contenuPlusMeta.is( ':visible' ) ? '180' : '0';
472
 
472
 
473
	this.rotationFleche( degres );
473
	this.rotationFleche( degres );
474
	$contenuPlusMeta.empty();
474
	$contenuPlusMeta.empty();
475
 
475
 
476
	$.each( META_LABELS, function( cle, label ) {
476
	$.each( META_LABELS, function( cle, label ) {
477
		let idAttr = cle.replace( '_', '-' ),
477
		let idAttr = cle.replace( '_', '-' ),
478
			contenu = lthis.obs[cle];
478
			contenu = lthis.obs[cle];
479
 
479
 
480
		switch( cle ) {
480
		switch( cle ) {
481
			case 'nom_sel':
481
			case 'nom_sel':
482
				contenu = lthis.afficherLien( lthis.urlLienEflore, contenu );
482
				contenu = lthis.afficherLien( lthis.urlLienEflore, contenu );
483
				break;
483
				break;
484
 
484
 
485
			case 'nom_ret':
485
			case 'nom_ret':
486
				let urlEfloreNomRetenu = lthis.urlLienEflore.replace( lthis.obs['nom_sel_nn'], lthis.obs['nom_ret_nn'] );
486
				let urlEfloreNomRetenu = lthis.urlLienEflore.replace( lthis.obs['nom_sel_nn'], lthis.obs['nom_ret_nn'] );
487
 
487
 
488
				contenu = lthis.afficherLien( urlEfloreNomRetenu, contenu );
488
				contenu = lthis.afficherLien( urlEfloreNomRetenu, contenu );
489
				break;
489
				break;
490
 
490
 
491
			case 'url_ip':
491
			case 'url_ip':
492
				contenu = lthis.afficherLien( contenu, contenu );
492
				contenu = lthis.afficherLien( contenu, contenu );
493
				break;
493
				break;
494
 
494
 
495
			case 'est_ip_valide':
495
			case 'est_ip_valide':
496
			case 'herbier':
496
			case 'herbier':
497
				if( '0' === contenu ) {
497
				if( '0' === contenu ) {
498
					contenu = 'non';
498
					contenu = 'non';
499
				}
499
				}
500
				break;
500
				break;
501
 
501
 
502
			case 'date_obs':
502
			case 'date_obs':
503
				contenu = lthis.formaterDate( contenu );
503
				contenu = lthis.formaterDate( contenu );
504
				console.log(contenu);
-
 
505
				break;
504
				break;
506
 
505
 
507
			case 'tags_obs':
506
			case 'tags_obs':
508
				let tagsObsLength = lthis.tagsObs.length;
507
				let tagsObsLength = lthis.tagsObs.length;
509
				contenu = lthis.tagsObs.join( '<br>' );
508
				contenu = lthis.tagsObs.join( '<br>' );
510
				break;
509
				break;
511
 
510
 
512
			default:
511
			default:
513
				break;
512
				break;
514
		}
513
		}
515
 
514
 
516
		if ( lthis.valOk( contenu ) ) {
515
		if ( lthis.valOk( contenu ) ) {
517
			$contenuPlusMeta.append(
516
			$contenuPlusMeta.append(
518
				'<li id="' + idAttr + '-meta-plus" class="row">'+
517
				'<li id="' + idAttr + '-meta-plus" class="row">'+
519
					'<div class="col-5 label">' + label.charAt( 0 ).toUpperCase() + label.slice( 1 ) + '</div>'+
518
					'<div class="col-5 label">' + label.charAt( 0 ).toUpperCase() + label.slice( 1 ) + '</div>'+
520
					'<div class="col-5 contenu">' + contenu + '</div>'+
519
					'<div class="col-7 contenu">' + contenu + '</div>'+
521
				'</li>'
520
				'</li>'
522
			);
521
			);
523
		}
522
		}
524
	});
523
	});
525
 
524
 
526
	if( !$contenuPlusMeta.hasClass( 'actif' ) ) {
525
	if( !$contenuPlusMeta.hasClass( 'actif' ) ) {
527
		$contenuPlusMeta.hide();
526
		$contenuPlusMeta.hide();
528
	}
527
	}
529
 
528
 
530
	let estVisible = false;
529
	let estVisible = false;
531
 
530
 
532
	$( '#plus-meta' ).off( 'click' ).on( 'click', function( event ) {
531
	$( '#plus-meta' ).off( 'click' ).on( 'click', function( event ) {
533
		event.preventDefault();
532
		event.preventDefault();
534
		$contenuPlusMeta.toggle( 200, function() {
533
		$contenuPlusMeta.toggle( 200, function() {
535
			estVisible = $contenuPlusMeta.is( ':visible' );
534
			estVisible = $contenuPlusMeta.is( ':visible' );
536
			degres     = estVisible ? '180' : '0';
535
			degres     = estVisible ? '180' : '0';
537
			$( this ).toggleClass( 'actif', estVisible );
536
			$( this ).toggleClass( 'actif', estVisible );
538
			lthis.rotationFleche( degres );
537
			lthis.rotationFleche( degres );
539
		});
538
		});
540
	});
539
	});
541
};
540
};
542
 
541
 
543
WidgetPhotoPopup.prototype.rotationFleche = function( degres ) {
542
WidgetPhotoPopup.prototype.rotationFleche = function( degres ) {
544
	$( '#plus-meta i' ).css({
543
	$( '#plus-meta i' ).css({
545
		'-webkit-transform' : 'rotate('+ degres +'deg)',
544
		'-webkit-transform' : 'rotate('+ degres +'deg)',
546
		'-moz-transform' : 'rotate('+ degres +'deg)',
545
		'-moz-transform' : 'rotate('+ degres +'deg)',
547
		'-ms-transform' : 'rotate('+ degres +'deg)',
546
		'-ms-transform' : 'rotate('+ degres +'deg)',
548
		'transform' : 'rotate('+ degres +'deg)'
547
		'transform' : 'rotate('+ degres +'deg)'
549
	});
548
	});
550
};
549
};
551
 
550
 
552
WidgetPhotoPopup.prototype.fournirLienTelechargement = function() {
551
WidgetPhotoPopup.prototype.fournirLienTelechargement = function() {
553
	const lthis = this;
552
	const lthis = this;
554
 
553
 
555
	$( '#formats' ).on( 'change', function() {
554
	$( '#formats' ).on( 'change', function() {
556
		let format             = ( $( this ).val() || 'O' ),
555
		let format             = ( $( this ).val() || 'O' ),
557
			lienTelechargement = lthis.urlBaseTelechargement + lthis.idImage + '?methode=telecharger&format=' + format;
556
			lienTelechargement = lthis.urlBaseTelechargement + lthis.idImage + '?methode=telecharger&format=' + format;
558
 
557
 
559
		$( '#telecharger' ).attr( 'href', lienTelechargement );
558
		$( '#telecharger' ).attr( 'href', lienTelechargement );
560
	});
559
	});
561
 
560
 
562
	$( '#formats' ).trigger( 'change' );
561
	$( '#formats' ).trigger( 'change' );
563
};
562
};
564
 
563
 
565
 
564
 
566
WidgetPhotoPopup.prototype.afficherPopupLocalisation = function() {
565
WidgetPhotoPopup.prototype.afficherPopupLocalisation = function() {
567
	const lthis = this;
566
	const lthis = this;
568
 
567
 
569
	$( '#localisation a.bouton' ).on( 'click', function( event ){
568
	$( '#localisation a.bouton' ).on( 'click', function( event ){
570
		event.preventDefault();
569
		event.preventDefault();
571
 
570
 
572
		$( this ).after(
571
		$( this ).after(
573
			'<div id="localisation-map-container">'+
572
			'<div id="localisation-map-container">'+
574
				'<button id="map-close" type="button" class="bouton btn btn-sm btn-outline-secondary" aria-label="Close">'+
573
				'<button id="map-close" type="button" class="bouton btn btn-sm btn-outline-secondary" aria-label="Close">'+
575
					'<span aria-hidden="true">×</span>'+
574
					'<span aria-hidden="true">×</span>'+
576
				'</button>'+
575
				'</button>'+
577
				'<div id="localisation-map"></div>'+
576
				'<div id="localisation-map"></div>'+
578
			'</div>'
577
			'</div>'
579
		);
578
		);
580
 
579
 
581
		let lat = lthis.obs['latitude'],
580
		let lat = lthis.obs['latitude'],
582
			lng = lthis.obs['longitude'],
581
			lng = lthis.obs['longitude'],
583
			map = L.map( 'localisation-map', {
582
			map = L.map( 'localisation-map', {
584
				zoomControl: true,
583
				zoomControl: true,
585
				dragging: false,
584
				dragging: false,
586
				scrollWheelZoom: 'center'
585
				scrollWheelZoom: 'center'
587
			} ).setView( [lat, lng], 12 );
586
			} ).setView( [lat, lng], 12 );
588
 
587
 
589
		map.markers = [];
588
		map.markers = [];
590
 
589
 
591
		L.tileLayer(
590
		L.tileLayer(
592
			'https://osm.tela-botanica.org/tuiles/osmfr/{z}/{x}/{y}.png',
591
			'https://osm.tela-botanica.org/tuiles/osmfr/{z}/{x}/{y}.png',
593
			{
592
			{
594
				attribution: 'Data © <a href="http://osm.org/copyright">OpenStreetMap</a>',
593
				attribution: 'Data © <a href="http://osm.org/copyright">OpenStreetMap</a>',
595
				maxZoom: 18
594
				maxZoom: 18
596
			}
595
			}
597
		).addTo( map );
596
		).addTo( map );
598
 
597
 
599
		map.addLayer( new L.FeatureGroup() );
598
		map.addLayer( new L.FeatureGroup() );
600
 
599
 
601
		let marker = new L.Marker(
600
		let marker = new L.Marker(
602
			{
601
			{
603
				'lat': lat,
602
				'lat': lat,
604
				'lng': lng
603
				'lng': lng
605
			},
604
			},
606
			{
605
			{
607
				draggable: false,
606
				draggable: false,
608
			}
607
			}
609
		);
608
		);
610
 
609
 
611
 
610
 
612
		map.addLayer( marker );
611
		map.addLayer( marker );
613
		map.markers.push( marker );
612
		map.markers.push( marker );
614
 
613
 
615
		$( '#map-close' ).on( 'click', function( event ){
614
		$( '#map-close' ).on( 'click', function( event ){
616
			$( '#localisation-map-container' ).remove();
615
			$( '#localisation-map-container' ).remove();
617
		});
616
		});
618
	});
617
	});
619
 
618
 
620
	$( '#fenetre-modal' ).on( 'click', function( event ) {
619
	$( '#fenetre-modal' ).on( 'click', function( event ) {
621
		if(
620
		if(
622
			!$( event.target ).closest( '#localisation-map-container' ).length
621
			!$( event.target ).closest( '#localisation-map-container' ).length
623
			&& !$( event.target ).closest( '#obs-localisation' ).length
622
			&& !$( event.target ).closest( '#obs-localisation' ).length
624
		) {
623
		) {
625
			$( '#localisation-map-container' ).remove();
624
			$( '#localisation-map-container' ).remove();
626
		}
625
		}
627
	});
626
	});
628
};
627
};
629
 
628
 
630
 
629
 
631
WidgetPhotoPopup.prototype.regenererMiniature = function() {
630
WidgetPhotoPopup.prototype.regenererMiniature = function() {
632
	const lthis = this;
631
	const lthis = this;
633
	$( '#regenerer-miniature' ).off( 'click' ).on( 'click', function( event ) {
632
	$( '#regenerer-miniature' ).off( 'click' ).on( 'click', function( event ) {
634
		event.preventDefault();
633
		event.preventDefault();
635
 
634
 
636
		let url = lthis.urlServiceRegenererMiniature + lthis.idImage;
635
		let url = lthis.urlServiceRegenererMiniature + lthis.idImage;
637
 
636
 
638
		$.get( url ).fail( function() {
637
		$.get( url, function( data ) {
-
 
638
				console.log( data );
-
 
639
			}
-
 
640
		).fail( function() {
639
			console.log( 'a foiré :(' );
641
			console.log( 'La régénérétion d´image ne s´est pas faite' );
640
		});
642
		});
641
	});
643
	});
642
};
644
};
643
 
645
 
644
WidgetPhotoPopup.prototype.formaterDate = function( sqlDate ) {
646
WidgetPhotoPopup.prototype.formaterDate = function( sqlDate ) {
645
	dateFormatee = sqlDate
647
	dateFormatee = sqlDate
646
		.substring( 0, 10 )
648
		.substring( 0, 10 )
647
		.split( '-' )
649
		.split( '-' )
648
		.reverse()
650
		.reverse()
649
		.join('/');
651
		.join('/');
650
 
652
 
651
	return dateFormatee;
653
	return dateFormatee;
652
};
654
};
653
 
655
 
654
WidgetPhotoPopup.prototype.afficherLien = function( url, nom ) {
656
WidgetPhotoPopup.prototype.afficherLien = function( url, nom ) {
655
	if( !/https?:\/\//.test( url ) ) {
657
	if( !/https?:\/\//.test( url ) ) {
656
		url = 'https://' + url;
658
		url = 'https://' + url;
657
	}
659
	}
658
	return '<a href="' + url + '" target="_blank">' + nom + '</a> ';
660
	return '<a href="' + url + '" target="_blank">' + nom + '</a> ';
659
};
661
};
660
 
662
 
661
WidgetPhotoPopup.prototype.fournirLienIdentiplante = function() {
663
WidgetPhotoPopup.prototype.fournirLienIdentiplante = function() {
662
	const lthis = this;
664
	const lthis = this;
663
	$( '.signaler-erreur-obs' ).each( function() {
665
	$( '.signaler-erreur-obs' ).each( function() {
664
		$( this ).attr( 'href', lthis.urlIP );
666
		$( this ).attr( 'href', lthis.urlIP );
665
	});
667
	});
666
};
668
};
667
 
669
 
668
// WidgetPhotoPopup.prototype.afficherTags = function() {
670
// WidgetPhotoPopup.prototype.afficherTags = function() {
669
// 	const lthis = this;
671
// 	const lthis = this;
670
// 	const TAGS_BASE = [
672
// 	const TAGS_BASE = [
671
// 		'port',
673
// 		'port',
672
// 		'fleur',
674
// 		'fleur',
673
// 		'fruit',
675
// 		'fruit',
674
// 		'feuille',
676
// 		'feuille',
675
// 		'ecorce',
677
// 		'ecorce',
676
// 		'rameau',
678
// 		'rameau',
677
// 		'planche',
679
// 		'planche',
678
// 		'insecte'
680
// 		'insecte'
679
// 	];
681
// 	];
680
 
682
 
681
	
683
	
682
// };
684
// };