@blueharford/scrypted-spatial-awareness 0.1.10 → 0.1.11

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/dist/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueharford/scrypted-spatial-awareness",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Cross-camera object tracking for Scrypted NVR with spatial awareness",
5
5
  "author": "Joshua Seidel <blueharford>",
6
6
  "license": "Apache-2.0",
package/src/main.ts CHANGED
@@ -336,6 +336,8 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
336
336
  const settings = await this.storageSettings.getSettings();
337
337
 
338
338
  // Topology editor button that opens modal overlay (appended to body for proper z-index)
339
+ const onclickCode = `(function(){var e=document.getElementById('sa-topology-modal');if(e)e.remove();var m=document.createElement('div');m.id='sa-topology-modal';m.style.cssText='position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.9);z-index:2147483647;display:flex;align-items:center;justify-content:center;';var c=document.createElement('div');c.style.cssText='width:95vw;height:92vh;max-width:1800px;background:#1a1a2e;border-radius:12px;overflow:hidden;position:relative;box-shadow:0 25px 50px rgba(0,0,0,0.5);';var b=document.createElement('button');b.innerHTML='×';b.style.cssText='position:absolute;top:15px;right:15px;z-index:2147483647;background:#e94560;color:white;border:none;width:40px;height:40px;border-radius:50%;font-size:24px;cursor:pointer;';b.onclick=function(){m.remove();};var f=document.createElement('iframe');f.src='/endpoint/@blueharford/scrypted-spatial-awareness/ui/editor';f.style.cssText='width:100%;height:100%;border:none;';c.appendChild(b);c.appendChild(f);m.appendChild(c);m.onclick=function(ev){if(ev.target===m)m.remove();};document.body.appendChild(m);})()`;
340
+
339
341
  settings.push({
340
342
  key: 'topologyEditor',
341
343
  title: 'Topology Editor',
@@ -374,33 +376,10 @@ export class SpatialAwarenessPlugin extends ScryptedDeviceBase
374
376
  </style>
375
377
  <div class="sa-btn-container">
376
378
  <p class="sa-btn-desc">Configure camera positions, connections, and transit times</p>
377
- <button class="sa-open-btn" onclick="window.openSATopologyEditor()">
379
+ <button class="sa-open-btn" onclick="${onclickCode}">
378
380
  <span>&#9881;</span> Open Topology Editor
379
381
  </button>
380
382
  </div>
381
- <script>
382
- window.openSATopologyEditor = function() {
383
- var existing = document.getElementById('sa-topology-modal');
384
- if (existing) existing.remove();
385
- var modal = document.createElement('div');
386
- modal.id = 'sa-topology-modal';
387
- modal.style.cssText = 'position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.9);z-index:2147483647;display:flex;align-items:center;justify-content:center;';
388
- var container = document.createElement('div');
389
- container.style.cssText = 'width:95vw;height:92vh;max-width:1800px;background:#1a1a2e;border-radius:12px;overflow:hidden;position:relative;box-shadow:0 25px 50px rgba(0,0,0,0.5);';
390
- var closeBtn = document.createElement('button');
391
- closeBtn.innerHTML = '&times;';
392
- closeBtn.style.cssText = 'position:absolute;top:15px;right:15px;z-index:2147483647;background:#e94560;color:white;border:none;width:40px;height:40px;border-radius:50%;font-size:24px;cursor:pointer;';
393
- closeBtn.onclick = function() { modal.remove(); };
394
- var iframe = document.createElement('iframe');
395
- iframe.src = '/endpoint/@blueharford/scrypted-spatial-awareness/ui/editor';
396
- iframe.style.cssText = 'width:100%;height:100%;border:none;';
397
- container.appendChild(closeBtn);
398
- container.appendChild(iframe);
399
- modal.appendChild(container);
400
- modal.onclick = function(e) { if (e.target === modal) modal.remove(); };
401
- document.body.appendChild(modal);
402
- };
403
- </script>
404
383
  `,
405
384
  group: 'Topology',
406
385
  });