Spaces:
Runtime error
Runtime error
url params
Browse files
frontend/src/lib/Buttons/RoomsSelector.svelte
CHANGED
|
@@ -35,8 +35,8 @@
|
|
| 35 |
$selectedRoomID = room.room_id;
|
| 36 |
collapsed = true;
|
| 37 |
$page.url.searchParams.set('roomid', room.room_id);
|
| 38 |
-
window.location.search =
|
| 39 |
-
window.parent.postMessage({ queryString:
|
| 40 |
}
|
| 41 |
</script>
|
| 42 |
|
|
|
|
| 35 |
$selectedRoomID = room.room_id;
|
| 36 |
collapsed = true;
|
| 37 |
$page.url.searchParams.set('roomid', room.room_id);
|
| 38 |
+
window.location.search = $page.url.searchParams.toString()
|
| 39 |
+
window.parent.postMessage({ queryString: $page.url.searchParams.toString() }, '*');
|
| 40 |
}
|
| 41 |
</script>
|
| 42 |
|
frontend/src/lib/ContentWarningModal.svelte
CHANGED
|
@@ -25,7 +25,10 @@
|
|
| 25 |
|
| 26 |
<button
|
| 27 |
bind:this={okButton}
|
| 28 |
-
on:click={() =>
|
|
|
|
|
|
|
|
|
|
| 29 |
class="font-semibold bg-blue-700 text-white rounded-lg px-5 text-xl 2xl:text-2xl spacing tracking-wide hover:saturate-150"
|
| 30 |
title="Input prompt to generate image and negative prompt inside brackets <NEGATIVE PROMPT>"
|
| 31 |
>OK
|
|
|
|
| 25 |
|
| 26 |
<button
|
| 27 |
bind:this={okButton}
|
| 28 |
+
on:click={() => {
|
| 29 |
+
//set acceptedContentWarning cookie
|
| 30 |
+
dispatch('contentModal');
|
| 31 |
+
}}
|
| 32 |
class="font-semibold bg-blue-700 text-white rounded-lg px-5 text-xl 2xl:text-2xl spacing tracking-wide hover:saturate-150"
|
| 33 |
title="Input prompt to generate image and negative prompt inside brackets <NEGATIVE PROMPT>"
|
| 34 |
>OK
|
frontend/src/routes/+page.svelte
CHANGED
|
@@ -36,10 +36,11 @@
|
|
| 36 |
});
|
| 37 |
|
| 38 |
updateRooms();
|
| 39 |
-
|
|
|
|
| 40 |
const accepted = Cookies.get('acceptedContentWarning');
|
| 41 |
hideContentModal = false;
|
| 42 |
-
if (accepted) {
|
| 43 |
hideContentModal = true;
|
| 44 |
}
|
| 45 |
});
|
|
@@ -47,6 +48,10 @@
|
|
| 47 |
function contentModal() {
|
| 48 |
hideContentModal = true;
|
| 49 |
Cookies.set('acceptedContentWarning', 'true', { expires: 10 });
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
async function updateRooms() {
|
|
@@ -74,10 +79,11 @@
|
|
| 74 |
// if seleceted room is full, select the first empty room
|
| 75 |
if (queriedRoom) {
|
| 76 |
$selectedRoomID = queriedRoom;
|
| 77 |
-
const
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
window.
|
|
|
|
| 81 |
}
|
| 82 |
loading = false;
|
| 83 |
return { rooms };
|
|
|
|
| 36 |
});
|
| 37 |
|
| 38 |
updateRooms();
|
| 39 |
+
const acceptedParam = new URLSearchParams(window.location.search).get('acceptedContentWarning')
|
| 40 |
+
console.log(acceptedParam);
|
| 41 |
const accepted = Cookies.get('acceptedContentWarning');
|
| 42 |
hideContentModal = false;
|
| 43 |
+
if (accepted || acceptedParam === 'true') {
|
| 44 |
hideContentModal = true;
|
| 45 |
}
|
| 46 |
});
|
|
|
|
| 48 |
function contentModal() {
|
| 49 |
hideContentModal = true;
|
| 50 |
Cookies.set('acceptedContentWarning', 'true', { expires: 10 });
|
| 51 |
+
const params = new URLSearchParams(window.location.search);
|
| 52 |
+
params.set('acceptedContentWarning', 'true');
|
| 53 |
+
window.parent.postMessage({ queryString: params.toString() }, '*');
|
| 54 |
+
window.location.search = params.toString();
|
| 55 |
}
|
| 56 |
|
| 57 |
async function updateRooms() {
|
|
|
|
| 79 |
// if seleceted room is full, select the first empty room
|
| 80 |
if (queriedRoom) {
|
| 81 |
$selectedRoomID = queriedRoom;
|
| 82 |
+
const params = new URLSearchParams(window.location.search);
|
| 83 |
+
params.set('roomid', queriedRoom);
|
| 84 |
+
|
| 85 |
+
window.history.replaceState(null, '', `?${params.toString()}`);
|
| 86 |
+
window.parent.postMessage({ queryString: params.toString() }, '*');
|
| 87 |
}
|
| 88 |
loading = false;
|
| 89 |
return { rooms };
|