fix: modal thumbnail via active.movie (drop backdrop_path); native-like bg blur
This commit is contained in:
1 parent
9452239891
commit
8017f96654
1 file changed
+22
-10
@@ -398,8 +398,10 @@
|
||||
// builds them lazily). Retry a couple of times, but never re-add the
|
||||
// controller or steal focus once it's already set.
|
||||
apply();
|
||||
// Native Lampa detail background: blurred fanart behind the page.
|
||||
// Set it in start() (after the activity is live), exactly like Lampa does.
|
||||
// Detail background: blurred fanart, matching Lampa's native canvas blur.
|
||||
// Lampa.Background.immediately() is throttled / gated by settings, so we
|
||||
// also set the .background element directly. Mimic Lampa's look:
|
||||
// heavy blur + darken + slight scale so edges don't show.
|
||||
try {
|
||||
var dm = resolveMovie((comp.activity && comp.activity.object) || selected);
|
||||
var bg = resolve(dm.img || dm.poster || dm.cover);
|
||||
@@ -407,6 +409,16 @@
|
||||
if (bg && Lampa.Background && Lampa.Background.immediately) {
|
||||
Lampa.Background.immediately(bg);
|
||||
}
|
||||
var bgel = document.querySelector('.background');
|
||||
if (bg && bgel) {
|
||||
bgel.style.backgroundImage = 'url("' + bg + '")';
|
||||
bgel.style.backgroundSize = 'cover';
|
||||
bgel.style.backgroundPosition = 'center';
|
||||
bgel.style.backgroundRepeat = 'no-repeat';
|
||||
bgel.style.filter = 'blur(30px) brightness(0.45)';
|
||||
bgel.style.transform = 'scale(1.1)';
|
||||
bgel.style.opacity = '1';
|
||||
}
|
||||
} catch (e) { console.log('[mymovies] bg err', e); }
|
||||
if (!$('.mymovies-detail .full-start-new__buttons .full-start__button.selector').length) {
|
||||
setTimeout(apply, 300);
|
||||
@@ -490,7 +502,8 @@
|
||||
component: PLUGIN.name + '_detail',
|
||||
title: m.title,
|
||||
page: m.title,
|
||||
object: m
|
||||
object: m,
|
||||
movie: m
|
||||
});
|
||||
}
|
||||
|
||||
@@ -502,18 +515,17 @@
|
||||
var magnet = m.magnet || ('magnet:?xt=urn:btih:' + (m.hash || ''));
|
||||
if (magnet.indexOf('magnet:') !== 0) return;
|
||||
var imgUrl = resolve(m.img || m.poster || m.cover);
|
||||
// Lampa's torrent modal sets the thumbnail from `movie.backdrop_path`
|
||||
// (see list$1: element.img = Api.img(params.movie.backdrop_path)).
|
||||
// Api.img() passes a full http(s) URL through unchanged, so we can
|
||||
// point backdrop_path at our horizontal movie.jpg and it will be used.
|
||||
// The torrent modal (.files template) reads `params.movie.img` directly
|
||||
// into <img src>. We pass a full http(s) URL so it loads as-is.
|
||||
// NOTE: do NOT set `backdrop_path` — Lampa runs it through Api.img()
|
||||
// (TMDB), which mangles a full URL into an invalid path.
|
||||
var element = {
|
||||
MagnetUri: magnet,
|
||||
title: m.title,
|
||||
poster: imgUrl,
|
||||
img: imgUrl,
|
||||
backdrop_path: imgUrl
|
||||
img: imgUrl
|
||||
};
|
||||
var movie = Object.assign({}, m, { img: imgUrl, poster: imgUrl, backdrop_path: imgUrl });
|
||||
var movie = Object.assign({}, m, { img: imgUrl, poster: imgUrl });
|
||||
console.log('[mymovies] play img=', imgUrl);
|
||||
Lampa.Torrent.start(element, movie);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user