Files
drupal-leshed/web/themes/custom/leshed/assets/dist/main.js
T
2026-07-17 16:45:27 +02:00

2 lines
5.0 KiB
JavaScript

var tn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function en(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var H={exports:{}};(function(h,D){(function(w,y){h.exports=y()})(tn,function(){var w=document,y=w.createTextNode.bind(w);function b(n,t,e){n.style.setProperty(t,e)}function T(n,t){return n.appendChild(t)}function m(n,t,e,o){var r=w.createElement("span");return t&&(r.className=t),e&&(!o&&r.setAttribute("data-"+t,e),r.textContent=e),n&&T(n,r)||r}function g(n,t){return n.getAttribute("data-"+t)}function f(n,t){return!n||n.length==0?[]:n.nodeName?[n]:[].slice.call(n[0].nodeName?n:(t||w).querySelectorAll(n))}function P(n){for(var t=[];n--;)t[n]=[];return t}function c(n,t){n&&n.some(t)}function E(n){return function(t){return n[t]}}function A(n,t,e){var o="--"+t,r=o+"-index";c(e,function(i,l){Array.isArray(i)?c(i,function(a){b(a,r,l)}):b(i,r,l)}),b(n,o+"-total",e.length)}var N={};function x(n,t,e){var o=e.indexOf(n);if(o==-1){e.unshift(n);var r=N[n];if(!r)throw new Error("plugin not loaded: "+n);c(r.depends,function(l){x(l,n,e)})}else{var i=e.indexOf(t);e.splice(o,1),e.splice(i,0,n)}return e}function d(n,t,e,o){return{by:n,depends:t,key:e,split:o}}function I(n){return x(n,0,[]).map(E(N))}function s(n){N[n.by]=n}function j(n,t,e,o,r){n.normalize();var i=[],l=document.createDocumentFragment();o&&i.push(n.previousSibling);var a=[];return f(n.childNodes).some(function(u){if(u.tagName&&!u.hasChildNodes()){a.push(u);return}if(u.childNodes&&u.childNodes.length){a.push(u),i.push.apply(i,j(u,t,e,o,r));return}var p=u.wholeText||"",C=p.trim();if(C.length){p[0]===" "&&a.push(y(" "));var W=e===""&&typeof Intl.Segmenter=="function";c(W?Array.from(new Intl.Segmenter().segment(C)).map(function(O){return O.segment}):C.split(e),function(O,nn){nn&&r&&a.push(m(l,"whitespace"," ",r));var _=m(l,t,O);i.push(_),a.push(_)}),p[p.length-1]===" "&&a.push(y(" "))}}),c(a,function(u){T(l,u)}),n.innerHTML="",T(n,l),i}var v=0;function k(n,t){for(var e in t)n[e]=t[e];return n}var L="words",q=d(L,v,"word",function(n){return j(n,"word",/\s+/,0,1)}),R="chars",B=d(R,[L],"char",function(n,t,e){var o=[];return c(e[L],function(r,i){o.push.apply(o,j(r,"char","",t.whitespace&&i))}),o});function M(n){n=n||{};var t=n.key;return f(n.target||"[data-splitting]").map(function(e){var o=e["🍌"];if(!n.force&&o)return o;o=e["🍌"]={el:e};var r=n.by||g(e,"splitting");(!r||r=="true")&&(r=R);var i=I(r),l=k({},n);return c(i,function(a){if(a.split){var u=a.by,p=(t?"-"+t:"")+a.key,C=a.split(e,l,o);p&&A(e,p,C),o[u]=C,e.classList.add(u)}}),e.classList.add("splitting"),o})}function G(n){n=n||{};var t=n.target=m();return t.innerHTML=n.content,M(n),t.outerHTML}M.html=G,M.add=s;function F(n,t,e){var o=f(t.matching||n.children,n),r={};return c(o,function(i){var l=Math.round(i[e]);(r[l]||(r[l]=[])).push(i)}),Object.keys(r).map(Number).sort(V).map(E(r))}function V(n,t){return n-t}var $=d("lines",[L],"line",function(n,t,e){return F(n,{matching:e[L]},"offsetTop")}),z=d("items",v,"item",function(n,t){return f(t.matching||n.children,n)}),U=d("rows",v,"row",function(n,t){return F(n,t,"offsetTop")}),Y=d("cols",v,"col",function(n,t){return F(n,t,"offsetLeft")}),J=d("grid",["rows","cols"]),S="layout",K=d(S,v,v,function(n,t){var e=t.rows=+(t.rows||g(n,"rows")||1),o=t.columns=+(t.columns||g(n,"columns")||1);if(t.image=t.image||g(n,"image")||n.currentSrc||n.src,t.image){var r=f("img",n)[0];t.image=r&&(r.currentSrc||r.src)}t.image&&b(n,"background-image","url("+t.image+")");for(var i=e*o,l=[],a=m(v,"cell-grid");i--;){var u=m(a,"cell");m(u,"cell-inner"),l.push(u)}return T(n,a),l}),Q=d("cellRows",[S],"row",function(n,t,e){var o=t.rows,r=P(o);return c(e[S],function(i,l,a){r[Math.floor(l/(a.length/o))].push(i)}),r}),X=d("cellColumns",[S],"col",function(n,t,e){var o=t.columns,r=P(o);return c(e[S],function(i,l){r[l%o].push(i)}),r}),Z=d("cells",["cellRows","cellColumns"],"cell",function(n,t,e){return e[S]});return s(q),s(B),s($),s(z),s(U),s(Y),s(J),s(K),s(Q),s(X),s(Z),M})})(H);var rn=H.exports;const on=en(rn);(function(h,D){(function(){D.path.isFront,console.log("drupalSettings",D);function y(){console.log("LeShedTheme init()"),T(),m()}function b(g,f){return Math.floor(Math.random()*(f-g))+g}function T(){let g=document.querySelectorAll("#block-leshed-identitedusite>a, article.node-type-projet>h2");for(const f of g){console.log(f.innerText,"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");let P=on({target:f,by:"chars"});console.log("splitted",P);for(const c of P[0].words){let E=c.getElementsByClassName("char");console.log("chars",E);for(const A of E){console.log(A.innerText);let N=b(150,600),x=Math.random()>.7?1:0;A.style.fontVariationSettings=`'wght' ${N}`,A.style.fontStyle=x?"italic":"normal"}}}}function m(){document.getElementById("burger-btn").parentElement.addEventListener("click",function(f){this.firstElementChild.toggleAttribute("opened"),this.firstElementChild.nextElementSibling.toggleAttribute("opened")})}y()})()})(Drupal,drupalSettings);