@etspress/netflix 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/public/console.css +2 -0
- package/public/home.js +7 -1
- package/public/inject.js +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etspress/netflix",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "流媒体合租主题插件",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"id": "netflix",
|
|
19
19
|
"name": "流媒体合租主题",
|
|
20
20
|
"description": "流媒体合租商店主题与页面展示配置",
|
|
21
|
-
"version": "0.1.
|
|
21
|
+
"version": "0.1.26",
|
|
22
22
|
"runtime": {
|
|
23
23
|
"type": "npm-static",
|
|
24
24
|
"publicRoot": "public"
|
package/plugin.json
CHANGED
package/public/console.css
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
@import url("/plugins/appstore/static-plugins/netflix/home.css");
|
|
2
2
|
|
|
3
|
+
html.nfc-active #app { display: none !important; }
|
|
4
|
+
|
|
3
5
|
#netflix-theme-home.nfc-console{min-height:100vh;background:#f7f7f8;color:#333;font-family:-apple-system,"Yuanti SC",system-ui,"Helvetica Neue",Helvetica,"Segoe UI",Arial,Roboto,"PingFang SC",miui,"Hiragino Sans GB","Microsoft Yahei",sans-serif;font-size:14px;line-height:1.5}
|
|
4
6
|
#netflix-theme-home.nfc-console *{box-sizing:border-box}
|
|
5
7
|
#netflix-theme-home.nfc-console .nfc-layout{display:grid;grid-template-columns:155px minmax(0,1fr);gap:20px;width:96vw;max-width:1200px;min-height:490px;margin:20px auto 84px;align-items:start}
|
package/public/home.js
CHANGED
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
// release it while the homepage is unmounting for an in-app transition.
|
|
44
44
|
if (window.location.pathname !== '/') return;
|
|
45
45
|
if (typeof window.__DUJIAO_RELEASE_HOME_GATE__ === 'function') window.__DUJIAO_RELEASE_HOME_GATE__();
|
|
46
|
+
if (typeof window.__NETFLIX_THEME_RELEASE_ROUTE_GATE__ === 'function') window.__NETFLIX_THEME_RELEASE_ROUTE_GATE__();
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
function escapeHtml(value) {
|
|
@@ -545,7 +546,12 @@
|
|
|
545
546
|
window.__NETFLIX_THEME_HOME_ROUTE_SYNC__ = syncRoute;
|
|
546
547
|
window.addEventListener('popstate', syncRoute);
|
|
547
548
|
window.addEventListener('hashchange', syncRoute);
|
|
548
|
-
|
|
549
|
+
if (window.__NETFLIX_THEME_ENABLED__ === true) {
|
|
550
|
+
pluginEnabled = true;
|
|
551
|
+
mount();
|
|
552
|
+
} else {
|
|
553
|
+
checkPlugin();
|
|
554
|
+
}
|
|
549
555
|
checkTimer = window.setInterval(checkPlugin, 2500);
|
|
550
556
|
routeTimer = window.setInterval(syncRoute, 1500);
|
|
551
557
|
window.addEventListener('pagehide', function () {
|
package/public/inject.js
CHANGED
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
card = createChoiceCard(kind);
|
|
278
278
|
group.appendChild(card);
|
|
279
279
|
}
|
|
280
|
-
var selected = state.home[kind] === option.value;
|
|
280
|
+
var selected = state.enabled && state.home[kind] === option.value;
|
|
281
281
|
setCardSelection(card, selected);
|
|
282
282
|
group.classList.toggle('netflix-theme-plugin-selected', selected);
|
|
283
283
|
setNativeRadioSelection(group, selected);
|
|
@@ -315,6 +315,7 @@
|
|
|
315
315
|
function selectPluginChoice(kind, value) {
|
|
316
316
|
var option = choices[kind];
|
|
317
317
|
var previous = state.home[kind] || '';
|
|
318
|
+
if (previous === value) return;
|
|
318
319
|
state.home[kind] = value;
|
|
319
320
|
syncPage();
|
|
320
321
|
persistHome().catch(function (error) {
|
|
@@ -338,6 +339,13 @@
|
|
|
338
339
|
var group = radio && radio.closest('[role="radiogroup"]');
|
|
339
340
|
var kind = group && group.dataset.netflixKind;
|
|
340
341
|
if (!kind || !state.home[kind]) return;
|
|
342
|
+
if (state.enabled) {
|
|
343
|
+
event.preventDefault();
|
|
344
|
+
event.stopImmediatePropagation();
|
|
345
|
+
state.home[kind] = choices[kind].value;
|
|
346
|
+
syncPage();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
341
349
|
state.home[kind] = '';
|
|
342
350
|
syncPage();
|
|
343
351
|
persistHome().catch(function (error) {
|
|
@@ -355,6 +363,10 @@
|
|
|
355
363
|
var field = (payload.fields || []).find(function (item) { return item.key === configKey; });
|
|
356
364
|
var home = JSON.parse(field && field.value || '{}');
|
|
357
365
|
state.home = home && typeof home === 'object' && !Array.isArray(home) ? home : {};
|
|
366
|
+
if (state.enabled) {
|
|
367
|
+
state.home.storefrontTemplate = choices.storefrontTemplate.value;
|
|
368
|
+
state.home.productLayout = choices.productLayout.value;
|
|
369
|
+
}
|
|
358
370
|
state.configLoaded = true;
|
|
359
371
|
syncPage();
|
|
360
372
|
} catch (error) {
|