Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions docs/multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,36 @@
ifrm.src = select.value + flags + h;
}
function handleHash() {
var route = (window.location.hash || "#");
var parts = route.replace(/^#/, '').split(':|:', 2);
updateSrc(left, selectLeft, parts[0]);
updateSrc(right, selectRight, parts[1]);
var route = decodeURIComponent(window.location.hash || "#");

if (route.indexOf(":|:") !== -1) {
var parts = route.replace(/^#/, '').split(':|:', 2);
updateSrc(left, selectLeft, parts[0]);
updateSrc(right, selectRight, parts[1]);
}
else {
route = route.replace(/^#/, '');
var params = new URLSearchParams(route);
if (params.has("left")) {
updateSrc(left, selectLeft, params.get("left"));
}
else if (params.has("leftscript")) {
updateSrc(left, selectLeft, "pub:" + params.get("leftscript"));
}
else {
updateSrc(left, selectLeft);
}
if (params.has("right")) {
updateSrc(right, selectRight, params.get("right"));
}
else if (params.has("rightscript")) {
updateSrc(right, selectRight, "pub:" + params.get("rightscript"));
}
else {
updateSrc(right, selectRight);
}
}

window.history.replaceState('', '', '#')
}

Expand Down
34 changes: 30 additions & 4 deletions webapp/public/multi.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,36 @@
function handleHash() {
var hashLeft = ""
var hashRight = ""
var route = (window.location.hash || "#");
var parts = route.replace(/^#/, '').split(':|:', 2);
updateSrc(left, parts[0]);
updateSrc(right, parts[1]);
var route = decodeURIComponent(window.location.hash || "#");

if (route.indexOf(":|:") !== -1) {
var parts = route.replace(/^#/, '').split(':|:', 2);
updateSrc(left, parts[0]);
updateSrc(right, parts[1]);
}
else {
route = route.replace(/^#/, '');
var params = new URLSearchParams(route);
if (params.has("left")) {
updateSrc(left, params.get("left"));
}
else if (params.has("leftscript")) {
updateSrc(left, "pub:" + params.get("leftscript"));
}
else {
updateSrc(left);
}
if (params.has("right")) {
updateSrc(right, params.get("right"));
}
else if (params.has("rightscript")) {
updateSrc(right, "pub:" + params.get("rightscript"));
}
else {
updateSrc(right);
}
}

window.history.replaceState('', '', '#')
}
function handleMessage(msg) {
Expand Down
Loading