Work on expanding the routes
This commit is contained in:
@@ -415,23 +415,36 @@ export let process_permission_checks = function process_permission_checks(access
|
||||
// Svelte specific:
|
||||
// WARNING: Avoid using `history.pushState(...)` and `history.replaceState(...)` as these will conflict with SvelteKit's router. Use the `pushState` and `replaceState` imports from `$app/navigation` instead.
|
||||
// Updated 2024-03-02
|
||||
import { pushState, replaceState } from '$app/navigation';
|
||||
|
||||
function handle_url_and_message(name: string, value: null|string) {
|
||||
console.log(`*** handle_url_and_message() *** name=${name} value=${value}`);
|
||||
|
||||
let location = window.location.href;
|
||||
// console.log('location:', location);
|
||||
const url = new URL(location);
|
||||
// console.log('url:', url);
|
||||
|
||||
if (value) {
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.set(name, value);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// console.log('url:', url);
|
||||
// pushState(url.href, {});
|
||||
// pushState(url.search, {});
|
||||
// replaceState(url.href, {});
|
||||
|
||||
let message = {name: value};
|
||||
window.parent.postMessage(message, "*");
|
||||
} else {
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete(name);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// console.log('url:', url);
|
||||
// pushState({}, '', url.search);
|
||||
// pushState(url.href, {});
|
||||
// replaceState(url.href, {});
|
||||
|
||||
let message = {name: null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}
|
||||
@@ -476,6 +489,25 @@ function create_video_element({account_id, base_url, hosted_file_id, filename=nu
|
||||
}
|
||||
|
||||
|
||||
// // Clear the quick access type
|
||||
// function clear_access_type() {
|
||||
// // NOTE: I think it makes since to reset this to anonymous even if logged in as an admin or similar.
|
||||
// window.localStorage.setItem('access_type', 'anonymous');
|
||||
|
||||
// // $ae_loc.access_type = null; // 'anonymous';
|
||||
// $ae_loc.access_type = 'anonymous';
|
||||
// trigger = 'process_permission_check';
|
||||
|
||||
// show_passcode_input = false;
|
||||
|
||||
// // $ae_loc = $ae_loc; // Trigger Svelte just in case
|
||||
// // ae_loc.set($ae_loc);
|
||||
// // console.log($ae_loc);
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
export let ae_util = {
|
||||
iso_datetime_formatter: iso_datetime_formatter,
|
||||
number_w_commas: number_w_commas,
|
||||
|
||||
Reference in New Issue
Block a user