diff --git a/plugin.js b/plugin.js index 4957c8d..f9a0547 100644 --- a/plugin.js +++ b/plugin.js @@ -291,13 +291,28 @@ grid.append('
Catalog is empty
'); return; } - // Manual native-styled cards (.card / .card__img) — identical to Lampa's - // own cards, and the Enter handler works reliably. Native Lampa.Card via - // Utils.createInstance was tried but click-to-detail did not forward. + // Use Lampa's native Card module so cards render identically to built-in + // sections and respect the "Показать обложку" (card_interfice_cover) setting + // automatically. Wire onlyEnter -> our detail page. movies.forEach(function (m) { - var card = manualCard(m); - card.on('hover:enter', function () { openMovie(m); }); - grid.append(card); + try { + var element = { + data: { + title: m.title || m.id, + poster: resolve(m.poster || m.img || m.cover), + img: resolve(m.img || m.poster || m.cover), + cover: resolve(m.cover || m.img || m.poster), + _mymovies: m + }, + params: { module: Lampa.Maker.module('Card') } + }; + var item = Lampa.Utils.createInstance(Lampa.Card, element); + item.create(); + item.use({ onlyEnter: function () { openMovie(m); } }); + grid.append(item.html); + } catch (e) { + grid.append(manualCard(m).on('hover:enter', function () { openMovie(m); })); + } }); }