gpt4 book ai didi

javascript - Roundcube java 脚本 `beforelogin` 事件钩子(Hook)

转载 作者:行者123 更新时间:2023-11-29 21:36:53 24 4
gpt4 key购买 nike

我正在尝试在 roundcube 中添加登录警报,但我似乎没有收到我期望的客户端事件。我想收听 beforelogin 事件。

我的 javascript 代码如下所示:

if (window.rcmail) {
rcmail.addEventListener('beforelogin', function() {
console.log("Got beforelogin");
window.alert("Alert");
});
rcmail.addEventListener('init', function() {
console.log("Got init");
});
}

它确实记录

Got init

到控制台日志,但令我惊讶的是它没有记录

Got beforelogin

它也不显示警报。

服务器端,javascript由

添加
class myalert extends rcube_plugin
{
function init()
{
$this->add_hook('template_object_loginform', array($this,'myalert'));
}

function myalert($args)
{
$this->include_script('myalert.js');
return $args;
}
}

我是否误解了 roundcube 客户端事件的命名约定?我添加的方式不对吗?还有什么我可能错过的吗?

最佳答案

之前从未使用过 roundcube,但作为文档 stated .

These events are triggered before and after the RoundCube client executes a certain command. An event handler of the before* events can return false in order to prevent the command to be executed.

beforelogin 事件只会在您执行 login 命令时调用。

关于javascript - Roundcube java 脚本 `beforelogin` 事件钩子(Hook),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34611833/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com