Allow customizing companion commands
This commit is contained in:
+8
-7
@@ -136,14 +136,15 @@
|
||||
}
|
||||
|
||||
function wireRevealButton() {
|
||||
var btn = document.querySelector('[data-companion-reveal]');
|
||||
if (!btn) return;
|
||||
if (!state.available) return;
|
||||
btn.hidden = false;
|
||||
btn.addEventListener('click', function () {
|
||||
var rel = wikiPathFromHref(window.location.pathname);
|
||||
if (rel === null) rel = '';
|
||||
companionGET('/open-folder', { path: rel }).catch(function () { });
|
||||
var btns = document.querySelectorAll('[data-companion-reveal]');
|
||||
btns.forEach(function (btn) {
|
||||
btn.hidden = false;
|
||||
btn.addEventListener('click', function () {
|
||||
var rel = wikiPathFromHref(window.location.pathname);
|
||||
if (rel === null) rel = '';
|
||||
companionGET('/open-folder', { path: rel }).catch(function () { });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="content">{{.SpecialContent}}</div>
|
||||
{{end}}
|
||||
{{if .Entries}}
|
||||
<h2 id="files">Files</h2>
|
||||
<h2 id="files">Files <button class="btn btn-small" data-companion-reveal hidden title="Open folder in file manager">open</button></h2>
|
||||
<div class="listing">
|
||||
{{range .Entries}}
|
||||
<div class="listing-item" data-path="{{.URL}}">
|
||||
|
||||
Reference in New Issue
Block a user