brookhong / Surfingkeys

Map your keys for web surfing, expand your browser with javascript and keyboard.
https://chrome.google.com/webstore/detail/surfingkeys/gfbliohnnapiefjpjlpjnehglfpaknnc
MIT License
5.42k stars 484 forks source link

还是报[SurfingKeys] Error found in settings: ReferenceError: unmapAllExcept is not defined #1600

Closed Code-from-Internet closed 2 years ago

Code-from-Internet commented 2 years ago

根据最近的几个 isssue 的对话,在配置文件最前面加入了以下代码:

const {
    aceVimMap,
    mapkey,
    imap,
    imapkey,
    getClickableElements,
    vmapkey,
    map,
    unmap,
    vunmap,
    cmap,
    addSearchAlias,
    removeSearchAlias,
    tabOpenLink,
    readText,
    Clipboard,
    Front,
    Hints,
    Visual,
    RUNTIME
} = api;'

并将Hints.characters = 'asdgwertcvuionm'; 改成 Hints.characters = ("asdgwertcvuionm");

还是报错[SurfingKeys] Error found in settings: ReferenceError: unmapAllExcept is not defined

还有,以下配置不work:

mapkey(',a', '#120Open Acfun', function () {
    tabOpenLink("https://www.acfun.cn/u/4075269.aspx");
});

原因是什么?

Code-from-Internet commented 2 years ago

建议作者写个脚本,能将旧版本的配置转换成新版的配置。

clarkwang commented 2 years ago

并将Hints.characters = 'asdgwertcvuionm'; 改成 Hints.characters = ("asdgwertcvuionm");

Should be Hints.setCharacters("asdgwertcvuionm").

还是报错[SurfingKeys] Error found in settings: ReferenceError: unmapAllExcept is not defined

unmapAllExcept should also be included in const { ... } = api; or use api.unmapAllExcept.

clarkwang commented 2 years ago

还有,以下配置不work:

mapkey(',a', '#120Open Acfun', function () {
    tabOpenLink("https://www.acfun.cn/u/4075269.aspx");
});

原因是什么?

Include tabOpenLink in const { ... } = api; or use api.tabOpenLink.

fabiomcosta commented 2 years ago

Just wanted to point out that there are some places that are not talking about the fact that these functions are not globally available from the settings anymore, like https://github.com/brookhong/Surfingkeys/wiki/FAQ#how-to-disable-surfingkeys-only-on-current-site and even my settings had some default code on it that was breaking. Using the functions from the api object works as expected.