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;