////"use strict"; function maximize_window(win_id) { var win = null; var is_maximized = null; var window_state = null; var desktop = null; var desktop_w = null; var desktop_h = null; var offset_height = null; var orig_x = null; var orig_y = null; var orig_w = null; var orig_h = null; var win_top = null; var win_left = null; var win_width = null; var win_height = null; var pixel_ratio = null; var was_minimized = null; var was_maximized = null; var is_minimized = null; var h = null; var w = null; var resize_icon_id = null; var resize_icon = null; reset_css_pixel_ratio(); //IMPORTANT for resetting the pixel ratio. Sets the ratio of CSS and regular pixels to 1:1 win = document.getElementById(win_id); if (win != null) { //2023-09-22: //instead of assigning default CSS animations for all //CSS properties, assign CSS animations to a window depending //on its action. This function removes CSS animations from //the window, and sets animation to the width and height. //See file: 'window_2.js' ////set_animations_resize_window(win_id); //2024-04-19: //Apply default CSS animation to element for //CSS properties: top, left, width, height, and box-shadow. //This CSS animation behaves the same way for all CSS properties //mentioned. remove any CSS animations from the window's interface //to prevent the window's table from lagging during move/resize, etc. //See file: 'window_2.js' ////set_animations_move_window(win_id); set_animations_default(win_id); remove_elem_animations(win_id + "_tbl_0000"); //cascade_all_windows(); //minimized_table_scroll_top(); //scroll back to top (scroll_box default) is_maximized = win.getAttribute("data-is_maximized"); is_minimized = win.getAttribute("data-is_minimized"); //if the window is NOT maximized. //It is either cascaded or minimized if (is_maximized !== "true" || is_maximized !== true) { win.style.maxWidth = "unset"; win.style.minWidth = "unset"; win.style.maxHeight = "unset"; win.style.minHeight = "unset"; //if the window is minimized, save it to a variable that is used //in the code below, located after the change of the window state //and the is_minimized attribute is changed. was_minimized = is_minimized; ////alert("not maximized"); global_css_pixel_ratio = get_pixel_ratio(); global_css_pixel_ratio = get_inverse_pixel_ratio(global_css_pixel_ratio); //desktop = document.getElementById("desktop"); //desktop_w = parseFloat(window.innerWidth); //desktop_h = parseFloat(window.innerHeight) - 3; //w = parseFloat(desktop_w); //h = parseFloat(desktop_h); // - 30; //if (global_css_pixel_ratio === 0.8) { // w = (w / (global_css_pixel_ratio)); // h = (h / (global_css_pixel_ratio)); //} //else { // ////w = (w * (global_css_pixel_ratio)); // ////h = (h * (global_css_pixel_ratio)); //} //if (document.getElementById("div_wrapper_0") !== null) { // offset_height = parseFloat(parseFloat(document.getElementById("div_wrapper_0").style.height) + 5); //} //else { // offset_height = 34; //} offset_height = 0; //this code is now stored in a different file: //see file: 'window_state_controls.js' /*if (document.getElementById("div_wrapper_0") !== null) { document.getElementById("div_wrapper_0").style.display = "none"; }*/ win_left = parseFloat(window.scrollX); win_top = parseFloat(window.scrollY) + (offset_height); // - get_scroll_offset_y(); ////win_width = parseFloat(w) - 9; ////win_height = parseFloat(h) - (offset_height); win_width = "calc(100% - 3px)"; win_height = "calc(100% - 1px)"; win.childNodes[0].style.opacity = 0.0; win.style.opacity = 0.5; win.style.left = parseFloat(win_left) + "px"; win.style.top = parseFloat(win_top) + "px"; //global_tId7 = setTimeout(function () { ////win.style.width = parseFloat(win_width) + "px"; ////win.style.height = parseFloat(win_height) + "px"; win.style.width = win_width; win.style.height = win_height; win.childNodes[0].style.opacity = global_window_opacity; win.style.opacity = global_window_opacity; // clearTimeout(global_tId7); // }, 400); ////win.style.position = "fixed"; win.childNodes[0].style.position = "relative"; win.childNodes[0].style.left = "0"; //2024-05-14: //the 'top' parameter was set to be changed from its default (0), //to '2px'. this made any minimized windows that were maximized appear //to be slight offset with the window's table object. setting this to //"0" appears to have no effect on a maximized window, and seems to //eliminate the vertical offset of the controls of a minimized window. ////win.childNodes[0].style.top = "2px"; win.childNodes[0].style.top = "0"; win.childNodes[0].style.width = win_width; // + "px"; //parseFloat(win.style.width).toString() + "px"; win.childNodes[0].style.height = win_height; // + "px"; //parseFloat(win.style.height).toString() + "px"; setTimeout(function () { disable_element(resize_icon.parentNode.id); }, 450); resize_icon_id = win_id + "_tbl_0000_tr_0002_td_0007_img_0007"; resize_icon = document.getElementById(resize_icon_id); resize_icon.style.opacity = 0.33; minimize_icon_id = win_id + "_tbl_0000_tr_0000_td_0002_img_0000"; minimize_icon = document.getElementById(minimize_icon_id); minimize_icon.setAttribute("src", "/chromosphere/images/ui/icons/minimize_19x19.png"); //disable_element(minimize_icon.parentNode.id); //minimize_icon.style.opacity = 0.0; maximize_icon_id = (win_id + "_tbl_0000_tr_0000_td_0003"); maximize_icon = document.getElementById(maximize_icon_id).childNodes[0]; maximize_icon.setAttribute("src", "images/ui/icons/cascade_19x19.png"); move_to_front(win.getAttribute("id")); resize_contents_container(win_id); //if the code editor is present in the window, //then show the code editor, and size the code //editor objects to fit the window's content //container. see file: 'code_editor_functions.js' if (is_code_editor_present(win_id) === true) { show_code_editor(win_id); on_cascade_resize_objects(win_id); on_maximize_resize_code_window(win_id); //if the code editor is visible and present, resize it accordingly resize_tabs_bar(win_id); setTimeout(function () { resize_tabs_bar(win_id); }, 300); }; ////on_maximize_resize_code_window(win_id); //if the code editor is visible and present, //resize it accordingly. //update_window_details(win_id); //if window details are showing, update them //resize the blocking image that prevents unwanted user interaction resize_window_adjust_blocking_image(win_id); document.getElementById(win_id).setAttribute("data-is_maximized", "true"); document.getElementById(win_id).setAttribute("data-is_minimized", "false"); document.getElementById(win_id).setAttribute("data-window_state", "Maximize"); //console.log(get_window_state(win_id)); //Set the web window's 3 upper right icons //that are used to change the web window's "state" (or display) //to match the state the web window is in: "cascade", "maximized", "minimized" set_window_state_icons(win_id); //2024-04-18: //if window was minimized, and is changing to "Maximize", //then hide the 'stow minimized windows' box. If the //window is now maximized, then the box should be hidden. //see files: 'minimize_window_scroll_box.js', and 'stow_minimized_windows.js' if (was_minimized === "true") { minimize_window_main(win); //// setTimeout(function () { hide_stow_minimized_window_box(); //// }, 500); } //2024-04-23: //this function hides the small icon that retracts the stowed minimized windows //and the box/button that stows minimized windows. //see file: 'hide_show_stowed.js' //// setTimeout(function () { hide_tuck_stowed_minimized_window_icon(); //// }, 500); //// global_tId24 = setTimeout(function () { /* minimize_window_main(win); */ //// clearTimeout(global_tId24); ////}, 350); //minimized_table_scroll_top(); //scroll back to top (scroll_box) //elem_scroll_Y(0); //scroll the minimized table/menu to the top. Fixes a bug... //these functions are located in 'minimize_window_scroll_box.js' file //scroll_box_scroll_top(); //upon maximize, if a window is below the window inner height in the minimize menu/table, move it back to the top, it //none_minimized_delete_scrollbox_table(); //if there are no minimized windows, remove scroll box and table/menu //} //2023-07-20: Set the web window's bg color to default' //this sets the web window's bg color to default on minimize. win.style.backgroundColor = global_window_bgColor; //set_thumbnail_bg_color(elem); setTimeout(function () { //2023-09-21: //This function places x resize, and y resize //bars onto the window. See file 'resize_windiw.js' setup_resize_bars(win_id); //2023-09-22: //This resizes the bar object for resizing. In this case, //we are resizing the bar that provides only X resizing. //See file 'set_x_resize.js' set_size_resize_bar_x(win_id); //2023-09-22: //This resizes the bar object for resizing. In this case, //we are resizing the bar that provides only Y resizing. //See file 'set_y_resize.js' set_size_resize_bar_y(win_id); }, 400); } else if (is_maximized === true || is_maximized === "true") { //else if the window is in a maximized state, //then Cascade the window //return; //alert("maximized"); //if the window is maximized, save it to a variable that is used //in the code below, located after the change of the window state //and the is_maximized attribute is changed. was_maximized = is_maximized; orig_x = (win.getAttribute("data-orig_x")); orig_y = (win.getAttribute("data-orig_y")); orig_w = (win.getAttribute("data-orig_w")); orig_h = (win.getAttribute("data-orig_h")); orig_y = orig_y + offset_Y_maximized_window(); win.childNodes[0].style.position = "relative"; win.childNodes[0].style.left = "0"; //parseFloat(win.style.left) + "px"; win.childNodes[0].style.top = "0"; //parseFloat(win.style.top) + "px"; win.childNodes[0].style.width = parseFloat(orig_w) + "px"; win.childNodes[0].style.height = parseFloat(orig_h) + "px"; win.style.opacity = 0.5; win.childNodes[0].style.opacity = 0.0; //2023-07-20: Set the web window's bg color to default' //this sets the web window's bg color to default on minimize. win.style.backgroundColor = global_window_bgColor; //set_thumbnail_bg_color(elem); //global_tId8 = setTimeout(function () { win.style.left = parseFloat(orig_x) + "px"; //if (parseFloat(orig_x) > parseFloat(win.style.left)) { // move_elem_right(win, parseFloat(orig_x), 1, 40); //} //else if (parseFloat(orig_x) < parseFloat(win.style.left)) { // move_elem_left(win, parseFloat(orig_x), 1, 40); //} win.style.top = parseFloat(orig_y) + "px"; //if (parseFloat(orig_y) > parseFloat(win.style.top)) { // move_elem_bottom(win, parseFloat(orig_y), 1, 40); //} //else if (parseFloat(orig_y) < parseFloat(win.style.top)) { // move_elem_top(win, parseFloat(orig_y), 1, 40); // } win.childNodes[0].style.opacity = global_window_opacity; win.style.opacity = global_window_opacity; // clearTimeout(global_tId8); // }, 400); win.style.width = parseFloat(orig_w) + "px"; //if (parseFloat(orig_w) > parseFloat(win.style.width)) { // increase_elem_width(win, parseFloat(orig_w), 1, 30); //} //else if (parseFloat(orig_w) < parseFloat(win.style.width)) { // decrease_elem_width(win, parseFloat(orig_w), 1, 30); //} win.style.height = parseFloat(orig_h) + "px"; //win.style.height = orig_h + "px"; //if (parseFloat(orig_h) > parseFloat(win.style.height)) { // increase_elem_height(win, parseFloat(orig_h), 1, 30); //} //else if (parseFloat(orig_h) < parseFloat(win.style.height)) { // decrease_elem_height(win, parseFloat(orig_h), 1, 30); //} /* resize_icon_id = win_id + "_tbl_0000_tr_0002_td_0007_img_0007"; resize_icon = document.getElementById(resize_icon_id); resize_icon.style.visibility = "visible"; resize_icon.style.opacity = 1.0; */ //if the web window is not maximized, enable the resize icon in case it's diabled enable_resize_icon(win_id); minimize_icon_id = win_id + "_tbl_0000_tr_0000_td_0002_img_0000"; minimize_icon = document.getElementById(minimize_icon_id); //minimize_icon.style.opacity = 1.0; maximize_icon_parent_id = (win_id + "_tbl_0000_tr_0000_td_0003"); maximize_icon = document.getElementById(maximize_icon_parent_id).childNodes[0]; maximize_icon.setAttribute("src", "images/ui/icons/maximize_19x19.png"); resize_contents_container(win_id); //resize the image that blocks unwanted user interaction resize_window_adjust_blocking_image(win_id); //if the code editor is present in the window, //then show the code editor, and size the code //editor objects to fit the window's content //container. see file: 'code_editor_functions.js' if (is_code_editor_present(win_id) === true) { show_code_editor(win_id); on_cascade_resize_objects(win_id); on_maximize_resize_code_window(win_id); //if the code editor is visible and present, resize it accordingly resize_tabs_bar(win_id); }; //on_maximize_resize_code_window(win_id); //if the code editor is visible and present, resize it accordingly //update_window_details(win_id); //if window details are showing, update them document.getElementById(win_id).setAttribute("data-is_maximized", "false"); document.getElementById(win_id).setAttribute("data-is_minimized", "false"); document.getElementById(win_id).setAttribute("data-window_state", "Cascade"); console.log(get_window_state(win_id)); //Upon minimizing a window, its drop shadow is removed. //Now that the window is considered cascaded, the drop //shadow can be reset. win.style.boxShadow = global_inactive_window_dropshadow; //Set the web window's 3 upper right icons //that are used to change the web window's "state" (or display) //to match the state the web window is in: "cascade", "maximized", "minimized" set_window_state_icons(win_id); //set_icons_for_cascaded_win(win_id); //minimized_table_scroll_top(); //scroll back to top (scroll_box default) //elem_scroll_Y(0); //scroll minimize table/menu to top (0). Fixes a bug...see minimize_window_scroll_box.js file //scroll_box_scroll_top(); //scroll the scroll box back to the top //none_minimized_delete_scrollbox_table(); //if there are no minimized windows, delete the scroll box and minimized window table/menu //minimize_window_main(); //creates and populates a menu/table that holds minimized windows. //2023-09-22: //This resizes the bar object for resizing. In this case, //we are resizing the bar that provides only X resizing. //See file 'set_x_resize.js' set_size_resize_bar_x(win_id); //2023-09-23: //This resizes the bar object for resizing. In this case, //we are resizing the bar that provides only Y resizing. //See file 'set_y_resize.js' set_size_resize_bar_y(win_id); //this function checks to see if any minimized windows are //stowed. if they are, then show the tuck/untuck stowed icon. //see file: 'stow_minimized_windows.js' ////if_minimized_windows_stowed_and_tucked_show_icon(); //2024-04-23: //see file: 'hide_show_stowed.js' //this function checks to see if any minimized windows are //stowed. if they are, then show the tuck/untuck stowed icon. if_minimized_windows_stowed_show_tuck_icon(); } } populate_details(win_id); //show_hide_minimized_win_scroll_box(); //show/hide minimized window menu scroll box (see minimize_window.js) //minimized_table_scroll_top(); //scroll back to top (scroll_box default) } function maximize_window_by_command(win_id) { var maximize_window_icon_td = null; var win = null; win = document.getElementById(win_id); maximize_window_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_0003"); if (win !== null) { if (maximize_window_icon_td !== null) { invoke_entire_mouse_event(maximize_window_icon_td.id); } } } function offset_Y_maximized_window() { var orig_position = null; var new_position = null; var windows = null; windows = document.getElementsByName("web_window"); var is_maximized = null; var win_obj = null; var scroll_Y = null; var i = null; scroll_Y = parseFloat(window.scrollY); if (scroll_Y != null) { for (i = 0; i < windows.length; i++) { win_obj = windows[i]; is_maximized = win_obj.getAttribute("data-is_maximized"); if (is_maximized == "true") { win_obj.style.top = scroll_Y + "px"; return; } } } } function set_window_fixed(win_id) { var win = null; var new_position = null; var orig_position = null; win = document.getElementById(win_id); if (win != null) { new_position = "fixed"; orig_position = win.style.position; win.setAttribute("data-original_style_position", orig_position); win.style.position = new_position; } } function set_window_absolute(win_id) { var win = null; var new_position = null; var orig_position = null; win = document.getElementById(win_id); if (win != null) { new_position = "absolute"; orig_position = win.style.position; win.setAttribute("data-original_style_position", orig_position); win.style.position = new_position; } } function set_window_static(win_id) { //"static" is the default for objects var win = null; var new_position = null; var orig_position = null; win = document.getElementById(win_id); if (win != null) { new_position = "static"; orig_position = win.style.position; win.setAttribute("data-original_style_position", orig_position); win.style.position = new_position; } } function cascade_all_maximized() { var windows = null; windows = document.getElementsByName("web_window"); var is_maximized = null; var win_obj = null; var i = null; for (i = 0; i < windows.length; i++) { win_obj = windows[i]; is_maximized = win_obj.getAttribute("data-is_maximized"); if (is_maximized == "true") { cascade_window(win_obj.id); } } } function cascade_all_() { var windows = null; windows = document.getElementsByName("web_window"); var is_cascaded = null; var win_obj = null; var i = null; for (i = 0; i < windows.length; i++) { win_obj = windows[i]; is_cascaded = win_obj.getAttribute("data-is_cascaded"); if (is_cascaded === "true") { cascade_window(win_obj.id); } } } function maximize_code_editor(win_id) { var controls = null; var parent_cell_id = null; var parent_cell_obj = null; var parent = null; controls = document.getElementById(win_id + "_code_editor_container"); parent_cell_id = win_id + "_inner_contents_container"; parent_cell_obj = document.getElementById(parent_cell_id); parent = parent_cell_obj; if (controls !== null) { resize_objects(controls, parent); //this method can be found in code_editor.js } } function get_maximized_windows() { var web_windows = null; var web_window = null; var is_maximized = null; var web_windows_length = null; var maximized_windows = null; web_windows = document.getElementsByName("web_window"); if (web_windows !== null) { web_windows_length = web_windows.length; if (web_windows_length > 0) { maximized_windows = []; for (i = 0; i < web_windows.length; i++) { web_window = web_windows[i]; is_maximized = web_window.getAttribute("data-is_maximized"); if (is_maximized === "true") { maximized_windows.push(web_window.getAttribute("id")); } } } } return maximized_windows; } function resize_maximized_web_windows() { var maximized_windows = null; var maximized_windows_length = null; var desktop = null; var desktop_h = null; var desktop_w = null; var h = null; var w = null; var offset_height = null; var i = null; var win = null; var win_left = null; var win_top = null; var win_width = null; var win_height = null; var inverse_pixel_ratio = null; var pixel_ratio = null; ////reset_css_pixel_ratio(); pixel_ratio = get_pixel_ratio(); inverse_pixel_ratio = get_inverse_pixel_ratio(pixel_ratio); //alert(inverse_pixel_ratio); maximized_windows = get_maximized_windows(); if (maximized_windows !== null) { maximized_windows_length = maximized_windows.length; //alert(maximized_windows_length); if (maximized_windows_length > 0) { desktop = document.getElementById("desktop"); if (desktop !== null) { desktop_w = parseFloat(desktop.style.width); desktop_h = parseFloat(desktop.style.height) - 3; w = parseFloat(desktop_w); h = parseFloat(desktop_h); w = (w * (pixel_ratio)); h = (h * (pixel_ratio)); if (document.getElementById("div_wrapper_0") != null) { offset_height = parseFloat(parseFloat(document.getElementById("div_wrapper_0").style.height) + 5); } else { offset_height = 34; } for (i = 0; i < maximized_windows_length; i++) { win = document.getElementById(maximized_windows[i]); if (win !== null && win !== undefined) { is_maximized = win.getAttribute("data-is_maximized"); if (is_maximized === "true") { win.setAttribute("data-is_maximized", "false"); maximize_window(win.id); return; } win_left = parseFloat(window.scrollX); win_top = parseFloat(window.scrollY) + (offset_height); // - get_scroll_offset_y(); win_width = parseFloat(w) - 9; win_height = parseFloat(h) - (offset_height); win.style.left = parseFloat(win_left) + "px"; win.style.top = parseFloat(win_top) + "px"; //win.style.width = win_width + parseFloat(win_width * inverse_pixel_ratio) + "px"; //win.style.height = win_height + parseFloat(win_height * inverse_pixel_ratio) + "px"; win.style.width = win_width + "px"; win.style.height = win_height + "px"; win.childNodes[0].style.position = "relative"; win.childNodes[0].style.left = "0"; win.childNodes[0].style.top = "2px"; win.childNodes[0].style.width = parseFloat(win.style.width) + "px"; // win_width + parseFloat(win_width / inverse_pixel_ratio) + "px"; //parseFloat(win.style.width) + "px"; win.childNodes[0].style.height = parseFloat(win.style.height) + "px"; //win_height + parseFloat(win_height / inverse_pixel_ratio) + "px"; //parseFloat(win.style.height) + "px"; resize_contents_container(win.id); } } } } } } //When the web window is displayed in a maximized state, the resize icon is set to disabled. //This function enables the resize icon when the web window is not in a "maximized" state of display. function enable_resize_icon(win_id) { var resize_icon_id = null; var resize_icon = null; resize_icon_id = win_id + "_tbl_0000_tr_0002_td_0007_img_0007"; resize_icon = document.getElementById(resize_icon_id); enable_element_on_maximize(resize_icon.parentNode.id); resize_icon.style.opacity = 1.0; }