PageSourceSearch

https://ccb-armor.org/plugins/auto/medias_responsive_mod/v1.40.0/squelettes/javascript/portfolio_ligne.js

js ccb-armor.org collected 2026-10-04 15:18:10 UTC 4,220 bytes, 167 lines download raw bytes

1
2if (typeof portfolio_ligne_marge === 'undefined') var portfolio_ligne_marge = 10;
3if (typeof portfolio_ligne_taille === 'undefined') var portfolio_ligne_taille = 300;
4
5
6
7function calculer_portfolio_ligne () {
8	
9	/* Concaténer les ul.portfolio_ligne qui se suivent */
10	/* Rendu inutile par post_echappe_html_propre */
11
12	$("p").each(function(){
13		if ($(this).html().trim() == "") $(this).remove();
14	});
15
16	$("ul.portfolio_ligne + ul.portfolio_ligne").each(function() {
17		var t = $(this);
18		var contenu = t.html();
19		t.prev("ul.portfolio_ligne").append(contenu);
20		t.remove();
21	});
22
23	/* Fonction principale: aligner les images sur des lignes */
24	$(".portfolio_ligne").each(function() {
25	
26		var m_right = "margin-right";
27		var m_left = "margin-left";
28		if ($(this).css("direction") == "rtl") {
29			m_right = "margin-left";
30			m_left = "margin-right";
31		}
32	
33		$(this).css("padding", 0).css("padding-bottom", -1*portfolio_ligne_marge+"px")
34			.find("li").css(m_right, portfolio_ligne_marge+"px")
35			.css("margin-bottom", portfolio_ligne_marge+"px")
36			.css("clear", "");
37		
38		// Eviter les problèmes d'arrondi…
39		$(this).width("auto");
40		var l_max = Math.floor($(this).width());
41		$(this).width(l_max);
42		var taille_max = portfolio_ligne_taille;
43		
44		if (l_max > 1400) taille_max *= 1.3;
45		else if (l_max <= 1400 && l_max > 1024) taille_max *= 1.2;
46		else if (l_max <= 1024 && l_max > 768) taille_max *= 1.1;
47		else if (l_max <= 768 && l_max > 520) taille_max *= 0.8;
48		else if (l_max <= 520 && l_max > 420) taille_max *= 0.7;
49		else if (l_max <= 420) taille_max *= 0.6;
50		
51		var num_deb = 1;
52		var num = 0;
53		var l_total = 0;
54		var l_temp = 200;
55		var l_cont = 200;
56		var h_cont = 200;
57		var rapport = 1;
58		var r_cont = new Array();
59		
60		$(this).find("li").each(function() {
61			num++
62						
63			l_cont = $(this).attr("data-width");
64			h_cont = $(this).attr("data-height");
65			r_cont[num] = l_cont / h_cont;
66			
67			l_temp = r_cont[num] * taille_max;
68			
69			
70			if (l_total + l_temp > l_max - ((num-1)-num_deb)*portfolio_ligne_marge) {
71				
72				rapport = ( l_max - ((num-1)-num_deb)*portfolio_ligne_marge) / ( l_total );
73				hauteur = taille_max * rapport;
74				hauteur_boite = Math.round(hauteur);
75								
76				var total_ligne  = 0;				
77				for (i = num_deb; i < num; i++) {
78				
79				
80					var t = $(this).parent("ul").find("li:nth-child("+i+")");
81					
82
83					if (total_ligne == 0) t.css("clear", "both");
84
85					
86					var h = Math.round(hauteur * r_cont[i]);
87					
88					if (i == num-1) {
89						h = l_max  - total_ligne;
90						t.css(m_right, "0");
91						total_ligne = 0;
92						
93					} else {
94						total_ligne += h + portfolio_ligne_marge;
95					}
96					
97					t.width(h);
98					t.find(".fond").height(hauteur_boite);
99				}
100				l_total = 0;
101				num_deb = num;
102			}
103			
104			l_total += l_temp;
105			
106			if ($(this).is(":last-child")) {
107				$(this).css(m_right, 0);
108				
109				var rapport = false;
110				if ( l_total + ((num-1)-num_deb)*portfolio_ligne_marge > 0.40*l_max) {
111					rapport = ( l_max -  ((num)-num_deb)*portfolio_ligne_marge ) / l_total;
112					hauteur = taille_max * rapport;
113					hauteur_boite = Math.round(hauteur);
114				}
115				
116				var total_ligne  = 0;				
117				for (i = num_deb; i <= num; i++) {
118					var t = $(this).parent("ul").find("li:nth-child("+i+")");
119					
120					if (total_ligne == 0) t.css("clear", "both");
121
122					if (!hauteur_boite) {
123						if (rapport) {
124							hauteur_boite = taille_max * rapport * 1.3;
125						} else {
126							var hauteur_boite = taille_max * 1.3;
127						}
128					}
129					//hauteur_boite = Math.round(hauteur);
130
131					var h = Math.round(hauteur_boite * r_cont[i]);
132						
133						
134					if (i == num && rapport) {
135						h = l_max  - total_ligne;
136						total_ligne = 0;
137						
138					} else {
139						total_ligne += h + portfolio_ligne_marge;
140					}
141					//console.log(total_ligne);
142										
143					if (i ==  num_deb && !rapport) {
144						//pt.addClass("forcer_centrer");
145						t.css(m_left,  "" );
146						t.css("clear", "both");
147					} else {
148						t.removeClass("forcer_centrer").css(m_left, "");
149					}
150
151					t.width(h);
152		
153					t.find(".fond").height(hauteur_boite);
154					
155				}
156
157			}
158			
159			
160		});
161		
162	});
163}
164
165
166$(document).ready( calculer_portfolio_ligne );
167$(window).on("resize", calculer_portfolio_ligne );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.