AnnLior commited on
Commit
a852d41
·
verified ·
1 Parent(s): bc7d3d4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +15 -2
index.html CHANGED
@@ -140,6 +140,7 @@ button:disabled{opacity:.5;cursor:not-allowed}
140
  .crumb-subheading{background:var(--crumb-subheading-bg);color:var(--crumb-subheading-text)}
141
  .crumb-sep{color:var(--status);font-weight:400}
142
  .found-quote{font-size:14px;color:var(--note-match-text);line-height:1.65;padding-left:2px}
 
143
  .empty{color:var(--empty)}
144
  .unique-banner{background:var(--banner-bg);border:1px solid var(--banner-border);color:var(--banner-text);border-radius:10px;padding:16px 18px;font-size:15px;font-weight:600}
145
  .by-chunk-header{font-size:16px;font-weight:700;padding:10px 14px;border-radius:8px;margin-bottom:8px}
@@ -751,10 +752,22 @@ function renderResults(data,useAdaptive){
751
  }
752
  const matches=[];
753
  for(const segs of r.segs)for(const s of segs)if(s.is_match)matches.push(s);
 
 
754
  for(const m of matches){
 
 
 
 
 
 
 
 
755
  html+=`<div class="found-item">`;
756
- html+=`<div class="found-source"><span class="found-label">Найдено в</span> ${leafPath(m.article)}<span class="found-colon">:</span></div>`;
757
- html+=`<div class="found-quote"><span class="pct-badge">${Math.round(m.score)}%</span> — «${escapeHtml(m.fragment)}»</div>`;
 
 
758
  html+=`</div>`;
759
  }
760
  }
 
140
  .crumb-subheading{background:var(--crumb-subheading-bg);color:var(--crumb-subheading-text)}
141
  .crumb-sep{color:var(--status);font-weight:400}
142
  .found-quote{font-size:14px;color:var(--note-match-text);line-height:1.65;padding-left:2px}
143
+ .found-quote-sep{border-top:1px dashed var(--split-border);margin-top:8px;padding-top:8px}
144
  .empty{color:var(--empty)}
145
  .unique-banner{background:var(--banner-bg);border:1px solid var(--banner-border);color:var(--banner-text);border-radius:10px;padding:16px 18px;font-size:15px;font-weight:600}
146
  .by-chunk-header{font-size:16px;font-weight:700;padding:10px 14px;border-radius:8px;margin-bottom:8px}
 
752
  }
753
  const matches=[];
754
  for(const segs of r.segs)for(const s of segs)if(s.is_match)matches.push(s);
755
+ const groups=[];
756
+ const groupByLeaf=new Map();
757
  for(const m of matches){
758
+ if(!groupByLeaf.has(m.article)){
759
+ const g={leaf:m.article,items:[]};
760
+ groupByLeaf.set(m.article,g);
761
+ groups.push(g);
762
+ }
763
+ groupByLeaf.get(m.article).items.push(m);
764
+ }
765
+ for(const g of groups){
766
  html+=`<div class="found-item">`;
767
+ html+=`<div class="found-source"><span class="found-label">Найдено в</span>&nbsp;${leafPath(g.leaf)}<span class="found-colon">:</span></div>`;
768
+ g.items.forEach((m,i)=>{
769
+ html+=`<div class="found-quote${i>0?" found-quote-sep":""}"><span class="pct-badge">${Math.round(m.score)}%</span> — «${escapeHtml(m.fragment)}»</div>`;
770
+ });
771
  html+=`</div>`;
772
  }
773
  }