mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Extract some helper functions for accessing a window/iframe by uuid
This commit is contained in:
parent
04a641adc2
commit
b03f6fae6d
@ -74,14 +74,6 @@ window.addEventListener('message', async (event) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const window_for_app_instance = (instance_id) => {
|
||||
return $(`.window[data-element_uuid="${instance_id}"]`).get(0);
|
||||
};
|
||||
|
||||
const iframe_for_app_instance = (instance_id) => {
|
||||
return $(window_for_app_instance(instance_id)).find('.window-app-iframe').get(0);
|
||||
};
|
||||
|
||||
const $el_parent_window = $(window_for_app_instance(event.data.appInstanceID));
|
||||
const parent_window_id = $el_parent_window.attr('data-id');
|
||||
const $el_parent_disable_mask = $el_parent_window.find('.window-disable-mask');
|
||||
|
@ -3512,4 +3512,14 @@ window.change_clock_visible = (clock_visible) => {
|
||||
}
|
||||
|
||||
$('select.change-clock-visible').val(window.user_preferences.clock_visible);
|
||||
}
|
||||
}
|
||||
|
||||
// Finds the `.window` element for the given app instance ID
|
||||
window.window_for_app_instance = (instance_id) => {
|
||||
return $(`.window[data-element_uuid="${instance_id}"]`).get(0);
|
||||
};
|
||||
|
||||
// Finds the `iframe` element for the given app instance ID
|
||||
window.iframe_for_app_instance = (instance_id) => {
|
||||
return $(window_for_app_instance(instance_id)).find('.window-app-iframe').get(0);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user