Skip to content

Commit 4bda4b2

Browse files
committed
Show first 2 sources inline with +N more popup, widen header bar
1 parent 7fd8b5d commit 4bda4b2

4 files changed

Lines changed: 24 additions & 24 deletions

File tree

gene.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
background-color: #1b1c1d;
2424
color: white;
2525
text-decoration: none;
26-
padding-top: 20px;
27-
padding-bottom: 5px;
26+
padding-top: 25px;
27+
padding-bottom: 10px;
2828
display: flex;
2929
justify-content: space-between;
3030
align-items: center;
@@ -981,17 +981,17 @@
981981
const match = sourcesStr.match(/^(\d+):\s*(.*)$/)
982982
if (!match) return sourcesStr
983983

984-
const count = match[1]
985984
const sourcesList = match[2].split(',').map(s => s.trim())
986985

987986
const pastelColors = ['#e8d5d5', '#d5dfe8', '#d5e8db', '#e8e2d5', '#ddd5e8', '#d5e8e6', '#e8d5e0', '#e0e8d5']
988987

989-
const badges = sourcesList.map((src, i) => {
990-
const bg = pastelColors[i % pastelColors.length]
991-
return `<span class="ui mini label" style="background-color: ${bg}; color: #333; margin: 1px;">${src}</span>`
992-
}).join(' ')
988+
const makeBadge = (src, i) => `<span class="ui mini label" style="background-color: ${pastelColors[i % pastelColors.length]}; color: #333; margin: 1px;">${src}</span>`
989+
990+
const inlineBadges = sourcesList.slice(0, 2).map(makeBadge).join(' ')
991+
if (sourcesList.length <= 2) return inlineBadges
993992

994-
return `<span class="show-popup action-link" data-html="${badges.replace(/"/g, '&quot;')}">${count} sources</span>`
993+
const allBadges = sourcesList.map(makeBadge).join(' ')
994+
return `${inlineBadges} <span class="show-popup action-link" data-html="${allBadges.replace(/"/g, '&quot;')}">(+${sourcesList.length - 2} more)</span>`
995995
}
996996

997997
const getTruncatedText = (text, maxLen=80) => {

index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
background-color: #1b1c1d;
2525
color: white;
2626
text-decoration: none;
27-
padding-top: 20px;
28-
padding-bottom: 5px;
27+
padding-top: 25px;
28+
padding-bottom: 10px;
2929
display: flex;
3030
justify-content: space-between;
3131
align-items: center;
@@ -982,17 +982,17 @@
982982
const match = sourcesStr.match(/^(\d+):\s*(.*)$/)
983983
if (!match) return sourcesStr
984984

985-
const count = match[1]
986985
const sourcesList = match[2].split(',').map(s => s.trim())
987986

988987
const pastelColors = ['#e8d5d5', '#d5dfe8', '#d5e8db', '#e8e2d5', '#ddd5e8', '#d5e8e6', '#e8d5e0', '#e0e8d5']
989988

990-
const badges = sourcesList.map((src, i) => {
991-
const bg = pastelColors[i % pastelColors.length]
992-
return `<span class="ui mini label" style="background-color: ${bg}; color: #333; margin: 1px;">${src}</span>`
993-
}).join(' ')
989+
const makeBadge = (src, i) => `<span class="ui mini label" style="background-color: ${pastelColors[i % pastelColors.length]}; color: #333; margin: 1px;">${src}</span>`
990+
991+
const inlineBadges = sourcesList.slice(0, 2).map(makeBadge).join(' ')
992+
if (sourcesList.length <= 2) return inlineBadges
994993

995-
return `<span class="show-popup action-link" data-html="${badges.replace(/"/g, '&quot;')}">${count} sources</span>`
994+
const allBadges = sourcesList.map(makeBadge).join(' ')
995+
return `${inlineBadges} <span class="show-popup action-link" data-html="${allBadges.replace(/"/g, '&quot;')}">(+${sourcesList.length - 2} more)</span>`
996996
}
997997

998998
const getTruncatedText = (text, maxLen=80) => {

website/header_template.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,17 @@
170170
const match = sourcesStr.match(/^(\d+):\s*(.*)$/)
171171
if (!match) return sourcesStr
172172

173-
const count = match[1]
174173
const sourcesList = match[2].split(',').map(s => s.trim())
175174

176175
const pastelColors = ['#e8d5d5', '#d5dfe8', '#d5e8db', '#e8e2d5', '#ddd5e8', '#d5e8e6', '#e8d5e0', '#e0e8d5']
177176

178-
const badges = sourcesList.map((src, i) => {
179-
const bg = pastelColors[i % pastelColors.length]
180-
return `<span class="ui mini label" style="background-color: ${bg}; color: #333; margin: 1px;">${src}</span>`
181-
}).join(' ')
177+
const makeBadge = (src, i) => `<span class="ui mini label" style="background-color: ${pastelColors[i % pastelColors.length]}; color: #333; margin: 1px;">${src}</span>`
182178

183-
return `<span class="show-popup action-link" data-html="${badges.replace(/"/g, '&quot;')}">${count} sources</span>`
179+
const inlineBadges = sourcesList.slice(0, 2).map(makeBadge).join(' ')
180+
if (sourcesList.length <= 2) return inlineBadges
181+
182+
const allBadges = sourcesList.map(makeBadge).join(' ')
183+
return `${inlineBadges} <span class="show-popup action-link" data-html="${allBadges.replace(/"/g, '&quot;')}">(+${sourcesList.length - 2} more)</span>`
184184
}
185185

186186
const getTruncatedText = (text, maxLen=80) => {

website/styles_for_all_pages.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
background-color: #1b1c1d;
1111
color: white;
1212
text-decoration: none;
13-
padding-top: 20px;
14-
padding-bottom: 5px;
13+
padding-top: 25px;
14+
padding-bottom: 10px;
1515
display: flex;
1616
justify-content: space-between;
1717
align-items: center;

0 commit comments

Comments
 (0)