feat: organize places and device workspaces with scoped heritage records
This commit is contained in:
+3
-3
@@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
let wallOwner='',wallOrder=[],wallPage=0,wallDragging='',ptzCamera='',ptzGeneration=0;
|
||||
const WALL_LAYOUTS={auto:[0,0],1:[1,1],2:[2,1],4:[2,2],6:[3,2],9:[3,3],16:[4,4]};
|
||||
function wallStorageKey(){return 'zhaofu-monitor-'+(currentUser?.id||'guest');}
|
||||
function wallStorageKey(){return 'zhaofu-monitor-'+(currentUser?.id||'guest')+'-'+(state.familyId||'')+'-'+(deviceContext?.id||'wall');}
|
||||
function wallSave(){try{localStorage.setItem(wallStorageKey(),JSON.stringify({order:wallOrder,layout:$('#wall-layout').value}));}catch{}}
|
||||
function wallSync(){
|
||||
if(wallOwner!==(currentUser?.id||'')){
|
||||
wallOwner=currentUser?.id||'';wallPage=0;let saved={};try{saved=JSON.parse(localStorage.getItem(wallStorageKey()))||{};}catch{}
|
||||
if(wallOwner!==wallStorageKey()){
|
||||
wallOwner=wallStorageKey();wallPage=0;let saved={};try{saved=JSON.parse(localStorage.getItem(wallStorageKey()))||{};}catch{}
|
||||
wallOrder=Array.isArray(saved.order)?saved.order.filter(x=>/^[a-f0-9]{16}$/.test(x)):[];
|
||||
$('#wall-layout').value=Object.hasOwn(WALL_LAYOUTS,saved.layout)?saved.layout:'auto';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user