PageSourceSearch

https://www.toptex.fr/skin/frontend/rwd/toptex_2020/js/aims/custom.js?v=1789685678

js toptex.fr collected 2026-09-28 13:14:47 UTC 13,760 bytes, 435 lines download raw bytes

1
2jQuery(document).ready(function(){
3    var $window = jQuery(window);
4    var $body = jQuery('body');
5    var $scrollToTop = jQuery('#scrollToTop');
6    var isScrolled = null;
7    var scrollTicking = false;
8
9    function updateScrollState() {
10        scrollTicking = false;
11        var scrolled = $window.scrollTop() > 100;
12        if (scrolled === isScrolled) {
13            return;
14        }
15        isScrolled = scrolled;
16        $body.toggleClass('scrolltotop-active', scrolled);
17        if (scrolled) {
18            $scrollToTop.fadeIn();
19        } else {
20            $scrollToTop.fadeOut();
21        }
22    }
23
24    // Coalesce les évènements scroll (60-120/s) sur une seule mise à jour par frame
25    $window.on('scroll', function () {
26        if (!scrollTicking) {
27            scrollTicking = true;
28            window.requestAnimationFrame(updateScrollState);
29        }
30    });
31    updateScrollState();
32
33
34    $scrollToTop.click(function(){
35        jQuery('html, body').animate({scrollTop : 0},800);
36        return false;
37    });
38
39
40        jQuery(".change-language").click(function(){
41            jQuery(this).toggleClass("active");
42            jQuery(this).next().slideToggle();
43        });
44
45
46    jQuery('.footer-links-mobile-wrapper .links .title').click(function(){
47        jQuery(this).toggleClass("active");
48        jQuery(this).next().slideToggle();
49    });
50
51    jQuery(".tt-accordion-item-btn").click(function(){
52        jQuery(this).toggleClass("active");
53        jQuery(this).next().slideToggle();
54    });
55
56
57    jQuery(".tt-select-field select").change(function() {
58
59        if(jQuery(this).val() == "") {
60            jQuery(this).addClass("not-selected")
61            jQuery(this).parent().addClass("not-selected")
62
63        }else {
64            jQuery(this).parent().removeClass("not-selected")
65            jQuery(this).removeClass("not-selected")
66        }
67
68
69    });
70
71    jQuery(".tt-radio-wrapper").click(function(e) {
72
73        var radio_group = jQuery(this).children("input").attr("name");
74
75        jQuery('.tt-radio-wrapper input[name="'+radio_group+'"]').each(function( index ) {
76            jQuery(this).parent().removeClass("checked");
77        });
78
79        jQuery(this).addClass("checked");
80
81        if(jQuery(this).find('input').attr('id') == 'delivery_terms_3'){
82            jQuery('#checkout-review-table-delivery').show();
83        }else{
84            jQuery('#checkout-review-table-delivery').hide();
85        }
86    });
87
88    jQuery(".tt-radio-wrapper input").each(function( index ) {
89            if(jQuery(this).is(':checked')){
90                jQuery(this).parent().addClass("checked");
91            }
92    });
93
94    jQuery(".tt-radio-cursor").on('click', function(e) {
95        if(jQuery(this).children("input").prop("disabled") !== true){
96            var radio_group = jQuery(this).children("input").attr("name");
97            if(!jQuery(this).children("input").is(':checked')) {
98                jQuery('.tt-radio-cursor input[name="' + radio_group + '"]').each(function (index) {
99                    jQuery(this).parent().removeClass("checked");
100                    jQuery(this).attr('checked', false);
101                });
102                jQuery(this).addClass("checked");
103                jQuery(this).children("input").attr('checked', true);
104
105            }
106        }
107    });
108
109    jQuery(".tt-radio-cursor input").each(function( index ) {
110        if(jQuery(this).is(':checked')){
111            jQuery(this).parent().addClass("checked");
112        }
113
114        if(jQuery(this).is(':disabled')){
115            jQuery(this).parent().parent().addClass("disabled");
116        }
117    });
118
119    jQuery(".tt-checkbox-cursor-wrapper").click(function() {
120        if(jQuery(this).children("input").prop("disabled") != true) {
121            if (jQuery(this).children("input").is(':checked')) {
122                jQuery(this).children(".tt-checkbox-cursor").addClass("checked");
123            } else {
124                jQuery(this).children(".tt-checkbox-cursor").removeClass("checked");
125            }
126        }
127    });
128
129    jQuery(".tt-checkbox-cursor-wrapper input").each(function( index ) {
130        if(jQuery(this).is(':checked')){
131            jQuery(this).next(".tt-checkbox-cursor").addClass("checked");
132        }else {
133            jQuery(this).next(".tt-checkbox-cursor").removeClass("checked");
134        }
135
136        if(jQuery(this).is(':disabled')){
137            jQuery(this).parent().parent().addClass("disabled");
138        }
139    });
140
141
142    jQuery(".focus-label-field").click(function(e) {
143        e.stopPropagation();
144    });
145
146    jQuery(".focus-label-field > label").click(function() {
147        jQuery( this ).next().focus();
148    });
149
150    jQuery(".focus-label-field .input-text:focus").parent().addClass("active");
151
152
153
154    jQuery(".focus-label-field .input-text").bind("change paste keyup", function() {
155        jQuery( this ).parent().addClass("active");
156    });
157
158
159    jQuery(".focus-label-field .input-text").focusin(function() {
160        jQuery( this ).parent().addClass("active");
161    });
162
163    jQuery(".focus-label-field .input-text").keydown(function() {
164        jQuery( this ).parent().addClass("active");
165    });
166
167
168    jQuery(".focus-label-field .input-text").focusout(function() {
169
170        if(jQuery.trim(jQuery(this).val()) == '') {
171            jQuery(this).parent().removeClass("active");
172        }
173
174    });
175
176    jQuery(".focus-label-field .shipping-postcode").focusin(function() {
177        jQuery( ".shipping-city" ).parent().addClass("active");
178    });
179
180    jQuery(".focus-label-field .shipping-city").focusin(function() {
181        jQuery( ".shipping-postcode" ).parent().addClass("active");
182    });
183
184    jQuery(".focus-label-field .shipping-postcode").focusout(function() {
185
186        if(jQuery.trim(jQuery( ".shipping-city" ).val()) == '') {
187
188            jQuery( ".shipping-city" ).parent().removeClass("active");
189        }
190
191    });
192
193    jQuery(".focus-label-field .shipping-city").focusout(function() {
194        if(jQuery.trim(jQuery( ".shipping-postcode" ).val()) == '') {
195            jQuery( ".shipping-postcode" ).parent().removeClass("active");
196        }
197    });
198
199
200    jQuery(".focus-label-field .input-text").each(function( index ) {
201        if(jQuery.trim(jQuery(this).val()) != '') {
202            jQuery(this).parent().addClass("active");
203        }
204    });
205
206
207    jQuery(".focus-label-field textarea.input-text").each(function( index ) {
208
209        var label_height = jQuery(this).prev("label").outerHeight(true);
210
211        this.style.height = "35px";
212
213        if(label_height > this.scrollHeight){
214            this.style.height = (label_height+5)+"px";
215        } else {
216            this.style.height = (this.scrollHeight)+"px";
217        }
218
219    });
220
221    jQuery(".tt-select-field select").each(function( index ) {
222        if(jQuery(this).val() == "") {
223            jQuery(this).addClass("not-selected");
224            jQuery(this).parent().addClass("not-selected");
225        }
226    });
227
228    jQuery( ".tt-email-tag-field-wrapper" ).click(function() {
229        jQuery(this).find("input").focus();
230    });
231
232
233    jQuery( ".trigger-btn" ).click(function(e) {
234        e.stopPropagation();
235        jQuery("#"+this.id.replace('trigger_', '')).trigger( "click" );
236    });
237
238
239    if (window.matchMedia("(min-width: " + (bp.small + 1) + "px)").matches) {
240        jQuery('.nav-primary li.level0.parent').mouseenter(function () {
241            jQuery("#overlay").show();
242            /*if (!jQuery("#header-sticky-wrapper").hasClass("is-sticky")) {
243                jQuery("#header").css("position", "relative");
244            }*/
245        });
246        jQuery('.nav-primary li.level0.parent').mouseleave(function () {
247            jQuery("#overlay").hide();
248            /*if (!jQuery("#header-sticky-wrapper").hasClass("is-sticky")) {
249                jQuery("#header").css("position", "initial");
250            }*/
251        });
252    }
253
254    jQuery('.anchor-link').click(function() {
255        var anchor = jQuery(this).attr("href");
256        var tag =  jQuery('#'+anchor.replace('#', ''));
257
258        jQuery('html,body').animate({scrollTop: tag.offset().top},'slow');
259
260
261    });
262
263
264    jQuery( '.tt-input-file input' ).each( function()
265    {
266        var $input	 =jQuery( this ),
267            $label	 = $input.next( 'label' ),
268            labelVal = $label.html();
269
270        $input.on( 'change', function( e )
271        {
272            var fileName = '';
273
274            if( this.files && this.files.length > 1 )
275                fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
276            else if( e.target.value )
277                fileName = e.target.value.split( '\\' ).pop();
278
279            if( fileName )
280                $label.find( 'span' ).html( fileName );
281            else
282                $label.html( labelVal );
283        });
284
285        // Firefox bug fix
286        $input
287            .on( 'focus', function(){ $input.addClass( 'has-focus' ); })
288            .on( 'blur', function(){ $input.removeClass( 'has-focus' ); });
289    });
290
291    jQuery(".visible-password-toggle").click(function(e) {
292
293        var inputType = jQuery( this ).siblings("input").attr("type");
294
295        if (inputType == "password"){
296            jQuery( this ).siblings("input").attr("type","text");
297            jQuery( this ).addClass("active");
298        }
299
300        if (inputType == "text"){
301            jQuery( this ).siblings("input").attr("type","password");
302            jQuery( this ).removeClass("active");
303        }
304
305    });
306
307    jQuery(".messages .close").click(function() {
308        jQuery(this).closest('.messages').slideUp(500);
309    });
310
311});
312
313jQuery( window ).on( "load", function() {
314
315
316
317    jQuery(".focus-label-field.active > input.input-text").each(function( index ) {
318
319        var label_height = jQuery(this).prev("label").outerHeight(true);
320
321
322        if (label_height > 15) {
323            jQuery(this).css("margin-top",(label_height-4)+"px");
324        }
325
326
327    });
328
329
330    jQuery(".focus-label-field:not(.active) > input.input-text").each(function( index ) {
331        var label_height = jQuery(this).prev("label").outerHeight(true);
332        var  input_height = jQuery(this).outerHeight();
333
334        if(label_height > input_height){
335            this.style.height = (label_height+5)+"px";
336        }
337
338    });
339
340});
341
342function focusLabelActive(element) {
343    jQuery(element).parent().addClass("active");
344}
345
346function focusLabelInactive(element) {
347    if(jQuery.trim(jQuery(element).val()) == '') {
348        jQuery(element).parent().removeClass("active");
349    }
350}
351
352
353
354
355
356function focusFieldResize(element) {
357    var label_height = jQuery(element).prev("label").outerHeight(true);
358    var  input_height = jQuery(element).outerHeight();
359
360    if(label_height > input_height){
361
362        jQuery(element).height(label_height+5)
363    }
364}
365
366function auto_grow(element) {
367    element.style.height = "35px";
368    element.style.height = (element.scrollHeight)+"px";
369}
370
371function tooltipPositionGeneric(element,wrapper) {
372    var tooltipElement = jQuery(element).children(".tt-tooltip");
373    var wrapperElement = jQuery(wrapper);
374
375    var wrapper_bottom = wrapperElement.offset().top + wrapperElement.outerHeight();
376    var wrapper_right = wrapperElement.offset().left + wrapperElement.width();
377    var wrapper_left = wrapperElement.offset().left;
378
379    var tooltip_bottom = tooltipElement.offset().top + tooltipElement.outerHeight();
380    var tooltip_right = tooltipElement.offset().left + tooltipElement.width();
381    var tooltip_left = tooltipElement.offset().left;
382
383    if (tooltip_bottom > wrapper_bottom) {
384        tooltipElement.addClass("bottom-limit")
385    }
386
387    if (tooltip_right > wrapper_right) {
388        tooltipElement.addClass("right-limit")
389    }
390
391    if (tooltip_left < wrapper_left) {
392        tooltipElement.addClass("left-limit")
393    }
394}
395if('Validation' in window) {
396    Validation.addAllThese([
397        ['validate-phone', 'Please enter a valid phone number in this field.', function(v) {
398            var pass=v.strip();
399            if (0 == pass.length) {
400                return true;
401            }
402            return Validation.get('IsEmpty').test(v) || /^((\+?)\d+\s?|0)[0-9](\s?\d{2}){4}$/.test(v);
403        }],
404        ['validate-password', 'The password must be at least 12 characters long, contain uppercase and lowercase letters, numbers and special characters such as « ! », « & », « - ».', function(v, elm) {
405            var pass = v.strip();
406            if (0 == pass.length) {
407                return true;
408            }
409
410            if (pass.length < 12) {
411                return false;
412            }
413            return Validation.get('IsEmpty').test(v) || /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9]).{12,}/.test(v)
414        }],
415        ['validate-password-login', 'Please enter 12 or more characters without leading or trailing spaces.', function(v, elm) {
416            var pass=v.strip(); /*strip leading and trailing spaces*/
417            return (!(v.length>0 && v.length < 12) && v.length == pass.length);
418        }],
419        ['validate-postalcode-PT', 'Please note - Please enter your details in accordance with Portuguese postcodes, i.e. 4 digits - 3 digits Location. Ex: 3020-928 Coimbra', function(v, elm) {
420            return Validation.get('IsEmpty').test(v) || /^\d{4}-\d{3}$/.test(v)
421        }],
422        ['validate-postalcode-FR', 'Please note - Please enter your details in accordance with France postcodes, i.e. 5 digits Location. Ex: 75001 Paris', function(v, elm) {
423            return Validation.get('IsEmpty').test(v) || /^\d{5}$/.test(v)
424        }]
425    ]);
426}
427jQuery(document).ready( function () {
428    jQuery('span.bot_filter').each(function(i, e) {
429        jQuery(e).click(function(event){
430            event.stopPropagation();
431            var link = jQuery(this).attr('link');
432            window.open(atob(link), "_self");
433        });
434    });
435} );

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.