Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More hotkeys for quick buttons #64

Closed
Amaimersion opened this issue Aug 4, 2018 · 3 comments
Closed

More hotkeys for quick buttons #64

Amaimersion opened this issue Aug 4, 2018 · 3 comments
Labels
waiting release Features or bug fixes that are ready to go on the next public release

Comments

@Amaimersion
Copy link
Contributor

I was want to create a PR with more hotkeys for quick buttons, but in order to avoid situation like this i decided to ask several questions.

Current list of hotkeys (seems):

  • Back - Left Arrow
  • Next - Space or Right Arrow
  • Settings - Esc
  • Hide - H

Will be added list of hotkeys:

  • Auto - A
  • Save - S
  • Load - L
  • Quit - Q

So, questions:

  1. Why do you create another events instead of simulate click?
    For example this:
// H Key
case 72:
    if ($_(`${selector} [data-action="distraction-free"]`).hasClass ('fa-eye')) {
        $_(`${selector} [data-action="distraction-free"]`).removeClass ('fa-eye');
        $_(`${selector} [data-action="distraction-free"]`).addClass ('fa-eye-slash');
        $_(`${selector} [data-ui="text"]`).hide ();
        Monogatari.global ('distraction-free', true);
    } else if ($_(`${selector} [data-action="distraction-free"]`).hasClass ('fa-eye-slash')) {
        $_(`${selector} [data-action="distraction-free"]`).removeClass ('fa-eye-slash');
        $_(`${selector} [data-action="distraction-free"]`).addClass ('fa-eye');
        $_(`${selector} [data-ui="text"]`).show ();
        Monogatari.global ('distraction-free', false);
    }
    break;

can be changed to this:

// H Key
case 72:
    button.click();
    break;

So, all the main logic can be placed in the one place instead of kinda copy in various places. I understand that this is architecture question and custom event can perform operations that doesn't related to the main event, but looks like in this situation in can be easily replaced.

  1. I should use selectors like this ${selector} [data-*] in a pair with Aegis, yes? document.querySelector and something like this is not allowed?
@Hyuchia Hyuchia added this to Needs Design in Monogatari v2.0 Aug 8, 2018
@Hyuchia
Copy link
Member

Hyuchia commented Aug 14, 2018

Hey there! Sorry this took a while, a new shortcut was added recently and now s is mapped to a skip mode (similar to auto play but it literally just skips through things) so we'd need to see what to map to that key (save or skip) and what would the other key would be.

About Question 1: Things should probably be added in a single function to prevent the duplicate code just as it was done on 71e99e8 to fix #65. That way there's no need to simulate events either and it adds an easier to use function.

About Question 2: It is always preferred to use Artemis although in some cases, document.querySelector is used such as the current Play implementation but that's a really specific case. Artemis is actually doing a querySelector on the back so... it's pretty much the same.

@Amaimersion
Copy link
Contributor Author

👍

@Hyuchia Hyuchia moved this from Needs Design to To do in Monogatari v2.0 Dec 5, 2018
@Hyuchia Hyuchia moved this from To do to In progress in Monogatari v2.0 Dec 10, 2018
@Hyuchia
Copy link
Member

Hyuchia commented Dec 11, 2018

Hi there! As of 692bc00, the following shortcuts are available:

  • Back - Left Arrow
  • Next - Space or Right Arrow
  • Settings - Esc
  • Hide - H
  • Open Save Menu - Shift+S
  • Open Load Menu - Shift+L
  • Quit - Shift+Q

A new library has also been added to handle these and other things such as cheats in an easier way.

@Hyuchia Hyuchia moved this from In progress to Needs Design in Monogatari v2.0 Dec 11, 2018
@Hyuchia Hyuchia moved this from Needs Design to Done in Monogatari v2.0 Mar 22, 2019
@Hyuchia Hyuchia added the waiting release Features or bug fixes that are ready to go on the next public release label Nov 7, 2019
@Hyuchia Hyuchia closed this as completed Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting release Features or bug fixes that are ready to go on the next public release
Projects
Development

No branches or pull requests

2 participants