PageSourceSearch

https://aibosolutions.com/assets/miniapps/blog/entries-swipe.js?v=72.0

js aibosolutions.com collected 2026-10-05 05:27:03 UTC 2,607 bytes, 109 lines download raw bytes

1function _simpelayoutSwipe()
2{
3	var touchstartX = 0;
4	var touchstartY = 0;
5	var touchendX = 0;
6	var touchendY = 0;
7	
8	var self = this;
9	var actualIndex = 0;
10	var gestureZone = document.querySelector('.blog-simplelayout-wrapper');
11	var navigator = $('.blog-simplelayout-navigator');
12	var wrapper = $('.blog-simplelayout-wrapper');
13	var totalItems = wrapper.find('.blog-simplelayout-item').length;
14	
15	if($(window).width() >= 640)
16		return;
17	
18	gestureZone.addEventListener('touchstart', function(event) {
19	    touchstartX = event.changedTouches[0].screenX;
20	    touchstartY = event.changedTouches[0].screenY;
21	}, false);
22	
23	gestureZone.addEventListener('touchend', function(event) {
24	    touchendX = event.changedTouches[0].screenX;
25	    touchendY = event.changedTouches[0].screenY;
26	    handleGesture();
27	}, false); 
28	
29	function handleGesture() {
30	    
31	    var horizontalDiff = touchstartX - touchendX;
32	    var verticalDiff = touchstartY - touchendY;
33	    
34	    if(horizontalDiff < 0)
35	    	horizontalDiff *= - 1;
36	    
37	    if(verticalDiff < 0)
38	    	verticalDiff *= - 1;
39	    
40	    // Swipe Left
41	    if(touchendX <= touchstartX && horizontalDiff > 70 && verticalDiff < 40)
42	    {
43	        actualIndex++;
44	        
45	        if(actualIndex >= totalItems - 1)
46	        	actualIndex = totalItems - 1;
47	    }
48	    
49	    // Swipe Right
50	    if(touchendX >= touchstartX)
51	    {
52	        actualIndex--;
53			
54	        if(actualIndex < 0)
55	        	actualIndex = 0;
56	    }
57	    
58	    /*
59	    if (touchendY <= touchstartY) {
60	        console.log('Swiped up');
61	    }
62	    
63	    if (touchendY >= touchstartY) {
64	        console.log('Swiped down');
65	    }
66	    
67	    if (touchendY === touchstartY) {
68	        console.log('Tap');
69	    }
70	    */
71	    
72	    self.navigate(actualIndex);
73	}
74	
75	// Navigator
76	for(var i = 0; i < totalItems; i++)
77	{
78		navigator.append($('<div data-index="' + i + '"></div>'));
79	}
80	
81	navigator.find('div').on('click', function(e) {
82		actualIndex = $(this).attr('data-index');
83		self.navigate(actualIndex);
84	});
85	
86	this.navigate = function(index)
87	{
88		var ancho = parseInt(wrapper.find('.blog-simplelayout-item-wrapper').width());
89
90		wrapper.find('.blog-simplelayout-items').css('transform', 'translateX(' + (ancho * index * -1) + 'px)');
91		
92		navigator.find('.active').removeClass('active');
93		navigator.find('[data-index="' + index + '"]').addClass('active');
94	}
95	
96	// Valor por defecto
97	this.navigate(0);
98	
99	// Si se redimensiona la ventana volvemos al primer elemento
100	$(window).resize(function() {
101		this.navigate(0);
102	});
103}
104/*
105$(document).ready(function() {
106	
107	_simpelayoutSwipe();
108});
109*/

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.