@blueharford/scrypted-spatial-awareness 0.1.9 → 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.9",
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,30 +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
- // Remove existing modal if any
384
- const existing = document.getElementById('sa-topology-modal');
385
- if (existing) existing.remove();
386
-
387
- // Create modal and append to body
388
- const modal = document.createElement('div');
389
- modal.id = 'sa-topology-modal';
390
- 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;';
391
- modal.innerHTML = \`
392
- <div style="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);">
393
- <button onclick="document.getElementById('sa-topology-modal').remove()" style="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;display:flex;align-items:center;justify-content:center;">&times;</button>
394
- <iframe src="/endpoint/@blueharford/scrypted-spatial-awareness/ui/editor" style="width:100%;height:100%;border:none;"></iframe>
395
- </div>
396
- \`;
397
- modal.onclick = function(e) { if (e.target === modal) modal.remove(); };
398
- document.body.appendChild(modal);
399
- };
400
- </script>
401
383
  `,
402
384
  group: 'Topology',
403
385
  });