Skip to content

Commit feb04ca

Browse files
Convert Transcript contentViews to CustomHTML
1 parent 2a343f9 commit feb04ca

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

src/_shared/modules/Database/module.js

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,49 @@
13701370
"clipTimeVisible": hypervideos[thisHypervideoID].config.clipTimeVisible,
13711371
"hidden": hypervideos[thisHypervideoID].hidden,
13721372
"theme": hypervideos[thisHypervideoID].config.theme || "",
1373-
"layoutArea": (FrameTrail.module('ViewLayout') && FrameTrail.module('ViewLayout').getLayoutAreaData)
1374-
? FrameTrail.module('ViewLayout').getLayoutAreaData()
1375-
: hypervideos[thisHypervideoID].config.layoutArea
1373+
"layoutArea": (function () {
1374+
var layoutArea = (FrameTrail.module('ViewLayout') && FrameTrail.module('ViewLayout').getLayoutAreaData)
1375+
? FrameTrail.module('ViewLayout').getLayoutAreaData()
1376+
: hypervideos[thisHypervideoID].config.layoutArea;
1377+
1378+
// Convert Transcript contentViews to CustomHTML so exports are self-contained
1379+
var areas = ['areaTop', 'areaBottom', 'areaLeft', 'areaRight'];
1380+
for (var a = 0; a < areas.length; a++) {
1381+
var areaKey = areas[a];
1382+
if (!layoutArea[areaKey]) continue;
1383+
for (var cv = 0; cv < layoutArea[areaKey].length; cv++) {
1384+
var cvData = layoutArea[areaKey][cv];
1385+
if (cvData.type === 'Transcript' && cvData.transcriptSource) {
1386+
var subs = subtitles[cvData.transcriptSource];
1387+
if (subs && subs.cues) {
1388+
var html = '<div class="transcriptContainer">';
1389+
for (var c = 0; c < subs.cues.length; c++) {
1390+
var cue = subs.cues[c];
1391+
html += '<span class="timebased" data-start="' + cue.startTime + '" data-end="' + cue.endTime + '">'
1392+
+ cue.text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
1393+
+ ' </span>';
1394+
}
1395+
html += '</div>';
1396+
layoutArea[areaKey][cv] = {
1397+
type: 'CustomHTML',
1398+
name: cvData.name,
1399+
icon: cvData.icon,
1400+
cssClass: cvData.cssClass,
1401+
html: html,
1402+
collectionFilter: cvData.collectionFilter,
1403+
contentSize: cvData.contentSize,
1404+
onClickContentItem: cvData.onClickContentItem,
1405+
initClosed: cvData.initClosed,
1406+
filterAspect: cvData.filterAspect,
1407+
zoomControls: cvData.zoomControls
1408+
};
1409+
}
1410+
}
1411+
}
1412+
}
1413+
1414+
return layoutArea;
1415+
})()
13761416
},
13771417
"clips": hypervideos[thisHypervideoID].clips,
13781418
"globalEvents": (codeSnippets.globalEvents) ? codeSnippets.globalEvents : {},

0 commit comments

Comments
 (0)