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 () { });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user