PageSourceSearch

https://cine-tamaris.fr/wp-content/plugins/ultimate-cursor/assets/js/cotton.min.js?ver=5.3.5

js cine-tamaris.fr collected 2026-10-02 07:42:16 UTC 11,431 bytes, 420 lines download raw bytes

1! ( function ( e, t ) {
2	'object' === typeof exports && 'undefined' !== typeof module
3		? ( module.exports = t() )
4		: 'function' === typeof define && define.amd
5		? define( t )
6		: ( ( e =
7				'undefined' !== typeof globalThis
8					? globalThis
9					: e || self ).Cotton = t() );
10} )( this, function () {
11	'use strict';
12	function e( t ) {
13		return ( e =
14			'function' === typeof Symbol && 'symbol' === typeof Symbol.iterator
15				? function ( e ) {
16						return typeof e;
17				  }
18				: function ( e ) {
19						return e &&
20							'function' === typeof Symbol &&
21							e.constructor === Symbol &&
22							e !== Symbol.prototype
23							? 'symbol'
24							: typeof e;
25				  } )( t );
26	}
27	function t( e, t ) {
28		for ( let n = 0; n < t.length; n++ ) {
29			const a = t[ n ];
30			( a.enumerable = a.enumerable || ! 1 ),
31				( a.configurable = ! 0 ),
32				'value' in a && ( a.writable = ! 0 ),
33				Object.defineProperty( e, a.key, a );
34		}
35	}
36	function n( e ) {
37		return (
38			( function ( e ) {
39				if ( Array.isArray( e ) ) {
40					return a( e );
41				}
42			} )( e ) ||
43			( function ( e ) {
44				if (
45					( 'undefined' !== typeof Symbol &&
46						null != e[ Symbol.iterator ] ) ||
47					null != e[ '@@iterator' ]
48				) {
49					return Array.from( e );
50				}
51			} )( e ) ||
52			( function ( e, t ) {
53				if ( ! e ) {
54					return;
55				}
56				if ( 'string' === typeof e ) {
57					return a( e, t );
58				}
59				let n = Object.prototype.toString.call( e ).slice( 8, -1 );
60				'Object' === n && e.constructor && ( n = e.constructor.name );
61				if ( 'Map' === n || 'Set' === n ) {
62					return Array.from( e );
63				}
64				if (
65					'Arguments' === n ||
66					/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( n )
67				) {
68					return a( e, t );
69				}
70			} )( e ) ||
71			( function () {
72				throw new TypeError(
73					'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
74				);
75			} )()
76		);
77	}
78	function a( e, t ) {
79		( null == t || t > e.length ) && ( t = e.length );
80		for ( var n = 0, a = new Array( t ); n < t; n++ ) {
81			a[ n ] = e[ n ];
82		}
83		return a;
84	}
85	function o( e ) {
86		console.error( '[Cotton warn]: '.concat( e ) );
87	}
88	function r( e ) {
89		const t = e.getBoundingClientRect(),
90			n = document.body.getBoundingClientRect();
91		return {
92			width: t.width,
93			height: t.height,
94			centerX: t.left - n.left + t.width / 2 - s( e ),
95			centerY: t.top - n.top + t.height / 2 - i( e ),
96		};
97	}
98	function s( e ) {
99		let t = getComputedStyle( e ).transform,
100			n = t.match( /^matrix3d\((.+)\)$/ );
101		return n
102			? parseFloat( n[ 1 ].split( ', ' )[ 12 ] )
103			: ( n = t.match( /^matrix\((.+)\)$/ ) )
104			? parseFloat( n[ 1 ].split( ', ' )[ 4 ] )
105			: 0;
106	}
107	function i( e ) {
108		let t = getComputedStyle( e ).transform,
109			n = t.match( /^matrix3d\((.+)\)$/ );
110		return n
111			? parseFloat( n[ 1 ].split( ', ' )[ 13 ] )
112			: ( n = t.match( /^matrix\((.+)\)$/ ) )
113			? parseFloat( n[ 1 ].split( ', ' )[ 5 ] )
114			: 0;
115	}
116	function c( e ) {
117		const t = e.element,
118			n = e.params,
119			a = n.data;
120		a.x && a.y
121			? ( ( a.dx = ( a.mouseX - a.x ) * n.speed ),
122			  ( a.dy = ( a.mouseY - a.y ) * n.speed ),
123			  Math.abs( a.dx ) + Math.abs( a.dy ) < 0.1
124					? ( ( a.x = a.mouseX ), ( a.y = a.mouseY ) )
125					: ( ( a.x += a.dx ), ( a.y += a.dy ) ) )
126			: ( ( a.x = a.mouseX ), ( a.y = a.mouseY ) ),
127			( a.animationFrame = requestAnimationFrame( function () {
128				c( e );
129			} ) ),
130			n.centerMouse
131				? ( t.style.transform = 'translate(calc(-50% + '
132						.concat( a.x, 'px), calc(-50% + ' )
133						.concat( a.y, 'px))' ) )
134				: ( t.style.transform = 'translate('
135						.concat( a.x, 'px, ' )
136						.concat( a.y, 'px)' ) );
137	}
138	function l( e ) {
139		const t = e.element,
140			n = e.params,
141			a = n.data,
142			o = n.airMode;
143		a.distanceX && a.distanceY
144			? ( ( a.dx = ( a.distanceX - a.x ) * n.speed ),
145			  ( a.dy = ( a.distanceY - a.y ) * n.speed ),
146			  Math.abs( a.dx ) + Math.abs( a.dy ) < 0.1
147					? ( ( a.x = a.distanceX ), ( a.y = a.distanceY ) )
148					: ( ( a.x += a.dx ), ( a.y += a.dy ) ) )
149			: ( ( a.x = a.distanceX ), ( a.y = a.distanceY ) ),
150			( a.animationFrame = requestAnimationFrame( function () {
151				l( e );
152			} ) );
153		const r = o.reverse ? -a.x : a.x,
154			s = o.reverse ? -a.y : a.y,
155			i =
156				'number' === typeof a.transformX
157					? a.transformX + 'px'
158					: a.transformX,
159			c =
160				'number' === typeof a.transformY
161					? a.transformY + 'px'
162					: a.transformY,
163			m = a.transformX
164				? 'calc('
165						.concat( i, ' + ' )
166						.concat( d( r / o.resistance ), 'px)' )
167				: ''.concat( d( r / o.resistance ), 'px' ),
168			u = a.transformY
169				? 'calc('
170						.concat( c, ' + ' )
171						.concat( d( s / o.resistance ), 'px)' )
172				: ''.concat( d( s / o.resistance ), 'px' );
173		t.style.transform = 'translate('.concat( m, ', ' ).concat( u, ')' );
174	}
175	var d = function ( e ) {
176		return Math.round( 100 * ( e + Number.EPSILON ) ) / 100;
177	};
178	function m( e, t ) {
179		if ( 0 !== e.models.length ) {
180			const n = e.models;
181			if ( t ) {
182				n.forEach( function ( t ) {
183					t.addEventListener( 'mouseenter', e.enterModelHandler ),
184						t.addEventListener( 'mouseleave', e.leaveModelHandler );
185				} );
186			} else {
187				n.forEach( function ( t ) {
188					t.removeEventListener( 'mouseenter', e.enterModelHandler ),
189						t.removeEventListener(
190							'mouseleave',
191							e.leaveModelHandler
192						);
193				} );
194				const a = document.querySelectorAll( e.params.models );
195				a.forEach( function ( t ) {
196					t.addEventListener( 'mouseenter', e.enterModelHandler ),
197						t.addEventListener( 'mouseleave', e.leaveModelHandler );
198				} ),
199					( e.models = a );
200			}
201		}
202	}
203	return ( function () {
204		function a( t, n ) {
205			! ( function ( e, t ) {
206				if ( ! ( e instanceof t ) ) {
207					throw new TypeError( 'Cannot call a class as a function' );
208				}
209			} )( this, a );
210			let r,
211				s = {
212					data: {
213						mouseX: null,
214						mouseY: null,
215						distanceX: null,
216						distanceY: null,
217						x: null,
218						y: null,
219						dx: null,
220						dy: null,
221						animationFrame: void 0,
222					},
223					scene: 'body',
224					conttonInitClass: 'cotton-init',
225					cottonMovingClass: 'cotton-moving',
226					cottonActiveClass: 'cotton-active',
227					models: '.cotton-model',
228					modelsActiveClass: 'model-active',
229					centerMouse: ! 0,
230					speed: 0.125,
231					airMode: ! 1,
232					on: {
233						enterModel: null,
234						leaveModel: null,
235						enterScene: null,
236						leaveScene: null,
237						cottonMove: null,
238					},
239				};
240			if (
241				( ( this.element =
242					t instanceof Element ? t : document.querySelector( t ) ),
243				( this.params = Object.assign( {}, s, n ) ),
244				( this.scene =
245					this.params.scene instanceof Element
246						? this.params.scene
247						: document.querySelector( this.params.scene ) ),
248				( this.models = NodeList.prototype.isPrototypeOf(
249					this.params.models
250				)
251					? this.params.models
252					: document.querySelectorAll( this.params.models ) ),
253				( this.enterModelHandler =
254					this.enterModelHandler.bind( this ) ),
255				( this.leaveModelHandler =
256					this.leaveModelHandler.bind( this ) ),
257				! this.element )
258			) {
259				return o( 'Cannot define a cotton element which is not exist' );
260			}
261			if ( ! this.scene ) {
262				return o( 'Cannot define a scene which is not exist' );
263			}
264			if (
265				( ( this.params.speed > 1 || this.params.speed <= 0 ) &&
266					( this.params.speed = 0.125 ),
267				this.params.airMode )
268			) {
269				const i = this.params.airMode,
270					c = { resistance: 15, reverse: ! 1, alive: ! 1 };
271				'object' !== e( i ) || Array.isArray( i )
272					? ( this.params.airMode = c )
273					: ( this.params.airMode = Object.assign( c, i ) ),
274					( i.resistance < 1 || i.resistance > 100 ) &&
275						( i.resistance = 15 );
276			}
277			( r = navigator.userAgent ).indexOf( 'Android' ) > -1 ||
278				r.indexOf( 'Adr' ),
279				( r.indexOf( 'Mac' ) > -1 && 'ontouchend' in document ) ||
280					a.init( this );
281		}
282		let d, u, f;
283		return (
284			( d = a ),
285			( f = [
286				{
287					key: 'getMouseData',
288					value( e ) {
289						const t = e.element,
290							a = e.scene,
291							o = e.params,
292							c = o.data,
293							l = o.airMode;
294						a.addEventListener( 'mousemove', function ( a ) {
295							( c.mouseX = l ? a.pageX : a.clientX ),
296								( c.mouseY = l ? a.pageY : a.clientY ),
297								n( t.classList ).indexOf( o.conttonInitClass ) >
298									-1 &&
299									t.classList.add( o.cottonMovingClass ),
300								o.on.cottonMove &&
301									'function' === typeof o.on.cottonMove &&
302									o.on.cottonMove.call( e, t, a );
303						} ),
304							l &&
305								( l.alive ||
306									( ( c.rect = r( t ) ),
307									( c.transformX = s( t ) ),
308									( c.transformY = i( t ) ),
309									window.addEventListener(
310										'resize',
311										function () {
312											c.rect = r( t );
313										}
314									) ),
315								a.addEventListener( 'mousemove', function () {
316									l.alive && ( c.rect = r( t ) );
317									const e =
318											window.innerWidth +
319											c.rect.width / 2,
320										n =
321											window.innerHeight +
322											c.rect.height / 2,
323										a = c.mouseX - c.rect.centerX,
324										o = c.mouseY - c.rect.centerY;
325									( c.distanceX = Math.min(
326										Math.max( parseInt( a ), -e ),
327										e
328									) ),
329										( c.distanceY = Math.min(
330											Math.max( parseInt( o ), -n ),
331											n
332										) );
333								} ) );
334					},
335				},
336				{
337					key: 'init',
338					value( e ) {
339						const t = e.element,
340							n = e.params,
341							o = e.scene;
342						o.addEventListener( 'mouseenter', function ( a ) {
343							n.on.enterScene &&
344								'function' === typeof n.on.enterScene &&
345								n.on.enterScene.call( e, t, o, a );
346						} ),
347							o.addEventListener( 'mouseleave', function ( a ) {
348								t.classList.remove( n.cottonMovingClass ),
349									n.on.leaveScene &&
350										'function' === typeof n.on.leaveScene &&
351										n.on.leaveScene.call( e, t, o, a );
352							} ),
353							a.getMouseData( e, ! 0 ),
354							e.move(),
355							m( e, ! 0 );
356					},
357				},
358			] ),
359			( u = [
360				{
361					key: 'enterModelHandler',
362					value( e ) {
363						const t = this.element,
364							n = this.params;
365						n.on.enterModel &&
366							'function' === typeof n.on.enterModel &&
367							n.on.enterModel.call( this, t, e.target, e ),
368							t.classList.add( n.cottonActiveClass ),
369							e.target.classList.add( n.modelsActiveClass );
370					},
371				},
372				{
373					key: 'leaveModelHandler',
374					value( e ) {
375						const t = this.element,
376							n = this.params;
377						n.on.leaveModel &&
378							'function' === typeof n.on.leaveModel &&
379							n.on.leaveModel.call( this, t, e.target, e ),
380							t.classList.remove( n.cottonActiveClass ),
381							e.target.classList.remove( n.modelsActiveClass );
382					},
383				},
384				{
385					key: 'move',
386					value() {
387						const e = this.params.data,
388							t = this.params.airMode;
389						this.element.classList.add(
390							this.params.conttonInitClass
391						),
392							e.animationFrame || ( t ? l( this ) : c( this ) );
393					},
394				},
395				{
396					key: 'stop',
397					value() {
398						const e = this.params.data;
399						this.element.classList.remove(
400							this.params.conttonInitClass
401						),
402							this.element.classList.remove(
403								this.params.cottonMovingClass
404							),
405							cancelAnimationFrame( e.animationFrame ),
406							( e.animationFrame = void 0 );
407					},
408				},
409				{
410					key: 'updateModels',
411					value() {
412						m( this, ! 1 );
413					},
414				},
415			] ) && t( d.prototype, u ),
416			f && t( d, f ),
417			a
418		);
419	} )();
420} );

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.