29 lines
781 B
JavaScript
29 lines
781 B
JavaScript
// 聊天室钓鱼入口事件绑定,先兼容存量全局 startFishing 实现。
|
|
|
|
let fishingEventsBound = false;
|
|
|
|
/**
|
|
* 绑定钓鱼按钮点击事件。
|
|
*
|
|
* @returns {void}
|
|
*/
|
|
export function bindFishingControls() {
|
|
if (fishingEventsBound || typeof document === "undefined") {
|
|
return;
|
|
}
|
|
|
|
fishingEventsBound = true;
|
|
document.addEventListener("click", (event) => {
|
|
if (!(event.target instanceof Element) || !event.target.closest("[data-chat-fishing-start]")) {
|
|
return;
|
|
}
|
|
|
|
event.preventDefault();
|
|
|
|
// 钓鱼完整流程仍在 fishing-panel.blade.php,当前模块只统一按钮事件入口。
|
|
if (typeof window.startFishing === "function") {
|
|
window.startFishing();
|
|
}
|
|
});
|
|
}
|