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

From version 9.8
edited by Veronika Kocher
on Thursday, 03 Sep 2026 15:54
Change comment: There is no comment for this version
To version 9.5
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
... ... @@ -58,7 +58,7 @@
58 58  <section class="card" style="margin-bottom:18px;overflow:hidden;border-left:6px solid #e94b13;">
59 59  <div class="hero"><img src="https://xwiki.uni-ak.ac.at/bin/download/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/WebHome/enable.png" alt="Planning and organising an artistic or research project"></div>
60 60  <div style="padding:18px 21px 20px">
61 -<div class="eye" style="color:#8a4d36;margin-bottom:5px">PREPARE · PROJECT PLANNING &amp; ORGANISATION</div>
61 +<div class="eye" style="color:#8a4d36;margin-bottom:5px">ENABLE · PROJECT PLANNING &amp; ORGANISATION</div>
62 62  <h2 style="font-size:27px;line-height:1.2;margin:0 0 8px;color:#2c2926">Build a project that can actually be hosted, funded, staffed and delivered</h2>
63 63  <p style="margin:0;color:#5e5953;line-height:1.6;max-width:1120px">Project planning at the Angewandte is not only a timeline and a budget. A workable project needs an artistic or research home, clear responsibilities, an appropriate funding and administrative route, and early coordination with the university structures triggered by your project.</p>
64 64  </div></section>
... ... @@ -425,13 +425,12 @@
425 425  </div>
426 426  {{/html}}
427 427  
428 -{{html clean="false"}}
429 -<!-- SN_SERVICE_NAVIGATOR_MASTER_STYLE_START -->
428 +\n\n
429 +\n\n{{html clean="false"}}
430 +<!-- SN_HORIZONTAL_BOX_HARMONIZER_START -->
430 430  
431 -<style data-sn-service-navigator-master="1">
432 -/* =========================================================
433 - MASTER TYPOGRAPHY
434 - ========================================================= */
432 +<style data-sn-horizontal-box-harmonizer="7">
433 +/* ---------- Typography: never justify headings ---------- */
435 435  #xwikicontent h1,
436 436  #xwikicontent h2,
437 437  #xwikicontent h3,
... ... @@ -453,105 +453,88 @@
453 453   word-spacing:normal!important;
454 454  }
455 455  
456 -/* =========================================================
457 - COMING SOON / IN VORBEREITUNG
458 - ========================================================= */
459 -.sn-coming-soon-badge{
460 - display:inline-block;
461 - vertical-align:middle;
462 - margin-left:10px;
463 - padding:4px 8px;
464 - border-radius:14px;
465 - border:1px solid #efd9cc;
466 - background:#fff4ee;
467 - color:#8a4d36;
468 - font-size:11px;
469 - font-weight:700;
470 - letter-spacing:.055em;
471 - line-height:1.2;
472 - white-space:nowrap;
473 -}
474 -
475 -/* =========================================================
476 - NATIVE / DETAIL CALLOUT GEOMETRY
477 - Preserve existing backgrounds.
478 - ========================================================= */
479 -#xwikicontent .arsn-info,
480 -#xwikicontent .dmp-info,
481 -#xwikicontent .ido-info,
482 -#xwikicontent .pp-info,
483 -#xwikicontent .infomessage{
455 +/* ---------- Native XWiki semantic callouts ---------- */
456 +#xwikicontent .box.infomessage,
457 +#xwikicontent .infomessage,
458 +#xwikicontent .box.warningmessage,
459 +#xwikicontent .warningmessage,
460 +#xwikicontent .box.successmessage,
461 +#xwikicontent .successmessage,
462 +#xwikicontent .box.errormessage,
463 +#xwikicontent .errormessage,
464 +#xwikicontent [data-sn-callout-harmonized="1"]{
484 484   box-sizing:border-box!important;
485 - border-left:4px solid #21b6d7!important;
486 - border-radius:8px;
466 + border-radius:8px!important;
467 + border-top:1px solid rgba(0,0,0,.08)!important;
468 + border-right:1px solid rgba(0,0,0,.08)!important;
469 + border-bottom:1px solid rgba(0,0,0,.08)!important;
470 + border-left:4px solid var(--sn-callout-accent,#21b6d7)!important;
471 + padding:14px 16px!important;
487 487   text-align:left!important;
473 + text-justify:auto!important;
488 488   word-spacing:normal!important;
475 + box-shadow:none!important;
489 489  }
490 490  
491 -#xwikicontent .arsn-warn,
492 -#xwikicontent .dmp-warn,
493 -#xwikicontent .ido-warn,
494 -#xwikicontent .pp-warn,
495 -#xwikicontent .warn,
496 -#xwikicontent .warning,
497 -#xwikicontent .warningmessage,
478 +#xwikicontent .box.infomessage,
479 +#xwikicontent .infomessage{
480 + --sn-callout-accent:#21b6d7;
481 + background:#eaf7fb!important;
482 +}
483 +
484 +#xwikicontent .box.warningmessage,
485 +#xwikicontent .warningmessage{
486 + --sn-callout-accent:#f0aa00;
487 + background:#fff8e7!important;
488 +}
489 +
490 +#xwikicontent .box.successmessage,
491 +#xwikicontent .successmessage{
492 + --sn-callout-accent:#38b76a;
493 + background:#edf9f1!important;
494 +}
495 +
496 +#xwikicontent .box.errormessage,
498 498  #xwikicontent .errormessage{
499 - box-sizing:border-box!important;
500 - border-left:4px solid #e94b13!important;
501 - border-radius:8px;
502 - text-align:left!important;
503 - word-spacing:normal!important;
498 + --sn-callout-accent:#e94b13;
499 + background:#fff1ec!important;
504 504  }
505 505  
506 -[data-sn-master-equal-height],
507 -[data-sn-master-first-row]{
508 - box-sizing:border-box;
502 +#xwikicontent [data-sn-callout-harmonized="1"] > :first-child,
503 +#xwikicontent .infomessage > :first-child,
504 +#xwikicontent .warningmessage > :first-child,
505 +#xwikicontent .successmessage > :first-child,
506 +#xwikicontent .errormessage > :first-child{
507 + margin-top:0!important;
509 509  }
510 510  
511 -/* =========================================================
512 - FULL-WIDTH THREE-LINE NUMBER / TITLE / SUBTITLE BLOCKS
513 - ========================================================= */
514 -#xwikicontent .arsn-area-label[data-sn-three-line="1"]{
515 - display:grid!important;
516 - grid-template-columns:minmax(0,1fr)!important;
517 - grid-auto-rows:auto!important;
518 - width:100%!important;
519 - max-width:none!important;
520 - box-sizing:border-box!important;
521 - justify-items:start!important;
522 - align-items:start!important;
523 - gap:2px!important;
524 - text-align:left!important;
525 - text-align-last:left!important;
526 - text-justify:auto!important;
527 - word-spacing:normal!important;
528 - white-space:normal!important;
510 +#xwikicontent [data-sn-callout-harmonized="1"] > :last-child,
511 +#xwikicontent .infomessage > :last-child,
512 +#xwikicontent .warningmessage > :last-child,
513 +#xwikicontent .successmessage > :last-child,
514 +#xwikicontent .errormessage > :last-child{
515 + margin-bottom:0!important;
529 529  }
530 -#xwikicontent .arsn-area-label[data-sn-three-line="1"] > .arsn-area-number,
531 -#xwikicontent .arsn-area-label[data-sn-three-line="1"] > .sn-area-label-title,
532 -#xwikicontent .arsn-area-label[data-sn-three-line="1"] > .arsn-area-action{
533 - display:block!important;
534 - width:100%!important;
535 - margin:0!important;
536 - text-align:left!important;
537 - text-align-last:left!important;
538 - text-justify:auto!important;
539 - word-spacing:normal!important;
540 - white-space:normal!important;
517 +
518 +#xwikicontent [data-sn-equal-height-managed],
519 +#xwikicontent [data-sn-first-section-aligned],
520 +#xwikicontent [data-sn-first-content-aligned]{
521 + box-sizing:border-box;
541 541  }
542 542  </style>
543 543  
544 -<script data-sn-service-navigator-master="1">
525 +<script data-sn-horizontal-box-harmonizer="7">
545 545  (function(){
546 546   "use strict";
547 547  
548 - var PAGE_KIND="detail";
549 - var PLACEHOLDER=false;
550 - var PLACEHOLDER_LABEL="COMING SOON";
551 -
552 552   var MOBILE_MAX=767;
553 553   var ROW_TOLERANCE=6;
531 + var MIN_W=150;
532 + var MIN_H=36;
533 + var MAX_PARENT_CHILDREN=18;
534 + var SEARCH_DEPTH=5;
554 554   var RESIZE_DEBOUNCE=220;
536 + var MIN_WIDTH_CHANGE=2;
555 555  
556 556   var root=
557 557   document.getElementById("xwikicontent")||
... ... @@ -561,114 +561,142 @@
561 561  
562 562   if(!root)return;
563 563  
564 - var managedHeight=new Set();
565 - var managedMargin=new Set();
566 - var originalHeight=new WeakMap();
567 - var originalMargin=new WeakMap();
546 + var heightManaged=new Set();
547 + var sectionManaged=new Set();
548 + var contentManaged=new Set();
568 568  
550 + var originalMinHeight=new WeakMap();
551 + var originalMarginTop=new WeakMap();
552 +
569 569   var resizeTimer=0;
570 - var running=false;
554 + var lastWidth=-1;
555 + var hasApplied=false;
556 + var applying=false;
571 571  
572 - var THEMES=[
573 - {
574 - name:"BLUE",
575 - accent:"#21b6d7",
576 - bg:"#eaf7fb",
577 - text:"#315d68",
578 - labels:[
579 - "HIER STARTEN",
580 - "ENTSCHEIDEN",
581 - "ÜBERPRÜFEN & ANPASSEN",
582 - "START HERE",
583 - "DECIDE",
584 - "REVIEW & ADAPT"
585 - ]
586 - },
587 - {
588 - name:"RED",
589 - accent:"#e94b13",
590 - bg:"#fff1ec",
591 - text:"#8a4d36",
592 - labels:[
593 - "PLANEN & ORGANISIEREN",
594 - "ORGANISIEREN & DOKUMENTIEREN",
595 - "PUBLIZIEREN & PRÄSENTIEREN",
596 - "PLAN & ORGANISE",
597 - "PLAN & ORGANIZE",
598 - "ORGANISE & DOCUMENT",
599 - "ORGANIZE & DOCUMENT",
600 - "PUBLISH & PRESENT"
601 - ]
602 - },
603 - {
604 - name:"YELLOW",
605 - accent:"#f0aa00",
606 - bg:"#fff8e7",
607 - text:"#785b17",
608 - labels:[
609 - "SCHÜTZEN & KLÄREN",
610 - "STANDARDISIEREN & IDENTIFIZIEREN",
611 - "ÖFFNEN, NACHNUTZEN & AUFFINDBAR MACHEN",
612 - "PROTECT & CLARIFY",
613 - "STANDARDISE & IDENTIFY",
614 - "STANDARDIZE & IDENTIFY",
615 - "OPEN, REUSE & MAKE FINDABLE"
616 - ]
617 - },
618 - {
619 - name:"GREEN",
620 - accent:"#38b76a",
621 - bg:"#edf9f1",
622 - text:"#3f7451",
623 - labels:[
624 - "INFRASTRUKTUR EINRICHTEN",
625 - "INFRASTRUKTUR & ZUSAMMENARBEIT EINRICHTEN",
626 - "SPEICHERN & ZUGRIFF STEUERN",
627 - "REPOSITORIUM, ERHALTEN & ÜBERGEBEN",
628 - "SET UP INFRASTRUCTURE",
629 - "SET UP INFRASTRUCTURE & COLLABORATION",
630 - "STORE & CONTROL ACCESS",
631 - "REPOSITORY, PRESERVE & HAND OVER"
632 - ]
558 + function num(v){
559 + var n=parseFloat(v);
560 + return Number.isFinite(n)?n:0;
561 + }
562 +
563 + function visible(el,minW,minH){
564 + if(!el||el.nodeType!==1)return false;
565 +
566 + var s=getComputedStyle(el);
567 +
568 + if(
569 + s.display==="none"||
570 + s.visibility==="hidden"||
571 + Number(s.opacity)===0
572 + ){
573 + return false;
633 633   }
634 - ];
635 635  
636 - function num(value){
637 - var n=parseFloat(value);
638 - return Number.isFinite(n)?n:0;
576 + var r=el.getBoundingClientRect();
577 +
578 + return (
579 + r.width>=(minW||1)&&
580 + r.height>=(minH||1)
581 + );
639 639   }
640 640  
641 - function norm(value){
642 - return String(value||"")
584 + function normalizeText(text){
585 + return String(text||"")
643 643   .replace(/\s+/g," ")
644 644   .trim()
645 645   .toUpperCase();
646 646   }
647 647  
648 - function visible(el){
649 - if(!el||el.nodeType!==1)return false;
591 + function excluded(el){
592 + return (
593 + !el.matches||
594 + el.matches(
595 + "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]"
596 + )
597 + );
598 + }
650 650  
651 - var style=getComputedStyle(el);
652 - var rect=el.getBoundingClientRect();
600 + /* ---------- Custom coloured callouts ---------- */
653 653  
602 + function nativeCallout(el){
603 + var c=
604 + typeof el.className==="string"
605 + ? el.className.toLowerCase()
606 + : "";
607 +
654 654   return (
655 - style.display!=="none"&&
656 - style.visibility!=="hidden"&&
657 - rect.width>20&&
658 - rect.height>4
609 + /(^|\s)(infomessage|warningmessage|successmessage|errormessage)(\s|$)/.test(c)
659 659   );
660 660   }
661 661  
662 - function saveStyle(el,map,property){
613 + function customCallout(el){
614 + if(!visible(el,220,42)||excluded(el))return false;
615 +
616 + var r=el.getBoundingClientRect();
617 +
618 + if(r.height>520)return false;
619 +
620 + var s=getComputedStyle(el);
621 +
622 + var bg=
623 + s.backgroundColor&&
624 + s.backgroundColor!=="rgba(0, 0, 0, 0)"&&
625 + s.backgroundColor!=="transparent"&&
626 + s.backgroundColor!=="rgb(255, 255, 255)";
627 +
628 + var left=
629 + num(s.borderLeftWidth);
630 +
631 + return (
632 + bg&&
633 + left>=2
634 + );
635 + }
636 +
637 + function harmoniseCustomCallouts(){
638 + Array.from(
639 + root.querySelectorAll(
640 + "div,aside,section"
641 + )
642 + ).forEach(function(el){
643 + if(nativeCallout(el))return;
644 + if(!customCallout(el))return;
645 +
646 + var s=getComputedStyle(el);
647 +
648 + el.setAttribute(
649 + "data-sn-callout-harmonized",
650 + "1"
651 + );
652 +
653 + if(
654 + s.borderLeftColor
655 + ){
656 + el.style.setProperty(
657 + "--sn-callout-accent",
658 + s.borderLeftColor
659 + );
660 + }
661 + });
662 + }
663 +
664 + /* ---------- Restore only values V7 itself changed ---------- */
665 +
666 + function saveOriginal(el,map,property){
663 663   if(map.has(el))return;
664 664  
665 665   map.set(el,{
666 - value:el.style.getPropertyValue(property),
667 - priority:el.style.getPropertyPriority(property)
670 + value:
671 + el.style.getPropertyValue(
672 + property
673 + ),
674 + priority:
675 + el.style.getPropertyPriority(
676 + property
677 + )
668 668   });
669 669   }
670 670  
671 - function restoreStyle(el,map,property){
681 + function restoreOriginal(el,map,property){
672 672   var original=map.get(el);
673 673  
674 674   if(original&&original.value){
... ... @@ -678,1069 +678,770 @@
678 678   original.priority||""
679 679   );
680 680   }else{
681 - el.style.removeProperty(property);
691 + el.style.removeProperty(
692 + property
693 + );
682 682   }
683 683   }
684 684  
685 685   function resetRuntime(){
686 - managedHeight.forEach(function(el){
687 - restoreStyle(
698 + heightManaged.forEach(function(el){
699 + restoreOriginal(
688 688   el,
689 - originalHeight,
701 + originalMinHeight,
690 690   "min-height"
691 691   );
704 +
692 692   el.removeAttribute(
693 - "data-sn-master-equal-height"
706 + "data-sn-equal-height-managed"
694 694   );
695 695   });
696 696  
697 - managedMargin.forEach(function(el){
698 - restoreStyle(
710 + sectionManaged.forEach(function(el){
711 + restoreOriginal(
699 699   el,
700 - originalMargin,
713 + originalMarginTop,
701 701   "margin-top"
702 702   );
716 +
703 703   el.removeAttribute(
704 - "data-sn-master-first-row"
718 + "data-sn-first-section-aligned"
705 705   );
706 706   });
707 707  
708 - managedHeight.clear();
709 - managedMargin.clear();
710 - }
722 + contentManaged.forEach(function(el){
723 + restoreOriginal(
724 + el,
725 + originalMarginTop,
726 + "margin-top"
727 + );
711 711  
712 - function themeFor(text){
713 - var value=norm(text);
729 + el.removeAttribute(
730 + "data-sn-first-content-aligned"
731 + );
732 + });
714 714  
715 - for(var i=0;i<THEMES.length;i++){
716 - for(var j=0;j<THEMES[i].labels.length;j++){
717 - var label=THEMES[i].labels[j];
718 -
719 - if(
720 - value===label||
721 - value.indexOf(label+" ")===0||
722 - value.indexOf(label+" -")===0||
723 - value.indexOf(label+" ·")===0
724 - ){
725 - return THEMES[i];
726 - }
727 - }
728 - }
729 -
730 - return null;
734 + heightManaged.clear();
735 + sectionManaged.clear();
736 + contentManaged.clear();
731 731   }
732 732  
733 - /* =======================================================
734 - BORDERLESS FILLED RED/ORANGE CTA BUTTONS
735 - ======================================================= */
739 + /* ---------- Card detection ---------- */
736 736  
737 - function colourDistance(a,b){
738 - return Math.sqrt(
739 - Math.pow(a[0]-b[0],2)+
740 - Math.pow(a[1]-b[1],2)+
741 - Math.pow(a[2]-b[2],2)
742 - );
741 + function namedLikeBox(el){
742 + var c=
743 + typeof el.className==="string"
744 + ? el.className
745 + : "";
746 +
747 + return /(^|[\s_-])(box|card|tile|panel|role|check|service|source|call|area|detail|resource|topic|warn|info)([\s_-]|$)/i.test(c);
743 743   }
744 744  
745 - function makeFilledRedOrangeCTAsBorderless(){
746 - var RED_ORANGE=[233,75,19];
750 + function boxLike(el){
751 + if(
752 + !visible(el,MIN_W,MIN_H)||
753 + excluded(el)
754 + ){
755 + return false;
756 + }
747 747  
748 - Array.from(
749 - root.querySelectorAll(
750 - 'a,button,[role="button"],input[type="submit"],input[type="button"]'
751 - )
752 - ).forEach(function(el){
753 - if(!visible(el))return;
758 + var s=getComputedStyle(el);
759 + var r=el.getBoundingClientRect();
754 754  
755 - var style=getComputedStyle(el);
756 - var rgb=parseRGB(style.backgroundColor);
761 + var border=
762 + num(s.borderTopWidth)+
763 + num(s.borderRightWidth)+
764 + num(s.borderBottomWidth)+
765 + num(s.borderLeftWidth);
757 757  
758 - if(!rgb)return;
767 + var radius=Math.max(
768 + num(s.borderTopLeftRadius),
769 + num(s.borderTopRightRadius),
770 + num(s.borderBottomLeftRadius),
771 + num(s.borderBottomRightRadius)
772 + );
759 759  
760 - if(
761 - colourDistance(
762 - rgb,
763 - RED_ORANGE
764 - )>55
765 - ){
766 - return;
767 - }
774 + var bg=
775 + s.backgroundColor&&
776 + s.backgroundColor!=="rgba(0, 0, 0, 0)"&&
777 + s.backgroundColor!=="transparent";
768 768  
769 - var rect=el.getBoundingClientRect();
779 + var shadow=
780 + s.boxShadow&&
781 + s.boxShadow!=="none";
770 770  
771 - if(
772 - rect.width<80||
773 - rect.height<24
774 - ){
775 - return;
776 - }
783 + return (
784 + namedLikeBox(el)||
785 + border>=1||
786 + (bg&&radius>=3)||
787 + (shadow&&r.width>=180)
788 + );
789 + }
777 777  
778 - el.style.setProperty(
779 - "border",
780 - "none",
781 - "important"
782 - );
791 + function pickTarget(child){
792 + if(!visible(child,MIN_W,MIN_H))return null;
783 783  
784 - el.style.setProperty(
785 - "border-left",
786 - "none",
787 - "important"
788 - );
794 + if(boxLike(child))return child;
789 789  
790 - el.style.setProperty(
791 - "border-top",
792 - "none",
793 - "important"
794 - );
796 + var cr=child.getBoundingClientRect();
797 + var q=[];
795 795  
796 - el.style.setProperty(
797 - "border-right",
798 - "none",
799 - "important"
800 - );
801 -
802 - el.style.setProperty(
803 - "border-bottom",
804 - "none",
805 - "important"
806 - );
807 -
808 - el.style.setProperty(
809 - "box-shadow",
810 - "none",
811 - "important"
812 - );
799 + Array.from(child.children||[]).forEach(function(el){
800 + q.push({el:el,depth:1});
813 813   });
814 - }
815 815  
816 - /* =======================================================
817 - FULL-WIDTH THREE-LINE AREA LABELS
818 - ======================================================= */
803 + var best=null;
804 + var bestScore=-Infinity;
819 819  
820 - function compactText(value){
821 - return String(value||"")
822 - .replace(/\s+/g," ")
823 - .trim();
824 - }
806 + while(q.length){
807 + var item=q.shift();
808 + var el=item.el;
825 825  
826 - function makeThreeLineAreaLabels(){
827 - Array.from(
828 - root.querySelectorAll(
829 - ".arsn-area-label"
830 - )
831 - ).forEach(function(label){
832 - if(
833 - label.getAttribute(
834 - "data-sn-three-line"
835 - )==="1"
836 - ){
837 - return;
838 - }
810 + if(!visible(el,MIN_W,MIN_H))continue;
839 839  
840 - var number=
841 - label.querySelector(
842 - ":scope > .arsn-area-number"
843 - );
812 + var r=el.getBoundingClientRect();
844 844  
845 - var action=
846 - label.querySelector(
847 - ":scope > .arsn-area-action"
848 - );
849 -
850 850   if(
851 - !number||
852 - !action
815 + r.width>=cr.width*.68&&
816 + boxLike(el)
853 853   ){
854 - return;
855 - }
818 + var widthFit=
819 + 1-Math.min(
820 + 1,
821 + Math.abs(cr.width-r.width)/
822 + Math.max(1,cr.width)
823 + );
856 856  
857 - var clone=
858 - label.cloneNode(true);
825 + var topFit=
826 + 1-Math.min(
827 + 1,
828 + Math.abs(cr.top-r.top)/100
829 + );
859 859  
860 - var cloneNumber=
861 - clone.querySelector(
862 - ":scope > .arsn-area-number"
863 - );
831 + var score=
832 + widthFit*6+
833 + topFit*3+
834 + Math.min(r.height,900)/450+
835 + Math.min(r.width*r.height,900000)/900000;
864 864  
865 - var cloneAction=
866 - clone.querySelector(
867 - ":scope > .arsn-area-action"
868 - );
869 -
870 - if(cloneNumber){
871 - cloneNumber.remove();
837 + if(score>bestScore){
838 + best=el;
839 + bestScore=score;
840 + }
872 872   }
873 873  
874 - if(cloneAction){
875 - cloneAction.remove();
843 + if(item.depth<SEARCH_DEPTH){
844 + Array.from(el.children||[]).forEach(function(next){
845 + q.push({
846 + el:next,
847 + depth:item.depth+1
848 + });
849 + });
876 876   }
851 + }
877 877  
878 - var titleText=
879 - compactText(
880 - clone.textContent
881 - );
853 + return best;
854 + }
882 882  
883 - if(!titleText){
884 - return;
885 - }
856 + function groupRows(entries){
857 + var groups=[];
886 886  
887 - var numberNode=
888 - number.cloneNode(true);
889 -
890 - var actionNode=
891 - action.cloneNode(true);
892 -
893 - var titleNode=
894 - document.createElement(
895 - "span"
859 + entries
860 + .slice()
861 + .sort(function(a,b){
862 + return (
863 + a.rect.top-b.rect.top||
864 + a.rect.left-b.rect.left
896 896   );
866 + })
867 + .forEach(function(entry){
868 + var group=null;
897 897  
898 - titleNode.className=
899 - "sn-area-label-title";
870 + for(var i=0;i<groups.length;i++){
871 + if(
872 + Math.abs(
873 + groups[i].top-
874 + entry.rect.top
875 + )<=ROW_TOLERANCE
876 + ){
877 + group=groups[i];
878 + break;
879 + }
880 + }
900 900  
901 - titleNode.textContent=
902 - titleText;
882 + if(!group){
883 + group={
884 + top:entry.rect.top,
885 + entries:[]
886 + };
887 + groups.push(group);
888 + }
903 903  
904 - while(label.firstChild){
905 - label.removeChild(
906 - label.firstChild
907 - );
908 - }
890 + group.entries.push(entry);
891 + });
909 909  
910 - label.appendChild(
911 - numberNode
912 - );
913 -
914 - label.appendChild(
915 - titleNode
916 - );
917 -
918 - label.appendChild(
919 - actionNode
920 - );
921 -
922 - label.setAttribute(
923 - "data-sn-three-line",
924 - "1"
925 - );
926 -
927 - var head=
928 - label.closest(
929 - ".arsn-area-head"
930 - );
931 -
932 - if(head){
933 - head.style.setProperty(
934 - "width",
935 - "100%",
936 - "important"
937 - );
938 -
939 - head.style.setProperty(
940 - "max-width",
941 - "100%",
942 - "important"
943 - );
944 -
945 - head.style.setProperty(
946 - "box-sizing",
947 - "border-box",
948 - "important"
949 - );
950 - }
951 - });
893 + return groups;
952 952   }
953 953  
954 - /* =======================================================
955 - PLACEHOLDER BADGE
956 - ======================================================= */
896 + function validRow(group){
897 + if(group.entries.length<2)return false;
957 957  
958 - function applyPlaceholderBadge(){
959 - if(!PLACEHOLDER)return;
899 + var lefts=
900 + group.entries
901 + .map(function(e){return e.rect.left;})
902 + .sort(function(a,b){return a-b;});
960 960  
961 961   if(
962 - document.querySelector(
963 - ".sn-coming-soon-badge"
964 - )
905 + lefts[lefts.length-1]-
906 + lefts[0]<
907 + 80
965 965   ){
966 - return;
909 + return false;
967 967   }
968 968  
969 - var title=
970 - document.querySelector(
971 - "#document-title"
972 - )||
973 - document.querySelector(
974 - "h1"
975 - );
912 + var widths=
913 + group.entries
914 + .map(function(e){return e.rect.width;})
915 + .filter(function(w){return w>0;});
976 976  
977 - if(!title)return;
917 + if(widths.length<2)return false;
978 978  
979 - var badge=
980 - document.createElement(
981 - "span"
982 - );
919 + var minW=
920 + Math.min.apply(Math,widths);
983 983  
984 - badge.className=
985 - "sn-coming-soon-badge";
922 + var maxW=
923 + Math.max.apply(Math,widths);
986 986  
987 - badge.textContent=
988 - PLACEHOLDER_LABEL;
989 -
990 - badge.setAttribute(
991 - "aria-label",
992 - PLACEHOLDER_LABEL
925 + return (
926 + maxW/
927 + Math.max(1,minW)<=
928 + 1.9
993 993   );
930 + }
994 994  
995 - title.appendChild(
996 - badge
932 + /* ---------- Known ARSN first section bars ---------- */
933 +
934 + function knownBar(el){
935 + var text=
936 + normalizeText(
937 + el.textContent
938 + );
939 +
940 + return (
941 + text==="HIER STARTEN"||
942 + text==="ORGANISIEREN & DOKUMENTIEREN"||
943 + text==="ENTSCHEIDEN"||
944 + text==="START HERE"||
945 + text==="GET STARTED"||
946 + text==="ORGANISE & DOCUMENT"||
947 + text==="ORGANIZE & DOCUMENT"||
948 + text==="DECIDE"
997 997   );
998 998   }
999 999  
1000 - /* =======================================================
1001 - DETAIL PAGE OWN-ACCENT PROPAGATION
1002 - ======================================================= */
952 + function findKnownBar(card){
953 + var cardRect=
954 + card.getBoundingClientRect();
1003 1003  
1004 - function parseRGB(value){
1005 - var match=String(value||"").match(
1006 - /rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i
1007 - );
956 + var rows=
957 + Array.from(
958 + card.querySelectorAll(
959 + "div,p,span,strong,h3,h4,h5,h6"
960 + )
961 + )
962 + .filter(function(el){
963 + if(!visible(el,20,6))return false;
964 + if(!knownBar(el))return false;
1008 1008  
1009 - if(!match)return null;
966 + var r=el.getBoundingClientRect();
1010 1010  
1011 - return [
1012 - Number(match[1]),
1013 - Number(match[2]),
1014 - Number(match[3])
1015 - ];
1016 - }
968 + var rel=
969 + r.top-
970 + cardRect.top;
1017 1017  
1018 - function distance(a,b){
1019 - return Math.sqrt(
1020 - Math.pow(a[0]-b[0],2)+
1021 - Math.pow(a[1]-b[1],2)+
1022 - Math.pow(a[2]-b[2],2)
1023 - );
972 + return (
973 + rel>=35&&
974 + rel<=
975 + cardRect.height*.75
976 + );
977 + })
978 + .sort(function(a,b){
979 + return (
980 + a.getBoundingClientRect().top-
981 + b.getBoundingClientRect().top
982 + );
983 + });
984 +
985 + return rows[0]||null;
1024 1024   }
1025 1025  
1026 - function paletteMatch(cssColor){
1027 - var rgb=parseRGB(cssColor);
988 + function alignKnownBars(cards){
989 + var rows=
990 + cards.map(function(card){
991 + var bar=
992 + findKnownBar(card);
1028 1028  
1029 - if(!rgb)return null;
994 + if(!bar)return null;
1030 1030  
1031 - var palette=[
1032 - {hex:"#21b6d7",rgb:[33,182,215]},
1033 - {hex:"#e94b13",rgb:[233,75,19]},
1034 - {hex:"#f0aa00",rgb:[240,170,0]},
1035 - {hex:"#38b76a",rgb:[56,183,106]}
1036 - ];
996 + var cr=
997 + card.getBoundingClientRect();
1037 1037  
1038 - var best=null;
1039 - var bestDistance=Infinity;
999 + var br=
1000 + bar.getBoundingClientRect();
1040 1040  
1041 - palette.forEach(function(item){
1042 - var d=distance(rgb,item.rgb);
1002 + return {
1003 + bar:bar,
1004 + relativeTop:
1005 + br.top-
1006 + cr.top
1007 + };
1008 + });
1043 1043  
1044 - if(d<bestDistance){
1045 - best=item;
1046 - bestDistance=d;
1047 - }
1048 - });
1010 + if(
1011 + rows.some(function(row){
1012 + return !row;
1013 + })
1014 + ){
1015 + return false;
1016 + }
1049 1049  
1050 - return bestDistance<=30
1051 - ?best
1052 - :null;
1053 - }
1018 + var target=
1019 + Math.max.apply(
1020 + Math,
1021 + rows.map(function(row){
1022 + return row.relativeTop;
1023 + })
1024 + );
1054 1054  
1055 - function propagateDetailAccents(){
1056 - if(PAGE_KIND!=="detail")return;
1026 + rows.forEach(function(row){
1027 + var delta=
1028 + target-
1029 + row.relativeTop;
1057 1057  
1058 - Array.from(
1059 - root.querySelectorAll(
1060 - ".arsn-call,.dmp-call,.ido-call,.pp-call,"+
1061 - ".arsn-source,.dmp-source,.ido-source,.pp-source"
1062 - )
1063 - ).forEach(function(el){
1064 - if(!visible(el))return;
1031 + if(delta<=1)return;
1065 1065  
1066 - var style=getComputedStyle(el);
1033 + saveOriginal(
1034 + row.bar,
1035 + originalMarginTop,
1036 + "margin-top"
1037 + );
1067 1067  
1068 - if(
1069 - num(style.borderTopWidth)>=2
1070 - ){
1071 - var match=
1072 - paletteMatch(
1073 - style.borderTopColor
1074 - );
1039 + var current=
1040 + num(
1041 + getComputedStyle(
1042 + row.bar
1043 + ).marginTop
1044 + );
1075 1075  
1076 - if(match){
1077 - el.style.setProperty(
1078 - "border-left",
1079 - "4px solid "+match.hex,
1080 - "important"
1081 - );
1082 - }
1083 - }
1084 - });
1046 + row.bar.style.setProperty(
1047 + "margin-top",
1048 + (
1049 + current+
1050 + delta
1051 + )+"px"
1052 + );
1085 1085  
1086 - // Warning families: explicit safety override.
1087 - Array.from(
1088 - root.querySelectorAll(
1089 - ".arsn-warn,.dmp-warn,.ido-warn,.pp-warn,"+
1090 - ".warn,.warning,.warningmessage,.errormessage"
1091 - )
1092 - ).forEach(function(el){
1093 - if(!visible(el))return;
1094 -
1095 - el.style.setProperty(
1096 - "border-left",
1097 - "4px solid #e94b13",
1098 - "important"
1054 + row.bar.setAttribute(
1055 + "data-sn-first-section-aligned",
1056 + "7"
1099 1099   );
1100 - });
1101 1101  
1102 - // Info families: explicit orientation override.
1103 - Array.from(
1104 - root.querySelectorAll(
1105 - ".arsn-info,.dmp-info,.ido-info,.pp-info,.infomessage"
1106 - )
1107 - ).forEach(function(el){
1108 - if(!visible(el))return;
1109 -
1110 - el.style.setProperty(
1111 - "border-left",
1112 - "4px solid #21b6d7",
1113 - "important"
1059 + sectionManaged.add(
1060 + row.bar
1114 1114   );
1115 1115   });
1063 +
1064 + return true;
1116 1116   }
1117 1117  
1118 - /* =======================================================
1119 - OVERVIEW SEMANTIC THEME PALETTE
1120 - ======================================================= */
1067 + /* ---------- Generic first content after heading ---------- */
1121 1121  
1122 - function smallestThemeHeaders(){
1123 - return Array.from(
1124 - root.querySelectorAll(
1125 - "div,span,p,strong,h3,h4,h5,h6"
1069 + function heading(card){
1070 + var cr=
1071 + card.getBoundingClientRect();
1072 +
1073 + var rows=
1074 + Array.from(
1075 + card.querySelectorAll(
1076 + "h1,h2,h3,h4,h5,h6,.box-title,[role=heading]"
1077 + )
1126 1126   )
1127 - ).filter(function(el){
1128 - if(!visible(el))return false;
1129 - if(!themeFor(el.textContent))return false;
1079 + .filter(function(el){
1080 + if(!visible(el,20,8))return false;
1130 1130  
1131 - return !Array.from(
1132 - el.children||[]
1133 - ).some(function(child){
1134 - return !!themeFor(
1135 - child.textContent
1082 + var r=el.getBoundingClientRect();
1083 +
1084 + var rel=
1085 + r.top-
1086 + cr.top;
1087 +
1088 + return (
1089 + rel>=0&&
1090 + rel<=
1091 + Math.min(
1092 + 160,
1093 + cr.height*.45
1094 + )
1136 1136   );
1096 + })
1097 + .sort(function(a,b){
1098 + return (
1099 + a.getBoundingClientRect().top-
1100 + b.getBoundingClientRect().top
1101 + );
1137 1137   });
1138 - });
1103 +
1104 + return rows[0]||null;
1139 1139   }
1140 1140  
1141 - function findOverviewCard(header){
1142 - var node=header.parentElement;
1143 - var candidates=[];
1107 + function firstContent(card,h){
1108 + if(!h)return null;
1144 1144  
1145 - while(node&&node!==root){
1146 - var rect=node.getBoundingClientRect();
1147 - var style=getComputedStyle(node);
1110 + var cr=
1111 + card.getBoundingClientRect();
1148 1148  
1149 - var border=
1150 - num(style.borderTopWidth)+
1151 - num(style.borderRightWidth)+
1152 - num(style.borderBottomWidth)+
1153 - num(style.borderLeftWidth);
1113 + var hr=
1114 + h.getBoundingClientRect();
1154 1154  
1155 - if(
1156 - rect.width>=220&&
1157 - rect.width<=800&&
1158 - rect.height>=120&&
1159 - border>=1
1160 - ){
1161 - candidates.push(node);
1162 - }
1116 + var rows=
1117 + Array.from(
1118 + card.querySelectorAll(
1119 + "p,div,ul,ol,dl,blockquote"
1120 + )
1121 + )
1122 + .filter(function(el){
1123 + if(
1124 + el===h||
1125 + h.contains(el)||
1126 + el.contains(h)
1127 + ){
1128 + return false;
1129 + }
1163 1163  
1164 - node=node.parentElement;
1165 - }
1131 + if(!visible(el,30,8))return false;
1166 1166  
1167 - if(!candidates.length)return null;
1133 + var text=
1134 + String(el.textContent||"")
1135 + .replace(/\s+/g," ")
1136 + .trim();
1168 1168  
1169 - candidates.sort(function(a,b){
1170 - return (
1171 - b.getBoundingClientRect().height-
1172 - a.getBoundingClientRect().height
1173 - );
1174 - });
1138 + if(text.length<3)return false;
1175 1175  
1176 - return candidates[0];
1177 - }
1140 + var r=el.getBoundingClientRect();
1178 1178  
1179 - function rowCandidates(link,card){
1180 - var result=[];
1181 - var cardRect=
1182 - card.getBoundingClientRect();
1142 + if(
1143 + r.top<
1144 + hr.bottom-1
1145 + ){
1146 + return false;
1147 + }
1183 1183  
1184 - var node=link;
1149 + if(
1150 + r.top-cr.top>
1151 + Math.min(
1152 + 280,
1153 + cr.height*.65
1154 + )
1155 + ){
1156 + return false;
1157 + }
1185 1185  
1186 - while(node&&node!==card){
1187 - if(visible(node)){
1188 - var rect=
1189 - node.getBoundingClientRect();
1190 -
1191 1191   if(
1192 - rect.height<=105&&
1193 - rect.width>=
1194 - cardRect.width*.50&&
1195 - rect.width<=
1196 - cardRect.width*1.03
1160 + r.height>
1161 + cr.height*.58
1197 1197   ){
1198 - result.push(node);
1163 + return false;
1199 1199   }
1200 - }
1201 1201  
1202 - node=node.parentElement;
1203 - }
1166 + return true;
1167 + })
1168 + .sort(function(a,b){
1169 + var ar=
1170 + a.getBoundingClientRect();
1204 1204  
1205 - return result;
1206 - }
1172 + var br=
1173 + b.getBoundingClientRect();
1207 1207  
1208 - function chooseOuterRow(
1209 - candidates,
1210 - link
1211 - ){
1212 - if(!candidates.length){
1213 - return link;
1214 - }
1215 -
1216 - var bordered=
1217 - candidates.filter(function(el){
1218 1218   return (
1219 - num(
1220 - getComputedStyle(el)
1221 - .borderLeftWidth
1222 - )>=1
1176 + ar.top-br.top||
1177 + ar.height-br.height
1223 1223   );
1224 1224   });
1225 1225  
1226 - var pool=
1227 - bordered.length
1228 - ?bordered
1229 - :candidates;
1181 + return rows[0]||null;
1182 + }
1230 1230  
1231 - pool.sort(function(a,b){
1232 - var ar=
1233 - a.getBoundingClientRect();
1184 + function alignGeneric(cards){
1185 + var rows=
1186 + cards.map(function(card){
1187 + var h=
1188 + heading(card);
1234 1234  
1235 - var br=
1236 - b.getBoundingClientRect();
1190 + var c=
1191 + firstContent(
1192 + card,
1193 + h
1194 + );
1237 1237  
1238 - return (
1239 - ar.left-br.left||
1240 - br.width-ar.width
1241 - );
1242 - });
1196 + if(!h||!c)return null;
1243 1243  
1244 - return pool[0]||link;
1245 - }
1198 + var cr=
1199 + card.getBoundingClientRect();
1246 1246  
1247 - function applyOverviewPalette(){
1248 - if(PAGE_KIND!=="overview"){
1249 - return [];
1201 + var rr=
1202 + c.getBoundingClientRect();
1203 +
1204 + return {
1205 + content:c,
1206 + relativeTop:
1207 + rr.top-cr.top
1208 + };
1209 + });
1210 +
1211 + if(
1212 + rows.some(function(row){
1213 + return !row;
1214 + })
1215 + ){
1216 + return false;
1250 1250   }
1251 1251  
1252 - var headers=
1253 - smallestThemeHeaders()
1254 - .map(function(el){
1255 - return {
1256 - el:el,
1257 - theme:
1258 - themeFor(
1259 - el.textContent
1260 - ),
1261 - card:
1262 - findOverviewCard(
1263 - el
1264 - )
1265 - };
1219 + var target=
1220 + Math.max.apply(
1221 + Math,
1222 + rows.map(function(row){
1223 + return row.relativeTop;
1266 1266   })
1267 - .filter(function(row){
1268 - return !!row.card;
1269 - });
1225 + );
1270 1270  
1271 - var unique=[];
1272 - var seenHeaders=new Set();
1227 + rows.forEach(function(row){
1228 + var delta=
1229 + target-
1230 + row.relativeTop;
1273 1273  
1274 - headers.forEach(function(row){
1275 - var key=
1276 - row.theme.name+
1277 - "|"+
1278 - Math.round(
1279 - row.card
1280 - .getBoundingClientRect()
1281 - .left
1282 - )+
1283 - "|"+
1284 - Math.round(
1285 - row.el
1286 - .getBoundingClientRect()
1287 - .top
1288 - );
1232 + if(delta<=1)return;
1289 1289  
1290 - if(!seenHeaders.has(key)){
1291 - seenHeaders.add(key);
1292 - unique.push(row);
1293 - }
1294 - });
1295 -
1296 - unique.forEach(function(row){
1297 - var headerRect=
1298 - row.el
1299 - .getBoundingClientRect();
1300 -
1301 - row.el.style.setProperty(
1302 - "background",
1303 - row.theme.bg,
1304 - "important"
1234 + saveOriginal(
1235 + row.content,
1236 + originalMarginTop,
1237 + "margin-top"
1305 1305   );
1306 1306  
1307 - row.el.style.setProperty(
1308 - "color",
1309 - row.theme.text,
1310 - "important"
1311 - );
1240 + var current=
1241 + num(
1242 + getComputedStyle(
1243 + row.content
1244 + ).marginTop
1245 + );
1312 1312  
1313 - row.el.style.setProperty(
1314 - "text-align",
1315 - "left",
1316 - "important"
1247 + row.content.style.setProperty(
1248 + "margin-top",
1249 + (
1250 + current+
1251 + delta
1252 + )+"px"
1317 1317   );
1318 1318  
1319 - row.el.style.setProperty(
1320 - "word-spacing",
1321 - "normal",
1322 - "important"
1255 + row.content.setAttribute(
1256 + "data-sn-first-content-aligned",
1257 + "7"
1323 1323   );
1324 1324  
1325 - var later=
1326 - unique
1327 - .filter(function(other){
1328 - return (
1329 - other.card===row.card&&
1330 - other.el
1331 - .getBoundingClientRect()
1332 - .top>
1333 - headerRect.top+2
1334 - );
1335 - })
1336 - .sort(function(a,b){
1337 - return (
1338 - a.el
1339 - .getBoundingClientRect()
1340 - .top-
1341 - b.el
1342 - .getBoundingClientRect()
1343 - .top
1344 - );
1345 - });
1346 -
1347 - var stopTop=
1348 - later.length
1349 - ?later[0].el
1350 - .getBoundingClientRect()
1351 - .top
1352 - :Infinity;
1353 -
1354 - Array.from(
1355 - row.card.querySelectorAll("a")
1356 - ).forEach(function(link){
1357 - if(!visible(link))return;
1358 -
1359 - var rect=
1360 - link.getBoundingClientRect();
1361 -
1362 - if(
1363 - rect.top<=
1364 - headerRect.bottom-2||
1365 - rect.top>=
1366 - stopTop-2
1367 - ){
1368 - return;
1369 - }
1370 -
1371 - var candidates=
1372 - rowCandidates(
1373 - link,
1374 - row.card
1375 - );
1376 -
1377 - var target=
1378 - chooseOuterRow(
1379 - candidates,
1380 - link
1381 - );
1382 -
1383 - candidates.forEach(function(el){
1384 - el.style.setProperty(
1385 - "border-left",
1386 - "0 solid transparent",
1387 - "important"
1388 - );
1389 - });
1390 -
1391 - target.style.setProperty(
1392 - "border-left",
1393 - "3px solid "+
1394 - row.theme.accent,
1395 - "important"
1396 - );
1397 -
1398 - target.style.setProperty(
1399 - "box-sizing",
1400 - "border-box",
1401 - "important"
1402 - );
1403 - });
1260 + contentManaged.add(
1261 + row.content
1262 + );
1404 1404   });
1405 1405  
1406 - return unique;
1265 + return true;
1407 1407   }
1408 1408  
1409 - /* =======================================================
1410 - OVERVIEW CARD HEIGHT + FIRST THEMATIC ROW
1411 - ======================================================= */
1268 + function applyRow(group){
1269 + if(!validRow(group))return false;
1412 1412  
1413 - function alignOverviewCards(headers){
1414 - if(
1415 - PAGE_KIND!=="overview"||
1416 - window.innerWidth<=MOBILE_MAX
1417 - ){
1418 - return;
1419 - }
1420 -
1421 1421   var cards=[];
1422 1422   var seen=new Set();
1423 1423  
1424 - headers.forEach(function(row){
1425 - if(!seen.has(row.card)){
1426 - seen.add(row.card);
1427 - cards.push(row.card);
1274 + group.entries.forEach(function(entry){
1275 + if(!seen.has(entry.target)){
1276 + seen.add(entry.target);
1277 + cards.push(entry.target);
1428 1428   }
1429 1429   });
1430 1430  
1431 - if(cards.length<2){
1432 - return;
1281 + if(cards.length<2)return false;
1282 +
1283 + if(
1284 + !alignKnownBars(cards)
1285 + ){
1286 + alignGeneric(cards);
1433 1433   }
1434 1434  
1435 - // Group cards by actual top position.
1436 - var groups=[];
1289 + var maxHeight=0;
1437 1437  
1438 1438   cards.forEach(function(card){
1439 - var top=
1440 - card.getBoundingClientRect().top;
1441 -
1442 - var group=null;
1443 -
1444 - for(var i=0;i<groups.length;i++){
1445 - if(
1446 - Math.abs(
1447 - groups[i].top-top
1448 - )<=ROW_TOLERANCE
1449 - ){
1450 - group=groups[i];
1451 - break;
1452 - }
1453 - }
1454 -
1455 - if(!group){
1456 - group={
1457 - top:top,
1458 - cards:[]
1459 - };
1460 - groups.push(group);
1461 - }
1462 -
1463 - group.cards.push(card);
1292 + maxHeight=
1293 + Math.max(
1294 + maxHeight,
1295 + card.getBoundingClientRect().height
1296 + );
1464 1464   });
1465 1465  
1466 - groups.forEach(function(group){
1467 - if(group.cards.length<2){
1468 - return;
1469 - }
1299 + maxHeight=
1300 + Math.ceil(
1301 + maxHeight
1302 + );
1470 1470  
1471 - var firstHeaders=
1472 - group.cards.map(function(card){
1473 - var candidates=
1474 - headers
1475 - .filter(function(row){
1476 - return row.card===card;
1477 - })
1478 - .sort(function(a,b){
1479 - return (
1480 - a.el
1481 - .getBoundingClientRect()
1482 - .top-
1483 - b.el
1484 - .getBoundingClientRect()
1485 - .top
1486 - );
1487 - });
1304 + if(maxHeight<MIN_H)return false;
1488 1488  
1489 - return candidates.length
1490 - ?candidates[0]
1491 - :null;
1492 - });
1306 + cards.forEach(function(card){
1307 + saveOriginal(
1308 + card,
1309 + originalMinHeight,
1310 + "min-height"
1311 + );
1493 1493  
1494 - if(
1495 - !firstHeaders.some(function(row){
1496 - return !row;
1497 - })
1498 - ){
1499 - var targetTop=
1500 - Math.max.apply(
1501 - Math,
1502 - firstHeaders.map(function(row){
1503 - return (
1504 - row.el
1505 - .getBoundingClientRect()
1506 - .top-
1507 - row.card
1508 - .getBoundingClientRect()
1509 - .top
1510 - );
1511 - })
1512 - );
1313 + card.style.setProperty(
1314 + "min-height",
1315 + maxHeight+"px"
1316 + );
1513 1513  
1514 - firstHeaders.forEach(function(row){
1515 - var relativeTop=
1516 - row.el
1517 - .getBoundingClientRect()
1518 - .top-
1519 - row.card
1520 - .getBoundingClientRect()
1521 - .top;
1318 + card.setAttribute(
1319 + "data-sn-equal-height-managed",
1320 + "7"
1321 + );
1522 1522  
1523 - var delta=
1524 - targetTop-relativeTop;
1323 + heightManaged.add(card);
1324 + });
1525 1525  
1526 - if(delta>1){
1527 - saveStyle(
1528 - row.el,
1529 - originalMargin,
1530 - "margin-top"
1531 - );
1326 + return true;
1327 + }
1532 1532  
1533 - var current=
1534 - num(
1535 - getComputedStyle(
1536 - row.el
1537 - ).marginTop
1538 - );
1329 + function calculate(force){
1330 + if(applying)return;
1539 1539  
1540 - row.el.style.setProperty(
1541 - "margin-top",
1542 - (
1543 - current+delta
1544 - )+"px"
1545 - );
1332 + var width=
1333 + Math.round(
1334 + window.innerWidth
1335 + );
1546 1546  
1547 - row.el.setAttribute(
1548 - "data-sn-master-first-row",
1549 - "1"
1550 - );
1337 + var meaningful=
1338 + lastWidth<0||
1339 + Math.abs(
1340 + width-
1341 + lastWidth
1342 + )>=
1343 + MIN_WIDTH_CHANGE;
1551 1551  
1552 - managedMargin.add(
1553 - row.el
1554 - );
1555 - }
1556 - });
1557 - }
1558 -
1559 - var maxHeight=0;
1560 -
1561 - group.cards.forEach(function(card){
1562 - maxHeight=
1563 - Math.max(
1564 - maxHeight,
1565 - card
1566 - .getBoundingClientRect()
1567 - .height
1568 - );
1569 - });
1570 -
1571 - maxHeight=
1572 - Math.ceil(maxHeight);
1573 -
1574 - group.cards.forEach(function(card){
1575 - saveStyle(
1576 - card,
1577 - originalHeight,
1578 - "min-height"
1579 - );
1580 -
1581 - card.style.setProperty(
1582 - "min-height",
1583 - maxHeight+"px"
1584 - );
1585 -
1586 - card.setAttribute(
1587 - "data-sn-master-equal-height",
1588 - "1"
1589 - );
1590 -
1591 - managedHeight.add(
1592 - card
1593 - );
1594 - });
1595 - });
1596 - }
1597 -
1598 - /* =======================================================
1599 - DETAIL GRID EQUAL HEIGHT, DESKTOP ONLY
1600 - ======================================================= */
1601 -
1602 - function equaliseDetailGrids(){
1603 1603   if(
1604 - PAGE_KIND!=="detail"||
1605 - window.innerWidth<=MOBILE_MAX
1346 + hasApplied&&
1347 + !force&&
1348 + !meaningful
1606 1606   ){
1607 1607   return;
1608 1608   }
1609 1609  
1610 - var selectors=[
1611 - ".arsn-grid",
1612 - ".arsn-grid-2",
1613 - ".arsn-grid-3",
1614 - ".dmp-grid",
1615 - ".ido-grid",
1616 - ".pp-grid"
1617 - ];
1353 + applying=true;
1618 1618  
1619 - selectors.forEach(function(selector){
1620 - Array.from(
1621 - root.querySelectorAll(selector)
1622 - ).forEach(function(grid){
1623 - var children=
1624 - Array.from(
1625 - grid.children||[]
1626 - ).filter(visible);
1355 + try{
1356 + harmoniseCustomCallouts();
1627 1627  
1628 - if(children.length<2){
1629 - return;
1358 + if(width<=MOBILE_MAX){
1359 + if(hasApplied){
1360 + resetRuntime();
1630 1630   }
1631 1631  
1632 - var groups=[];
1363 + hasApplied=false;
1364 + lastWidth=width;
1365 + return;
1366 + }
1633 1633  
1634 - children.forEach(function(child){
1635 - var top=
1636 - child
1637 - .getBoundingClientRect()
1638 - .top;
1368 + if(hasApplied){
1369 + resetRuntime();
1370 + }
1639 1639  
1640 - var group=null;
1372 + var parents=
1373 + Array.from(
1374 + root.querySelectorAll("*")
1375 + )
1376 + .filter(function(parent){
1377 + return (
1378 + visible(
1379 + parent,
1380 + MIN_W,
1381 + MIN_H
1382 + )&&
1383 + parent.children&&
1384 + parent.children.length>=2&&
1385 + parent.children.length<=
1386 + MAX_PARENT_CHILDREN
1387 + );
1388 + });
1641 1641  
1642 - for(var i=0;i<groups.length;i++){
1643 - if(
1644 - Math.abs(
1645 - groups[i].top-top
1646 - )<=ROW_TOLERANCE
1647 - ){
1648 - group=groups[i];
1649 - break;
1650 - }
1651 - }
1390 + var touched=
1391 + new Set();
1652 1652  
1653 - if(!group){
1654 - group={
1655 - top:top,
1656 - items:[]
1657 - };
1658 - groups.push(group);
1659 - }
1393 + parents.forEach(function(parent){
1394 + var entries=[];
1660 1660  
1661 - group.items.push(child);
1662 - });
1663 -
1664 - groups.forEach(function(group){
1665 - if(group.items.length<2){
1396 + Array.from(
1397 + parent.children
1398 + ).forEach(function(child){
1399 + if(
1400 + !visible(
1401 + child,
1402 + MIN_W,
1403 + MIN_H
1404 + )
1405 + ){
1666 1666   return;
1667 1667   }
1668 1668  
1669 - var maxHeight=0;
1409 + var target=
1410 + pickTarget(child);
1670 1670  
1671 - group.items.forEach(function(item){
1672 - maxHeight=
1673 - Math.max(
1674 - maxHeight,
1675 - item
1676 - .getBoundingClientRect()
1677 - .height
1678 - );
1412 + if(!target)return;
1413 +
1414 + entries.push({
1415 + target:target,
1416 + rect:
1417 + target.getBoundingClientRect()
1679 1679   });
1419 + });
1680 1680  
1681 - maxHeight=
1682 - Math.ceil(maxHeight);
1421 + groupRows(
1422 + entries
1423 + ).forEach(function(group){
1424 + if(!validRow(group))return;
1683 1683  
1684 - group.items.forEach(function(item){
1685 - saveStyle(
1686 - item,
1687 - originalHeight,
1688 - "min-height"
1689 - );
1426 + var targets=
1427 + group.entries.map(function(entry){
1428 + return entry.target;
1429 + });
1690 1690  
1691 - item.style.setProperty(
1692 - "min-height",
1693 - maxHeight+"px"
1694 - );
1431 + if(
1432 + !targets.some(function(el){
1433 + return !touched.has(el);
1434 + })
1435 + ){
1436 + return;
1437 + }
1695 1695  
1696 - item.setAttribute(
1697 - "data-sn-master-equal-height",
1698 - "1"
1699 - );
1700 -
1701 - managedHeight.add(item);
1702 - });
1439 + if(applyRow(group)){
1440 + targets.forEach(function(el){
1441 + touched.add(el);
1442 + });
1443 + }
1703 1703   });
1704 1704   });
1705 - });
1706 - }
1707 1707  
1708 - /* =======================================================
1709 - RUN / RESPONSIVE SCHEDULING
1710 - ======================================================= */
1711 -
1712 - function run(){
1713 - if(running)return;
1714 -
1715 - running=true;
1716 -
1717 - try{
1718 - resetRuntime();
1719 - applyPlaceholderBadge();
1720 - propagateDetailAccents();
1721 -
1722 - var headers=
1723 - applyOverviewPalette();
1724 -
1725 - makeThreeLineAreaLabels();
1726 - makeFilledRedOrangeCTAsBorderless();
1727 -
1728 - if(
1729 - window.innerWidth>
1730 - MOBILE_MAX
1731 - ){
1732 - alignOverviewCards(
1733 - headers
1734 - );
1735 -
1736 - equaliseDetailGrids();
1737 - }
1447 + lastWidth=width;
1448 + hasApplied=true;
1738 1738   }finally{
1739 - running=false;
1450 + applying=false;
1740 1740   }
1741 1741   }
1742 1742  
1743 - function onResize(){
1454 + function resize(){
1744 1744   if(resizeTimer){
1745 1745   clearTimeout(
1746 1746   resizeTimer
... ... @@ -1751,40 +1751,19 @@
1751 1751   setTimeout(
1752 1752   function(){
1753 1753   resizeTimer=0;
1754 - run();
1465 + calculate(false);
1755 1755   },
1756 1756   RESIZE_DEBOUNCE
1757 1757   );
1758 1758   }
1759 1759  
1760 - async function waitForReady(){
1761 - if(
1762 - document.readyState!=="complete"
1763 - ){
1764 - await new Promise(function(resolve){
1765 - window.addEventListener(
1766 - "load",
1767 - resolve,
1768 - {once:true}
1769 - );
1770 - });
1771 - }
1772 -
1773 - if(
1774 - document.fonts&&
1775 - document.fonts.ready
1776 - ){
1777 - try{
1778 - await document.fonts.ready;
1779 - }catch(error){}
1780 - }
1781 -
1471 + function waitImages(){
1782 1782   var images=
1783 1783   Array.from(
1784 1784   root.querySelectorAll("img")
1785 1785   );
1786 1786  
1787 - await Promise.all(
1477 + return Promise.all(
1788 1788   images.map(function(img){
1789 1789   if(img.complete){
1790 1790   return Promise.resolve();
... ... @@ -1809,20 +1809,46 @@
1809 1809   });
1810 1810   })
1811 1811   );
1502 + }
1812 1812  
1813 - run();
1504 + async function initial(){
1505 + if(
1506 + document.readyState!==
1507 + "complete"
1508 + ){
1509 + await new Promise(function(resolve){
1510 + addEventListener(
1511 + "load",
1512 + resolve,
1513 + {once:true}
1514 + );
1515 + });
1516 + }
1517 +
1518 + if(
1519 + document.fonts&&
1520 + document.fonts.ready
1521 + ){
1522 + try{
1523 + await document.fonts.ready;
1524 + }catch(error){}
1525 + }
1526 +
1527 + await waitImages();
1528 +
1529 + // Exactly one initial layout calculation.
1530 + calculate(true);
1814 1814   }
1815 1815  
1816 - window.addEventListener(
1533 + addEventListener(
1817 1817   "resize",
1818 - onResize,
1535 + resize,
1819 1819   {passive:true}
1820 1820   );
1821 1821  
1822 - waitForReady();
1539 + initial();
1823 1823  })();
1824 1824  </script>
1825 1825  
1826 -<!-- SN_SERVICE_NAVIGATOR_MASTER_STYLE_END -->
1827 -{{/html}}
1828 -
1543 +<!-- SN_HORIZONTAL_BOX_HARMONIZER_END -->
1544 +{{/html}}\n