From e18c49cc69c31802f4bd0a4d7f19d3553d1bade8 Mon Sep 17 00:00:00 2001 From: Hermes Date: Sun, 9 Aug 2026 13:23:56 +0200 Subject: [PATCH] menu: guard against duplicate (add data-action to native button) --- plugin.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin.js b/plugin.js index f553056..c8e2646 100644 --- a/plugin.js +++ b/plugin.js @@ -394,8 +394,10 @@ var menuSubscribed = false; var menuInterval = null; function addMenuButton() { - // Use Lampa's native menu API (adds to .menu__list:eq(0) and wires hover:enter). - Lampa.Menu.addButton( + // Guard: only one copy (addButton does not set data-action, so we add it ourselves). + if ($('[data-action="' + PLUGIN.menu_action + '"]').length) return; + // Use Lampa's native menu API (adds to .menu__list and wires hover:enter). + var el = Lampa.Menu.addButton( '', t(PLUGIN.title), function () { @@ -407,6 +409,7 @@ }); } ); + if (el && el.attr) el.attr('data-action', PLUGIN.menu_action); } function start() { if (menuSubscribed) return;