Add companion application
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Lift the floating action button above the footer when the footer is on
|
||||
// screen, so it never overlaps the request-time line or the companion icon.
|
||||
// Mirrors the TOC's header-aware top-offset behaviour in toc.js.
|
||||
(function () {
|
||||
var fab = document.querySelector(".fab");
|
||||
var footer = document.querySelector("footer");
|
||||
if (!fab || !footer) return;
|
||||
|
||||
function updateBottom() {
|
||||
var rect = footer.getBoundingClientRect();
|
||||
var overlap = Math.max(0, window.innerHeight - rect.top);
|
||||
fab.style.bottom = (overlap + 16) + "px";
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", updateBottom, { passive: true });
|
||||
window.addEventListener("resize", updateBottom);
|
||||
updateBottom();
|
||||
})();
|
||||
@@ -11,7 +11,7 @@
|
||||
<h2 id="files">Files</h2>
|
||||
<div class="listing">
|
||||
{{range .Entries}}
|
||||
<div class="listing-item">
|
||||
<div class="listing-item" data-path="{{.URL}}">
|
||||
<span class="icon">{{.Icon}}</span>
|
||||
<a href="{{.URL}}">{{.Name}}</a>
|
||||
<span class="meta">{{.Meta}}</span>
|
||||
@@ -37,11 +37,13 @@
|
||||
{{define "extras"}}
|
||||
{{if .SidebarWidget}}{{.SidebarWidget}}{{end}}
|
||||
{{if .CanEdit}}
|
||||
<script src="/_/page/fab.js" defer></script>
|
||||
<div class="fab dropdown">
|
||||
<button class="btn btn-fab" data-action="actions-drop" title="Actions" aria-label="Actions">≡</button>
|
||||
<div class="dropdown-menu align-right open-up">
|
||||
<button class="btn dropdown-item" onclick="newPage()" title="New page (N)">NEW</button>
|
||||
<a class="btn dropdown-item" href="?edit" title="Edit page (E)">EDIT</a>
|
||||
<button class="btn dropdown-item" data-companion-reveal hidden title="Reveal in file manager">REVEAL</button>
|
||||
{{if not .IsRoot}}
|
||||
<button class="btn dropdown-item" onclick="movePage()" title="Move page (M)">MOVE</button>
|
||||
<button class="btn dropdown-item danger" onclick="deletePage()" title="Delete page">DELETE</button>
|
||||
|
||||
Reference in New Issue
Block a user