forked from nm3clol/nm3clol-express-app
Switched video player to use modular breadcrumbs feature.
This commit is contained in:
parent
76a460abcd
commit
ece488c177
|
@ -173,7 +173,16 @@ export default function () {
|
||||||
else {
|
else {
|
||||||
let info = JSON.parse((await readFile(fullFilePath)).toString());
|
let info = JSON.parse((await readFile(fullFilePath)).toString());
|
||||||
let subtitleVTT = fs.existsSync(subtitleFile) ? (await readFile(subtitleFile)).toString() : '';
|
let subtitleVTT = fs.existsSync(subtitleFile) ? (await readFile(subtitleFile)).toString() : '';
|
||||||
const renderData = { route, filePath, fullFilePath, req, paths, directory: path.join('public', directory), videoURL, subtitleURL, subtitleVTT, info };
|
let breadcrumbs: Breadcrumb[] = [];
|
||||||
|
paths.forEach((path, index, paths) => {
|
||||||
|
if (index == 0) {
|
||||||
|
breadcrumbs.push({ title: config.siteName, url: '/' });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
breadcrumbs.push({ title: helpers.getDirectoryName(path.name).replaceAll('_', ' ').replaceAll('-', ' '), url: `/${path.url}` });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const renderData = { breadcrumbs, route, filePath, fullFilePath, req, paths, directory: path.join('public', directory), videoURL, subtitleURL, subtitleVTT, info };
|
||||||
res.render("video-player", { h: helpers, ...renderData });
|
res.render("video-player", { h: helpers, ...renderData });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,7 +27,7 @@ console.log(`Assigning /search route to search router.`);
|
||||||
app.use('/search', searchRouter());
|
app.use('/search', searchRouter());
|
||||||
// app.use('/advanced-search', advancedSearch.router);
|
// app.use('/advanced-search', advancedSearch.router);
|
||||||
|
|
||||||
// Search endpoints
|
// Page endpoints
|
||||||
console.log(`Assigning / route to page router.`);
|
console.log(`Assigning / route to page router.`);
|
||||||
app.use('/', pageRouter());
|
app.use('/', pageRouter());
|
||||||
|
|
||||||
|
|
|
@ -12,25 +12,7 @@
|
||||||
|
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<header>
|
<header>
|
||||||
<h1 class="mt-5" style="font-family: 'Covered By Your Grace'">
|
<%- include('./includes/breadcrumbs.ejs') %>
|
||||||
<% paths.forEach(function(value, index) { %>
|
|
||||||
<% if (h.shouldShowDirectorySeparator(index)) { %>
|
|
||||||
<span class="separator">› </span>
|
|
||||||
<% } %>
|
|
||||||
<% if (h.shouldShowSiteWelcomeMessage(paths)) { %>
|
|
||||||
<i> </i>
|
|
||||||
<%= h.getSiteWelcomeMessage() %>
|
|
||||||
<% } else if (h.shouldOmitLinkOnLastBreadcrumb(paths, index)) { %>
|
|
||||||
<%= h.trimSlashes(value.name) %>
|
|
||||||
<% } else if (index == 0) { %>
|
|
||||||
<a href="/"><%= h.getSiteName() %></a>
|
|
||||||
<% } else { %>
|
|
||||||
<a href="/<%= value.url %>">
|
|
||||||
<%= h.getDirectoryName(value.name) %>
|
|
||||||
</a>
|
|
||||||
<% } %>
|
|
||||||
<% }); %>
|
|
||||||
</h1>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<% if (typeof videoURL !== 'undefined') {%>
|
<% if (typeof videoURL !== 'undefined') {%>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user