37 lines
922 B
JavaScript
37 lines
922 B
JavaScript
// 娱乐大厅弹窗事件代理,替代静态关闭按钮内联 onclick。
|
|
|
|
let gameHallEventsBound = false;
|
|
|
|
/**
|
|
* 关闭娱乐大厅弹窗。
|
|
*
|
|
* @returns {void}
|
|
*/
|
|
function closeGameHallThroughGlobal() {
|
|
// 游戏大厅加载、缓存和卡片行为仍在 Blade 旧脚本内,模块阶段只统一关闭入口。
|
|
if (typeof window.closeGameHall === "function") {
|
|
window.closeGameHall();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 绑定娱乐大厅基础控件事件。
|
|
*
|
|
* @returns {void}
|
|
*/
|
|
export function bindGameHallControls() {
|
|
if (gameHallEventsBound || typeof document === "undefined") {
|
|
return;
|
|
}
|
|
|
|
gameHallEventsBound = true;
|
|
document.addEventListener("click", (event) => {
|
|
if (!(event.target instanceof Element) || !event.target.closest("[data-game-hall-close]")) {
|
|
return;
|
|
}
|
|
|
|
event.preventDefault();
|
|
closeGameHallThroughGlobal();
|
|
});
|
|
}
|