PageSourceSearch

https://www.thalgo.co.uk/app/global.js?a=1786619538

js thalgo.co.uk collected 2026-10-04 13:32:13 UTC 29,913 bytes, 741 lines download raw bytes

1var si={},starts=starts||new Date().getTime(),inputs,selects,textareas,url,str,json, post=[],postdata = [], shutdowns = [], errors = [], ww = window.innerWidth, desktop = 1, mobile = 0, site_img_path = site_img_path || '', lang = lang || 'fr', ip = ip || '', device = 'd',img2load=-1,cl = cl||console.log,ct=ct||console.table||console.log,//
2    nf = function (a,b,c) {return;},x,topH,hash=location.hash.replace(/^#/gi,'').replace(/#/gi,'&'),qs=parseQuery(hash),audio,classname='',nav='',ua=navigator.userAgent.toLowerCase(), lazyImg2load=-1,loadedImgByClass={},imp='/site/templates/defaut/front/images';
3
4if (ua.indexOf('safari') != -1) {
5    if (ua.indexOf('edge') > -1) {
6        nav=classname='edge';
7    } else if (ua.indexOf('android') > -1) {
8        nav='android';classname='chrome android';
9    } else if (ua.indexOf('chrome') > -1) {
10        nav=classname='chrome';
11    }else {//Safari :: "mozilla/5.0 (windows nt 6.2; wow64) applewebkit/534.57.2 (khtml, like gecko) version/5.1.7 safari/534.57.2"
12        nav=classname='safari';
13    }
14}
15
16/*}events{*/
17window.onerror = errorhandler;
18window.addEventListener('hashchange',onHashChange, false);//au démarrage ;)
19window.addEventListener('resize', resize);//better, only Fire at event end ?
20window.addEventListener('load', resize);//better, only Fire at event end ?
21window.addEventListener('load', function(e){
22    document.body.parentNode.className+=' '+classname;
23});//better, only Fire at event end ?
24
25window.onbeforeunload=function(e){//F5, click, etc ..
26//common:BODY,BUTTON,A -> navigation
27    var ael=document.activeElement;//BODY,1 => is refresh or new url typed or closed, but can't do that much upon closing except message
28    cl('unloads',ael,ael.tagName,shutdowns.length,shutdowns);
29    for(var i in shutdowns){shutdowns[i]();}
30    return;//No unload dialog -- sends analytics stats for going elsewhere
31    //return true;
32    //e.preventDefault();//prevents Nav
33    //(e || window.event).returnValue = null;     // Gecko + IE
34    //return confirmationMessage;//Etes vous certain de vouloir quitter cette page ?
35}
36
37if (window.location.href.indexOf('.home') < 0 && window.location.href.indexOf('.preprod2') < 0) {prod = 1;ct = cl = nf;}
38/*}functions{*/
39
40
41Object.size = function(obj) {var size = 0, key;for (key in obj) {if (obj.hasOwnProperty(key)) size++;}return size;};
42
43function gt(x){var x=x||0,y=new Date().getTime()-starts;if(x)cl(x,y);return y;}
44
45function ajaxForm(el,callback){
46    callback=callback||nf;str='';url=el.action;postdata=[];
47    inputs=el.querySelectorAll('input');inputs.forEach(inputName);
48    selects=el.querySelectorAll('select');selects.forEach(inputName);
49    textareas=el.querySelectorAll('textarea');textareas.forEach(inputName);
50    for(var i in postdata){
51        cl('s',i,postdata[i]['name'],postdata[i]['value']);
52        //post.push(postdata[i]['name']+'='+postdata[i]['value']);
53        str+='&'+postdata[i]['name']+'='+postdata[i]['value'];
54    }
55    ajax(url,el.method.toUpperCase(),str,callback);
56    return false;
57}
58
59//ajax('/','POST',{'a':'b'},nf);ajax.urls;ajax.inc;ajax.nb;
60ajax.nb=0;ajax.inc=0;ajax.urls=[];
61function ajax(url,method,data,callback){
62    url=url||'?';method=method||'POST';data=data||'';callback=callback||nf;
63    var res,xhr = new XMLHttpRequest();
64    xhr.open(method, url, true);url+='#'+ajax.inc;
65    xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
66    if(method=='POST')xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
67    xhr.onload = function () {
68        ajax.urls.remove(url);ajax.nb--;
69        callback(this.responseText);
70        cl('ajx response'+this.responseText);
71    };
72    ajax.inc++;ajax.nb++;ajax.urls.push(url);
73    xhr.send(data);
74    //cl({url,method,data,'urls':ajax.urls});
75}
76
77function errorhandler(desc, page, line, chr, errobj) {
78    if(/axept\.io|avis-verifies|bat\.js|facebook\.net/i.test(page))return true;//dontcare
79    var err=(desc+page+line+'').toLowerCase();
80//global errors[]
81    if(errors.indexOf(err)>-1)return true;
82    if(dev && errobj){
83        var err = new Error();
84        cl(err.stack);
85        cl(errobj);
86    }
87    cl(errobj);
88    ct(desc, page,line, chr);//desc, page, line, chr, //	script error.
89    //if(errobj)console.error(errobj);//desc, page, line, chr, //	Script error. :0 0 => is undefined function
90    if(dev)return true;
91    //ajax('/tag.php','POST',('jsx='+desc+'&page='+page+'&line='+line+'&loc='+window.location.href).toLowerCase());
92    return true;
93}
94
95/*jquery ajaxify form :: returns promise */
96async function defer(method, which, timeout, dilatation) {//not being jquery deferer itslef
97    var timeout = timeout || 200,dilatation=dilatation||1.1,which=which || function(){x=(typeof window['jQuery']=='function' && typeof window['jQuery'].fn=='object');cl('jqr',x,gt(),'->',method.name);return x;};
98    if (which()) {
99        return method();
100        //args
101    }
102    setTimeout(function () {defer(method,which,Math.round(timeout*dilatation));},timeout );
103}
104
105function inputName(input) {
106    if (input.name && input.value && !input.disabled) {
107        if (['radio','checkbox'].indexOf(input.type)>-1) {
108            if (input.checked) {
109                postdata.push({name: input.name, value: input.value});
110                return input.value;
111            }
112        } else {
113            postdata.push({name: input.name, value: input.value});
114            return input.value;
115        }
116        //postdata.concat({name:input.name,value:input.value});
117        //postdata[input.name]=input.value;
118    }
119    return;
120}
121
122function isJson(str) {
123    try {
124        var x=JSON.parse(str);
125    } catch (e) {
126        return false;
127    }
128    return x;
129}
130
131function resized(){/*cl(window.innerWidth);*/
132    sc('ww',window.innerWidth);
133    sc('wh',window.innerHeight);
134}
135
136resize.events=[resized];
137function resize(){
138    /*cl('resize',resize.events);*/
139    resize.events.forEach(function(e){    e();    });
140}
141function dqs(x){return document.querySelectorAll(x);}
142function b64EncodeUnicode(str) {
143    var x,x2;
144    x=btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
145        function toSolidBytes(match, p1) {
146            return String.fromCharCode('0x' + p1);
147        }));
148    x2=x.replace(/\+/gi,'-').replace(/\//gi,'_');
149    //cl({x,x2});
150    return x2;
151}
152
153
154function btnPlusMinus(){
155// Click pour incrémenter la quantité
156    $('.btn-plus').unbind().on('click', function(e) {
157        var sub = $(this).next();
158        if(!$(this).hasClass('disable')) {
159            var qteid = '.qte-' + $(this).data('id'),targets=dqs(qteid),value = parseInt(targets[0].value, 10),c=parseInt(targets[0].getAttribute('conditionnement')||1);
160            //value = isNaN(value) ? 0 : value;
161            value+=c;
162            targets.forEach(function(e){e.value=value;});
163        }
164        setTimeout(function () {
165            console.log(sub);
166            sub.find('.qte-submit').click();
167        }, 1500);
168    });
169
170// Click pour décrémenter la quantité
171    $('.btn-moins').unbind().on('click', function(e) {
172        var sub = $(this).parent('form').find('.refresh');
173        if(!$(this).hasClass('disable')) {//onhover+page => targets
174            var qteid = '.qte-' + $(this).data('id'),targets=dqs(qteid),value = parseInt(targets[0].value, 10),c=parseInt(targets[0].getAttribute('conditionnement')||1);
175            if(value>1){
176                value-=c;
177                targets.forEach(function(e){e.value=value;});
178            }
179        }
180        setTimeout(function () {
181            sub.find('.qte-submit').click();
182        }, 1500);
183    });
184
185    $('.qte-prod.ipt').unbind().on('keyup',function(e) {//Keep as multiples of
186        var nv,c=parseInt(this.getAttribute('conditionnement')||1);
187        if(this.value % c >0){nv=parseInt(this.value / c)*c;this.value=nv;}
188    });
189
190    $('.qte-prod.ipt').unbind().on('blur',function() {
191        var sub = $(this).closest('.refresh');
192        setTimeout(function () {
193            sub.find('.qte-submit').click();
194        }, 1500)
195    });
196
197    // Validation de la modification des quantités au panier
198    $('.qte-submit').unbind().on('click', function(e) {
199        $('.qte-submit').addClass('fa-spin');
200        var qtemini = parseInt($(this).parents().parents().parents().parents().data('qtemini'));
201        var qtesaisie = parseInt($(this).parents().siblings('.qtesaisie').val());
202
203        if (isNaN(qtesaisie)) {
204            qtesaisie = qtemini;
205        }
206        var qtecalculee = parseInt(qtemini * Math.floor(qtesaisie / qtemini));
207        if (qtecalculee <= qtemini) {
208            $(this).parents().siblings('.qtesaisie').val(qtemini);
209        } else {
210            $(this).parents().siblings('.qtesaisie').val(qtecalculee);
211        }
212        console.log($(this).parents().parent('form'));
213        // Validation du formulaire
214        $(this).parents().parent('form').submit();
215    });
216}
217
218function hl(x){
219    console.log('hl',x);
220    location.href =x;
221}
222
223var sc=setCookie,gc=getCookie;
224function getCookie(e){
225    //if(localStorage.getItem(e))return localStorage.getItem(e);
226    return document.cookie.length>0&&(begin=document.cookie.indexOf(e+"="),-1!=begin)?(begin+=e.length+1,end=document.cookie.indexOf(";",begin),-1==end&&(end=document.cookie.length),unescape(document.cookie.substring(begin,end))):null}
227function delCookie(e){path=";path=/",domain=";domain=."+document.location.hostname;var o="Thu, 01-Jan-1970 00:00:01 GMT";document.cookie=e+"="+path+domain+";expires="+o}
228function lsg(k){return lcg(k);}
229function lcg(k){
230    if(localStorage.getItem('ttl_'+k) && localStorage.getItem('ttl_'+k)>Date.now()){
231        return localStorage.getItem(k);
232    }
233    return 0;
234}
235function lss(k,v,ttl){
236    ttl=ttl||365;
237    localStorage.setItem('ttl_'+k,Date.now()+(ttl*3600*24));
238    return localStorage.setItem(k,v);
239}
240function lsd(k){
241    localStorage.removeItem('ttl_'+k);
242    localStorage.removeItem(k);
243    return 1;
244}
245function setCookie(name,value,expires,path,domain,secure){
246    //localStorage.setItem(name,value);
247    path=path || '/';
248    var today = new Date();today.setTime(today.getTime());
249    if(expires){expires = expires * 1000/*ms*/ * 3600/*hours*/ * 24;}//given in days
250    else{expires=1000*60*60*24*365;}//365 dats
251    var expires_date = new Date( today.getTime() + (expires) );
252    document.cookie=name+"="+escape(value)+ ((expires)?";expires="+expires_date.toGMTString():"")+ ((path)?";path="+path:"")+ ((domain)?";domain="+domain:"")+ ( ( secure ) ? ";secure" : "" );
253}
254
255/** upon 200 response clear the redirection counter cookie **/
256if(getCookie('redirects')){
257    delCookie('redirects');//instead of shutdown or first echo 200ok => clearRedirections();
258}
259
260function onHashChange(){
261    hash=location.hash.replace(/^#/gi,'').replace(/#/gi,'&');//plusieurs à la suite
262    if(!hash)return;
263    qs=parseQuery(hash);x=topH=0;
264    if(qs['c']) {
265        qs['click']='.'+qs['c'];
266    }//#c=bestsellers
267    if(qs['click']){//#click=.bestsellers
268        x=document.querySelector(qs['click']);
269        if(x){
270            x.click();
271            topH=(window.scrollY)+(x.getBoundingClientRect().top);
272            setTimeout(function(){window.scrollTo(0,topH-50);},25);
273            location.hash='';//neutralize
274            if($('#header-menu-deploiement:visible').length){
275                $('#menu-deploiement-open').click();
276            }
277            //top=getOffset(x)['top'];
278        }
279    }
280    //cl({hash,qs,x,topH});
281}
282
283function parseQuery(queryString) {
284    var query = {};
285    var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
286    for (var i = 0; i < pairs.length; i++) {
287        var pair = pairs[i].split('=');
288        query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
289    }
290    return query;
291}
292
293function getOffset(el) {
294    const rect = el.getBoundingClientRect();
295    return {
296        left: rect.left + window.scrollX,
297        top: rect.top + window.scrollY
298    };
299}
300
301var txt,currentQte,qteMaxselectedUniverse={};
302function cadeauxPerUnivers(uid,name){
303    var sup='',nbKdo=nbKdoPerU[uid],pid,str,pname;
304    txt="  "+name+" "+trads['offerts restants'];//addcadeauxpopup()
305    currentQte=0;qteMax=nbKdo;
306
307    if(nbKdo<1){
308        dqs('.choixEchantillons')[0].innerHTML='';
309        dqs('.u'+uid).style.display='none';
310    }
311
312    selectedUniverse={'uid':uid,'name':name};
313    if(uid==22)sup=trads['10 Echantillons']+'';
314    //trads['Univers']+" "+trads['avec']+"
315    str="<fieldset><legend> &nbsp; <span class='selectedEchantillons'>"+qteMax+'/'+qteMax+"</span>"+txt+"</legend>";
316    console.log(uid);
317    for(var i in uid2p[uid]){
318        pid=uid2p[uid][i];
319        pname=pr[pid];
320        str+="<span class='ibm'>" +pname+"<br/><span style='display:inline' class='article_reference text-muted'>"+sup+"</span><span class='cnt'>"+
321            "<span class='qte btn-moins p1' data-id='"+pid+"'>-</span> <input conditionnement=1 type='numeric' class='ipt qte-prod qte-"+pid+"' name='qte["+pid+"]'" +
322    " value='0'><span class='qte btn-plus p2' data-id='"+pid+"'>+</span></span></span>";
323
324    }
325    dqs('.choixEchantillons')[0].innerHTML="<form method=POST id='btqkdo' action='?' onsubmit='return onSubmit(0,0,\"#btqkdo\",cadeauxPerUniversCb);'><input name='catalogue' value='pro'" +
326        " type='hidden'><input" +
327        " name='addKdos' value='1' type='hidden'><div class='str'>" +str+
328        ""+
329        "</div></fieldset><input class='btn-thalgo' onclick='this.style.display = \"none\"' type='submit' style='width:100%' value='"+trads['Valider ma sélection']+"'></form>";
330
331    $('.p1').on('click',function(){
332        el=$(this).parent().find('.qte-prod');v=el.val();
333        if(v>0){v--;currentQte--;el.val(v);$('.selectedEchantillons')[0].innerHTML= (qteMax-currentQte)+' / '+qteMax;}
334    });
335    $('.p2').on('click',function(){
336        el=$(this).parent().find('.qte-prod');v=el.val();
337        if(currentQte<qteMax){v++;currentQte++;el.val(v);$('.selectedEchantillons')[0].innerHTML= (qteMax-currentQte)+' / '+qteMax;}
338    });
339}
340
341function factuCoordinatesModifCb(x){
342    cl(x);
343    if(x['ret']){
344        dqs('#currentFactu')[0].innerHTML=x['ret'];
345        dqs('#modifFactu')[0].style.display='none';
346    }else{
347        cl(x);
348    }
349    return 1;
350}
351
352function cadeauxPerUniversCb(x){
353    /* NaN brochures*/
354    //cl(x);
355    $('.spinner').show();
356    var uid=selectedUniverse['uid'],nbKdo=nbKdoPerU[uid];
357    if(x['ajouts']>=nbKdo){
358        cl(x,nbKdo);
359        nbKdoPerU[uid]=-1;currentQte=qteMax=0;
360        dqs('.choixEchantillons')[0].innerHTML='';
361        dqs('.u'+uid)[0].style.display='none';
362    }else{
363        cl(x,nbKdo);
364        nbKdoPerU[uid]-=x['ajouts'];//Simple décrementation pour 2 step
365        currentQte=0;qteMax=nbKdoPerU[uid];
366        $('.selectedEchantillons')[0].innerHTML= (qteMax-currentQte)+' / '+qteMax;
367        dqs('.u'+uid+' .qte')[0].innerHTML=qteMax;
368        dqs('#btqkdo .qte-prod').forEach(function(e){e.value=0;});
369    }
370
371    if(x['ajouts']){
372        location.reload();
373    }
374    return 1;
375    //de toutes façons ..
376//{"qteTot":5,"ajouts":50}
377}
378
379
380function onSubmit(a,url,parentElement,cb){//BigAction, Big Dal
381    var a=a||null,url=url||null,parentElement=parentElement||'#step2',cb=cb||nf;
382    postdata=[];
383    inputs=dqs(parentElement+' input');inputs.forEach(inputName);
384    selects=dqs(parentElement+' select');selects.forEach(inputName);
385    textareas=dqs(parentElement+' textarea');textareas.forEach(inputName);
386    form = $(this); ajxTarget = form.attr('ajax-target');
387    //cl({onsubmit:postdata});
388    $.ajax({//JSON.stringify(postdata)
389        type: "POST", url: '?ac=submitAllForm', data: postdata, success: function (data) {
390            data = isJson(data);            retMsg=[];
391            var cbreturn = cb(data);
392            if(cbreturn)return cbreturn;
393            //cl(data);
394if(data['msg']){
395    if(ajxTarget)$(ajxTarget).show().html(data['msg']);
396}
397
398            if (data['ko'] && Object.size(data['ko'])) {
399                errors='';
400                //cl(data['ko']);
401                for(var i in data['ko']){
402                    if(typeof data['ko'][i]=='string'){
403                        retMsg.push(data['ko'][i]);
404                        el=document.querySelector('input[name="'+i+'"]');
405                        if(el){el.className+=' erreur';}
406                        else{cl('cantget',i)}
407                        v=data['ko'][i];
408                        errors+='<li>'+v;
409                    }
410                }
411                if(ajxTarget){
412                    $(ajxTarget).show().html(retMsg);
413                }else{
414                    document.querySelector('.errors').innerHTML=errors;
415                }
416                $('html,body').animate({scrollTop: $('.errors').offset().top});
417
418            } else if (data['ok'] && Object.size(data['ok'])) {
419                //cl({url,'ok': data['ok']});//location.refresh
420                location.href = correctUrl(url);
421            }
422
423            if(typeof data['redirects'] != 'undefined'){
424                location.href=correctUrl(data['redirects']);return 1;
425            }
426
427            if (data['redir']) {
428                //cl({'redir2': data['redir']});
429                location.href = correctUrl(data['redir']);
430            }
431            if (data['content']) {
432                cl(ajxTarget);
433            }
434            //cl('unexpected response')
435        }
436    });
437    return false;
438};
439
440function gsubmit(x) {/* pour les formulaires au sein d'un formulaire (dans une div) pour être soumis via ajax*/
441    var url,ajxTarget;postdata=[];
442    parentElement=dqs(x)[0];
443    inputs=dqs(x+' input');inputs.forEach(inputName);
444    selects=dqs(x+' select');selects.forEach(inputName);
445    textareas=dqs(x+' textarea');textareas.forEach(inputName);
446    url=parentElement.getAttribute('action');ajxTarget=parentElement.getAttribute('ajax-target');
447    //cl({'gsubmit':postdata,url,ajxTarget});
448    $.ajax({
449        type: "POST", url: url, data: postdata, success: function (data) {
450            data = isJson(data);
451            //cl({data,url});
452            if (data['ko']) {
453                cl(data['ko']);
454                $(ajxTarget).html(data['ko']);
455            } else if (data['ok']) {
456
457            } else if (data['redir']) {
458                //cl({'redir2': data['redir']});
459                location.href = correctUrl(data['redir']);
460            } else if (data['content']) {
461                $(ajxTarget).html(data['content']);
462                x2=data['content'].trim().replace(/\s+/gi,' ').replace(/> </gi,'><');
463                x3=b64EncodeUnicode(x2);
464                //cl({x2,x3,url,ajxTarget,data});
465                sc(ajxTarget,x3);//atob safe for cookie ?
466                if(url=='?ac=pointrelais'){
467                    pointRelaisClick();
468                }
469            }
470        }
471    });
472    return false;//Do not submit parent form !!!
473}
474
475function fsubmit(x){/* pour les formulaires au sein d'un formulaire déjà bindés pour être soumis via ajax*/
476    return dqs(x)[0].submit();
477}
478
479Array.prototype.remove = function() {
480    var what, a = arguments, L = a.length, ax;
481    while (L && this.length) {
482        what = a[--L];
483        while ((ax = this.indexOf(what)) !== -1) {
484            this.splice(ax, 1);
485        }
486    }
487    return this;
488};
489
490webpActive.t=99;
491function webpActive() {
492    if(webpActive.t!=99){
493        return webpActive.t;
494    }
495    var elem = document.createElement('canvas');
496    if (!!(elem.getContext && elem.getContext('2d'))) {
497        webpActive.t=elem.toDataURL('image/webp').indexOf('data:image/webp') == 0
498    } else {webpActive.t=false;}
499    cl('webp:',gt(),webpActive.t);
500    return webpActive.t;
501}
502function mc(x,y) {y=y||1;return y*Math.round(x/y)||y;}
503
504var imgargs=[];//
505function img2thumb(x,addw=0,addh=0,ctx=0){
506    if(!x)return;
507    var o1=x,z,extras,args={},h=0,w=0,addw=addw||0,addh=addh||0,ctx=ctx||0,hasHash=x.indexOf('#'),totHash='';
508    if(hasHash>-1){
509        z=x.split('#');x=z.shift();totHash=z.join('&');extras=z.shift();//might be several trailing #
510        imgargs=args=pq(extras);
511        if(typeof args.addw!='undefined'){addw=parseInt(args.addw);}if(typeof args.addh!='undefined'){addh=parseInt(args.addh);}
512//w or h
513        if(typeof args.wh!='undefined'){h=addh+Math.round(parseInt(args.wh)*window.innerHeight/1000)*10;}
514        else if(typeof args.ww!='undefined'){
515            w=addw+Math.round(parseInt(args.ww)*window.innerWidth/1000)*10;
516        }
517        //if(typeof args.ph!='undefined'){h=Math.round(parseInt(args.ph)*window.innerHeight/1000)*10;}
518        //if(typeof args.pw != 'undefined' && args.pw){w=Math.round(parseInt(args.pw)*window.innerWidth/1000)*10;}
519    }
520
521    //if(x.indexOf('prechoix-participation')>-1){bp=1;}
522    //if(webpActive() && x.indexOf('.webp')<0 &&/* x.indexOf('.gif')<0 &&*/ x.indexOf('.svg')<0)x+='.webp';
523
524    var suffix='webp',ext=x.split('.'),tn='tn-',original=x,thumb=x,r,path=x.split('/'),filename=path.pop();path=path.join('/')+'/';
525    ext=ext.pop();
526
527    if(['webp','gif','jpg','png'].indexOf(ext)<0){return x;}//seuls autorisés
528/*
529https://www.thalgo.fr.home/site/uploaded/carrousels/tn-_-w1250-fr_carrousels_image_421.jpg.webp
530https://www.thalgo.fr.home/site/uploaded/carrousels/tn-_-w1400-fr_carrousels_image_421.jpg.webp
531*/
532    if(x.indexOf('/tn-')>-1) {//x is total
533        //cl('img2thumb:tn:',addw,w,x,args.pw);
534        //if (ext != suffix) {x+='.'+suffix;}
535        return x+'#'+totHash;
536    }//Keep old thumbnailed references, fuck the rest
537
538    /*
539        if(!h){r=/_?-h([0-9]+)-/i.exec(filename);if(r){h=r[1]*window.innerHeight/980;}
540        if(!w){r=/_?-w([0-9]+)-/i.exec(filename);if(r){w=r[1]*window.innerWidth/1900;}
541    */
542    if(h && h>=window.innerHeight){h=window.innerHeight+addh;}
543    if(w && w>=window.innerWidth){w=window.innerWidth+addw;}
544
545    original=filename.replace(/^tn-|_?-(h|w)([0-9]+)-/gi,'');
546    if(h){tn+='_-h'+mc(h,50);}if(w){tn+='_-w'+mc(w,50);}
547    if(h || w)thumb=path+tn+'-'+original;
548    original=path+original;
549    if(0 && ext!=suffix){thumb+='.'+suffix}
550    //clog({thumb,x,args,w,h,filename,original,extras});
551    var t=typeof args.pw;//typeof(args['pw']);
552    //cl({o1,args,t,w,h,x,thumb});
553    //cl('img2thumb:tot:',addw,w,thumb,args);
554    return thumb+totHash;
555}
556
557function pq(queryString) {//parseQuery
558    var query = {};
559    var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
560    for (var i = 0; i < pairs.length; i++) {
561        var pair = pairs[i].split('=');
562        query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
563    }
564    return query;
565}
566
567function getLocation(href) {var l = document.createElement("a");l.href = href;return l;};
568
569/*
570/relative => x.hostname is the same
571if(x.hostname='' && typeof(x.pathname)=='undefined')
572    // && x.href='https:' //same protocal
573    //try{new URL("http://example.com/aa/bb/")}
574    if(url.indexOf('//')){//and has no hostname defined
575}
576 */
577function correctUrl(url){
578    x=getLocation(url);
579    if(x.hostname=='' || x.hostname.indexOf('.')<0){//Means //Pathname -- un slash de trop
580        url=url.substr(1);
581    }
582    return url;
583}
584
585function docLoaded(){//function(){//onDocLoad //' src='>loading=lazy data-
586    if(docLoaded.t)return;
587    docLoaded.t=1;gt('docloaded in');
588//
589    if(1){//dynStyles computations
590dqs('#style')[0].innerHTML+='.soin-sponsor .soin {background:url('+img2thumb(imp+'/bg-soin.jpg#ww=100')+') no-repeat center left;}  #h .bginstagram{background:transparent url('+img2thumb('/assets/img/bginstagram.jpg#ww=100')+') no-repeat 50% / '+((mobile)?'cover':'cover')+';}   #la-beaute-marine .image-video {background-image:url('+imp+img2thumb('expertise-marine-push.jpg#ww=100')+');} .villa {background:url('+imp+img2thumb('bg-villa.jpg#ww=100')+' ) no-repeat center center;}  ';
591//mobile background-size:cover;
592    }
593
594
595/*
596
597  data-bgurl="<?=$bd?>" data-bgs="50% / cover"
598  style="background:url('$data-bgurl) $data-bgs"
599*/
600if('style::background'){
601    x=dqs('[data-bgurl]');//cl('data-bgurl',x);
602    x.forEach(function(el,nb){
603        var opts=el.getAttribute('data-bgs')||'';
604        y=img2thumb(el.getAttribute('data-bgurl'),200,0,'data-bgurl');
605        if(!opts)el.setAttribute('style',"background-image:url('"+y+"')");
606        else el.setAttribute('style',"background:url('"+y+"') "+opts);
607        el.removeAttribute('data-bgs');el.removeAttribute('data-bgurl');
608    });
609}
610//*/
611    //#mw
612    x=dqs('div[data-src]');//cl('owl carrousel :: div data-src',x);//owl carrousel
613    x.forEach(function(el,nb){
614        el.setAttribute('data-src',img2thumb(el.getAttribute('data-src'),500));//better display quality
615    });//*/
616
617    x=dqs('img[data-src]');//cl('data-src',x);
618    lazyImg2load=x.length;cl('lazyImg2load',lazyImg2load);
619    x.forEach(function(el,nb){
620        el.onload=function(){
621            lazyImg2load--;
622            if(typeof loadedImgByClass[el.className] == 'undefined')loadedImgByClass[el.className]=0;
623            loadedImgByClass[el.className]++;
624        }
625        el.src=img2thumb(el.getAttribute('data-src'));el.removeAttribute('data-src');
626    });
627if('home-parallax bandeaux'){
628    x=dqs('[data-image-src]');//cl('data-image-src',x);
629    x.forEach(function(el,nb){
630        el.setAttribute('data-image-src',img2thumb(el.getAttribute('data-image-src'),100));
631    });
632}
633    if('page détails'){
634        x=dqs('[data-image]');//cl('data-image::soins, produit detail',x);
635        x.forEach(function(el,nb){
636            el.setAttribute('data-image',img2thumb(el.getAttribute('data-image')));
637        });
638        x=dqs('[data-zoom-image]');cl('data-zoom-image::soins, produit detail',x);
639        x.forEach(function(el,nb){
640            el.setAttribute('data-zoom-image',img2thumb(el.getAttribute('data-zoom-image')));
641        });
642    }
643/*
644x="background:url('/site/uploaded/menuitems/fr_menuitems_bandeau_778.jpg#ww=100')"
645/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&amp;:\/~+#-]*[\w@?^=%&amp;\/~+#-])?/.exec(x);
646todo:data-bg-url,data-bg-style
647    x=dqs('[data-style]');//cl('data-style',x);
648    x.forEach(function(el,nb){
649        var link='',ds=el.getAttribute('data-style');
650        //regexparse link out of ds
651        cl(link);
652        ds=img2thumb(ds);
653        el.removeAttribute('data-style');
654        el.style=ds;
655    });
656*/
657    x=dqs('[firstpic]');
658    x.forEach(function(el,nb){
659        el.setAttribute('firstpic',img2thumb(el.getAttribute('firstpic')));
660    });
661    x=dqs('[secondpic]');//cl('secondpic',x);
662    x.forEach(function(el,nb){
663        el.setAttribute('firstpic',img2thumb(el.getAttribute('secondpic')));
664    });
665}
666
667/*}variables do'bjets fonctions ..{*/
668docLoaded.t=0;
669/*}end functions -- 99::Runs{*/
670
671if(typeof document.querySelectorAll=='function'){
672    document.addEventListener('DOMContentLoaded',docLoaded);
673    defer(docLoaded,function(){return (document.readyState=='complete');});
674}else{
675    cl('no dqs');
676    defer(function(){
677        jQuery('[data-src]').each(function(){el=this;
678            var ds=el.getAttribute('data-src');
679            //if(webpActive() && ds.indexOf('.webp')<0 && ds.indexOf('.gif')<0){ds+='.webp';}
680            //el.removeAttribute('data-src');
681            el.src=ds;
682        });
683        jQuery('[data-style]').each(function(){el=this;
684            var link='',ds=el.getAttribute('data-style');
685            //get link out of ds
686            cl(link);
687            //if(webpActive() && link.indexOf('.webp')<0 && ds.indexOf('.gif')<0){ds=ds.replace(link,link+'.webp');}
688            //el.removeAttribute('data-style');
689            //el.style=ds;
690        });
691    });
692}
693
694
695function secondPic(){
696    //jQuery(document).ready(function() {});
697    jQuery('a[secondpic]').on({
698        mouseenter: function () {
699            var sec=$(this).attr('secondpic');
700            var img=$(this).find('img')[0];
701            img.setAttribute('firstPic',img.src);
702            img.src=sec;
703        },
704        mouseleave: function () {
705            var img=$(this).find('img')[0];
706            img.src=img.getAttribute('firstPic');
707        }
708    });
709}
710
711function topMenuResizer(){
712    var ptime1=gt()
713        ,nav1=dqs('#header .menu .nav-menu ul.nav')[0]
714        ,dynStyles=dqs('#dynamicStyles')[0]
715        ,el=dqs('#header .menu .nav-menu ul.nav>li>a span')[0]
716        ,paddingLeft=15
717        //,twoLinesHeight=(dqs('#header .menu .nav-menu ul.nav li')[0].clientHeight)*1.9
718        //,navHeight=nav1.clientHeight
719        //,paddingLeft=parseInt(getComputedStyle(el).paddingLeft)
720        ,letterSpacing=0//getComputedStyle(el).letterSpacing
721        //,fontSize=parseInt(getComputedStyle(el).fontSize)
722        ,essais=0;
723
724    //while(navHeight>twoLinesHeight && essais<150 && fontSize>1){
725     //   essais++;
726     //   if(paddingLeft>0){
727     //       paddingLeft-=1;
728     //   }else if(!letterSpacing){
729     //       letterSpacing=-1;
730     //   }else if(fontSize){
731     //       fontSize-=1;
732      //  }
733     //   dynStyles.innerHTML="#h #header .menu .nav-menu ul.nav>li>a span{padding:0 "+paddingLeft+"px;font-size:"+fontSize+"px;letter-spacing:"+letterSpacing+"px} ";
734     //   navHeight=nav1.clientHeight;
735    //}
736
737   // cl('topMenuResizer:steps:',essais,'in',gt()-ptime1,'secs','navh:',navHeight,'two:',twoLinesHeight,'pl',paddingLeft,'ls:',letterSpacing,'fs:',fontSize);
738}
739
740defer(secondPic);
741defer(topMenuResizer);

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.