Skip to content

Commit

Permalink
feat: hide alfred GUI on shift keypress
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jan 19, 2023
1 parent d66e385 commit d6862d0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Alfred.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,19 @@ body:not(.uk-offcanvas-container) .alfred:hover {
height: 145px;
border-bottom: 3px solid #ececec;
}
.alfred:hover > .alfredelements > .icons {
.alfred:hover:not(.alfred-disabled) > .alfredelements > .icons {
display: inline-block;
}
.alfred:hover > .alfredelements > .add-top {
.alfred:hover:not(.alfred-disabled) > .alfredelements > .add-top {
display: inline-block;
}
.alfred:hover > .alfredelements > .add-bottom {
.alfred:hover:not(.alfred-disabled) > .alfredelements > .add-bottom {
display: inline-block;
}
.alfred:hover > .alfredelements > .add-left {
.alfred:hover:not(.alfred-disabled) > .alfredelements > .add-left {
display: inline-block;
}
.alfred:hover > .alfredelements > .add-right {
.alfred:hover:not(.alfred-disabled) > .alfredelements > .add-right {
display: inline-block;
}
.alfred-cover {
Expand Down
16 changes: 16 additions & 0 deletions Alfred.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,21 @@
if ($alfred.find("*:not(.alfred) .pw-edited").length) return;
$alfred.find("> .alfredelements > .icons > a.alfred-edit").click();
});

// toggle alfred overlays on shift keypress
let $hovered = false;
let pressed = false;
$(document).on("mouseover", function (e) {
$hovered = $(e.target);
if (pressed) $hovered.closest(".alfred").addClass("alfred-disabled");
});
$(document).on("keydown keyup", function (e) {
pressed = false;
$(".alfred").removeClass("alfred-disabled");
if (!e.shiftKey) return;
pressed = true;
let $alfred = $hovered.closest(".alfred");
$alfred.addClass("alfred-disabled");
});
});
})();
2 changes: 1 addition & 1 deletion Alfred.less
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ body:not(.uk-offcanvas-container) .alfred:hover {
border-bottom: 3px solid @grey;
}

&:hover {
&:hover:not(.alfred-disabled) {
> .alfredelements {
> .icons {
display: inline-block;
Expand Down
2 changes: 1 addition & 1 deletion RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function getModuleInfo()
{
return [
'title' => 'RockFrontend',
'version' => '2.15.0',
'version' => '2.16.0',
'summary' => 'Module for easy frontend development',
'autoload' => true,
'singular' => true,
Expand Down

0 comments on commit d6862d0

Please sign in to comment.