Fix params lost

This commit is contained in:
Xiayucheng1212
2024-04-17 19:45:01 +08:00
parent 7e0c6c6470
commit 8713db3d55
2 changed files with 11 additions and 1 deletions

View File

@@ -172,6 +172,14 @@ async function UIWindow(options) {
// Window
let zindex = options.stay_on_top ? (99999999 + last_window_zindex + 1 + ' !important') : last_window_zindex;
let user_set_url_params = [];
if (options.params !== undefined) {
for (let key in options.params) {
user_set_url_params.push(key + "=" + options.params[key]);
}
user_set_url_params = '?'+ user_set_url_params.join('&');
}
h += `<div class="window window-active
${options.cover_page ? 'window-cover-page' : ''}
${options.uid !== undefined ? 'window-'+options.uid : ''}
@@ -206,6 +214,7 @@ async function UIWindow(options) {
data-sort_order ="${options.sort_order ?? 'asc'}"
data-multiselectable = "${options.selectable_body}"
data-update_window_url = "${options.update_window_url}"
data-user_set_url_params = "${user_set_url_params}"
data-initial_zindex = "${zindex}"
style=" z-index: ${zindex};
${options.width !== undefined ? 'width: ' + html_encode(options.width) +'; ':''}
@@ -3154,7 +3163,7 @@ $.fn.focusWindow = function(event) {
//change window URL
const update_window_url = $(this).attr('data-update_window_url');
if(update_window_url === 'true' || update_window_url === null){
window.history.replaceState({window_id: $(this).attr('data-id')}, '', '/app/'+$(this).attr('data-app'));
window.history.replaceState({window_id: $(this).attr('data-id')}, '', '/app/'+$(this).attr('data-app')+$(this).attr('data-user_set_url_params'));
document.title = $(this).attr('data-name');
}
$(`.taskbar .taskbar-item[data-app="${$(this).attr('data-app')}"]`).addClass('taskbar-item-active');

View File

@@ -1845,6 +1845,7 @@ window.launch_app = async (options)=>{
element_uuid: uuid,
title: title,
iframe_url: iframe_url.href,
params: options.params ?? undefined,
icon: icon,
window_class: 'window-app',
update_window_url: true,