Last modified by Veronika Kocher on Friday, 04 Sep 2026 14:45

From version 5.8
edited by Veronika Kocher
on Thursday, 03 Sep 2026 9:18
Change comment: There is no comment for this version
To version 5.10
edited by Veronika Kocher
on Thursday, 03 Sep 2026 10:09
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -261,22 +261,115 @@
261 261  </div>
262 262  {{/html}}
263 263  
264 -{{html clean="false"}}
264 +\n\n
265 +\n\n{{html clean="false"}}
265 265  <!-- SN_HORIZONTAL_BOX_HARMONIZER_START -->
266 -<style data-sn-horizontal-box-harmonizer="1">
267 -[data-sn-equal-height-managed="1"]{box-sizing:border-box}
268 -@media(max-width:767px){
269 - [data-sn-equal-height-managed="1"]{min-height:0!important}
267 +
268 +<style data-sn-horizontal-box-harmonizer="7">
269 +/* ---------- Typography: never justify headings ---------- */
270 +#xwikicontent h1,
271 +#xwikicontent h2,
272 +#xwikicontent h3,
273 +#xwikicontent h4,
274 +#xwikicontent h5,
275 +#xwikicontent h6,
276 +#xwikicontent .box-title,
277 +#xwikicontent [role="heading"],
278 +#xwikicontent h1 a,
279 +#xwikicontent h2 a,
280 +#xwikicontent h3 a,
281 +#xwikicontent h4 a,
282 +#xwikicontent h5 a,
283 +#xwikicontent h6 a,
284 +#xwikicontent .box-title a,
285 +#xwikicontent [role="heading"] a{
286 + text-align:left!important;
287 + text-justify:auto!important;
288 + word-spacing:normal!important;
270 270  }
290 +
291 +/* ---------- Native XWiki semantic callouts ---------- */
292 +#xwikicontent .box.infomessage,
293 +#xwikicontent .infomessage,
294 +#xwikicontent .box.warningmessage,
295 +#xwikicontent .warningmessage,
296 +#xwikicontent .box.successmessage,
297 +#xwikicontent .successmessage,
298 +#xwikicontent .box.errormessage,
299 +#xwikicontent .errormessage,
300 +#xwikicontent [data-sn-callout-harmonized="1"]{
301 + box-sizing:border-box!important;
302 + border-radius:8px!important;
303 + border-top:1px solid rgba(0,0,0,.08)!important;
304 + border-right:1px solid rgba(0,0,0,.08)!important;
305 + border-bottom:1px solid rgba(0,0,0,.08)!important;
306 + border-left:4px solid var(--sn-callout-accent,#21b6d7)!important;
307 + padding:14px 16px!important;
308 + text-align:left!important;
309 + text-justify:auto!important;
310 + word-spacing:normal!important;
311 + box-shadow:none!important;
312 +}
313 +
314 +#xwikicontent .box.infomessage,
315 +#xwikicontent .infomessage{
316 + --sn-callout-accent:#21b6d7;
317 + background:#eaf7fb!important;
318 +}
319 +
320 +#xwikicontent .box.warningmessage,
321 +#xwikicontent .warningmessage{
322 + --sn-callout-accent:#f0aa00;
323 + background:#fff8e7!important;
324 +}
325 +
326 +#xwikicontent .box.successmessage,
327 +#xwikicontent .successmessage{
328 + --sn-callout-accent:#38b76a;
329 + background:#edf9f1!important;
330 +}
331 +
332 +#xwikicontent .box.errormessage,
333 +#xwikicontent .errormessage{
334 + --sn-callout-accent:#e94b13;
335 + background:#fff1ec!important;
336 +}
337 +
338 +#xwikicontent [data-sn-callout-harmonized="1"] > :first-child,
339 +#xwikicontent .infomessage > :first-child,
340 +#xwikicontent .warningmessage > :first-child,
341 +#xwikicontent .successmessage > :first-child,
342 +#xwikicontent .errormessage > :first-child{
343 + margin-top:0!important;
344 +}
345 +
346 +#xwikicontent [data-sn-callout-harmonized="1"] > :last-child,
347 +#xwikicontent .infomessage > :last-child,
348 +#xwikicontent .warningmessage > :last-child,
349 +#xwikicontent .successmessage > :last-child,
350 +#xwikicontent .errormessage > :last-child{
351 + margin-bottom:0!important;
352 +}
353 +
354 +#xwikicontent [data-sn-equal-height-managed],
355 +#xwikicontent [data-sn-first-section-aligned],
356 +#xwikicontent [data-sn-first-content-aligned]{
357 + box-sizing:border-box;
358 +}
271 271  </style>
272 -<script data-sn-horizontal-box-harmonizer="1">
360 +
361 +<script data-sn-horizontal-box-harmonizer="7">
273 273  (function(){
274 274   "use strict";
275 275  
276 276   var MOBILE_MAX=767;
277 - var ROW_TOLERANCE=4;
366 + var ROW_TOLERANCE=6;
278 278   var MIN_W=150;
279 279   var MIN_H=36;
369 + var MAX_PARENT_CHILDREN=18;
370 + var SEARCH_DEPTH=5;
371 + var RESIZE_DEBOUNCE=220;
372 + var MIN_WIDTH_CHANGE=2;
280 280  
281 281   var root=
282 282   document.getElementById("xwikicontent")||
... ... @@ -286,72 +286,297 @@
286 286  
287 287   if(!root)return;
288 288  
289 - var managed=new Set();
290 - var raf=0;
382 + var heightManaged=new Set();
383 + var sectionManaged=new Set();
384 + var contentManaged=new Set();
291 291  
386 + var originalMinHeight=new WeakMap();
387 + var originalMarginTop=new WeakMap();
388 +
389 + var resizeTimer=0;
390 + var lastWidth=-1;
391 + var hasApplied=false;
392 + var applying=false;
393 +
292 292   function num(v){
293 293   var n=parseFloat(v);
294 294   return Number.isFinite(n)?n:0;
295 295   }
296 296  
297 - function visible(el){
399 + function visible(el,minW,minH){
298 298   if(!el||el.nodeType!==1)return false;
401 +
299 299   var s=getComputedStyle(el);
300 - if(s.display==="none"||s.visibility==="hidden"||Number(s.opacity)===0)return false;
403 +
404 + if(
405 + s.display==="none"||
406 + s.visibility==="hidden"||
407 + Number(s.opacity)===0
408 + ){
409 + return false;
410 + }
411 +
301 301   var r=el.getBoundingClientRect();
302 - return r.width>=MIN_W&&r.height>=MIN_H;
413 +
414 + return (
415 + r.width>=(minW||1)&&
416 + r.height>=(minH||1)
417 + );
303 303   }
304 304  
420 + function normalizeText(text){
421 + return String(text||"")
422 + .replace(/\s+/g," ")
423 + .trim()
424 + .toUpperCase();
425 + }
426 +
305 305   function excluded(el){
306 - return !el.matches||el.matches(
307 - "button,input,select,textarea,option,label,img,svg,canvas,table,thead,tbody,tfoot,tr,td,th,summary,script,style,noscript,template,.btn,.chip,[role=button]"
428 + return (
429 + !el.matches||
430 + el.matches(
431 + "button,input,select,textarea,option,label,img,svg,canvas,table,thead,tbody,tfoot,tr,td,th,summary,script,style,noscript,template,.btn,.chip,[role=button]"
432 + )
308 308   );
309 309   }
310 310  
436 + /* ---------- Custom coloured callouts ---------- */
437 +
438 + function nativeCallout(el){
439 + var c=
440 + typeof el.className==="string"
441 + ? el.className.toLowerCase()
442 + : "";
443 +
444 + return (
445 + /(^|\s)(infomessage|warningmessage|successmessage|errormessage)(\s|$)/.test(c)
446 + );
447 + }
448 +
449 + function customCallout(el){
450 + if(!visible(el,220,42)||excluded(el))return false;
451 +
452 + var r=el.getBoundingClientRect();
453 +
454 + if(r.height>520)return false;
455 +
456 + var s=getComputedStyle(el);
457 +
458 + var bg=
459 + s.backgroundColor&&
460 + s.backgroundColor!=="rgba(0, 0, 0, 0)"&&
461 + s.backgroundColor!=="transparent"&&
462 + s.backgroundColor!=="rgb(255, 255, 255)";
463 +
464 + var left=
465 + num(s.borderLeftWidth);
466 +
467 + return (
468 + bg&&
469 + left>=2
470 + );
471 + }
472 +
473 + function harmoniseCustomCallouts(){
474 + Array.from(
475 + root.querySelectorAll(
476 + "div,aside,section"
477 + )
478 + ).forEach(function(el){
479 + if(nativeCallout(el))return;
480 + if(!customCallout(el))return;
481 +
482 + var s=getComputedStyle(el);
483 +
484 + el.setAttribute(
485 + "data-sn-callout-harmonized",
486 + "1"
487 + );
488 +
489 + if(
490 + s.borderLeftColor
491 + ){
492 + el.style.setProperty(
493 + "--sn-callout-accent",
494 + s.borderLeftColor
495 + );
496 + }
497 + });
498 + }
499 +
500 + /* ---------- Restore only values V7 itself changed ---------- */
501 +
502 + function saveOriginal(el,map,property){
503 + if(map.has(el))return;
504 +
505 + map.set(el,{
506 + value:
507 + el.style.getPropertyValue(
508 + property
509 + ),
510 + priority:
511 + el.style.getPropertyPriority(
512 + property
513 + )
514 + });
515 + }
516 +
517 + function restoreOriginal(el,map,property){
518 + var original=map.get(el);
519 +
520 + if(original&&original.value){
521 + el.style.setProperty(
522 + property,
523 + original.value,
524 + original.priority||""
525 + );
526 + }else{
527 + el.style.removeProperty(
528 + property
529 + );
530 + }
531 + }
532 +
533 + function resetRuntime(){
534 + heightManaged.forEach(function(el){
535 + restoreOriginal(
536 + el,
537 + originalMinHeight,
538 + "min-height"
539 + );
540 +
541 + el.removeAttribute(
542 + "data-sn-equal-height-managed"
543 + );
544 + });
545 +
546 + sectionManaged.forEach(function(el){
547 + restoreOriginal(
548 + el,
549 + originalMarginTop,
550 + "margin-top"
551 + );
552 +
553 + el.removeAttribute(
554 + "data-sn-first-section-aligned"
555 + );
556 + });
557 +
558 + contentManaged.forEach(function(el){
559 + restoreOriginal(
560 + el,
561 + originalMarginTop,
562 + "margin-top"
563 + );
564 +
565 + el.removeAttribute(
566 + "data-sn-first-content-aligned"
567 + );
568 + });
569 +
570 + heightManaged.clear();
571 + sectionManaged.clear();
572 + contentManaged.clear();
573 + }
574 +
575 + /* ---------- Card detection ---------- */
576 +
311 311   function namedLikeBox(el){
312 - var c=typeof el.className==="string"?el.className:"";
578 + var c=
579 + typeof el.className==="string"
580 + ? el.className
581 + : "";
582 +
313 313   return /(^|[\s_-])(box|card|tile|panel|role|check|service|source|call|area|detail|resource|topic|warn|info)([\s_-]|$)/i.test(c);
314 314   }
315 315  
316 316   function boxLike(el){
317 - if(!visible(el)||excluded(el))return false;
587 + if(
588 + !visible(el,MIN_W,MIN_H)||
589 + excluded(el)
590 + ){
591 + return false;
592 + }
593 +
318 318   var s=getComputedStyle(el);
319 319   var r=el.getBoundingClientRect();
596 +
320 320   var border=
321 - num(s.borderTopWidth)+num(s.borderRightWidth)+
322 - num(s.borderBottomWidth)+num(s.borderLeftWidth);
598 + num(s.borderTopWidth)+
599 + num(s.borderRightWidth)+
600 + num(s.borderBottomWidth)+
601 + num(s.borderLeftWidth);
602 +
323 323   var radius=Math.max(
324 - num(s.borderTopLeftRadius),num(s.borderTopRightRadius),
325 - num(s.borderBottomLeftRadius),num(s.borderBottomRightRadius)
604 + num(s.borderTopLeftRadius),
605 + num(s.borderTopRightRadius),
606 + num(s.borderBottomLeftRadius),
607 + num(s.borderBottomRightRadius)
326 326   );
327 - var bg=s.backgroundColor&&s.backgroundColor!=="rgba(0, 0, 0, 0)"&&s.backgroundColor!=="transparent";
328 - var shadow=s.boxShadow&&s.boxShadow!=="none";
329 - return namedLikeBox(el)||border>=1||(bg&&radius>=3)||(shadow&&r.width>=180);
609 +
610 + var bg=
611 + s.backgroundColor&&
612 + s.backgroundColor!=="rgba(0, 0, 0, 0)"&&
613 + s.backgroundColor!=="transparent";
614 +
615 + var shadow=
616 + s.boxShadow&&
617 + s.boxShadow!=="none";
618 +
619 + return (
620 + namedLikeBox(el)||
621 + border>=1||
622 + (bg&&radius>=3)||
623 + (shadow&&r.width>=180)
624 + );
330 330   }
331 331  
332 332   function pickTarget(child){
333 - if(!visible(child))return null;
628 + if(!visible(child,MIN_W,MIN_H))return null;
629 +
334 334   if(boxLike(child))return child;
335 335  
336 336   var cr=child.getBoundingClientRect();
337 337   var q=[];
634 +
338 338   Array.from(child.children||[]).forEach(function(el){
339 339   q.push({el:el,depth:1});
340 340   });
341 341  
342 - var best=null,bestScore=-1;
639 + var best=null;
640 + var bestScore=-Infinity;
343 343  
344 344   while(q.length){
345 345   var item=q.shift();
346 346   var el=item.el;
347 - if(!visible(el))continue;
348 348  
646 + if(!visible(el,MIN_W,MIN_H))continue;
647 +
349 349   var r=el.getBoundingClientRect();
350 350  
351 - if(r.width>=cr.width*.72&&boxLike(el)){
352 - var widthFit=1-Math.min(1,Math.abs(cr.width-r.width)/Math.max(1,cr.width));
353 - var topFit=1-Math.min(1,Math.abs(cr.top-r.top)/80);
354 - var score=widthFit*5+topFit*2+Math.min(r.height,600)/600;
650 + if(
651 + r.width>=cr.width*.68&&
652 + boxLike(el)
653 + ){
654 + var widthFit=
655 + 1-Math.min(
656 + 1,
657 + Math.abs(cr.width-r.width)/
658 + Math.max(1,cr.width)
659 + );
660 +
661 + var topFit=
662 + 1-Math.min(
663 + 1,
664 + Math.abs(cr.top-r.top)/100
665 + );
666 +
667 + var score=
668 + widthFit*6+
669 + topFit*3+
670 + Math.min(r.height,900)/450+
671 + Math.min(r.width*r.height,900000)/900000;
672 +
355 355   if(score>bestScore){
356 356   best=el;
357 357   bestScore=score;
... ... @@ -358,9 +358,12 @@
358 358   }
359 359   }
360 360  
361 - if(item.depth<3){
679 + if(item.depth<SEARCH_DEPTH){
362 362   Array.from(el.children||[]).forEach(function(next){
363 - q.push({el:next,depth:item.depth+1});
681 + q.push({
682 + el:next,
683 + depth:item.depth+1
684 + });
364 364   });
365 365   }
366 366   }
... ... @@ -368,130 +368,692 @@
368 368   return best;
369 369   }
370 370  
371 - function reset(){
372 - managed.forEach(function(el){
373 - el.style.removeProperty("min-height");
374 - el.removeAttribute("data-sn-equal-height-managed");
375 - });
376 - managed.clear();
692 + function groupRows(entries){
693 + var groups=[];
694 +
695 + entries
696 + .slice()
697 + .sort(function(a,b){
698 + return (
699 + a.rect.top-b.rect.top||
700 + a.rect.left-b.rect.left
701 + );
702 + })
703 + .forEach(function(entry){
704 + var group=null;
705 +
706 + for(var i=0;i<groups.length;i++){
707 + if(
708 + Math.abs(
709 + groups[i].top-
710 + entry.rect.top
711 + )<=ROW_TOLERANCE
712 + ){
713 + group=groups[i];
714 + break;
715 + }
716 + }
717 +
718 + if(!group){
719 + group={
720 + top:entry.rect.top,
721 + entries:[]
722 + };
723 + groups.push(group);
724 + }
725 +
726 + group.entries.push(entry);
727 + });
728 +
729 + return groups;
377 377   }
378 378  
379 - function horizontalLayout(parent){
380 - if(!visible(parent))return false;
381 - var s=getComputedStyle(parent);
382 - if(s.display==="grid"||s.display==="inline-grid")return true;
383 - if(s.display==="flex"||s.display==="inline-flex"){
384 - return s.flexDirection==="row"||s.flexDirection==="row-reverse";
732 + function validRow(group){
733 + if(group.entries.length<2)return false;
734 +
735 + var lefts=
736 + group.entries
737 + .map(function(e){return e.rect.left;})
738 + .sort(function(a,b){return a-b;});
739 +
740 + if(
741 + lefts[lefts.length-1]-
742 + lefts[0]<
743 + 80
744 + ){
745 + return false;
385 385   }
386 - return false;
747 +
748 + var widths=
749 + group.entries
750 + .map(function(e){return e.rect.width;})
751 + .filter(function(w){return w>0;});
752 +
753 + if(widths.length<2)return false;
754 +
755 + var minW=
756 + Math.min.apply(Math,widths);
757 +
758 + var maxW=
759 + Math.max.apply(Math,widths);
760 +
761 + return (
762 + maxW/
763 + Math.max(1,minW)<=
764 + 1.9
765 + );
387 387   }
388 388  
389 - function rowGroups(entries){
390 - var groups=[];
391 - entries.slice().sort(function(a,b){
392 - return a.rect.top-b.rect.top||a.rect.left-b.rect.left;
393 - }).forEach(function(entry){
394 - var group=null;
395 - for(var i=0;i<groups.length;i++){
396 - if(Math.abs(groups[i].top-entry.rect.top)<=ROW_TOLERANCE){
397 - group=groups[i];
398 - break;
768 + /* ---------- Known ARSN first section bars ---------- */
769 +
770 + function knownBar(el){
771 + var text=
772 + normalizeText(
773 + el.textContent
774 + );
775 +
776 + return (
777 + text==="HIER STARTEN"||
778 + text==="ORGANISIEREN & DOKUMENTIEREN"||
779 + text==="ENTSCHEIDEN"||
780 + text==="START HERE"||
781 + text==="GET STARTED"||
782 + text==="ORGANISE & DOCUMENT"||
783 + text==="ORGANIZE & DOCUMENT"||
784 + text==="DECIDE"
785 + );
786 + }
787 +
788 + function findKnownBar(card){
789 + var cardRect=
790 + card.getBoundingClientRect();
791 +
792 + var rows=
793 + Array.from(
794 + card.querySelectorAll(
795 + "div,p,span,strong,h3,h4,h5,h6"
796 + )
797 + )
798 + .filter(function(el){
799 + if(!visible(el,20,6))return false;
800 + if(!knownBar(el))return false;
801 +
802 + var r=el.getBoundingClientRect();
803 +
804 + var rel=
805 + r.top-
806 + cardRect.top;
807 +
808 + return (
809 + rel>=35&&
810 + rel<=
811 + cardRect.height*.75
812 + );
813 + })
814 + .sort(function(a,b){
815 + return (
816 + a.getBoundingClientRect().top-
817 + b.getBoundingClientRect().top
818 + );
819 + });
820 +
821 + return rows[0]||null;
822 + }
823 +
824 + function alignKnownBars(cards){
825 + var rows=
826 + cards.map(function(card){
827 + var bar=
828 + findKnownBar(card);
829 +
830 + if(!bar)return null;
831 +
832 + var cr=
833 + card.getBoundingClientRect();
834 +
835 + var br=
836 + bar.getBoundingClientRect();
837 +
838 + return {
839 + bar:bar,
840 + relativeTop:
841 + br.top-
842 + cr.top
843 + };
844 + });
845 +
846 + if(
847 + rows.some(function(row){
848 + return !row;
849 + })
850 + ){
851 + return false;
852 + }
853 +
854 + var target=
855 + Math.max.apply(
856 + Math,
857 + rows.map(function(row){
858 + return row.relativeTop;
859 + })
860 + );
861 +
862 + rows.forEach(function(row){
863 + var delta=
864 + target-
865 + row.relativeTop;
866 +
867 + if(delta<=1)return;
868 +
869 + saveOriginal(
870 + row.bar,
871 + originalMarginTop,
872 + "margin-top"
873 + );
874 +
875 + var current=
876 + num(
877 + getComputedStyle(
878 + row.bar
879 + ).marginTop
880 + );
881 +
882 + row.bar.style.setProperty(
883 + "margin-top",
884 + (
885 + current+
886 + delta
887 + )+"px"
888 + );
889 +
890 + row.bar.setAttribute(
891 + "data-sn-first-section-aligned",
892 + "7"
893 + );
894 +
895 + sectionManaged.add(
896 + row.bar
897 + );
898 + });
899 +
900 + return true;
901 + }
902 +
903 + /* ---------- Generic first content after heading ---------- */
904 +
905 + function heading(card){
906 + var cr=
907 + card.getBoundingClientRect();
908 +
909 + var rows=
910 + Array.from(
911 + card.querySelectorAll(
912 + "h1,h2,h3,h4,h5,h6,.box-title,[role=heading]"
913 + )
914 + )
915 + .filter(function(el){
916 + if(!visible(el,20,8))return false;
917 +
918 + var r=el.getBoundingClientRect();
919 +
920 + var rel=
921 + r.top-
922 + cr.top;
923 +
924 + return (
925 + rel>=0&&
926 + rel<=
927 + Math.min(
928 + 160,
929 + cr.height*.45
930 + )
931 + );
932 + })
933 + .sort(function(a,b){
934 + return (
935 + a.getBoundingClientRect().top-
936 + b.getBoundingClientRect().top
937 + );
938 + });
939 +
940 + return rows[0]||null;
941 + }
942 +
943 + function firstContent(card,h){
944 + if(!h)return null;
945 +
946 + var cr=
947 + card.getBoundingClientRect();
948 +
949 + var hr=
950 + h.getBoundingClientRect();
951 +
952 + var rows=
953 + Array.from(
954 + card.querySelectorAll(
955 + "p,div,ul,ol,dl,blockquote"
956 + )
957 + )
958 + .filter(function(el){
959 + if(
960 + el===h||
961 + h.contains(el)||
962 + el.contains(h)
963 + ){
964 + return false;
399 399   }
400 - }
401 - if(!group){
402 - group={top:entry.rect.top,entries:[]};
403 - groups.push(group);
404 - }
405 - group.entries.push(entry);
966 +
967 + if(!visible(el,30,8))return false;
968 +
969 + var text=
970 + String(el.textContent||"")
971 + .replace(/\s+/g," ")
972 + .trim();
973 +
974 + if(text.length<3)return false;
975 +
976 + var r=el.getBoundingClientRect();
977 +
978 + if(
979 + r.top<
980 + hr.bottom-1
981 + ){
982 + return false;
983 + }
984 +
985 + if(
986 + r.top-cr.top>
987 + Math.min(
988 + 280,
989 + cr.height*.65
990 + )
991 + ){
992 + return false;
993 + }
994 +
995 + if(
996 + r.height>
997 + cr.height*.58
998 + ){
999 + return false;
1000 + }
1001 +
1002 + return true;
1003 + })
1004 + .sort(function(a,b){
1005 + var ar=
1006 + a.getBoundingClientRect();
1007 +
1008 + var br=
1009 + b.getBoundingClientRect();
1010 +
1011 + return (
1012 + ar.top-br.top||
1013 + ar.height-br.height
1014 + );
1015 + });
1016 +
1017 + return rows[0]||null;
1018 + }
1019 +
1020 + function alignGeneric(cards){
1021 + var rows=
1022 + cards.map(function(card){
1023 + var h=
1024 + heading(card);
1025 +
1026 + var c=
1027 + firstContent(
1028 + card,
1029 + h
1030 + );
1031 +
1032 + if(!h||!c)return null;
1033 +
1034 + var cr=
1035 + card.getBoundingClientRect();
1036 +
1037 + var rr=
1038 + c.getBoundingClientRect();
1039 +
1040 + return {
1041 + content:c,
1042 + relativeTop:
1043 + rr.top-cr.top
1044 + };
1045 + });
1046 +
1047 + if(
1048 + rows.some(function(row){
1049 + return !row;
1050 + })
1051 + ){
1052 + return false;
1053 + }
1054 +
1055 + var target=
1056 + Math.max.apply(
1057 + Math,
1058 + rows.map(function(row){
1059 + return row.relativeTop;
1060 + })
1061 + );
1062 +
1063 + rows.forEach(function(row){
1064 + var delta=
1065 + target-
1066 + row.relativeTop;
1067 +
1068 + if(delta<=1)return;
1069 +
1070 + saveOriginal(
1071 + row.content,
1072 + originalMarginTop,
1073 + "margin-top"
1074 + );
1075 +
1076 + var current=
1077 + num(
1078 + getComputedStyle(
1079 + row.content
1080 + ).marginTop
1081 + );
1082 +
1083 + row.content.style.setProperty(
1084 + "margin-top",
1085 + (
1086 + current+
1087 + delta
1088 + )+"px"
1089 + );
1090 +
1091 + row.content.setAttribute(
1092 + "data-sn-first-content-aligned",
1093 + "7"
1094 + );
1095 +
1096 + contentManaged.add(
1097 + row.content
1098 + );
406 406   });
407 - return groups;
1100 +
1101 + return true;
408 408   }
409 409  
410 - function run(){
411 - reset();
1104 + function applyRow(group){
1105 + if(!validRow(group))return false;
412 412  
413 - if(window.innerWidth<=MOBILE_MAX)return;
1107 + var cards=[];
1108 + var seen=new Set();
414 414  
415 - var parents=Array.from(root.querySelectorAll("*")).filter(function(el){
416 - return el.children&&el.children.length>=2&&horizontalLayout(el);
1110 + group.entries.forEach(function(entry){
1111 + if(!seen.has(entry.target)){
1112 + seen.add(entry.target);
1113 + cards.push(entry.target);
1114 + }
417 417   });
418 418  
419 - parents.forEach(function(parent){
420 - var entries=[];
1117 + if(cards.length<2)return false;
421 421  
422 - Array.from(parent.children).forEach(function(child){
423 - if(!visible(child))return;
424 - var target=pickTarget(child);
425 - if(!target)return;
426 - entries.push({
427 - target:target,
428 - rect:target.getBoundingClientRect()
429 - });
430 - });
1119 + if(
1120 + !alignKnownBars(cards)
1121 + ){
1122 + alignGeneric(cards);
1123 + }
431 431  
432 - if(entries.length<2)return;
1125 + var maxHeight=0;
433 433  
434 - rowGroups(entries).forEach(function(group){
435 - if(group.entries.length<2)return;
1127 + cards.forEach(function(card){
1128 + maxHeight=
1129 + Math.max(
1130 + maxHeight,
1131 + card.getBoundingClientRect().height
1132 + );
1133 + });
436 436  
437 - var lefts=group.entries.map(function(e){return e.rect.left;}).sort(function(a,b){return a-b;});
438 - if(lefts[lefts.length-1]-lefts[0]<80)return;
1135 + maxHeight=
1136 + Math.ceil(
1137 + maxHeight
1138 + );
439 439  
440 - var targets=[];
441 - var seen=new Set();
1140 + if(maxHeight<MIN_H)return false;
442 442  
443 - group.entries.forEach(function(e){
444 - if(!seen.has(e.target)){
445 - seen.add(e.target);
446 - targets.push(e.target);
447 - }
1142 + cards.forEach(function(card){
1143 + saveOriginal(
1144 + card,
1145 + originalMinHeight,
1146 + "min-height"
1147 + );
1148 +
1149 + card.style.setProperty(
1150 + "min-height",
1151 + maxHeight+"px"
1152 + );
1153 +
1154 + card.setAttribute(
1155 + "data-sn-equal-height-managed",
1156 + "7"
1157 + );
1158 +
1159 + heightManaged.add(card);
1160 + });
1161 +
1162 + return true;
1163 + }
1164 +
1165 + function calculate(force){
1166 + if(applying)return;
1167 +
1168 + var width=
1169 + Math.round(
1170 + window.innerWidth
1171 + );
1172 +
1173 + var meaningful=
1174 + lastWidth<0||
1175 + Math.abs(
1176 + width-
1177 + lastWidth
1178 + )>=
1179 + MIN_WIDTH_CHANGE;
1180 +
1181 + if(
1182 + hasApplied&&
1183 + !force&&
1184 + !meaningful
1185 + ){
1186 + return;
1187 + }
1188 +
1189 + applying=true;
1190 +
1191 + try{
1192 + harmoniseCustomCallouts();
1193 +
1194 + if(width<=MOBILE_MAX){
1195 + if(hasApplied){
1196 + resetRuntime();
1197 + }
1198 +
1199 + hasApplied=false;
1200 + lastWidth=width;
1201 + return;
1202 + }
1203 +
1204 + if(hasApplied){
1205 + resetRuntime();
1206 + }
1207 +
1208 + var parents=
1209 + Array.from(
1210 + root.querySelectorAll("*")
1211 + )
1212 + .filter(function(parent){
1213 + return (
1214 + visible(
1215 + parent,
1216 + MIN_W,
1217 + MIN_H
1218 + )&&
1219 + parent.children&&
1220 + parent.children.length>=2&&
1221 + parent.children.length<=
1222 + MAX_PARENT_CHILDREN
1223 + );
448 448   });
449 449  
450 - if(targets.length<2)return;
1226 + var touched=
1227 + new Set();
451 451  
452 - var max=0;
453 - targets.forEach(function(el){
454 - max=Math.max(max,el.getBoundingClientRect().height);
1229 + parents.forEach(function(parent){
1230 + var entries=[];
1231 +
1232 + Array.from(
1233 + parent.children
1234 + ).forEach(function(child){
1235 + if(
1236 + !visible(
1237 + child,
1238 + MIN_W,
1239 + MIN_H
1240 + )
1241 + ){
1242 + return;
1243 + }
1244 +
1245 + var target=
1246 + pickTarget(child);
1247 +
1248 + if(!target)return;
1249 +
1250 + entries.push({
1251 + target:target,
1252 + rect:
1253 + target.getBoundingClientRect()
1254 + });
455 455   });
456 456  
457 - max=Math.ceil(max);
458 - if(max<MIN_H)return;
1257 + groupRows(
1258 + entries
1259 + ).forEach(function(group){
1260 + if(!validRow(group))return;
459 459  
460 - targets.forEach(function(el){
461 - el.style.setProperty("min-height",max+"px");
462 - el.setAttribute("data-sn-equal-height-managed","1");
463 - managed.add(el);
1262 + var targets=
1263 + group.entries.map(function(entry){
1264 + return entry.target;
1265 + });
1266 +
1267 + if(
1268 + !targets.some(function(el){
1269 + return !touched.has(el);
1270 + })
1271 + ){
1272 + return;
1273 + }
1274 +
1275 + if(applyRow(group)){
1276 + targets.forEach(function(el){
1277 + touched.add(el);
1278 + });
1279 + }
464 464   });
465 465   });
466 - });
1282 +
1283 + lastWidth=width;
1284 + hasApplied=true;
1285 + }finally{
1286 + applying=false;
1287 + }
467 467   }
468 468  
469 - function schedule(){
470 - if(raf)cancelAnimationFrame(raf);
471 - raf=requestAnimationFrame(function(){
472 - raf=requestAnimationFrame(function(){
473 - raf=0;
474 - run();
475 - });
476 - });
1290 + function resize(){
1291 + if(resizeTimer){
1292 + clearTimeout(
1293 + resizeTimer
1294 + );
1295 + }
1296 +
1297 + resizeTimer=
1298 + setTimeout(
1299 + function(){
1300 + resizeTimer=0;
1301 + calculate(false);
1302 + },
1303 + RESIZE_DEBOUNCE
1304 + );
477 477   }
478 478  
479 - addEventListener("resize",schedule,{passive:true});
480 - addEventListener("load",schedule,{once:true});
1307 + function waitImages(){
1308 + var images=
1309 + Array.from(
1310 + root.querySelectorAll("img")
1311 + );
481 481  
482 - root.addEventListener("click",function(){
483 - setTimeout(schedule,0);
484 - },true);
1313 + return Promise.all(
1314 + images.map(function(img){
1315 + if(img.complete){
1316 + return Promise.resolve();
1317 + }
485 485  
486 - if(document.fonts&&document.fonts.ready){
487 - document.fonts.ready.then(schedule);
1319 + return new Promise(function(resolve){
1320 + var done=function(){
1321 + resolve();
1322 + };
1323 +
1324 + img.addEventListener(
1325 + "load",
1326 + done,
1327 + {once:true}
1328 + );
1329 +
1330 + img.addEventListener(
1331 + "error",
1332 + done,
1333 + {once:true}
1334 + );
1335 + });
1336 + })
1337 + );
488 488   }
489 489  
490 - schedule();
491 - setTimeout(schedule,250);
492 - setTimeout(schedule,900);
1340 + async function initial(){
1341 + if(
1342 + document.readyState!==
1343 + "complete"
1344 + ){
1345 + await new Promise(function(resolve){
1346 + addEventListener(
1347 + "load",
1348 + resolve,
1349 + {once:true}
1350 + );
1351 + });
1352 + }
1353 +
1354 + if(
1355 + document.fonts&&
1356 + document.fonts.ready
1357 + ){
1358 + try{
1359 + await document.fonts.ready;
1360 + }catch(error){}
1361 + }
1362 +
1363 + await waitImages();
1364 +
1365 + // Exactly one initial layout calculation.
1366 + calculate(true);
1367 + }
1368 +
1369 + addEventListener(
1370 + "resize",
1371 + resize,
1372 + {passive:true}
1373 + );
1374 +
1375 + initial();
493 493  })();
494 494  </script>
495 -<!-- SN_HORIZONTAL_BOX_HARMONIZER_END -->
496 -{{/html}}
497 497  
1379 +<!-- SN_HORIZONTAL_BOX_HARMONIZER_END -->
1380 +{{/html}}\n