"use strict"; //2024-15-2024: //This script is made up of functions //that handle main code operations //used in the tabbed windows feature. //This script depends on the functions //located inside other script files in //order to operate. //2024-1-17: //Happy birthday to Eddie, today! //2024-15-2024: /* ------------------------------------------------ //BEGIN WINDOW LAYER (Z-INDEX) REORDERING FUNCTIONS --------------------------------------------------*/ //2024_15_2024: //begin operating the feature by calling this function. //designate the win_id (i.e. the window's id) as the //argument. It defaults to the globally active window's id). //if it has been set. function init_tab_window(win_id = global_active_window_id) { start_tab_window(win_id); } //2024-02-15: //after initial configurations, start the window tabbing //process for a window. //[END COMMENT] function start_tab_window(win_id) { var window_tab = null; var tab_id = null; var tab_box = null; var window_tabs_container = null; var tabs_container = null; var tabbed_win_count = null; //if the tab for the window already exists, //then delete it. if (tab_box_exists(win_id)) { remove_tabbed_window_tab_box(win_id); } //2024-05-21: //the code below counts the number of tabbed windows. //if not tabbed windows exist, then remove the elements //of the tab window feature. tabbed_win_count = tabbed_window_count(); if (typeof (tabbed_win_count) === "number" && tabbed_win_count < 1) { remove_tabbed_windows_feature_framework(); } //make a tab object for the window to be tabbed. window_tab = make_window_title_tab(win_id); if (window_tab !== null) { //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 tabble 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"); //2024-1-16: //Change the "id" attribute of the element, and every //child element to a different value. This will prevent any //HTML element from having a duplicate id attribute value. //The line(s) of code below edit the "name" attribute of //the tab element, and the "id" attribute. window_tab = change_element_attribute_values(window_tab, "id", "_window_tab"); window_tab.setAttribute("name", "tabbed"); window_tab = change_element_attribute_values(window_tab, "name", "_window_tab"); //get, or create the container object that holds all tab box objects //for tabbed windows. tabs_container = get_tabbed_window_tabs_container(); if (tabs_container !== null) { tab_id = window_tab.getAttribute("id"); tab_box = document.getElementById(tab_id); if (tab_box !== null) { //that window must already be tabbed, //because there is already a tab //for that window inside the tabs //container. } else { //the window tab does not exist within the //"window tabs container" element. Place //the window's tab box inside the tabbed items //container. tabs_container.appendChild(window_tab); insert_window_tab_into_tabs_container(window_tab); tabs_container.style.display = "flex"; most_customizable_config_elem_for_animation(window_tab.id, "width, opacity", 0.8, 0); //set the width of each window's tab based upon //the number of tabs per the available browser's //available width. set_window_tab_boxes_width(); } //2024-05-12: //creating a CSS animation for the changing background of //a tab box when selected. see file: 'animations.js' add_css_animation_property(window_tab, "background-color"); } //2024-03-12: //set the tabs container to animate movement set_animations_default(tabs_container.id); } //make a tab box for the window to be tabbed. //set the size of the window's table object to the window's. //add event listeners for interacting with the tab box. make_tab_box_set_event_listeners(win_id); //this function displays the tucked stowed minimized windows //icon. much of the functionality for this function can be //found in files: 'stow_minimized_windows.js' and //'retracted_extend_minimized_windows.js'. show_stowed_tucked_minimized_windows_icon(); //2024-05-12: //this function will take the existing tab box element, //and places the appropriate window icons into the tab box. //see file: 'window_state_controls.js' for this function //2024-05-12: //commenting this function call out. it is now called //in another script. see file: 'window_state_controls.js' set_icons_add_functions_for_tabbed(win_id); } //2024-02-15: //a subroutine to make a tab box object for the window to be tabbed. //makes a tag object copied from a window's object title box in the //form of a table cell HTML object. the new tag object contains //a table which originally serves as a container holding the window's //title. the title of the window to be tabbed is placed within //a table cell object. add event listeners for interacting with //the tab box. //[END COMMENT] function make_tab_box_set_event_listeners(win_id) { win = document.getElementById(win_id); if (win !== null) { //place an HTML attribute value into the window's tag which //desginates the window's tabbed status. document.getElementById(win_id).setAttribute("data-is_tabbed", "true"); config_window_for_tabbed_view(win_id); //set the height and width of the window's table object to match //that of a window. win.childNodes[0].style.width = parseFloat(win.style.width) + "px"; win.childNodes[0].style.height = parseFloat(win.style.height) + "px"; //add the event handlers to the window to be tabbed needed for interaction. //set the window to be tabbed so that it expands its height and width //to fit within the viewing box for holding tabbed windows. add_resize_window_event_listeners(win_id); } } //2024-03-16: //the function that makes the tab box for a tabbed window. function make_window_title_tab(win_id) { var win = null; var tab_element = null; var title_box = null; var title_box_node = null; var title_box_id = null; var title_box_html = null; var title_box_wrapper = null; var tabs_container = null; var tab_close_icon = null; var content_box = null; //get the window object by its id win = document.getElementById(win_id); if (win !== null) { //get the id attribute of the window's title object title_box_id = win_id + "_window_title"; title_box = document.getElementById(title_box_id); if (title_box !== null) { //create a new HTML div object. title_box_wrapper = document.createElement("div"); //get the title box object of the window //that is to be tabbed. The function returns an HTML object, not text title_box_wrapper = get_window_title_HTML(win_id, title_box_wrapper); //give the tab box object an id, and a name attribute title_box_wrapper.setAttribute("id", title_box_id + "_div_wrapper"); title_box_wrapper.setAttribute("name", "title_box_wrapper"); //set the CSS background property of the new tab box object title_box_wrapper.style.backgroundColor = "rgba(153,153,153,1.0)"; set_all_tab_boxes_background_color(win_id); //set all other CSS properties for the tab box object. title_box_wrapper.style.top = "0"; ////title_box_wrapper.style.zIndex = 1000; //get_top_window_zIndex() + 1.0; //place the tab box in a layer (z-index) above all windows title_box_wrapper.style.width = "300px"; title_box_wrapper.style.maxWidth = "340px"; title_box_wrapper.style.minWidth = "32px"; title_box_wrapper.style.height = "32px"; title_box_wrapper.style.maxHeight = "32px"; title_box_wrapper.style.minHeight = "32px"; title_box_wrapper.style.overflowX = "hidden"; title_box_wrapper.style.overflowY = "hidden"; title_box_wrapper.style.padding = "3px"; title_box_wrapper.style.paddingRight = "0"; // "16px"; title_box_wrapper.style.paddingBottom = "0"; title_box_wrapper.style.paddingTop = "0"; title_box_wrapper.style.margin = "3px"; title_box_wrapper.style.marginLeft = "3px"; title_box_wrapper.style.marginRight = "3px"; title_box_wrapper.style.marginBottom = "0"; title_box_wrapper.style.marginTop = "8px"; title_box_wrapper.style.borderTopRightRadius = "8px"; title_box_wrapper.style.borderTopLeftRadius = "8px"; title_box_wrapper.style.borderStyle = "solid"; title_box_wrapper.style.borderBottomStyle = "none"; title_box_wrapper.style.borderWidth = "0.5px"; title_box_wrapper.style.borderColor = "rgb(0,0,0)"; title_box_wrapper.style.borderTopColor = "rgba(225,225,225, 0.75)"; title_box_wrapper.style.borderLeftColor = "rgba(225,225,225, 0.5)"; title_box_wrapper.style.borderRightColor = "rgb(51,51,51)"; title_box_wrapper.style.userSelect = "none"; title_box_wrapper.addEventListener("mouseenter", function (win_id, event) { var window_id_from_tab_box_id = null; //the 'win_id' argument is actually the title box wrapper id. //get the actual window id and store it in a variable for later //use. window_id_from_tab_box_id = title_box_wrapper.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); /* //2024-05-20: //this function will select and show the tabbed window //that is the previous sibling of the tabbed window to //remove. if the previous sibling of the tabbed window //doesn't exist, it will select the next sibling. //if neither sibling exists, then it is the last tabbed //window remaining. on_tab_close_select_show_adjacent_tabbed_window(window_id_from_tab_box_id); ////title_box_wrapper.style.backgroundColor = "rgba(153,153,153,1.0)"; ////set_all_tab_boxes_background_color(window_id_from_tab_box_id); */ }); //set an event listener for when the user clicks on the existing tab. //take the window to be tabbed, make its corresponding tab box, //places it into the tabbed window viewport. title_box_wrapper.addEventListener("mousedown", function (event) { var window_id_from_tab_box_id = null; //the 'win_id' argument is actually the title box wrapper id. //get the actual window id and store it in a variable for later //use. window_id_from_tab_box_id = title_box_wrapper.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); title_box_wrapper.style.backgroundColor = "rgba(153,153,153,1.0)"; set_all_tab_boxes_background_color(window_id_from_tab_box_id); title_box_wrapper_mousedown(window_id_from_tab_box_id); //2024-09-26: //whenever a tab is clickup down upon, place a UI blocking //image over all windows' content containers. then, remove //the UI blocking imaage from the tabbed window's content //container to allow interaction with the selected tab's //window. see file: 'ui_interaction_window_content_block.js' block_all_window_content_containers(); unblock_window_content_container(window_id_from_tab_box_id); ////if there is atleast one tabbed window /* if (single_tabbed_window_exists(win_id)) { //takes a non-tabbed window and converts it to //a tabbed window. Hides the top and bottom //rows of the window, resizes it to fit the //tabbed window viewport. tab_window(win_id); //set the tabbed window's x location. If any //minimized window exists, the tabbed windows //are moved to the right in order to make space //for any minimized windows. If there is no //minimized window, then the x location of the tabbed //windows is placed at the left of the browser window. set_window_left_position(win_id); //call a function that handles the browser window resize //event. This will set a tabbed window to fit properly within the //bounds of the browser window. window_resize_event_function(win_id); //set the z-index of the tabbed window to //so its placed on top of all windows move_to_front(win_id); //during the tabbed window view, we want to have all //cascaded windows placed on top of any tabbed windows. //otherwise, all cascaded windows are hidden behind //the tabbed window. move_cascaded_windows_to_front(); } */ event.preventDefault(); event.stopPropagation(); return; }, false); //when the mouse button is clicked up, //the browser window delays a short amount of time //to allow the tabbed windows to be placed into position. //The delay ensures that the tabbed windows left position //can be set if there are any minimized windows that exist. window.addEventListener("mouseup", function (event) { setTimeout(function () { var window_id_from_tab_box_id = null; //the 'win_id' argument is actually the title box wrapper id. //get the actual window id and store it in a variable for later //use. window_id_from_tab_box_id = title_box_wrapper.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); //the code to execute was taken from this event listener, //and placed into a function. the function may need to be called //programatically later on. web_browser_window_mouseup_tabbed_windows(window_id_from_tab_box_id); //350 milliseconds looks to be a long enough delay //for elements to all be ready for setting the //tabbed window X location. }, 350); event.preventDefault(); event.stopPropagation(); return; }, false); //when a clicked mouse button is released, check to see //if any tabbed windows exist. If any do, then tab the window, //set its X position, resize the tabbed window to fit within //the browser's window. Move the tabbed window to the top layer of //all windows (z-index). Then, show any cascaded windows placed //on top of the tabbed windows (z-index). title_box_wrapper.addEventListener("mouseup", function (event) { var window_id_from_tab_box_id = null; //the 'win_id' argument is actually the title box wrapper id. //get the actual window id and store it in a variable for later //use. window_id_from_tab_box_id = title_box_wrapper.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); if (single_tabbed_window_exists(window_id_from_tab_box_id)) { tab_window(window_id_from_tab_box_id); set_window_left_position(window_id_from_tab_box_id); window_resize_event_function(window_id_from_tab_box_id); move_to_front(window_id_from_tab_box_id); move_cascaded_windows_to_front(); //2024-05-19: //if the the minimized windows are both //tucked and stowed. then the width of the //tab boxs' container is greater than the //width of the screen because its left //padding is set to 40 pixels. resize the //tab boxs' container to fit the screen to //adjust for the left padding width. resize_tab_box_container_to_fit_screen_width(); } //2024-05-18: //set all windows' zIndex property in order. tabbed windows are set //with the lowest zIndex. cascaded windows are set next. minimized //windows are set next. finally, the maximized window(s) are set. //see file: 'window_2.js' ////set_all_window_zIndexes(); event.preventDefault(); event.stopPropagation(); return; }, false); } } return title_box_wrapper; } //when the mouse button is clicked down over a tab box function title_box_wrapper_mousedown(win_id) { if (single_tabbed_window_exists(win_id)) { //takes a non-tabbed window and converts it to //a tabbed window. Hides the top and bottom //rows of the window, resizes it to fit the //tabbed window viewport. tab_window(win_id); //set the tabbed window's x location. If any //minimized window exists, the tabbed windows //are moved to the right in order to make space //for any minimized windows. If there is no //minimized window, then the x location of the tabbed //windows is placed at the left of the browser window. set_window_left_position(win_id); //call a function that handles the browser window resize //event. This will set a tabbed window to fit properly within the //bounds of the browser window. window_resize_event_function(win_id); //set the z-index of the tabbed window to //so its placed on top of all windows move_to_front(win_id); //during the tabbed window view, we want to have all //cascaded windows placed on top of any tabbed windows. //otherwise, all cascaded windows are hidden behind //the tabbed window. move_cascaded_windows_to_front(); //2024-05-19: //if the the minimized windows are both //tucked and stowed. then the width of the //tab boxs' container is greater than the //width of the screen because its left //padding is set to 40 pixels. resize the //tab boxs' container to fit the screen to //adjust for the left padding width. resize_tab_box_container_to_fit_screen_width(); } } function web_browser_window_mouseup_tabbed_windows(win_id) { //when the mouse button is clicked up, //the browser window delays a short amount of time //to allow the tabbed windows to be placed into position. //The delay ensures that the tabbed windows left position //can be set if there are any minimized windows that exist. //window.addEventListener("mouseup", function (win_id, event) { ////var window_id_from_tab_box_id = null; if (single_tabbed_window_exists(win_id)) { //the 'win_id' argument is actually the title box wrapper id. //get the actual window id and store it in a variable for later //use. ////window_id_from_tab_box_id = title_box_wrapper.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); ////setTimeout(function () { ////alert("m0o0oo!"); ////if (is_window_tabbed(win_id) === "true" || is_window_tabbed(win_id) === true) { //// return; ////} ////alert("is maximized? " + is_window_maximized()); //Keep this! //this is code that is set to run after a pause //when the user clicks their mouse button up on the //browser window object. the problem with this, is that //if the window's contents are filled by an iframe element. //clicking mouse-up in an iframe won't trigger this functionality //so I'm commenting it out for now. //change the X position of the tabbed window //to allow any minimized windows to be seen. set_window_left_position(win_id); //call the function that is used upon resizing //the browser window. This will configure the //tabbed window to fit properly within the bounds //of the browser window. window_resize_event_function(win_id); //2024-05-18: //set all windows' zIndex property in order. tabbed windows are set //with the lowest zIndex. cascaded windows are set next. minimized //windows are set next. finally, the maximized window(s) are set. //see file: 'window_2.js' ////set_all_window_zIndexes(); //350 milliseconds looks to be a long enough delay //for elements to all be ready for setting the //tabbed window X location. ////}, 350); } //2024-05-18: //set all windows' zIndex property in order. tabbed windows are set //with the lowest zIndex. cascaded windows are set next. minimized //windows are set next. finally, the maximized window(s) are set. //see file: 'window_2.js' /* ////set_all_window_zIndexes(); reset_all_window_zIndexes(); move_all_minimized_windows_to_front(); move_all_maximized_windows_to_front(); */ } //If there are minimized windows in place, this function //sets the X position of the tabbed windows so the minimized //windows can be seen. function set_window_left_position(win_id) { //return; var left_margin = null; var tabbed_window = null; var tabs_container = null; left_margin = get_tabbed_windows_left_margin(); tabbed_window = document.getElementById(win_id); if (tabbed_window !== null) { tabbed_window.style.left = left_margin + "px"; tabs_container = get_tabbed_window_tabs_container(); tabs_container.style.left = left_margin + "px"; resize_contents_container(win_id); } } //2024-02-15: //hide any visible tabbed windows. //get the tabbed window that was selected by the user (i.e. a mouse event upon the tabbed window's tab box) //place the window to be viewed as a tab window into the tabbed window viewport. //set the height and the width, top and left, CSS properties of the tabbed window so that it displays in the tabbed //window viewport properly (i.e. expand the tabbed window to the viewport borders, and set its screen x/y location). function tab_window(win_id) { var win = null; win = document.getElementById(win_id); if (win !== null) { //configure the selected non-tabbed window into a tabbed window //by removing both top and bottom bars of the window. displays //the window contents, only. config_window_for_tabbed_view(win_id); //show the selected window inside the tabbed window //viewport box. Note: this function transforms the //window object //(i.e. the tabbed window object, not its tab box) select_tab_box_show_window(win_id); //2024-1-18: //resizing the window seems to fix certain glitches, //so I out its code into a function, and will be calling it //here in this event listener for quality redundancy purposes. window_resize_event_function(win_id); //move the tabbed window to the top of all of the windows (z-index) move_to_front(win_id); //2024-03-13: //If any cascaded windows are positioned above the tabs container, shift their //Y position so that they aren't hidden behind the tabs container show_tabs_Y_offset_cascaded_windows(); } } //2024-1-17: //A quick algorithm of the process by which a tabbed window is restored //to its cascaded state. async function rebuild_cascading_window_from_tabbed(win) { var cascaded = null; var win_id = null; if (win !== null) { win_id = win.id; win.setAttribute("data-window_state", "Tabbed"); cascaded = await cascade_window(win_id); win.setAttribute("data-is_tabbed", "false"); restore_stripped_window_element(win_id); } } //this function creates a div element that contains the tab boxes. function make_tabbed_windows_container() { var container = null; container = document.createElement("div"); container.setAttribute("id", "tabbed_windows_container"); container.style.position = "fixed"; container.style.top = "31.5px"; container.style.left = "3px"; container.style.width = "100%"; container.style.height = "40px"; container.style.borderBottom = "0.5px solid rgba(0,0,0,1.0)"; container.style.backgroundColor = "rgba(197,197,197,1.0)"; //container.style.backgroundImage = "url(/chromosphere/images/ui/backgrounds/tabbed_windows_bg.png)"; container.style.display = "flex"; container.style.flexWrap = "nowrap"; container.style.marginBottom = "0"; container.style.paddingBottom = "0"; container.style.marginTop = "4px"; container.style.paddingTop = "8px"; return container; } //remove any tab box associated with a window. async function remove_tabbed_window_tab_box(win_id) { var tab_box_id = null; var tab_box = null; var linked_window = null; //2024-05-20: //this function will select and show the tabbed window //that is the previous sibling of the tabbed window to //remove. if the previous sibling of the tabbed window //doesn't exist, it will select the next sibling. //if neither sibling exists, then it is the last tabbed //window remaining. the last tab and associated tabbed //window will be selected and shown. ////on_tab_close_select_show_adjacent_tabbed_window(win_id); tab_box_id = win_id + "_title_box_window_tab"; tab_box = document.getElementById(tab_box_id); if (tab_box !== null) { linked_window = document.getElementById(win_id); if (linked_window !== null) { rebuild_cascading_window_from_tabbed(linked_window); window_state = linked_window.getAttribute("data-window_state"); linked_window.setAttribute("data-window_state", "Tabbed"); cascaded = await cascade_window(linked_window.id); linked_window.setAttribute("data-is_tabbed", "false"); tab_box.parentNode.removeChild(tab_box); linked_window.parentNode.removeChild(linked_window); return true; } } } //when the user clicks a tab, display its tabbed window function select_tab_box_show_window(win_id) { var win = null; win = document.getElementById(win_id); if (win !== null) { win.style.display = "block"; ////win.style.zIndex = get_bottom_window_zIndex() - 1.0; move_to_front(win_id); win.style.left = "3px"; win.childNodes[0].style.width = parseFloat(win.style.width) + "px"; win.childNodes[0].style.height = parseFloat(win.style.height) + "px"; } } //this function checks to see if the container to hold the //tab boxes exists. If it exists, then the function returns //the existing tab box container. If the tab box container //does not exist, create it, add it to the DOM, and return //the new tab box container function get_tabbed_window_tabs_container() { var existing_container = null; var tabs_container = null; var tabs_container_left_margin = null; var scroll_box = null; var tabs_container_left_margin = null; existing_container = document.getElementById("tabbed_windows_container"); //the container to hold window tabs ("tabbed_windows_container") //already exists in the DOM if (existing_container !== null) { //existing_container.style.backgroundColor = "#5c008a"; tabs_container = existing_container; } //else no "tabbed_windows_container" element exists in the DOM else { tabs_container = make_tabbed_windows_container(); if (tabs_container !== null) { document.body.appendChild(tabs_container); tabs_container.style.display = "none"; } } return tabs_container; } //2024-1-16: //A function that places a window tab box into the tabs //container element function insert_window_tab_into_tabs_container(window_tab) { var tabs_container = null; var tab_box = null; var tab_exists = null; tabs_container = get_tabbed_window_tabs_container(); tab_box = window_tab; if (tabs_container !== null) { if (tab_box !== null) { tab_exists = document.getElementById(tab_box.getAttribute("id")); if (tab_exists !== null) { //a tab already exists in the tabs container } else { //a tab does not exist in the tabs container. //add it. tabs_container.appendChild(tab_box); } } } } //set the width of each tab box to best fit within //the browser window. The size is determined by //the browser window's width, per the number of //tab boxes that exist. function set_window_tab_boxes_width() { var tab_boxes = null; var tab_box = null; var tab_boxes_count = null; var i = null; var window_inner_width = null; var tabbed_box_width = null; tab_boxes = document.getElementsByName("tabbed_window_tab"); if (tab_boxes !== null) { window_inner_width = parseFloat(window.innerWidth); tab_boxes_count = tab_boxes.length; tabbed_box_width = parseFloat(window_inner_width) / parseFloat(tab_boxes_count) + "px"; for (i = 0; i < tab_boxes_count; i++) { tab_box = tab_boxes[i]; tab_box.style.width = tabbed_box_width; } } } //2024-03-21: //it may show that this function has 0 references, but it is //called by another script. //Keep This! async function cascade_tabbed_window_tab_box(win_id) { ////alert("cascade_tabbed_window_tab_box()"); var tab_box_id = null; var tab_box = null; var linked_window = null; var window_state = null; var cascaded = null; tab_box_id = win_id + "_title_box_window_tab"; tab_box = document.getElementById(tab_box_id); if (tab_box !== null) { linked_window = document.getElementById(win_id); if (linked_window !== null) { rebuild_cascading_window_from_tabbed(linked_window); window_state = linked_window.getAttribute("data-window_state"); linked_window.setAttribute("data-window_state", "Tabbed"); cascaded = await cascade_window(linked_window.id); linked_window.setAttribute("data-is_tabbed", "false"); tab_box.parentNode.removeChild(tab_box); return linked_window.id; } } } //convert a cascaded window into a tabbed window //by hiding the top and bottom rows (title bar, status bar). //This causes the window to show only its contents. function strip_window_show_content(win_id) { var win = null; var top_row = null; var bottom_row = null; win = document.getElementById(win_id); if (win !== null) { //hide the X and Y window resize bars of the window. //These items are normally transparent, so //you won't be able to see them, but thier display is set //to "block". This functions sets their display to "none". //This change is reversed when a window is restored to //being in a cascaded state. See function: //"restore_stripped_window_element(win_id)" hide_window_components_for_tabbed_windows(win_id); //if a UI blocking image is present over the //window content table cell, then remove it. ////remove_ui_content_blocking_image(win_id); //2024-09-26: //commented out the function that removes UI blocking //images from the window that is to be tabbed. //added a function to resize the existing UI blocking //image to fit the tabbed window contents container. //calling a method that offsets the Y position of the //ui interaction blocking image to adjust for the added //top padding added to the tabbed window. //see file: 'ui_interaction_window_content_block.js' resize_window_adjust_blocking_image(win_id); offset_ui_blocking_img_y(win_id, parseFloat(win.style.paddingTop)); top_row = document.getElementById(win_id + "_tbl_0000_tr_0000_td_0000"); if (top_row !== null) { win.setAttribute("data-top_row_height", parseFloat(top_row.scrollHeight)); top_row.style.height = "0"; top_row.style.overflow = "hidden"; top_row.parentNode.style.height = "0"; top_row.parentNode.style.overflow = "hidden"; top_row.parentNode.style.display = "none"; } bottom_row = document.getElementById(win_id + "_tbl_0000_tr_0002_td_0000"); if (bottom_row !== null) { win.setAttribute("data-bottom_row_height", parseFloat(bottom_row.scrollHeight)); bottom_row.style.height = "0"; bottom_row.style.overflow = "hidden"; bottom_row.parentNode.style.height = "0"; bottom_row.parentNode.style.overflow = "hidden"; bottom_row.parentNode.style.display = "none"; } win.style.borderRadius = "0"; win.style.padding = "3px"; win.style.borderTopStyle = "none"; win.style.position = "fixed"; } } //if a window is in a tabbed state, restore its top and bottom //rows (title bar, status bar) to a cascaded window state. function restore_stripped_window_element(win_id) { var win = null; var top_row = null; var bottom_row = null; var top_row_height = null; var bottom_row_height = null; win = document.getElementById(win_id); if (win !== null) { top_row = document.getElementById(win_id + "_tbl_0000_tr_0000_td_0000"); if (top_row !== null) { top_row_height = win.getAttribute("data-top_row_height"); top_row.style.height = top_row_height + "px"; top_row.style.overflow = "visible"; top_row.style.display = "table-cell"; top_row.parentNode.style.height = top_row_height + "px"; top_row.parentNode.style.overflow = "visible"; top_row.parentNode.style.display = "table-row"; top_row.style.marginTop = "19px"; top_row.style.padding = "0"; top_row.style.margin = "0"; } bottom_row = document.getElementById(win_id + "_tbl_0000_tr_0002_td_0000"); if (bottom_row !== null) { bottom_row_height = win.getAttribute("data-bottom_row_height"); bottom_row.style.height = bottom_row_height + "px"; bottom_row.style.overflow = "visible"; bottom_row.parentNode.style.height = bottom_row_height + "px"; bottom_row.parentNode.style.overflow = "visible"; bottom_row.parentNode.style.display = "table-row"; bottom_row.style.marginBottom = "19px"; bottom_row.style.padding = "0"; bottom_row.style.margin = "0"; } win.style.borderRadius = "8px"; //win.style.padding = "0"; //win.style.paddingTop = "0"; //win.style.paddingBottom = "0"; //win.style.paddingLeft = "3px"; //win.style.paddingRight = "3px"; win.style.marginTop = "0"; win.style.paddingBottom = global_window_padding_bottom; win.style.paddingTop = global_window_padding_top; win.style.paddingRight = global_window_padding_right; win.style.paddingLeft = global_window_padding_left; win.style.borderTopStyle = "solid"; win.style.position = "absolute"; //when a window is tabbed, resize X bar, //and resize Y bar are set to hidden. This function makes them //visible as on a cascaded window (but the components' opacity is 0). //these components are restored when a window is restored to a cascaded //state. See function: "hide_window_components_for_tabbed_windows(win_id)" show_window_components_for_tabbed_windows(win_id); //when the window's state is set back to 'cascade', then place the UI //interaction blocking layer back onto the window. It was removed //in the function: //"restore_stripped_window_element(win_id)". //for this function, see the file: //'ui_interaction_window_content_block.js' block_window_content_container(win_id); } } //position a tabbed window's top, height, width properties. //The window's left (X) position is not affected by this function function position_tabbed_window(win_id) { var win = null; var tab_container = null; var offsetY = null; var pixel_ratio = null; var bottom_row_height = null; var top_row_height = null; var tabbed_window_left_margin = null; pixel_ratio = get_pixel_ratio(); win = document.getElementById(win_id); if (win !== null) { bottom_row_height = get_windows_bottom_row_height(win_id); top_row_height = get_windows_top_row_height(win_id); tab_container = get_tabbed_window_tabs_container(); if (tab_container !== null) { offsetY = get_Y_offset_for_tabbed_windows(); offsetY = offsetY - 9; ////win.style.paddingTop = "34px"; win.style.paddingTop = "3px"; win.style.borderLeft = "1px none rgba(204,204,204,1.0)"; win.style.top = offsetY.toString() + "px"; if (pixel_ratio === 1.25) { win.style.width = (parseFloat((parseFloat(top.innerWidth) * parseFloat(pixel_ratio)) - 7) - parseFloat(win.style.left)) + "px"; win.style.height = (parseFloat(((parseFloat(top.innerHeight) - (parseFloat(offsetY) - parseFloat(bottom_row_height)) + 9) - 3.1) + 7) * pixel_ratio) + "px"; } else { win.style.width = (parseFloat((parseFloat(top.innerWidth) / parseFloat(pixel_ratio)) - 7) - parseFloat(win.style.left)) + "px"; win.style.height = (parseFloat(((parseFloat(top.innerHeight) - (parseFloat(offsetY) - parseFloat(bottom_row_height)) + 9) - 3.1) + 7) / pixel_ratio) + "px"; } //set the proper size of the tabbed window's content //to fill the window's bounds. resize_contents_container(win_id); win.childNodes[0].style.width = parseFloat(win.style.width) + "px"; win.childNodes[0].style.height = parseFloat(win.style.height) + "px"; //2024-03-21: //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); //2024-03-21: //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); } } } //convert a cascaded window into a tabbed window, //position it, and expand the window's content to //the size of the window. function config_window_for_tabbed_view(win_id) { //See this function in file: 'create_window_functions.js', //or in file: 'create_window.js'. var win = null; win = document.getElementById(win_id); strip_window_show_content(win_id); position_tabbed_window(win_id); resize_contents_container(win_id); if (win !== null) { win.childNodes[0].style.width = parseFloat(win.style.width) + "px"; win.childNodes[0].style.height = parseFloat(win.style.height) + "px"; } } //Get the Y offset of the tabbed windows' container //if it exists. Tabbed windows are placed directly //below the tab box container. function get_Y_offset_for_tabbed_windows() { var menu = null; var tabs = null; var offsetY = null; var pixel_ratio = null; var tabs_container = null; offsetY = 0; pixel_ratio = get_pixel_ratio(); menu = document.getElementById("div_wrapper_0"); tabs_container = get_tabbed_window_tabs_container(); if (menu !== null) { offsetY = parseFloat(menu.scrollTop) + parseFloat(menu.offsetHeight); offsetY = offsetY + parseFloat(tabs_container.offsetHeight); if (pixel_ratio === 0.8) { offsetY = offsetY * get_pixel_ratio(); } else { offsetY = offsetY / get_pixel_ratio(); } } tabs = document.getElementById("tabbed_windows_container"); if (tabs !== null) { if (tabs.style.display !== "none") { offsetY = offsetY + parseFloat(tabs.offsetHeight); if (pixel_ratio === 0.8) { offsetY = offsetY * get_pixel_ratio(); } else { offsetY = offsetY / get_pixel_ratio(); } } else { offsetY = 40; if (pixel_ratio === 0.8) { offsetY = offsetY * get_pixel_ratio(); } else { offsetY = offsetY / get_pixel_ratio(); } } } else { offsetY = 40; if (pixel_ratio === 0.8) { offsetY = offsetY * get_pixel_ratio(); } else { offsetY = offsetY / get_pixel_ratio(); } } return offsetY; } function config_all_windows_for_tabbed_view() { var all_windows = null; var window_count = null; var i = null; var win_id = null; all_windows = document.getElementsByName("web_window"); if (all_windows !== null) { window_count = all_windows.length; for (i = 0; i < window_count; i++) { win_id = all_windows[i].getAttribute("id"); config_window_for_tabbed_view(win_id); } } } function get_windows_bottom_row_height(win_id) { var full_id = null; var bottom_td = null; var td_height = null; full_id = win_id + "_tbl_0000_tr_0002_td_0000"; bottom_td = document.getElementById(full_id); if (bottom_td !== null) { td_height = parseFloat(bottom_td.style.height); } return td_height; } function get_windows_top_row_height(win_id) { var full_id = null; var top_td = null; var td_height = null; full_id = win_id + "_tbl_0000_tr_0000_td_0000"; top_td = document.getElementById(full_id); if (top_td !== null) { td_height = parseFloat(top_td.style.height); } return td_height; } //Adding window resize event listeners function add_resize_window_event_listeners(win_id) { window.addEventListener("resize", function () { window_resize_event_function(win_id); }); } //When the window element is resized, it calls //this function. function window_resize_event_function(win_id) { var win = null; var is_tabbed = null; win = document.getElementById(win_id); if (win !== null) { is_tabbed = win.getAttribute("data-is_tabbed"); if (is_tabbed === "true" || is_tabbed === true) { strip_window_show_content(win_id); position_tabbed_window(win_id); resize_contents_container(win_id); win.childNodes[0].style.width = parseFloat(win.style.width) + "px"; //(parseFloat(win.style.width) - parseFloat(win.style.left)) + "px"; win.childNodes[0].style.height = parseFloat(win.style.height) + "px"; //show_tabs_container(); resize_window_tabs_container(); //2024-05-19: //if the the minimized windows are both //tucked and stowed, then the width of the //tab boxs' container is greater than the //width of the screen because its left //padding is set to 40 pixels. resize the //tab boxs' container to fit the screen to //adjust for the left padding width. resize_tab_box_container_to_fit_screen_width(); //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); resize_tabs_bar(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 }; } else { return; } } } //When you run out of tabs, you may think there's nothing //left behind. Here's something that is something. This //function gets rid of it. function remove_tabbed_windows_feature_framework() { var obj = null; obj = document.getElementById("tabbed_windows_container"); if (obj !== null) { obj.parentNode.removeChild(obj); } } //This function gets the window's title cell function get_window_title_HTML(win_id, empty_tab) { var win = null; var title_td_cell = null; var tab = null; var options_box_HTML = null; var table_border = null; ////var DOM_parser = null; var tab_innerHTML = null; //in the case that we are running in test mode, //set the border width of the table accordingly. if (global_test_mode === true) { table_border = "1"; } else { table_border = "0"; } tab = empty_tab; win = document.getElementById(win_id); if (win !== null) { if (tab !== null) { title_td_cell = document.getElementById(win_id + "_tbl_0000_tr_0000_td_0001"); title_td_cell.style.paddingRight = "5px"; options_box_HTML = make_options_td(win_id, tab); tab_innerHTML = ""; tab_innerHTML = tab_innerHTML + "
"; tab_innerHTML = tab_innerHTML + " "; tab_innerHTML = tab_innerHTML + " | "; tab_innerHTML = tab_innerHTML + ""; tab_innerHTML = tab_innerHTML + " "; tab_innerHTML = tab_innerHTML + " | "; tab_innerHTML = tab_innerHTML + "