ruin1990 / AnkiTemplate

Some useful template improve our learning experience
https://ankiweb.net/shared/info/457099967
Apache License 2.0
15 stars 1 forks source link

请问能否增加将翻开下一个 绑定到 移动端的 用户动作 的功能。 #11

Open hihvan opened 4 days ago

hihvan commented 4 days ago

非常好模板,爱来自瓷器。 你的模板的,非常的有趣的,完全可以替换默认模板。 请问是否能增加将 上一个 下一个的 功能增加到 安卓、苹果的 userJs1、2用户动作12。 这样可以适配手柄操作和手势操作。提高效率。: )

ruin1990 commented 1 day ago

I think your native language is not Chinese. China should be translated as 中国(China) instead of 瓷器(porcelain). Anyway, we all have Google Translate, so you can use whatever language you want.

Good question. I do have a method to implement this requirement reserved for other users. After all, it cannot be directly linked to Anki's program settings. 好问题,我确实有预留给其他使用者的这个需求的实现方法,毕竟无法直接关联到Anki的程序设置里。

This requires a simple modification of the source code to implement, and I have reserved a shortcut key interface. 这个需要简单修改源码实现,我预留了快捷键接口。

If you use a gesture controller (an event similar to a mouse is sent to the device), there is usually a like button to configure the position. This is what I used before. Configure the heart/love/camera location to the next one. 如果你是手势手柄(类似鼠标那种事件发给设备),一般有个点赞的按钮可以配置位置,我之前用的是这种。把点赞/拍照位置配置到下一个。

If you are using a key controller (that is, sending key events), you first open https://keycode.info/ and test the key code you want to set. Then modify the number after the equal sign of the keycode variable in front.html to the corresponding value. It can realize the binding of the previous page and the next page. You can read my comments and supports multiple key bindings. 如果你是按键手柄(也就是发送的是按键事件),你先打开https://keycode.info/ ,测试下你要设置的按键键码是啥。 然后修改front.html中的keycode变量等号后面的数字换成对应的值。 既可实现上一页和下一页的绑定,可以看我的注释,支持多个键绑定的。

If you don't know how to change it, you can tell me the key code and I will change it for you. Of course, my reply is slow. 如果你不会改可以告诉我键码我给你改个,当然我回复的比较慢。

Let me give you an example. For example, if I don’t want to use a handle, I set the left and right clicks of my TWS headset to the previous song and the next song respectively. I added these two button configurations. 我举个例子,比如我不想用手柄,我的TWS耳机左侧和右侧单击分别被我设置成上一首和下一首,我把这2个按键配置加上

Open browser with : https://keycode.info/
浏览器打开:https://keycode.info/

The key code under test is as follows:
测试下键码如下:

上一首 MediaTrackPrevious 177
下一首 MediaTrackNext   176
    // key and flow button thanks for kleinerpirat with https://ankiweb.net/shared/info/1231171279
    // Tab for incremental reveal
    // ` for full reveal
    // for custom keycodes: https://keycode.info/
    var keycode_tab = 9;
    var keycode_backquote = 192;
+   var keycode_media_next = 176;
+   var keycode_media_prev = 177;
    //var keycode_q = 81;
    //var keycode_w = 87;

    var shortcuts = {
        "next": {
            "name": "Tab",
-           "keycodes": [keycode_tab/*, keycode_w*/],
+           "keycodes": [keycode_tab, keycode_media_next],
        },
        "previous": {
            "name": "Backquote",
-           "keycodes": [keycode_backquote/*, keycode_q*/],
+           "keycodes": [keycode_backquote, keycode_media_prev],
        }
    };