|
@@ -110,6 +110,8 @@ async function UIWindow(options) {
|
|
|
options.window_css = options.window_css ?? {};
|
|
|
options.window_class = (options.window_class !== undefined ? ' ' + options.window_class : '');
|
|
|
|
|
|
+ options.is_visible = options.is_visible ?? true;
|
|
|
+
|
|
|
// if only one instance is allowed, bring focus to the window that is already open
|
|
|
if(options.single_instance && options.app !== ''){
|
|
|
let $already_open_window = $(`.window[data-app="${html_encode(options.app)}"]`);
|
|
@@ -489,7 +491,9 @@ async function UIWindow(options) {
|
|
|
$(el_window_head_icon).attr('src', window.icons['shared.svg']);
|
|
|
}
|
|
|
// focus on this window and deactivate other windows
|
|
|
- $(el_window).focusWindow();
|
|
|
+ if ( options.is_visible ) {
|
|
|
+ $(el_window).focusWindow();
|
|
|
+ }
|
|
|
|
|
|
if (animate_window_opening) {
|
|
|
// animate window opening
|
|
@@ -517,25 +521,28 @@ async function UIWindow(options) {
|
|
|
|
|
|
// onAppend() - using show() is a hack to make sure window is visible AND onAppend is called when
|
|
|
// window is actually appended and usable.
|
|
|
- $(el_window).show(0, function(e){
|
|
|
- // if SaveFileDialog, bring focus to the el_savefiledialog_filename and select all
|
|
|
- if(options.is_saveFileDialog){
|
|
|
- let item_name = el_savefiledialog_filename.value;
|
|
|
- const extname = path.extname('/' + item_name);
|
|
|
- if(extname !== '')
|
|
|
- el_savefiledialog_filename.setSelectionRange(0, item_name.length - extname.length)
|
|
|
- else
|
|
|
- $(el_savefiledialog_filename).select();
|
|
|
-
|
|
|
- $(el_savefiledialog_filename).get(0).focus({preventScroll:true});
|
|
|
- }
|
|
|
- //set custom window css
|
|
|
- $(el_window).css(options.window_css);
|
|
|
- // onAppend()
|
|
|
- if(options.onAppend && typeof options.onAppend === 'function'){
|
|
|
- options.onAppend(el_window);
|
|
|
- }
|
|
|
- })
|
|
|
+ // NOTE: there is another is_visible condition below
|
|
|
+ if ( options.is_visible ) {
|
|
|
+ $(el_window).show(0, function(e){
|
|
|
+ // if SaveFileDialog, bring focus to the el_savefiledialog_filename and select all
|
|
|
+ if(options.is_saveFileDialog){
|
|
|
+ let item_name = el_savefiledialog_filename.value;
|
|
|
+ const extname = path.extname('/' + item_name);
|
|
|
+ if(extname !== '')
|
|
|
+ el_savefiledialog_filename.setSelectionRange(0, item_name.length - extname.length)
|
|
|
+ else
|
|
|
+ $(el_savefiledialog_filename).select();
|
|
|
+
|
|
|
+ $(el_savefiledialog_filename).get(0).focus({preventScroll:true});
|
|
|
+ }
|
|
|
+ //set custom window css
|
|
|
+ $(el_window).css(options.window_css);
|
|
|
+ // onAppend()
|
|
|
+ if(options.onAppend && typeof options.onAppend === 'function'){
|
|
|
+ options.onAppend(el_window);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
if(options.is_saveFileDialog){
|
|
|
//------------------------------------------------
|
|
@@ -960,7 +967,9 @@ async function UIWindow(options) {
|
|
|
$(el_window).css('top', options.top)
|
|
|
$(el_window).css('left', options.left)
|
|
|
}
|
|
|
- $(el_window).css('display', 'block');
|
|
|
+ if ( options.is_visible ) {
|
|
|
+ $(el_window).css('display', 'block');
|
|
|
+ }
|
|
|
|
|
|
// mousedown on the window body will unselect selected items if neither ctrl nor command are pressed
|
|
|
$(el_window_body).on('mousedown', function(e){
|