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