Skip to content

Commit

Permalink
feat: toggle alfred ui on CMD/CTRL
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jan 27, 2024
1 parent 332fd0e commit f23fb4b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Alfred.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,19 @@
if ($alfred.find("*:not(.alfred) .pw-edited").length) return;
$alfred.find("> .alfredelements > .icons > a.alfred-edit").click();
});

// toggle alfred ui if topbar is disabled
$(document).on("keydown", function (e) {
if (document.querySelector("#rf-topbar")) return;
if (!(e.ctrlKey || e.metaKey)) return;
let body = document.querySelector("body");
if (localStorage.getItem("rf-topbar-hide") == "0") {
body.classList.add("no-alfred");
localStorage.setItem("rf-topbar-hide", 1);
} else {
body.classList.remove("no-alfred");
localStorage.setItem("rf-topbar-hide", 0);
}
});
});
})();
11 changes: 10 additions & 1 deletion Alfred.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ public function init()

// health checks
$this->checkHealth();

// development helpers by rockmigrations
if ($this->wire->modules->isInstalled('RockMigrations')) {
$rm = rockmigrations();
$rm->minify(__DIR__ . "/Alfred.js");
}
}

public function ready()
Expand Down Expand Up @@ -261,7 +267,7 @@ private function addAlfredMarkup(string &$html): void

$this->js("rootUrl", $this->wire->config->urls->root);
$this->js("defaultVspaceScale", number_format(self::defaultVspaceScale, 2, ".", ""));
$this->scripts('rockfrontend')->add($this->path . "Alfred.js");
$this->scripts('rockfrontend')->add(__DIR__ . "/Alfred.min.js");
$this->addAlfredStyles();

// replace alfred cache markup
Expand Down

0 comments on commit f23fb4b

Please sign in to comment.