nuvio-tizen 1.1.0 → 1.2.0

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/css/style.css CHANGED
@@ -118,6 +118,16 @@ html, body {
118
118
  .search-results .card { margin: 0 22px 24px 0; }
119
119
  .search-empty { font-size: 24px; color: #8b93a5; margin-top: 30px; }
120
120
 
121
+ /* --- Confirm modal --- */
122
+ .modal-overlay { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; z-index: 45; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; }
123
+ .modal-box { width: 820px; background: #161b26; border: 2px solid #2a3346; border-radius: 16px; padding: 44px 48px; text-align: center; }
124
+ .modal-msg { font-size: 30px; line-height: 1.4; color: #e6e9ef; margin-bottom: 36px; }
125
+ .modal-row { display: flex; justify-content: center; }
126
+ .modal-btn { min-width: 200px; text-align: center; }
127
+ .pill.danger { background: #3a2130; }
128
+ .pill.danger.focusable.focused { background: #ef4444; color: #fff; }
129
+ .reset-item .a-name { color: #f0a5a5; }
130
+
121
131
  /* --- Toast + spinner --- */
122
132
  #toast { position: absolute; bottom: 60px; left: 50%; margin-left: -300px; width: 600px; text-align: center; z-index: 40; background: rgba(0,0,0,0.85); padding: 18px 24px; border-radius: 10px; font-size: 22px; }
123
133
  #spinner { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); }
package/js/app.js CHANGED
@@ -37,6 +37,7 @@ var App = (function () {
37
37
 
38
38
  function back() {
39
39
  if (Player.isActive()) { Player.exit(); return; }
40
+ if (Views.isModalOpen()) { Views.closeModal(); return; }
40
41
  if (_current === 'detail' && Views.backInDetail()) { return; }
41
42
  var f = _stack.pop();
42
43
  if (!f) { tryExitApp(); return; }
package/js/stremio.js CHANGED
@@ -51,6 +51,12 @@ var Stremio = (function () {
51
51
  _loaded = null;
52
52
  }
53
53
 
54
+ // Clears the stored list so the fresh-install DEFAULT_ADDONS apply again.
55
+ function resetAddons() {
56
+ U.store.remove(ADDONS_KEY);
57
+ _loaded = null;
58
+ }
59
+
54
60
  // ---- Manifest loading (cached in-memory per session) ----
55
61
  var _loaded = null;
56
62
 
@@ -268,7 +274,7 @@ var Stremio = (function () {
268
274
 
269
275
  return {
270
276
  DEFAULT_ADDONS: DEFAULT_ADDONS,
271
- getAddonUrls: getAddonUrls, addAddon: addAddon, removeAddon: removeAddon,
277
+ getAddonUrls: getAddonUrls, addAddon: addAddon, removeAddon: removeAddon, resetAddons: resetAddons,
272
278
  loadAddons: loadAddons, listCatalogs: listCatalogs, getCatalog: getCatalog,
273
279
  getMeta: getMeta, getStreams: getStreams, getSubtitles: getSubtitles,
274
280
  getSearchCatalogs: getSearchCatalogs, search: search,
package/js/views.js CHANGED
@@ -5,6 +5,52 @@ var Views = (function () {
5
5
 
6
6
  function scr(name) { return U.byId('screen-' + name); }
7
7
 
8
+ // ---------- confirm modal (D-pad friendly) ----------
9
+ var _modalOpen = false;
10
+ var _modalPrevFocus = null;
11
+ var _modalScope = null;
12
+
13
+ function confirm(message, confirmLabel, onYes) {
14
+ // defensive: never stack modals
15
+ var existing = document.querySelector('.modal-overlay');
16
+ if (existing) { existing.parentNode.removeChild(existing); }
17
+ var overlay = U.el('div', 'modal-overlay');
18
+ var box = U.el('div', 'modal-box');
19
+ box.appendChild(U.el('div', 'modal-msg', message));
20
+ var row = U.el('div', 'modal-row');
21
+ var no = U.el('div', 'pill focusable modal-btn', 'Cancel');
22
+ var yes = U.el('div', 'pill focusable modal-btn danger', confirmLabel || 'Confirm');
23
+ no.__onselect = function () { closeModal(); };
24
+ yes.__onselect = function () { closeModal(); onYes(); };
25
+ row.appendChild(no);
26
+ row.appendChild(yes);
27
+ box.appendChild(row);
28
+ overlay.appendChild(box);
29
+ document.body.appendChild(overlay);
30
+
31
+ _modalPrevFocus = Focus.current();
32
+ _modalScope = _current(); // remember which screen is under the modal
33
+ _modalOpen = true;
34
+ Focus.setScope(overlay, no); // default to Cancel (safe)
35
+ }
36
+
37
+ function closeModal() {
38
+ var o = document.querySelector('.modal-overlay');
39
+ if (o) { document.body.removeChild(o); }
40
+ _modalOpen = false;
41
+ if (_modalScope) { Focus.setScope(_modalScope, _modalPrevFocus); }
42
+ _modalScope = null; _modalPrevFocus = null;
43
+ }
44
+
45
+ function _current() {
46
+ var names = ['home', 'detail', 'search', 'settings'];
47
+ for (var i = 0; i < names.length; i++) {
48
+ var e = scr(names[i]);
49
+ if (e && e.className.indexOf('hidden') === -1) { return e; }
50
+ }
51
+ return scr('settings');
52
+ }
53
+
8
54
  // ---------- shared bits ----------
9
55
  function header(withGear, withSearch) {
10
56
  var h = U.el('div', 'header');
@@ -360,14 +406,30 @@ var Views = (function () {
360
406
  var item = U.el('div', 'addon-item focusable');
361
407
  item.appendChild(U.el('div', 'a-name', loaded ? (loaded.manifest.name || 'Addon') : '(failed to load)'));
362
408
  item.appendChild(U.el('div', 'a-url', url));
409
+ var name = loaded ? (loaded.manifest.name || 'Addon') : 'this addon';
363
410
  item.__onselect = function () {
364
- U.toast('Removed. Reopening…');
365
- Stremio.removeAddon(url);
366
- setTimeout(renderSettings, 500);
411
+ confirm('Remove "' + name + '"?', 'Remove', function () {
412
+ Stremio.removeAddon(url);
413
+ U.toast('Removed');
414
+ setTimeout(renderSettings, 300);
415
+ });
367
416
  };
368
417
  wrap.appendChild(item);
369
418
  });
370
419
 
420
+ // Reset to defaults
421
+ var reset = U.el('div', 'addon-item focusable reset-item');
422
+ reset.appendChild(U.el('div', 'a-name', '↺ Reset to default addons'));
423
+ reset.appendChild(U.el('div', 'a-url', 'Removes all addons and restores Cinemeta, WatchHub, OpenSubtitles v3'));
424
+ reset.__onselect = function () {
425
+ confirm('Reset to default addons? This removes all addons you’ve added.', 'Reset', function () {
426
+ Stremio.resetAddons();
427
+ U.toast('Addons reset to default');
428
+ setTimeout(renderSettings, 300);
429
+ });
430
+ };
431
+ wrap.appendChild(reset);
432
+
371
433
  // Add-addon input
372
434
  var addRow = U.el('div', 'addon-item focusable');
373
435
  addRow.appendChild(U.el('div', 'a-name', '+ Add addon (focus, then type a manifest URL)'));
@@ -398,6 +460,7 @@ var Views = (function () {
398
460
 
399
461
  return {
400
462
  renderHome: renderHome, renderDetail: renderDetail, renderSettings: renderSettings,
401
- renderSearch: renderSearch, backInDetail: backInDetail
463
+ renderSearch: renderSearch, backInDetail: backInDetail,
464
+ isModalOpen: function () { return _modalOpen; }, closeModal: closeModal
402
465
  };
403
466
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuvio-tizen",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Nuvio-style Stremio-addon streaming client for Tizen 3.0+ Samsung TVs (TizenBrew app module).",
5
5
  "packageType": "app",
6
6
  "appName": "Nuvio",