Skip to content

Commit 3155ec5

Browse files
committed
Replace browser location when redirected to http (possibly fixed).
1 parent d4728dd commit 3155ec5

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Diff for: src/.todo

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ Todo:
2323
✔ scroll bar idle colour is hard to see @done(21-07-12 21:36)
2424

2525
Closed release:
26-
☐ Elements are not loaded in the correct order. (Partially complete).
2726

2827
Public release:
28+
☐ Replace browser location when redirected to http (possibly fixed).
29+
☐ Tell the browser to cache the elements for faster loading.
2930
☐ Change some variables from being stored as a cookie to local storage.
3031
☐ Create the settings menu instead of passing options in through the URL.
3132
☐ Odd issue with scaled UIs on firefox when dragging elements around.
@@ -104,6 +105,7 @@ Done:
104105
✔ sort out the protocol to load (http/https) when an external IP is specified. @done(21-07-22 21:28)
105106
✔ Remove the noscript tag from the page. @done(21-07-23 00:37)
106107
✔ I may need to defer the scripts to make sure that they are loaded after the page is loaded. @done(21-07-23 01:01)
108+
✔ Elements are not loaded in the correct order. (Partially complete). @done(21-07-23 16:29)
107109

108110
Cancelled:
109111
✘ fix @use on element stylesheets. @cancelled(21-05-15 21:23) replaced with variables set in ui.ts.

Diff for: src/edit/editor.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,13 @@ class Editor
393393
if (ip == null || ip == undefined || !RegExp(Client.ipRegex).test(ip)) { ip = "127.0.0.1"; }
394394
this.optionsMenu.data.gameIP.value = ip;
395395
Main.SetCache("GAME_IP", ip, 365);
396-
if (ip !== "127.0.0.1" && window.location.protocol !== "http:") { window.location.href = `http://${window.location.hostname}${window.location.pathname}${window.location.search}`; }
396+
if (ip !== "127.0.0.1" && window.location.protocol !== "http:")
397+
{
398+
history.replaceState(null, "", `http://${window.location.hostname}${window.location.pathname}${window.location.search}`);
399+
window.location.href = `http://${window.location.hostname}${window.location.pathname}${window.location.search}`;
400+
// history.replaceState(null, "",
401+
// window.location.href.replace(`http://${window.location.hostname}${window.location.pathname}${window.location.search}`, ""));
402+
}
397403
this.client = new Client(ip);
398404
this.client.AddEndpoint("MapData");
399405
this.client.AddEndpoint("LiveData");

Diff for: src/view/view.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ class View
111111
if (ip == null || ip == undefined || !RegExp(Client.ipRegex).test(ip)) { ip = "127.0.0.1"; }
112112
this.optionsContainer.options.ip.value = ip;
113113
Main.SetCache("GAME_IP", ip, 365);
114-
if (ip !== "127.0.0.1" && window.location.protocol !== "http:") { window.location.href = `http://${window.location.hostname}${window.location.pathname}${window.location.search}`; }
114+
if (ip !== "127.0.0.1" && window.location.protocol !== "http:")
115+
{
116+
history.replaceState(null, "", `http://${window.location.hostname}${window.location.pathname}${window.location.search}`);
117+
window.location.href = `http://${window.location.hostname}${window.location.pathname}${window.location.search}`;
118+
// history.replaceState(null, "",
119+
// window.location.href.replace(`http://${window.location.hostname}${window.location.pathname}${window.location.search}`, ""));
120+
}
115121
this.client = new Client(ip);
116122
this.client.AddEndpoint("MapData");
117123
this.client.AddEndpoint("LiveData");

0 commit comments

Comments
 (0)