Skip to content

Commit d7e85e7

Browse files
committed
browse paths and collapse
1 parent 5f1db69 commit d7e85e7

2 files changed

Lines changed: 59 additions & 29 deletions

File tree

browse.html

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@
2626
.noUi-handle { display: none; }
2727
.noUi-horizontal { height: 8px; }
2828

29+
/* Navbar font and icon sizing */
30+
.navbar-brand { font-size: 24px; line-height: 50px; height: 50px; padding: 0 15px; display: flex; align-items: center; }
31+
.banner-icon { font-size: 40px; margin-right: 10px; }
32+
.banner-text { font-size: 24px; }
33+
.nav-text { font-size: 18px; }
34+
.navbar-nav > li > a { font-size: 18px; line-height: 50px; padding-top: 0; padding-bottom: 0; }
35+
2936
footer { text-align: center; }
3037
</style>
3138
</head>
3239
<body>
33-
<script src="resources/js/jquery.min.js"></script>
34-
<script src="resources/js/navbar-search.js"></script>
40+
<script src="/resources/js/jquery.min.js"></script>
41+
<script src="/resources/js/navbar-search.js"></script>
3542
<div id="navbar-container"></div>
3643
<div class="container-fluid">
3744
<div class="row">
@@ -294,8 +301,8 @@ <h2>Browse Manuscripts</h2>
294301
return periodFields.includes(key) ? val.join('. ') : val.join(', ');
295302
};
296303

297-
// Create content summary from all title fields
298-
const titleFields = ['titleStmt', 'msItemTitle', 'rubric', 'syrTitle'];
304+
// Create syriac content summary from all title fields
305+
const titleFields = ['syrTitle','rubric','incipit','explicit','finalRubric'];
299306
const allTitles = [];
300307
titleFields.forEach(field => {
301308
if (item[field]) {
@@ -309,39 +316,62 @@ <h2>Browse Manuscripts</h2>
309316
let contentSummary = allTitles.join(' ');
310317
// Strip HTML tags
311318
contentSummary = contentSummary.replace(/<[^>]*>/g, '');
312-
const truncated = contentSummary.length > 500;
313-
const displayContent = truncated ? contentSummary.substring(0, 500) : contentSummary;
314-
315-
let msUrl = item.id ? `${BASE_URL}/ms/${item.id.replace('ms-', '')}.html` : '#';
319+
const truncated = contentSummary.length > 100;
320+
const displayContent = truncated ? contentSummary.substring(0, 100) : contentSummary;
321+
// const truncatedNote = item.contentsNote && item.contentsNote.length > 100;
322+
// displayContentNote = truncatedNote ? item.contentsNote.substring(0, 100) : item.contentsNote;
323+
const itemTitle = formatValue(item.msItemTitle, 'msItemTitle') || '';
324+
const trucatedItemTitle = itemTitle.length > 100;
325+
const displayItemTitle = trucatedItemTitle ? itemTitle.substring(0, 100) : itemTitle;
326+
let msUrl = item.id ? `${BASE_URL}/ms/${item.id.replace('ms-', '').replace(/-part\d+$/, '')}.html` : '#';
316327
if (item.partNum) {
317-
msUrl= item.id ? `${BASE_URL}/${item.id.replace('-', '/').replace('/part','')}.html#msPart${item.partNum}` : '#';
328+
msUrl = `${msUrl}#msPart${item.partNum}`;
318329
}
319-
320-
321330

331+
322332
return `
323-
<div class="result-item">
324-
<strong>${item.displayTitleEnglish ? `<p>${formatValue(item.displayTitleEnglish, 'displayTitleEnglish')}</strong></p>` : ''}
325-
${contentSummary ? `<p><strong>Content:</strong> <span class="content-text" id="content-${index}">${displayContent}${truncated ? '' : ''}</span>${truncated ? ` <a href="#" class="show-more" data-index="${index}" data-full="${contentSummary.replace(/"/g, '&quot;')}">...</a>` : ''}</p>` : ''}
326-
<p><strong>Shelfmark:</strong> ${formatValue(item.shelfmark, 'shelfmark') || 'N/A'}</p>
327-
<p>URL: <a href="${msUrl}" target="_blank">${item.idno}</a></p>
328-
<small class="text-muted">
329-
${item.material ? `Material: ${formatValue(item.material, 'material')} | ` : ''}
330-
${item.script ? `Script: ${formatValue(item.scriptLanguage, 'script')} | ` : ''}
331-
${item.classification ? `Classification: ${formatValue(item.classification, 'classification')}` : ''}
332-
</small>
333-
</div>
334-
`}).join('');
333+
<div class="result-item" style="padding:15px; border:1px solid #ddd; margin-bottom:10px; border-radius:5px;">
334+
<p><strong></strong> ${formatValue(item.shelfmark, 'shelfmark') || ''}
335+
${item.wrightNum ? `${formatValue(item.wrightNum, 'wrightNum')} ` : ''}
336+
</p>
337+
<p>URI: <a href="${msUrl}" target="_blank">${item.idno}</a></p>
338+
<p>${item.origDate ? `${formatValue(item.origDate, 'origDate')}` : ''}${item.origPlace ? ` | ${formatValue(item.origPlace, 'origPlace')}` : ''}</p>
339+
<p class="text-muted">
340+
${item.scriptLanguage ? `Script: ${item.scriptLanguage} ` : ''}
341+
${item.material ? `| ${formatValue(item.material, 'material')} ` : ''}
342+
${item.form ? ` ${formatValue(item.form, 'material')} ` : ''}
343+
${item.extent ? `| ${formatValue(item.extent, 'extent')} ` : ''}
344+
</p>
345+
<p> ${item.classification ? `Classification: ${formatValue(item.classification, 'classification')}` : ''}</p>
346+
<p id="title-${index}"><em>${displayItemTitle}</em>${trucatedItemTitle ? ` <a href="#" class="toggle-more" data-index="${index}" data-type="title" data-full="${itemTitle.replace(/"/g, '&quot;')}" data-short="${displayItemTitle.replace(/"/g, '&quot;')}">...</a>` : ''}</p>
347+
<p id="content-${index}"><span class="syriac tei-quote" lang="syr">Syriac Content: ${displayContent}</span>${truncated ? `<a href="#" class="toggle-more" data-index="${index}" data-type="content" data-full="${contentSummary.replace(/"/g, '&quot;')}" data-short="${displayContent.replace(/"/g, '&quot;')}">...</a>` : ''}</p>
348+
</div>
349+
`}).join('');
335350

336351
$('#results').html(resultsHtml || '<div class="alert alert-info">No results found</div>');
337352

338-
// Add click handler for show more links
339-
$('.show-more').on('click', function(e) {
353+
// Add click handler for toggle more links
354+
$(document).on('click', '.toggle-more', function(e) {
340355
e.preventDefault();
341356
const index = $(this).data('index');
357+
const type = $(this).data('type');
342358
const full = $(this).data('full');
343-
$(`#content-${index}`).text(full);
344-
$(this).remove();
359+
const short = $(this).data('short');
360+
const isExpanded = $(this).text() === '...';
361+
362+
if (type === 'title') {
363+
if (isExpanded) {
364+
$(`#title-${index}`).html(`<em>${full}</em> <a href="#" class="toggle-more" data-index="${index}" data-type="title" data-full="${full}" data-short="${short}">collapse</a>`);
365+
} else {
366+
$(`#title-${index}`).html(`<em>${short}</em> <a href="#" class="toggle-more" data-index="${index}" data-type="title" data-full="${full}" data-short="${short}">...</a>`);
367+
}
368+
} else if (type === 'content') {
369+
if (isExpanded) {
370+
$(`#content-${index}`).html(`<span class="syriac">${full}</span> <a href="#" class="toggle-more" data-index="${index}" data-type="content" data-full="${full}" data-short="${short}">collapse</a>`);
371+
} else {
372+
$(`#content-${index}`).html(`<span class="syriac tei-quote" lang="syr">Syriac Content: ${short}</span><a href="#" class="toggle-more" data-index="${index}" data-type="content" data-full="${full}" data-short="${short}">...</a>`);
373+
}
374+
}
345375
});
346376
}
347377

dev-browse.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ <h2>Browse Manuscripts</h2>
323323
const itemTitle = formatValue(item.msItemTitle, 'msItemTitle') || '';
324324
const trucatedItemTitle = itemTitle.length > 100;
325325
const displayItemTitle = trucatedItemTitle ? itemTitle.substring(0, 100) : itemTitle;
326-
let msUrl = item.id ? `${BASE_URL}/ms/${item.id.replace('ms-', '')}.html` : '#';
326+
let msUrl = item.id ? `${BASE_URL}/ms/${item.id.replace('ms-', '').replace(/-part\d+$/, '')}.html` : '#';
327327
if (item.partNum) {
328-
msUrl = item.id ? `${BASE_URL}/${item.id.replace('-', '/').replace('/part','.html#msPart')}` : '#';
328+
msUrl = `${msUrl}#msPart${item.partNum}`;
329329
}
330330

331331

0 commit comments

Comments
 (0)