From 74b3edc4f2030d7638505b0063f73a06a37018cf Mon Sep 17 00:00:00 2001 From: = Date: Mon, 6 May 2024 20:23:41 -0600 Subject: [PATCH] Added link position persistance --- index.html | 2 +- scripts-v5/{wslink-v7.js => wslink-v8.js} | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) rename scripts-v5/{wslink-v7.js => wslink-v8.js} (99%) diff --git a/index.html b/index.html index 6c6487c..8b0cc0b 100755 --- a/index.html +++ b/index.html @@ -671,7 +671,7 @@

Data Privacy

- + diff --git a/scripts-v5/wslink-v7.js b/scripts-v5/wslink-v8.js similarity index 99% rename from scripts-v5/wslink-v7.js rename to scripts-v5/wslink-v8.js index 1772eb0..f639e01 100644 --- a/scripts-v5/wslink-v7.js +++ b/scripts-v5/wslink-v8.js @@ -99,7 +99,8 @@ function create_link(auto_link = false){ function link_room(){ var room_id = document.getElementById("room_id").value - ws = new WebSocket(`wss://zero-network.net/phasmolink/link/${znid}/${room_id}`); + var load_pos = getCookie("link-position") + ws = new WebSocket(`wss://zero-network.net/phasmolink/link/${znid}/${room_id}${load_pos ? '?pos='+load_pos : ''}`); setCookie("room_id",room_id,1) ws.onopen = function(event){ @@ -132,6 +133,7 @@ function link_room(){ if (incoming_state.hasOwnProperty("setpos")){ my_pos = incoming_state["setpos"] + setCookie("link-position",my_pos,1) pos_elem = document.getElementById("link_pos") pos_elem.innerText = my_pos pos_elem.style.border = `2px solid #${pos_colors[my_pos]}` @@ -517,6 +519,7 @@ function disconnect_room(reset=false,has_status=false){ document.getElementById("room_id").value = "" } setCookie("room_id","",-1) + setCookie("link-position","",1) hasLink=false } }