mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
90 lines
2.7 KiB
Plaintext
90 lines
2.7 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<link rel="shortcut icon" href="../favicon.ico">
|
|
<link href="../libraries/normalize.min.css" rel="stylesheet">
|
|
<link href="../stylesheets/share.css" rel="stylesheet">
|
|
<% if (note.type === 'text' || note.type === 'book') { %>
|
|
<link href="../libraries/ckeditor/ckeditor-content.css" rel="stylesheet">
|
|
<% } %>
|
|
<title><%= note.title %></title>
|
|
</head>
|
|
<body>
|
|
<div id="layout">
|
|
<% if (subRoot.hasChildren()) { %>
|
|
<button id="menuButton"></button>
|
|
|
|
<div id="menu">
|
|
<%- include('share-tree-item', {note: subRoot, activeNote: note}) %>
|
|
</div>
|
|
<% } %>
|
|
|
|
<div id="main">
|
|
<h1 id="title"><%= note.title %></h1>
|
|
|
|
<div id="content">
|
|
<div class="ck-content"><%- content %></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
(function (window, document) {
|
|
|
|
// we fetch the elements each time because docusaurus removes the previous
|
|
// element references on page navigation
|
|
function getElements() {
|
|
return {
|
|
layout: document.getElementById('layout'),
|
|
menu: document.getElementById('menu'),
|
|
menuButton: document.getElementById('menuButton')
|
|
};
|
|
}
|
|
|
|
function toggleClass(element, className) {
|
|
var classes = element.className.split(/\s+/);
|
|
var length = classes.length;
|
|
var i = 0;
|
|
|
|
for (; i < length; i++) {
|
|
if (classes[i] === className) {
|
|
classes.splice(i, 1);
|
|
break;
|
|
}
|
|
}
|
|
// The className is not found
|
|
if (length === classes.length) {
|
|
classes.push(className);
|
|
}
|
|
|
|
element.className = classes.join(' ');
|
|
}
|
|
|
|
function toggleAll() {
|
|
var active = 'active';
|
|
var elements = getElements();
|
|
|
|
toggleClass(elements.layout, active);
|
|
toggleClass(elements.menu, active);
|
|
toggleClass(elements.menuButton, active);
|
|
}
|
|
|
|
function handleEvent(e) {
|
|
var elements = getElements();
|
|
|
|
if (e.target.id === elements.menuButton.id) {
|
|
toggleAll();
|
|
e.preventDefault();
|
|
} else if (elements.menu.className.indexOf('active') !== -1) {
|
|
toggleAll();
|
|
}
|
|
}
|
|
|
|
document.addEventListener('click', handleEvent);
|
|
|
|
}(this, this.document));
|
|
</script>
|
|
</body>
|
|
</html>
|