Changes for page Service Navigator

Last modified by Veronika Kocher on Friday, 09 Oct 2026 12:12

From version 22.16
edited by Veronika Kocher
on Thursday, 03 Sep 2026 13:04
Change comment: There is no comment for this version
To version 22.14
edited by Veronika Kocher
on Thursday, 03 Sep 2026 9:34
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -286,100 +286,23 @@
286 286  {{/html}}
287 287  
288 288  {{html clean="false"}}
289 -<!-- SN_SERVICE_NAVIGATOR_MASTER_STYLE_START -->
290 -
291 -<style data-sn-service-navigator-master="1">
292 -/* =========================================================
293 - MASTER TYPOGRAPHY
294 - ========================================================= */
295 -#xwikicontent h1,
296 -#xwikicontent h2,
297 -#xwikicontent h3,
298 -#xwikicontent h4,
299 -#xwikicontent h5,
300 -#xwikicontent h6,
301 -#xwikicontent .box-title,
302 -#xwikicontent [role="heading"],
303 -#xwikicontent h1 a,
304 -#xwikicontent h2 a,
305 -#xwikicontent h3 a,
306 -#xwikicontent h4 a,
307 -#xwikicontent h5 a,
308 -#xwikicontent h6 a,
309 -#xwikicontent .box-title a,
310 -#xwikicontent [role="heading"] a{
311 - text-align:left!important;
312 - text-justify:auto!important;
313 - word-spacing:normal!important;
314 -}
315 -
316 -/* =========================================================
317 - COMING SOON / IN VORBEREITUNG
318 - ========================================================= */
319 -.sn-coming-soon-badge{
320 - display:inline-block;
321 - vertical-align:middle;
322 - margin-left:10px;
323 - padding:4px 8px;
324 - border-radius:14px;
325 - border:1px solid #efd9cc;
326 - background:#fff4ee;
327 - color:#8a4d36;
328 - font-size:11px;
329 - font-weight:700;
330 - letter-spacing:.055em;
331 - line-height:1.2;
332 - white-space:nowrap;
333 -}
334 -
335 -/* =========================================================
336 - NATIVE / DETAIL CALLOUT GEOMETRY
337 - Preserve existing backgrounds.
338 - ========================================================= */
339 -#xwikicontent .arsn-info,
340 -#xwikicontent .dmp-info,
341 -#xwikicontent .ido-info,
342 -#xwikicontent .pp-info,
343 -#xwikicontent .infomessage{
344 - box-sizing:border-box!important;
345 - border-left:4px solid #21b6d7!important;
346 - border-radius:8px;
347 - text-align:left!important;
348 - word-spacing:normal!important;
349 -}
350 -
351 -#xwikicontent .arsn-warn,
352 -#xwikicontent .dmp-warn,
353 -#xwikicontent .ido-warn,
354 -#xwikicontent .pp-warn,
355 -#xwikicontent .warn,
356 -#xwikicontent .warning,
357 -#xwikicontent .warningmessage,
358 -#xwikicontent .errormessage{
359 - box-sizing:border-box!important;
360 - border-left:4px solid #e94b13!important;
361 - border-radius:8px;
362 - text-align:left!important;
363 - word-spacing:normal!important;
364 -}
365 -
366 -[data-sn-master-equal-height],
367 -[data-sn-master-first-row]{
289 +<!-- SN_HORIZONTAL_BOX_HARMONIZER_START -->
290 +<style data-sn-horizontal-box-harmonizer="4">
291 +[data-sn-equal-height-managed],
292 +[data-sn-first-section-aligned]{
368 368   box-sizing:border-box;
369 369  }
370 370  </style>
371 -
372 -<script data-sn-service-navigator-master="1">
296 +<script data-sn-horizontal-box-harmonizer="4">
373 373  (function(){
374 374   "use strict";
375 375  
376 - var PAGE_KIND="overview";
377 - var PLACEHOLDER=false;
378 - var PLACEHOLDER_LABEL="COMING SOON";
379 -
380 380   var MOBILE_MAX=767;
381 381   var ROW_TOLERANCE=6;
382 - var RESIZE_DEBOUNCE=220;
302 + var MIN_W=150;
303 + var MIN_H=36;
304 + var MAX_PARENT_CHILDREN=16;
305 + var SEARCH_DEPTH=5;
383 383  
384 384   var root=
385 385   document.getElementById("xwikicontent")||
... ... @@ -389,105 +389,93 @@
389 389  
390 390   if(!root)return;
391 391  
392 - var managedHeight=new Set();
393 - var managedMargin=new Set();
394 - var originalHeight=new WeakMap();
395 - var originalMargin=new WeakMap();
315 + var heightManaged=new Set();
316 + var sectionManaged=new Set();
317 + var originalMinHeight=new WeakMap();
318 + var originalMarginTop=new WeakMap();
319 + var raf=0;
396 396  
397 - var resizeTimer=0;
398 - var running=false;
321 + function num(v){
322 + var n=parseFloat(v);
323 + return Number.isFinite(n)?n:0;
324 + }
399 399  
400 - var THEMES=[
401 - {
402 - name:"BLUE",
403 - accent:"#21b6d7",
404 - bg:"#eaf7fb",
405 - text:"#315d68",
406 - labels:[
407 - "HIER STARTEN",
408 - "ENTSCHEIDEN",
409 - "ÜBERPRÜFEN & ANPASSEN",
410 - "START HERE",
411 - "DECIDE",
412 - "REVIEW & ADAPT"
413 - ]
414 - },
415 - {
416 - name:"RED",
417 - accent:"#e94b13",
418 - bg:"#fff1ec",
419 - text:"#8a4d36",
420 - labels:[
421 - "PLANEN & ORGANISIEREN",
422 - "ORGANISIEREN & DOKUMENTIEREN",
423 - "PUBLIZIEREN & PRÄSENTIEREN",
424 - "PLAN & ORGANISE",
425 - "PLAN & ORGANIZE",
426 - "ORGANISE & DOCUMENT",
427 - "ORGANIZE & DOCUMENT",
428 - "PUBLISH & PRESENT"
429 - ]
430 - },
431 - {
432 - name:"YELLOW",
433 - accent:"#f0aa00",
434 - bg:"#fff8e7",
435 - text:"#785b17",
436 - labels:[
437 - "SCHÜTZEN & KLÄREN",
438 - "STANDARDISIEREN & IDENTIFIZIEREN",
439 - "ÖFFNEN, NACHNUTZEN & AUFFINDBAR MACHEN",
440 - "PROTECT & CLARIFY",
441 - "STANDARDISE & IDENTIFY",
442 - "STANDARDIZE & IDENTIFY",
443 - "OPEN, REUSE & MAKE FINDABLE"
444 - ]
445 - },
446 - {
447 - name:"GREEN",
448 - accent:"#38b76a",
449 - bg:"#edf9f1",
450 - text:"#3f7451",
451 - labels:[
452 - "INFRASTRUKTUR EINRICHTEN",
453 - "INFRASTRUKTUR & ZUSAMMENARBEIT EINRICHTEN",
454 - "SPEICHERN & ZUGRIFF STEUERN",
455 - "REPOSITORIUM, ERHALTEN & ÜBERGEBEN",
456 - "SET UP INFRASTRUCTURE",
457 - "SET UP INFRASTRUCTURE & COLLABORATION",
458 - "STORE & CONTROL ACCESS",
459 - "REPOSITORY, PRESERVE & HAND OVER"
460 - ]
326 + function visible(el,minW,minH){
327 + if(!el||el.nodeType!==1)return false;
328 +
329 + var s=getComputedStyle(el);
330 +
331 + if(
332 + s.display==="none"||
333 + s.visibility==="hidden"||
334 + Number(s.opacity)===0
335 + ){
336 + return false;
461 461   }
462 - ];
463 463  
464 - function num(value){
465 - var n=parseFloat(value);
466 - return Number.isFinite(n)?n:0;
339 + var r=el.getBoundingClientRect();
340 +
341 + return (
342 + r.width>=(minW||1)&&
343 + r.height>=(minH||1)
344 + );
467 467   }
468 468  
469 - function norm(value){
470 - return String(value||"")
471 - .replace(/\s+/g," ")
472 - .trim()
473 - .toUpperCase();
347 + function excluded(el){
348 + return (
349 + !el.matches||
350 + el.matches(
351 + "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]"
352 + )
353 + );
474 474   }
475 475  
476 - function visible(el){
477 - if(!el||el.nodeType!==1)return false;
356 + function namedLikeBox(el){
357 + var c=
358 + typeof el.className==="string"
359 + ? el.className
360 + : "";
478 478  
479 - var style=getComputedStyle(el);
480 - var rect=el.getBoundingClientRect();
362 + return /(^|[s_-])(box|card|tile|panel|role|check|service|source|call|area|detail|resource|topic|warn|info)([s_-]|$)/i.test(c);
363 + }
481 481  
365 + function boxLike(el){
366 + if(!visible(el,MIN_W,MIN_H)||excluded(el))return false;
367 +
368 + var s=getComputedStyle(el);
369 + var r=el.getBoundingClientRect();
370 +
371 + var border=
372 + num(s.borderTopWidth)+
373 + num(s.borderRightWidth)+
374 + num(s.borderBottomWidth)+
375 + num(s.borderLeftWidth);
376 +
377 + var radius=Math.max(
378 + num(s.borderTopLeftRadius),
379 + num(s.borderTopRightRadius),
380 + num(s.borderBottomLeftRadius),
381 + num(s.borderBottomRightRadius)
382 + );
383 +
384 + var bg=
385 + s.backgroundColor&&
386 + s.backgroundColor!=="rgba(0, 0, 0, 0)"&&
387 + s.backgroundColor!=="transparent";
388 +
389 + var shadow=
390 + s.boxShadow&&
391 + s.boxShadow!=="none";
392 +
482 482   return (
483 - style.display!=="none"&&
484 - style.visibility!=="hidden"&&
485 - rect.width>20&&
486 - rect.height>4
394 + namedLikeBox(el)||
395 + border>=1||
396 + (bg&&radius>=3)||
397 + (shadow&&r.width>=180)
487 487   );
488 488   }
489 489  
490 - function saveStyle(el,map,property){
401 + function saveOriginal(el,map,property){
491 491   if(map.has(el))return;
492 492  
493 493   map.set(el,{
... ... @@ -496,7 +496,7 @@
496 496   });
497 497   }
498 498  
499 - function restoreStyle(el,map,property){
410 + function restoreOriginal(el,map,property){
500 500   var original=map.get(el);
501 501  
502 502   if(original&&original.value){
... ... @@ -510,249 +510,247 @@
510 510   }
511 511   }
512 512  
513 - function resetRuntime(){
514 - managedHeight.forEach(function(el){
515 - restoreStyle(
424 + function reset(){
425 + heightManaged.forEach(function(el){
426 + restoreOriginal(
516 516   el,
517 - originalHeight,
428 + originalMinHeight,
518 518   "min-height"
519 519   );
431 +
520 520   el.removeAttribute(
521 - "data-sn-master-equal-height"
433 + "data-sn-equal-height-managed"
522 522   );
523 523   });
524 524  
525 - managedMargin.forEach(function(el){
526 - restoreStyle(
437 + sectionManaged.forEach(function(el){
438 + restoreOriginal(
527 527   el,
528 - originalMargin,
440 + originalMarginTop,
529 529   "margin-top"
530 530   );
443 +
531 531   el.removeAttribute(
532 - "data-sn-master-first-row"
445 + "data-sn-first-section-aligned"
533 533   );
534 534   });
535 535  
536 - managedHeight.clear();
537 - managedMargin.clear();
449 + heightManaged.clear();
450 + sectionManaged.clear();
538 538   }
539 539  
540 - function themeFor(text){
541 - var value=norm(text);
453 + function pickTarget(child){
454 + if(!visible(child,MIN_W,MIN_H))return null;
542 542  
543 - for(var i=0;i<THEMES.length;i++){
544 - for(var j=0;j<THEMES[i].labels.length;j++){
545 - var label=THEMES[i].labels[j];
546 -
547 - if(
548 - value===label||
549 - value.indexOf(label+" ")===0||
550 - value.indexOf(label+" -")===0||
551 - value.indexOf(label+" ·")===0
552 - ){
553 - return THEMES[i];
554 - }
555 - }
456 + if(boxLike(child)){
457 + return child;
556 556   }
557 557  
558 - return null;
559 - }
460 + var cr=child.getBoundingClientRect();
461 + var q=[];
560 560  
561 - /* =======================================================
562 - PLACEHOLDER BADGE
563 - ======================================================= */
463 + Array.from(child.children||[]).forEach(function(el){
464 + q.push({el:el,depth:1});
465 + });
564 564  
565 - function applyPlaceholderBadge(){
566 - if(!PLACEHOLDER)return;
467 + var best=null;
468 + var bestScore=-Infinity;
567 567  
568 - if(
569 - document.querySelector(
570 - ".sn-coming-soon-badge"
571 - )
572 - ){
573 - return;
574 - }
470 + while(q.length){
471 + var item=q.shift();
472 + var el=item.el;
575 575  
576 - var title=
577 - document.querySelector(
578 - "#document-title"
579 - )||
580 - document.querySelector(
581 - "h1"
582 - );
474 + if(!visible(el,MIN_W,MIN_H))continue;
583 583  
584 - if(!title)return;
476 + var r=el.getBoundingClientRect();
585 585  
586 - var badge=
587 - document.createElement(
588 - "span"
589 - );
478 + if(
479 + r.width>=cr.width*.68&&
480 + boxLike(el)
481 + ){
482 + var widthFit=
483 + 1-Math.min(
484 + 1,
485 + Math.abs(cr.width-r.width)/
486 + Math.max(1,cr.width)
487 + );
590 590  
591 - badge.className=
592 - "sn-coming-soon-badge";
489 + var topFit=
490 + 1-Math.min(
491 + 1,
492 + Math.abs(cr.top-r.top)/100
493 + );
593 593  
594 - badge.textContent=
595 - PLACEHOLDER_LABEL;
495 + var score=
496 + widthFit*6+
497 + topFit*3+
498 + Math.min(r.height,900)/450+
499 + Math.min(r.width*r.height,900000)/900000;
596 596  
597 - badge.setAttribute(
598 - "aria-label",
599 - PLACEHOLDER_LABEL
600 - );
501 + if(score>bestScore){
502 + best=el;
503 + bestScore=score;
504 + }
505 + }
601 601  
602 - title.appendChild(
603 - badge
604 - );
507 + if(item.depth<SEARCH_DEPTH){
508 + Array.from(el.children||[]).forEach(function(next){
509 + q.push({
510 + el:next,
511 + depth:item.depth+1
512 + });
513 + });
514 + }
515 + }
516 +
517 + return best;
605 605   }
606 606  
607 - /* =======================================================
608 - DETAIL PAGE OWN-ACCENT PROPAGATION
609 - ======================================================= */
520 + function groupsByVisualRow(entries){
521 + var groups=[];
610 610  
611 - function parseRGB(value){
612 - var match=String(value||"").match(
613 - /rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i
614 - );
523 + entries
524 + .slice()
525 + .sort(function(a,b){
526 + return (
527 + a.rect.top-b.rect.top||
528 + a.rect.left-b.rect.left
529 + );
530 + })
531 + .forEach(function(entry){
532 + var group=null;
615 615  
616 - if(!match)return null;
534 + for(var i=0;i<groups.length;i++){
535 + if(
536 + Math.abs(
537 + groups[i].top-
538 + entry.rect.top
539 + )<=ROW_TOLERANCE
540 + ){
541 + group=groups[i];
542 + break;
543 + }
544 + }
617 617  
618 - return [
619 - Number(match[1]),
620 - Number(match[2]),
621 - Number(match[3])
622 - ];
623 - }
546 + if(!group){
547 + group={
548 + top:entry.rect.top,
549 + entries:[]
550 + };
551 + groups.push(group);
552 + }
624 624  
625 - function distance(a,b){
626 - return Math.sqrt(
627 - Math.pow(a[0]-b[0],2)+
628 - Math.pow(a[1]-b[1],2)+
629 - Math.pow(a[2]-b[2],2)
630 - );
554 + group.entries.push(entry);
555 + });
556 +
557 + return groups;
631 631   }
632 632  
633 - function paletteMatch(cssColor){
634 - var rgb=parseRGB(cssColor);
560 + function validHorizontalGroup(group){
561 + if(group.entries.length<2)return false;
635 635  
636 - if(!rgb)return null;
563 + var lefts=
564 + group.entries
565 + .map(function(e){return e.rect.left;})
566 + .sort(function(a,b){return a-b;});
637 637  
638 - var palette=[
639 - {hex:"#21b6d7",rgb:[33,182,215]},
640 - {hex:"#e94b13",rgb:[233,75,19]},
641 - {hex:"#f0aa00",rgb:[240,170,0]},
642 - {hex:"#38b76a",rgb:[56,183,106]}
643 - ];
568 + if(
569 + lefts[lefts.length-1]-
570 + lefts[0]<
571 + 80
572 + ){
573 + return false;
574 + }
644 644  
645 - var best=null;
646 - var bestDistance=Infinity;
576 + var widths=
577 + group.entries
578 + .map(function(e){return e.rect.width;})
579 + .filter(function(w){return w>0;});
647 647  
648 - palette.forEach(function(item){
649 - var d=distance(rgb,item.rgb);
581 + if(widths.length<2)return false;
650 650  
651 - if(d<bestDistance){
652 - best=item;
653 - bestDistance=d;
654 - }
655 - });
583 + var minWidth=Math.min.apply(Math,widths);
584 + var maxWidth=Math.max.apply(Math,widths);
656 656  
657 - return bestDistance<=30
658 - ?best
659 - :null;
586 + return (
587 + maxWidth/
588 + Math.max(1,minWidth)<=
589 + 1.9
590 + );
660 660   }
661 661  
662 - function propagateDetailAccents(){
663 - if(PAGE_KIND!=="detail")return;
593 + function normalizeText(text){
594 + return String(text||"")
595 + .replace(/s+/g," ")
596 + .trim()
597 + .toUpperCase();
598 + }
664 664  
600 + function exactKnownFirstSection(el){
601 + var text=normalizeText(el.textContent);
602 +
603 + return (
604 + text==="HIER STARTEN"||
605 + text==="ORGANISIEREN & DOKUMENTIEREN"||
606 + text==="ENTSCHEIDEN"||
607 + text==="START HERE"||
608 + text==="GET STARTED"||
609 + text==="ORGANISE & DOCUMENT"||
610 + text==="ORGANIZE & DOCUMENT"||
611 + text==="DECIDE"
612 + );
613 + }
614 +
615 + function visuallyFirstSectionBar(card){
616 + var cardRect=card.getBoundingClientRect();
617 + var candidates=[];
618 +
665 665   Array.from(
666 - root.querySelectorAll(
667 - ".arsn-call,.dmp-call,.ido-call,.pp-call,"+
668 - ".arsn-source,.dmp-source,.ido-source,.pp-source"
620 + card.querySelectorAll(
621 + "div,p,span,strong,h3,h4,h5,h6"
669 669   )
670 670   ).forEach(function(el){
671 - if(!visible(el))return;
624 + if(!visible(el,20,6))return;
625 + if(excluded(el))return;
672 672  
673 - var style=getComputedStyle(el);
627 + var r=el.getBoundingClientRect();
628 + var relativeTop=r.top-cardRect.top;
674 674  
675 675   if(
676 - num(style.borderTopWidth)>=2
631 + relativeTop<45||
632 + relativeTop>cardRect.height*.72
677 677   ){
678 - var match=
679 - paletteMatch(
680 - style.borderTopColor
681 - );
682 -
683 - if(match){
684 - el.style.setProperty(
685 - "border-left",
686 - "4px solid "+match.hex,
687 - "important"
688 - );
689 - }
634 + return;
690 690   }
691 - });
692 692  
693 - // Warning families: explicit safety override.
694 - Array.from(
695 - root.querySelectorAll(
696 - ".arsn-warn,.dmp-warn,.ido-warn,.pp-warn,"+
697 - ".warn,.warning,.warningmessage,.errormessage"
698 - )
699 - ).forEach(function(el){
700 - if(!visible(el))return;
637 + var widthRatio=
638 + r.width/
639 + Math.max(1,cardRect.width);
701 701  
702 - el.style.setProperty(
703 - "border-left",
704 - "4px solid #e94b13",
705 - "important"
706 - );
707 - });
641 + if(
642 + widthRatio<.55||
643 + widthRatio>1.05||
644 + r.height>54
645 + ){
646 + return;
647 + }
708 708  
709 - // Info families: explicit orientation override.
710 - Array.from(
711 - root.querySelectorAll(
712 - ".arsn-info,.dmp-info,.ido-info,.pp-info,.infomessage"
713 - )
714 - ).forEach(function(el){
715 - if(!visible(el))return;
649 + var text=normalizeText(el.textContent);
716 716  
717 - el.style.setProperty(
718 - "border-left",
719 - "4px solid #21b6d7",
720 - "important"
721 - );
722 - });
723 - }
651 + if(
652 + text.length<2||
653 + text.length>90
654 + ){
655 + return;
656 + }
724 724  
725 - /* =======================================================
726 - OVERVIEW SEMANTIC THEME PALETTE
727 - ======================================================= */
658 + var style=getComputedStyle(el);
728 728  
729 - function smallestThemeHeaders(){
730 - return Array.from(
731 - root.querySelectorAll(
732 - "div,span,p,strong,h3,h4,h5,h6"
733 - )
734 - ).filter(function(el){
735 - if(!visible(el))return false;
736 - if(!themeFor(el.textContent))return false;
660 + var bg=
661 + style.backgroundColor&&
662 + style.backgroundColor!=="rgba(0, 0, 0, 0)"&&
663 + style.backgroundColor!=="transparent";
737 737  
738 - return !Array.from(
739 - el.children||[]
740 - ).some(function(child){
741 - return !!themeFor(
742 - child.textContent
743 - );
744 - });
745 - });
746 - }
747 -
748 - function findOverviewCard(header){
749 - var node=header.parentElement;
750 - var candidates=[];
751 -
752 - while(node&&node!==root){
753 - var rect=node.getBoundingClientRect();
754 - var style=getComputedStyle(node);
755 -
756 756   var border=
757 757   num(style.borderTopWidth)+
758 758   num(style.borderRightWidth)+
... ... @@ -759,674 +759,315 @@
759 759   num(style.borderBottomWidth)+
760 760   num(style.borderLeftWidth);
761 761  
762 - if(
763 - rect.width>=220&&
764 - rect.width<=800&&
765 - rect.height>=120&&
766 - border>=1
767 - ){
768 - candidates.push(node);
769 - }
671 + var mostlyUpper=
672 + text.length>=3&&
673 + text===text.toUpperCase();
770 770  
771 - node=node.parentElement;
772 - }
675 + var exact=exactKnownFirstSection(el);
773 773  
774 - if(!candidates.length)return null;
677 + var score=
678 + (exact?20:0)+
679 + (bg?6:0)+
680 + (border>=1?2:0)+
681 + (mostlyUpper?4:0)+
682 + (num(style.fontWeight)>=600?1:0);
775 775  
776 - candidates.sort(function(a,b){
777 - return (
778 - b.getBoundingClientRect().height-
779 - a.getBoundingClientRect().height
780 - );
684 + if(score>=7){
685 + candidates.push({
686 + el:el,
687 + relativeTop:relativeTop,
688 + width:r.width,
689 + score:score
690 + });
691 + }
781 781   });
782 782  
783 - return candidates[0];
784 - }
694 + if(!candidates.length)return null;
785 785  
786 - function rowCandidates(link,card){
787 - var result=[];
788 - var cardRect=
789 - card.getBoundingClientRect();
790 -
791 - var node=link;
792 -
793 - while(node&&node!==card){
794 - if(visible(node)){
795 - var rect=
796 - node.getBoundingClientRect();
797 -
798 - if(
799 - rect.height<=105&&
800 - rect.width>=
801 - cardRect.width*.50&&
802 - rect.width<=
803 - cardRect.width*1.03
804 - ){
805 - result.push(node);
806 - }
696 + candidates.sort(function(a,b){
697 + if(a.score!==b.score)return b.score-a.score;
698 + if(Math.abs(a.relativeTop-b.relativeTop)>3){
699 + return a.relativeTop-b.relativeTop;
807 807   }
701 + return b.width-a.width;
702 + });
808 808  
809 - node=node.parentElement;
810 - }
704 + // For exact known labels always prefer the earliest exact match.
705 + var exacts=candidates.filter(function(c){
706 + return exactKnownFirstSection(c.el);
707 + });
811 811  
812 - return result;
813 - }
814 -
815 - function chooseOuterRow(
816 - candidates,
817 - link
818 - ){
819 - if(!candidates.length){
820 - return link;
709 + if(exacts.length){
710 + exacts.sort(function(a,b){
711 + return a.relativeTop-b.relativeTop||b.width-a.width;
712 + });
713 + return exacts[0].el;
821 821   }
822 822  
823 - var bordered=
824 - candidates.filter(function(el){
825 - return (
826 - num(
827 - getComputedStyle(el)
828 - .borderLeftWidth
829 - )>=1
830 - );
831 - });
716 + // Generic fallback: earliest high-confidence bar.
717 + candidates.sort(function(a,b){
718 + return a.relativeTop-b.relativeTop||b.score-a.score||b.width-a.width;
719 + });
832 832  
833 - var pool=
834 - bordered.length
835 - ?bordered
836 - :candidates;
721 + return candidates[0].el;
722 + }
837 837  
838 - pool.sort(function(a,b){
839 - var ar=
840 - a.getBoundingClientRect();
724 + function alignFirstSections(cards){
725 + var rows=
726 + cards.map(function(card){
727 + var bar=
728 + visuallyFirstSectionBar(card);
841 841  
842 - var br=
843 - b.getBoundingClientRect();
730 + if(!bar)return null;
844 844  
845 - return (
846 - ar.left-br.left||
847 - br.width-ar.width
848 - );
849 - });
732 + var cardRect=
733 + card.getBoundingClientRect();
850 850  
851 - return pool[0]||link;
852 - }
735 + var barRect=
736 + bar.getBoundingClientRect();
853 853  
854 - function applyOverviewPalette(){
855 - if(PAGE_KIND!=="overview"){
856 - return [];
738 + return {
739 + card:card,
740 + bar:bar,
741 + relativeTop:
742 + barRect.top-cardRect.top,
743 + label:
744 + normalizeText(bar.textContent)
745 + };
746 + });
747 +
748 + // Conservative: only align when every card in the horizontal row
749 + // has a reliable first section bar.
750 + if(
751 + rows.some(function(row){
752 + return !row;
753 + })
754 + ){
755 + return null;
857 857   }
858 858  
859 - var headers=
860 - smallestThemeHeaders()
861 - .map(function(el){
862 - return {
863 - el:el,
864 - theme:
865 - themeFor(
866 - el.textContent
867 - ),
868 - card:
869 - findOverviewCard(
870 - el
871 - )
872 - };
758 + var targetTop=
759 + Math.max.apply(
760 + Math,
761 + rows.map(function(row){
762 + return row.relativeTop;
873 873   })
874 - .filter(function(row){
875 - return !!row.card;
876 - });
764 + );
877 877  
878 - var unique=[];
879 - var seenHeaders=new Set();
766 + rows.forEach(function(row){
767 + var delta=
768 + targetTop-
769 + row.relativeTop;
880 880  
881 - headers.forEach(function(row){
882 - var key=
883 - row.theme.name+
884 - "|"+
885 - Math.round(
886 - row.card
887 - .getBoundingClientRect()
888 - .left
889 - )+
890 - "|"+
891 - Math.round(
892 - row.el
893 - .getBoundingClientRect()
894 - .top
895 - );
771 + if(delta<=1)return;
896 896  
897 - if(!seenHeaders.has(key)){
898 - seenHeaders.add(key);
899 - unique.push(row);
900 - }
901 - });
902 -
903 - unique.forEach(function(row){
904 - var headerRect=
905 - row.el
906 - .getBoundingClientRect();
907 -
908 - row.el.style.setProperty(
909 - "background",
910 - row.theme.bg,
911 - "important"
773 + saveOriginal(
774 + row.bar,
775 + originalMarginTop,
776 + "margin-top"
912 912   );
913 913  
914 - row.el.style.setProperty(
915 - "color",
916 - row.theme.text,
917 - "important"
918 - );
779 + var currentMargin=
780 + num(
781 + getComputedStyle(
782 + row.bar
783 + ).marginTop
784 + );
919 919  
920 - row.el.style.setProperty(
921 - "text-align",
922 - "left",
923 - "important"
786 + row.bar.style.setProperty(
787 + "margin-top",
788 + (
789 + currentMargin+
790 + delta
791 + )+"px"
924 924   );
925 925  
926 - row.el.style.setProperty(
927 - "word-spacing",
928 - "normal",
929 - "important"
794 + row.bar.setAttribute(
795 + "data-sn-first-section-aligned",
796 + "4"
930 930   );
931 931  
932 - var later=
933 - unique
934 - .filter(function(other){
935 - return (
936 - other.card===row.card&&
937 - other.el
938 - .getBoundingClientRect()
939 - .top>
940 - headerRect.top+2
941 - );
942 - })
943 - .sort(function(a,b){
944 - return (
945 - a.el
946 - .getBoundingClientRect()
947 - .top-
948 - b.el
949 - .getBoundingClientRect()
950 - .top
951 - );
952 - });
953 -
954 - var stopTop=
955 - later.length
956 - ?later[0].el
957 - .getBoundingClientRect()
958 - .top
959 - :Infinity;
960 -
961 - Array.from(
962 - row.card.querySelectorAll("a")
963 - ).forEach(function(link){
964 - if(!visible(link))return;
965 -
966 - var rect=
967 - link.getBoundingClientRect();
968 -
969 - if(
970 - rect.top<=
971 - headerRect.bottom-2||
972 - rect.top>=
973 - stopTop-2
974 - ){
975 - return;
976 - }
977 -
978 - var candidates=
979 - rowCandidates(
980 - link,
981 - row.card
982 - );
983 -
984 - var target=
985 - chooseOuterRow(
986 - candidates,
987 - link
988 - );
989 -
990 - candidates.forEach(function(el){
991 - el.style.setProperty(
992 - "border-left",
993 - "0 solid transparent",
994 - "important"
995 - );
996 - });
997 -
998 - target.style.setProperty(
999 - "border-left",
1000 - "3px solid "+
1001 - row.theme.accent,
1002 - "important"
1003 - );
1004 -
1005 - target.style.setProperty(
1006 - "box-sizing",
1007 - "border-box",
1008 - "important"
1009 - );
1010 - });
799 + sectionManaged.add(row.bar);
1011 1011   });
1012 1012  
1013 - return unique;
802 + return {
803 + labels:
804 + rows.map(function(row){
805 + return row.label;
806 + }),
807 + targetRelativeTop:
808 + Math.round(targetTop)
809 + };
1014 1014   }
1015 1015  
1016 - /* =======================================================
1017 - OVERVIEW CARD HEIGHT + FIRST THEMATIC ROW
1018 - ======================================================= */
1019 -
1020 - function alignOverviewCards(headers){
1021 - if(
1022 - PAGE_KIND!=="overview"||
1023 - window.innerWidth<=MOBILE_MAX
1024 - ){
1025 - return;
812 + function applyGroup(group){
813 + if(!validHorizontalGroup(group)){
814 + return null;
1026 1026   }
1027 1027  
1028 1028   var cards=[];
1029 1029   var seen=new Set();
1030 1030  
1031 - headers.forEach(function(row){
1032 - if(!seen.has(row.card)){
1033 - seen.add(row.card);
1034 - cards.push(row.card);
820 + group.entries.forEach(function(entry){
821 + if(!seen.has(entry.target)){
822 + seen.add(entry.target);
823 + cards.push(entry.target);
1035 1035   }
1036 1036   });
1037 1037  
1038 - if(cards.length<2){
1039 - return;
1040 - }
827 + if(cards.length<2)return null;
1041 1041  
1042 - // Group cards by actual top position.
1043 - var groups=[];
829 + var firstSection=
830 + alignFirstSections(cards);
1044 1044  
1045 - cards.forEach(function(card){
1046 - var top=
1047 - card.getBoundingClientRect().top;
832 + // The section alignment can change natural card heights.
833 + // Measure only afterwards.
834 + var maxHeight=0;
1048 1048  
1049 - var group=null;
1050 -
1051 - for(var i=0;i<groups.length;i++){
1052 - if(
1053 - Math.abs(
1054 - groups[i].top-top
1055 - )<=ROW_TOLERANCE
1056 - ){
1057 - group=groups[i];
1058 - break;
1059 - }
1060 - }
1061 -
1062 - if(!group){
1063 - group={
1064 - top:top,
1065 - cards:[]
1066 - };
1067 - groups.push(group);
1068 - }
1069 -
1070 - group.cards.push(card);
836 + cards.forEach(function(card){
837 + maxHeight=Math.max(
838 + maxHeight,
839 + card.getBoundingClientRect().height
840 + );
1071 1071   });
1072 1072  
1073 - groups.forEach(function(group){
1074 - if(group.cards.length<2){
1075 - return;
1076 - }
843 + maxHeight=Math.ceil(maxHeight);
1077 1077  
1078 - var firstHeaders=
1079 - group.cards.map(function(card){
1080 - var candidates=
1081 - headers
1082 - .filter(function(row){
1083 - return row.card===card;
1084 - })
1085 - .sort(function(a,b){
1086 - return (
1087 - a.el
1088 - .getBoundingClientRect()
1089 - .top-
1090 - b.el
1091 - .getBoundingClientRect()
1092 - .top
1093 - );
1094 - });
845 + if(maxHeight<MIN_H)return null;
1095 1095  
1096 - return candidates.length
1097 - ?candidates[0]
1098 - :null;
1099 - });
847 + cards.forEach(function(card){
848 + saveOriginal(
849 + card,
850 + originalMinHeight,
851 + "min-height"
852 + );
1100 1100  
1101 - if(
1102 - !firstHeaders.some(function(row){
1103 - return !row;
1104 - })
1105 - ){
1106 - var targetTop=
1107 - Math.max.apply(
1108 - Math,
1109 - firstHeaders.map(function(row){
1110 - return (
1111 - row.el
1112 - .getBoundingClientRect()
1113 - .top-
1114 - row.card
1115 - .getBoundingClientRect()
1116 - .top
1117 - );
1118 - })
1119 - );
854 + card.style.setProperty(
855 + "min-height",
856 + maxHeight+"px"
857 + );
1120 1120  
1121 - firstHeaders.forEach(function(row){
1122 - var relativeTop=
1123 - row.el
1124 - .getBoundingClientRect()
1125 - .top-
1126 - row.card
1127 - .getBoundingClientRect()
1128 - .top;
859 + card.setAttribute(
860 + "data-sn-equal-height-managed",
861 + "4"
862 + );
1129 1129  
1130 - var delta=
1131 - targetTop-relativeTop;
1132 -
1133 - if(delta>1){
1134 - saveStyle(
1135 - row.el,
1136 - originalMargin,
1137 - "margin-top"
1138 - );
1139 -
1140 - var current=
1141 - num(
1142 - getComputedStyle(
1143 - row.el
1144 - ).marginTop
1145 - );
1146 -
1147 - row.el.style.setProperty(
1148 - "margin-top",
1149 - (
1150 - current+delta
1151 - )+"px"
1152 - );
1153 -
1154 - row.el.setAttribute(
1155 - "data-sn-master-first-row",
1156 - "1"
1157 - );
1158 -
1159 - managedMargin.add(
1160 - row.el
1161 - );
1162 - }
1163 - });
1164 - }
1165 -
1166 - var maxHeight=0;
1167 -
1168 - group.cards.forEach(function(card){
1169 - maxHeight=
1170 - Math.max(
1171 - maxHeight,
1172 - card
1173 - .getBoundingClientRect()
1174 - .height
1175 - );
1176 - });
1177 -
1178 - maxHeight=
1179 - Math.ceil(maxHeight);
1180 -
1181 - group.cards.forEach(function(card){
1182 - saveStyle(
1183 - card,
1184 - originalHeight,
1185 - "min-height"
1186 - );
1187 -
1188 - card.style.setProperty(
1189 - "min-height",
1190 - maxHeight+"px"
1191 - );
1192 -
1193 - card.setAttribute(
1194 - "data-sn-master-equal-height",
1195 - "1"
1196 - );
1197 -
1198 - managedHeight.add(
1199 - card
1200 - );
1201 - });
864 + heightManaged.add(card);
1202 1202   });
866 +
867 + return {
868 + cards:cards.length,
869 + height:maxHeight,
870 + firstSection:firstSection
871 + };
1203 1203   }
1204 1204  
1205 - /* =======================================================
1206 - DETAIL GRID EQUAL HEIGHT, DESKTOP ONLY
1207 - ======================================================= */
874 + function run(){
875 + reset();
1208 1208  
1209 - function equaliseDetailGrids(){
1210 1210   if(
1211 - PAGE_KIND!=="detail"||
1212 1212   window.innerWidth<=MOBILE_MAX
1213 1213   ){
1214 1214   return;
1215 1215   }
1216 1216  
1217 - var selectors=[
1218 - ".arsn-grid",
1219 - ".arsn-grid-2",
1220 - ".arsn-grid-3",
1221 - ".dmp-grid",
1222 - ".ido-grid",
1223 - ".pp-grid"
1224 - ];
1225 -
1226 - selectors.forEach(function(selector){
883 + var parents=
1227 1227   Array.from(
1228 - root.querySelectorAll(selector)
1229 - ).forEach(function(grid){
1230 - var children=
1231 - Array.from(
1232 - grid.children||[]
1233 - ).filter(visible);
885 + root.querySelectorAll("*")
886 + ).filter(function(parent){
887 + return (
888 + visible(parent,MIN_W,MIN_H)&&
889 + parent.children&&
890 + parent.children.length>=2&&
891 + parent.children.length<=MAX_PARENT_CHILDREN
892 + );
893 + });
1234 1234  
1235 - if(children.length<2){
1236 - return;
1237 - }
895 + var touched=new Set();
1238 1238  
1239 - var groups=[];
897 + parents.forEach(function(parent){
898 + var entries=[];
1240 1240  
1241 - children.forEach(function(child){
1242 - var top=
1243 - child
1244 - .getBoundingClientRect()
1245 - .top;
900 + Array.from(parent.children).forEach(function(child){
901 + if(!visible(child,MIN_W,MIN_H))return;
1246 1246  
1247 - var group=null;
903 + var target=pickTarget(child);
904 + if(!target)return;
1248 1248  
1249 - for(var i=0;i<groups.length;i++){
1250 - if(
1251 - Math.abs(
1252 - groups[i].top-top
1253 - )<=ROW_TOLERANCE
1254 - ){
1255 - group=groups[i];
1256 - break;
1257 - }
1258 - }
1259 -
1260 - if(!group){
1261 - group={
1262 - top:top,
1263 - items:[]
1264 - };
1265 - groups.push(group);
1266 - }
1267 -
1268 - group.items.push(child);
906 + entries.push({
907 + target:target,
908 + rect:target.getBoundingClientRect()
1269 1269   });
910 + });
1270 1270  
1271 - groups.forEach(function(group){
1272 - if(group.items.length<2){
1273 - return;
1274 - }
912 + if(entries.length<2)return;
1275 1275  
1276 - var maxHeight=0;
914 + groupsByVisualRow(entries).forEach(function(group){
915 + if(!validHorizontalGroup(group))return;
1277 1277  
1278 - group.items.forEach(function(item){
1279 - maxHeight=
1280 - Math.max(
1281 - maxHeight,
1282 - item
1283 - .getBoundingClientRect()
1284 - .height
1285 - );
917 + var signature=
918 + group.entries.map(function(entry){
919 + return entry.target;
1286 1286   });
1287 1287  
1288 - maxHeight=
1289 - Math.ceil(maxHeight);
922 + if(
923 + !signature.some(function(el){
924 + return !touched.has(el);
925 + })
926 + ){
927 + return;
928 + }
1290 1290  
1291 - group.items.forEach(function(item){
1292 - saveStyle(
1293 - item,
1294 - originalHeight,
1295 - "min-height"
1296 - );
930 + var applied=
931 + applyGroup(group);
1297 1297  
1298 - item.style.setProperty(
1299 - "min-height",
1300 - maxHeight+"px"
1301 - );
1302 -
1303 - item.setAttribute(
1304 - "data-sn-master-equal-height",
1305 - "1"
1306 - );
1307 -
1308 - managedHeight.add(item);
933 + if(applied){
934 + signature.forEach(function(el){
935 + touched.add(el);
1309 1309   });
1310 - });
937 + }
1311 1311   });
1312 1312   });
1313 1313   }
1314 1314  
1315 - /* =======================================================
1316 - RUN / RESPONSIVE SCHEDULING
1317 - ======================================================= */
942 + function schedule(){
943 + if(raf)cancelAnimationFrame(raf);
1318 1318  
1319 - function run(){
1320 - if(running)return;
1321 -
1322 - running=true;
1323 -
1324 - try{
1325 - resetRuntime();
1326 - applyPlaceholderBadge();
1327 - propagateDetailAccents();
1328 -
1329 - var headers=
1330 - applyOverviewPalette();
1331 -
1332 - if(
1333 - window.innerWidth>
1334 - MOBILE_MAX
1335 - ){
1336 - alignOverviewCards(
1337 - headers
1338 - );
1339 -
1340 - equaliseDetailGrids();
1341 - }
1342 - }finally{
1343 - running=false;
1344 - }
945 + raf=requestAnimationFrame(function(){
946 + raf=requestAnimationFrame(function(){
947 + raf=0;
948 + run();
949 + });
950 + });
1345 1345   }
1346 1346  
1347 - function onResize(){
1348 - if(resizeTimer){
1349 - clearTimeout(
1350 - resizeTimer
1351 - );
1352 - }
953 + addEventListener("resize",schedule,{passive:true});
954 + addEventListener("load",schedule,{once:true});
1353 1353  
1354 - resizeTimer=
1355 - setTimeout(
1356 - function(){
1357 - resizeTimer=0;
1358 - run();
1359 - },
1360 - RESIZE_DEBOUNCE
1361 - );
1362 - }
956 + root.addEventListener(
957 + "click",
958 + function(){
959 + setTimeout(schedule,0);
960 + },
961 + true
962 + );
1363 1363  
1364 - async function waitForReady(){
1365 - if(
1366 - document.readyState!=="complete"
1367 - ){
1368 - await new Promise(function(resolve){
1369 - window.addEventListener(
1370 - "load",
1371 - resolve,
1372 - {once:true}
1373 - );
1374 - });
964 + Array.from(root.querySelectorAll("img")).forEach(function(img){
965 + if(!img.complete){
966 + img.addEventListener("load",schedule,{once:true});
1375 1375   }
968 + });
1376 1376  
1377 - if(
1378 - document.fonts&&
1379 - document.fonts.ready
1380 - ){
1381 - try{
1382 - await document.fonts.ready;
1383 - }catch(error){}
1384 - }
1385 -
1386 - var images=
1387 - Array.from(
1388 - root.querySelectorAll("img")
1389 - );
1390 -
1391 - await Promise.all(
1392 - images.map(function(img){
1393 - if(img.complete){
1394 - return Promise.resolve();
1395 - }
1396 -
1397 - return new Promise(function(resolve){
1398 - var done=function(){
1399 - resolve();
1400 - };
1401 -
1402 - img.addEventListener(
1403 - "load",
1404 - done,
1405 - {once:true}
1406 - );
1407 -
1408 - img.addEventListener(
1409 - "error",
1410 - done,
1411 - {once:true}
1412 - );
1413 - });
1414 - })
1415 - );
1416 -
1417 - run();
970 + if(document.fonts&&document.fonts.ready){
971 + document.fonts.ready.then(schedule);
1418 1418   }
1419 1419  
1420 - window.addEventListener(
1421 - "resize",
1422 - onResize,
1423 - {passive:true}
1424 - );
1425 -
1426 - waitForReady();
974 + schedule();
975 + setTimeout(schedule,200);
976 + setTimeout(schedule,650);
977 + setTimeout(schedule,1400);
1427 1427  })();
1428 1428  </script>
1429 -
1430 -<!-- SN_SERVICE_NAVIGATOR_MASTER_STYLE_END -->
980 +<!-- SN_HORIZONTAL_BOX_HARMONIZER_END -->
1431 1431  {{/html}}
1432 1432