PageSourceSearch

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

js ccb-armor.org collected 2026-10-04 15:18:12 UTC 2,677 bytes, 79 lines download raw bytes

1
2function _getComputedTranslateX(obj)
3{
4    var transform = $(obj).css("transform");
5    var mat = transform.match(/^matrix3d\((.+)\)$/);
6    if(mat) return parseFloat(mat[1].split(', ')[12]);
7    mat = transform.match(/^matrix\((.+)\)$/);
8    return mat ? parseFloat(mat[1].split(', ')[4]) : 0;
9}
10
11
12function calculer_portfolio_slide() {
13	$(".portfolio_slide").each(function() {
14			var ratio_ecran = ($( window ).height() - 100) / $( this ).outerWidth() * 100;
15
16
17			var ratio_max = 10000;
18			$(this).find(".spip_img").each(function(){
19				if ($(this).attr("data-italien-l")) {
20					var ratio = $(this).attr("data-italien-h") / $(this).attr("data-italien-l") * 100;
21					ratio_max = Math.min(ratio, ratio_max);
22				}
23			});
24			ratio_max = Math.min(ratio_ecran, ratio_max);
25			$(this).find(".spip_img").css("padding-bottom", ratio_max+"%");
26	});
27}
28
29function activer_porfolio_slide() {
30
31	$(".portfolio_slide").on("touchstart MSPointerDown ", function(e) {
32		var event = e.originalEvent;
33		if (event.pointerType && (event.pointerType == event.MSPOINTER_TYPE_MOUSE || event.pointerType == "mouse" )) return;
34
35		this.pos_gauche_init = event.pageX || event.targetTouches[0].pageX;
36		this.pos_gauche = this.pos_gauche_init;
37		$(this).addClass("notrans");
38		this.margin_left_init = _getComputedTranslateX(this);		
39		
40	}).on("touchmove MSPointerMove ", function(e) {
41		var event = e.originalEvent;
42		if (event.pointerType && (event.pointerType == event.MSPOINTER_TYPE_MOUSE || event.pointerType == "mouse" )) return;
43		//event.preventDefault();
44
45		this.pos_gauche = event.pageX || event.targetTouches[0].pageX;
46
47		if (Math.abs(this.pos_gauche - this.pos_gauche_init) > 50 ) {
48			event.preventDefault();
49		}
50
51
52		var decal = this.margin_left_init + this.pos_gauche - this.pos_gauche_init;
53		
54			$(this).css("transform", "translate3d("+ decal +"px, 0,0)");
55		
56	}).on("touchend MSPointerUp ", function(e) {
57		var event = e.originalEvent;
58		if (event.pointerType && (event.pointerType == event.MSPOINTER_TYPE_MOUSE || event.pointerType == "mouse" )) return;
59
60		$(this).removeClass("notrans").css("transform", "");
61
62		if (Math.abs(this.pos_gauche - this.pos_gauche_init) > 50 ) {
63			event.preventDefault();
64	
65			if (this.pos_gauche > this.pos_gauche_init - 50) {
66				$(this).parent(".portfolio_slide_container").find(".portfolio_slide_radio:checked").prev(".portfolio_slide_radio").click();
67			} else {
68				$(this).parent(".portfolio_slide_container").find(".portfolio_slide_radio:checked").next(".portfolio_slide_radio").click();
69			}
70		}
71
72	});
73
74}
75
76
77$(document).ready( activer_porfolio_slide );
78$(document).ready( calculer_portfolio_slide );
79$(window).on("resize", calculer_portfolio_slide );

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.