"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 + (title_td_cell.outerHTML) + options_box_HTML; 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 = tab_innerHTML + "
"; tab_innerHTML = tab_innerHTML + "
"; tab.innerHTML = tab_innerHTML; } } return tab; } function make_options_td(win_id, tab_box) { return ""; } //Keep This! //It may show that this function has 0 references, but it is //actually called from an HTML 'onmouseup' attribute. //see function: 'make_options_td' function restore_tabbed_window_to_cascade(win_id) { var win = null; var tab = null; win = document.getElementById(win_id); if (win !== null) { //be sure to call these lines of code in their existing order, //or else the window's UI could be entirely blocked. //(it's not related to ui_interface_window_block_image feature) restore_stripped_window_element(win_id); rebuild_cascading_window_from_tabbed(win); tab = document.getElementById(win_id + "_tab_box_container_window_tab"); if (tab !== null) { most_customizable_config_elem_for_animation(tab.parentNode.id, "width, opacity", 0.8, 0); tab.parentNode.style.minWidth = "0"; tab.parentNode.style.opacity = 0.0; tab.parentNode.style.overflow = "hidden"; tab.parentNode.style.width = "0"; tab.parentNode.style.padding = "0"; tab.parentNode.style.margin = "0"; tab.parentNode.style.borderStyle = "none"; //if there is less than 2 tabbed windows, //set the opacity of the tab boxs' container //to fade from opaque, to transparent. if (get_all_tabbed_windows().length <= 1) { add_css_animation_property(get_tabbed_window_tabs_container(), "opacity"); get_tabbed_window_tabs_container().style.opacity = 0.0; } setTimeout(function () { if (win.getAttribute("data-window_state") === "Minimize") { left_offset_all_tabbed_windows(); } }, 100); setTimeout(function () { tab.parentNode.style.display = "flex"; }, 750); setTimeout(function () { remove_tab_box(win_id); }, 750); setTimeout(function () { left_offset_all_tabbed_windows(); //resize the tab boxs' container to fit the screen. ////resize_tab_box_container_to_fit_screen_width(); }, 150); setTimeout(function () { title_box_wrapper_mousedown(win_id); }, 800); } win.style.opacity = 0.0; move_to_front(win_id); quick_fade_in(win_id); } } //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. function resize_tab_box_container_to_fit_screen_width() { var tabs_container = null; var new_width = null; var pixel_ratio = null; var stowed_and_tucked = null; var stowed_and_untucked = null; var stowed = null; tabs_container = get_tabbed_window_tabs_container(); if (tabs_container !== null) { if (minimized_window_count() < 1) { return; } stowed = get_are_minimized_windows_stowed_attribute(); if (stowed !== true && stowed !== "true") { return; } stowed_and_untucked = get_are_minimized_windows_stowed_untucked(); if (stowed_and_untucked === true) { return; } stowed_and_tucked = get_are_minimized_windows_stowed_tucked(); if (stowed_and_tucked === true) { pixel_ratio = get_pixel_ratio(); if (pixel_ratio === 1.25) { new_width = ((parseFloat(window.innerWidth) * pixel_ratio) - 40); } else { new_width = ((parseFloat(window.innerWidth) / pixel_ratio) - 40); } tabs_container.style.width = new_width + "px"; } } } function stowed_minimized_windows_tabbed_to_minimize_offset_tabbed_left() { //alert("Are windows stowed and tucked? " + get_are_minimized_windows_stowed_tucked()); //setTimeout(function () { // title_box_wrapper_mousedown(); //}, 700); } //checks to see if a tabbed window has an existing tab box. function tab_box_exists(win_id) { var tab_id = null; var tab = null; var output = null; tab_id = win_id + "_window_title_div_wrapper_window_tab"; tab = document.getElementById(tab_id); if (tab !== null) { output = true; } else if (tab === null) { output = false; } else { output = false; } return output; } function remove_tab_box(win_id) { var tab_id = null; var tab = null; var tab_count = null; //2024-05-20: //this is not currently in use, but keep it! //this function will show and select the //top tabbed window. 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_top_tabbed_window(); //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_id = win_id + "_window_title_div_wrapper_window_tab"; tab = document.getElementById(tab_id); if (tab !== null) { if (tabbed_windows_exist()) { ////select_sibling_tab(win_id); //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.parentNode.removeChild(tab); ////display_last_tabbed_window(); tab_count = tabbed_window_count(); if (tab_count < 1.0) { remove_tabbed_windows_feature_framework(); } } } function tabbed_windows_exist() { var tabs = null; var tab_count = null; var exists = null; tabs = document.getElementsByName("tabbed_window_tab"); if (tabs !== null) { tab_count = tabs.length; if (tab_count > 0) { //tabbed window(s) are present exists = true; } else { //no windows are in tab mode exists = false; } } return exists; } //this function returns true if there is at least one //tabbed window that exists. otherwise, it returns false. function single_tabbed_window_exists(win_id) { var win = null; var exists = null; win = document.getElementById(win_id); if (win !== null) { if (is_window_tabbed(win_id)) { exists = true; } else { exists = false; } } else { exists = false; } return exists; } //2024-05-20; //when a tabbed window and its tab is removed, or is changing its //window state from tabbed, to another window state, this function //is called. if any remaining tabbed windows exist, then select //the one on top (highest zIndex), select its associated tab box, //and display the top tabbed window. function on_tab_close_select_show_top_tabbed_window() { var top_tabbed_win = null; var top_tabbed_win_id = null; var top_tabbed_win_previous_sibling = null; var top_tabbed_win_next_sibling = null; top_tabbed_win_id = get_top_tabbed_win_id(); if (top_tabbed_win_id !== null && typeof (top_tabbed_win_id) === "string") { top_tabbed_win = document.getElementById(top_tabbed_win_id); if (top_tabbed_win !== null) { if (typeof (top_tabbed_win.previousSibling) === "object" && top_tabbed_win.previousSibling !== null) { top_tabbed_win_previous_sibling = top_tabbed_win.previousSibling; set_all_tab_boxes_background_color(top_tabbed_win_previous_sibling.id); select_tab_box_show_window(top_tabbed_win_previous_sibling.id); move_to_front(top_tabbed_win_previous_sibling.id); move_cascaded_windows_to_front(); } else if (typeof (top_tabbed_win.nextSibling) === "object" && top_tabbed_win.nextSibling !== null) { top_tabbed_win_next_sibling = top_tabbed_win.nextSibling; set_all_tab_boxes_background_color(top_tabbed_win_next_sibling.id); select_tab_box_show_window(top_tabbed_win_next_sibling.id); move_to_front(top_tabbed_win_next_sibling.id); move_cascaded_windows_to_front(); } else { set_all_tab_boxes_background_color(top_tabbed_win.id); select_tab_box_show_window(top_tabbed_win.id); move_to_front(top_tabbed_win.id); move_cascaded_windows_to_front(); } } } } //this function returns the tabbed window id attribute //from the tabbed window with the highest z-index value. //if there are tabbed windows, place them into an array. //if that array is made up on id attributes of each //tabbed window, instead of tabbed window elements, then //convert the array of id strings to tabbed window //elements. function get_top_tabbed_win_id() { var tabbed_windows = null; var tabbed_windows_length = null; var tabbed_window = null; var tabbed_win_id = null; var top_tabbed_window_id = null; var i = null; tabbed_windows = get_all_tabbed_windows(); tabbed_windows = convert_win_id_array_to_objects(tabbed_windows); tabbed_windows = arrange_windows_by_zIndex_asc(tabbed_windows); if (tabbed_windows !== null) { if (tabbed_windows.length > 0) { tabbed_windows_length = parseFloat(tabbed_windows.length); for (i = 0; i < tabbed_windows_length; i++) { tabbed_window = tabbed_windows[i]; if (tabbed_window !== null) { if (tabbed_window.hasAttribute("id") === true) { if (typeof (tabbed_window.getAttribute("id")) === "string") { tabbed_win_id = ""; tabbed_win_id = tabbed_window.getAttribute("id"); } } } } } } top_tabbed_window_id = tabbed_win_id; return top_tabbed_window_id; } //2024-05-20: //this function will select and show the tabbed window //that is the next sibling of the tabbed window to //remove. if the next sibling of the tabbed window //doesn't exist, it will select the previous sibling. //if neither sibling exists, then it is the last tabbed //window remaining. the function defined here is called //in the another script. see file: 'window_state_controls.js' function on_tab_close_select_show_adjacent_tabbed_window(win_id, display_first_or_last_tab_default = "first") { //variables for the tab box, and //tabbed window that is to be removed //from tabbed windows. var closing_tab = null; var closing_tabs_window = null; //variables for the next, and previous //tabs that may exist adjacent to the //tab (and its tabbed window) to be removed. var closing_tab_next_sibling = null; var closing_tab_previous_sibling = null; //variables for the next window id, //and window element that are to be //selected and displayed. var closing_tab_next_sibling_window_id = null; var closing_tab_next_sibling_window = null; //variables for the previous window id, //and window element that are to be //selected and displayed. var closing_tab_previous_sibling_window_id = null; var closing_tab_previous_sibling_window = null; closing_tab = document.getElementById(win_id + "_window_title_div_wrapper_window_tab"); if (closing_tab !== null) { closing_tabs_window = document.getElementById(win_id); if (closing_tabs_window !== null) { if (closing_tab.nextSibling !== null) { closing_tab_next_sibling = closing_tab.nextSibling; closing_tab_next_sibling_window_id = closing_tab_next_sibling.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); if (typeof (closing_tab_next_sibling_window_id) === "string") { closing_tab_next_sibling_window = document.getElementById(closing_tab_next_sibling_window_id); if (closing_tab_next_sibling_window !== null) { set_all_tab_boxes_background_color(closing_tab_next_sibling_window.id); select_tab_box_show_window(closing_tab_next_sibling_window.id); move_to_front(closing_tab_next_sibling_window.id); move_cascaded_windows_to_front(); } } } else if (closing_tab.previousSibling !== null) { closing_tab_previous_sibling = closing_tab.previousSibling; closing_tab_previous_sibling_window_id = closing_tab_previous_sibling.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); if (typeof (closing_tab_previous_sibling_window_id) === "string") { closing_tab_previous_sibling_window = document.getElementById(closing_tab_previous_sibling_window_id); if (closing_tab_previous_sibling_window !== null) { set_all_tab_boxes_background_color(closing_tab_previous_sibling_window.id); select_tab_box_show_window(closing_tab_previous_sibling_window.id); move_to_front(closing_tab_previous_sibling_window.id); move_cascaded_windows_to_front(); } } } else { //2024-05-20: //if neither next or previous sibling objects exist, //then select and show the default tab and its tabbed //window. if the argument is a string with the value //of "first", then the first tab and tabbed window in //the tabbed window collection will be displayed by //default. if the argument is a string with the value //of "last", then the last tab and tabbed window in //the tabbed window collection will be displayed by //default. if the function is called without an //argument, then the first tab and tabbed window in //the tabbed windows collection will be displayed. //if the argument's value is not "first", or "last", //then the first tab and tabbed window in the tabbed //window collection will displayed. display_default_tab_and_tabbed_window("first"); } } } } //2024-05-20: //select and show the default tab and its tabbed //window. if the argument is a string with the value //of "first", then the first tab and tabbed window in //the tabbed window collection will be displayed by //default. if the argument is a string with the value //of "last", then the last tab and tabbed window in //the tabbed window collection will be displayed by //default. if the function is called without an //argument, then the first tab and tabbed window in //the tabbed windows collection will be displayed. //if the argument's value is not "first", or "last", //then the first tab and tabbed window in the tabbed //window collection will displayed. function display_default_tab_and_tabbed_window(display_first_or_last_tab_default = "first") { if (display_first_or_last_tab_default === "last") { //2024-05-20: //Keep This! //if the function call below is commented out, //then it is not in use. Keep this, anyway! //this function gets the last tabbed window //out of a collection of tabbed window tab boxes, if //any exist. if there is only one existing tabbed window, //then select its tab, and show its associated tabbed window. //if there are more than one tabbed windows existing, the //last tabbed window in the tabbed window tabs collection //is selected and displayed. display_last_tabbed_window(); } else if (display_first_or_last_tab_default === "first") { //2024-05-20: //Keep This! //if the function call below is commented out, //then it is not in use. Keep this, anyway! //this function gets the first tabbed window //out of a collection of tabbed window tab boxes, if //any exist. if there is only one existing tabbed window, //then select its tab, and show its associated tabbed window. //if there are more than one tabbed windows existing, the //first tabbed window in the tabbed window tabs collection //is selected and displayed. display_first_tabbed_window(); } else { //2024-05-20: //Keep This! //if the function call below is commented out, //then it is not in use. Keep this, anyway! //this function gets the first tabbed window //out of a collection of tabbed window tab boxes, if //any exist. if there is only one existing tabbed window, //then select its tab, and show its associated tabbed window. //if there are more than one tabbed windows existing, the //first tabbed window in the tabbed window tabs collection //is selected and displayed. display_first_tabbed_window(); } } //2024-05-20: //this function gets the last tabbed window //out of a collection of tabbed window tab boxes, if //any exist. if there is only one existing tabbed window, //then select its tab, and show its associated tabbed window. //if there are more than one tabbed windows existing, the //last tabbed window in the tabbed window tabs collection //is selected and displayed. function display_last_tabbed_window() { var tabs = null; var tabs_length = null; var last_tab = null; var last_tabbed_window_id = null; var last_tabbed_window = null; tabs = document.getElementsByName("tabbed_window_tab"); if (tabs !== null) { if (parseFloat(tabs.length) > 0) { tabs_length = parseFloat(tabs.length); last_tab = tabs[tabs_length - 1]; if (last_tab !== null) { last_tabbed_window_id = last_tab.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); if (typeof (last_tabbed_window_id) === "string") { last_tabbed_window = document.getElementById(last_tabbed_window_id); if (last_tabbed_window !== null) { set_all_tab_boxes_background_color(last_tabbed_window.id); select_tab_box_show_window(last_tabbed_window.id); move_to_front(last_tabbed_window.id); move_cascaded_windows_to_front(); } } } } } } //2024-05-20: //this function gets the first tabbed window //out of a collection of tabbed window tab boxes, if //any exist. if there is only one existing tabbed window, //then select its tab, and show its associated tabbed window. //if there are more than one tabbed windows existing, the //first tabbed window in the tabbed window tabs collection //is selected and displayed. function display_first_tabbed_window() { var tabs = null; var first_tab = null; var first_tabbed_window_id = null; var first_tabbed_window = null; tabs = document.getElementsByName("tabbed_window_tab"); if (tabs !== null) { if (parseFloat(tabs.length) > 0) { first_tab = tabs[0]; if (first_tab !== null) { if (first_tab.hasAttribute("id") === true) { first_tabbed_window_id = first_tab.getAttribute("id").toString().replace("_window_title_div_wrapper_window_tab", ""); if (typeof (first_tabbed_window_id) === "string") { first_tabbed_window = document.getElementById(first_tabbed_window_id); if (first_tabbed_window !== null) { set_all_tab_boxes_background_color(first_tabbed_window.id); select_tab_box_show_window(first_tabbed_window.id); move_to_front(first_tabbed_window.id); move_cascaded_windows_to_front(); } } } } } } } function tabbed_window_count() { var tab_count = null; tab_count = document.getElementsByName("tabbed_window_tab").length; return tab_count; } function set_all_tab_boxes_background_color(win_id) { var tab_boxes = null; var tab_box = null; var tab_box_count = null; var i = null; tab_boxes = document.getElementsByName("tabbed_window_tab"); if (tab_boxes !== null) { tab_box_count = tab_boxes.length; if (tab_box_count > 0) { for (i = 0; i < tab_box_count; i++) { tab_box = tab_boxes[i]; if ((win_id + "_window_title_div_wrapper_window_tab") === tab_box.id) { tab_box.style.backgroundColor = "rgba(153,153,153,1.0)"; } else { tab_box.style.backgroundColor = "rgba(120,120,120,1.0)"; } //2024-05-12: //set the tab box to be animated with the default //CSS animation properties. //set animations on tab boxes to a default value. //see file: 'transformations.js' default_config_elem_for_animation(tab_box.id); //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(tab_box, "background-color"); //2024-05-12: //set the animation's duration time in seconds. //see file: 'animations.js' set_element_animation_duration(tab_box, 0.4); //2024-05-12: //remove CSS animation propert'es on the box that are not needed. //otherwise, the animations set for the tab box container element //may interfere with the tabs box container CSS animation properties. //see file 'animations.js. remove_css_animation_property(tab_box, "left"); remove_css_animation_property(tab_box, "top"); remove_css_animation_property(tab_box, "width"); remove_css_animation_property(tab_box, "height"); remove_css_animation_property(tab_box, "box-shadow"); } } } } //if minimized windows are present, then it indicates that the //scroll box element used in organizing minimized windows into //a stack formation, or into a stowed, or stowed and tucked //configuration exists. in the case where the stowed minimized //windows are untucked, set the left margin value to the width //of the stow minimized windows box/button width. function get_tabbed_windows_left_margin() { var tabbed_window_left_margin = null; var min_win_count = null; var scroll_box = null; min_win_count = minimized_window_count(); if (min_win_count > 0) { scroll_box = document.getElementById("scroll_box"); if (scroll_box !== null) { tabbed_window_left_margin = parseFloat(scroll_box.offsetWidth); } else { tabbed_window_left_margin = 3; } } else { tabbed_window_left_margin = 3; } //2024-05-17: //if the minimized windows are in a stowed configuration, and they are also //untucked, then set the margin to keep the stow minimized windows box/button //visible. for the functions that handle stowing and tucking minimized windows, //see files: 'stow_minimized_windows.js', and 'hide_show_stowed.js' if (get_are_minimized_windows_stowed_untucked() === true) { tabbed_window_left_margin = get_stowed_minimized_windows_box_untucked_width(); } return tabbed_window_left_margin; } //2024-05-20: //this function is no longer needed, as the actions //that it performs are handled by newly created //functions located below. see functions: //'if_no_maximized_exist_show_tab_box_container()', //'if_maximized_exist_hide_tab_box_container()', //and 'on_window_state_change_set_tab_box_container_display()' /* //whenever a window is maximized, hide the //tabbed window tab box container if it is present. function hide_tabs_on_maximize_window() { var tabs_container = null; console.log("function 'hide_tabs_on_maximize_window()' has been called. a window is being set to a maximized state. if the tabbed window tab box container exists, make it hidden."); console.log("function 'hide_tabs_on_maximize_window()' is exiting with no further action being taken."); return; tabs_container = document.getElementById("tabbed_windows_container"); if (tabs_container !== null) { tabs_container.style.display = "none"; } } */ //this function sets the tabbed window tab boxs' container //CSS display to its default property of "flex". function show_tabs_container() { var tabs_container = null; tabs_container = document.getElementById("tabbed_windows_container"); if (tabbed_windows_exist()) { if (tabs_container !== null) { tabs_container.style.display = "flex"; } } } //this function offsets the top location of //cascaded windows when the tabbed windows tab box //container is present. function show_tabs_Y_offset_cascaded_windows() { var tabs_container = null; var wins = null; var wins_count = null; var i = null; var win = null; var y_offset = null; var is_tabbed = null; tabs_container = document.getElementById("tabbed_windows_container"); if (tabs_container !== null) { wins = document.getElementsByName("web_window"); if (wins !== null) { wins_count = wins.length; for (i = 0; i < wins_count; i++) { win = wins[i]; if (win !== null) { if (win.hasAttribute("data-window_state") === true) { if (win.getAttribute("data-window_state") === "Cascade") { y_offset = get_Y_offset_for_tabbed_windows(); if (parseFloat(win.style.top) <= y_offset) { is_tabbed = is_window_tabbed(win.id); if (is_tabbed === true || is_tabbed === "true") { continue; } else { if (win.getAttribute("data-is_minimized") === true || win.getAttribute("data-is_minimized") === "true") { continue; } else { win.setAttribute("data-orig_y", y_offset); win.style.top = y_offset + "px"; } } } } } } } } } } //this function sets the width of the tabbed windows tab box container //so that it fits the width of the browser window, minus the left offset //location of the container. function resize_window_tabs_container(width = window.innerWidth, left = get_tabbed_windows_left_margin()) { var tabs_container = null; tabs_container = get_tabbed_window_tabs_container(); if (tabs_container !== null) { tabs_container.style.left = left + "px"; tabs_container.style.width = "calc(100% - " + left + "px)"; } } //this function sets the width of all tab boxes //within the tabbed window tab boxs' container. //the width of each tab is determined by the //number of tabs present divided by the width //of the container. function resize_all_tabbed_windows_width() { var all_windows = null; var window_count = null; var i = null; var win = null; var margin_left = null; margin_left = get_tabbed_windows_left_margin(); if (typeof margin_left !== "number") { margin_left = 3; } all_windows = get_all_tabbed_windows(); if (all_windows !== null) { window_count = all_windows.length; for (i = 0; i < window_count; i++) { win = all_windows[i]; if (win !== null) { if (win.hasAttribute("data-is_tabbed") === true) { if (win.getAttribute("data-is_tabbed") === "true" || win.getAttribute("data-is_tabbed") === true) { win.style.width = (parseFloat(window.innerWidth) - parseFloat(win.style.left)) + "px"; } } } } } } function move_cascaded_windows_to_front() { var all_windows = null; var window_count = null; var i = null; var win = null; all_windows = document.getElementsByName("web_window"); if (all_windows !== null) { window_count = all_windows.length; for (i = 0; i < window_count; i++) { win = all_windows[i]; if (win !== null) { if (win.hasAttribute("data-is_tabbed") === true) { if (win.getAttribute("data-is_tabbed") === "true" || win.getAttribute("data-is_tabbed") === true) { //continue } else { move_to_front(win.id); } } else { move_to_front(win.id); } } } } } function hide_window_components_for_tabbed_windows(win_id) { var x_resize_bar = null; var y_resize_bar = null; x_resize_bar = document.getElementById(win_id + "_resize_bar_x"); if (x_resize_bar !== null) { x_resize_bar.style.display = "none"; } y_resize_bar = document.getElementById(win_id + "_resize_bar_y"); if (y_resize_bar !== null) { y_resize_bar.style.display = "none"; } } function show_window_components_for_tabbed_windows(win_id) { var x_resize_bar = null; var y_resize_bar = null; x_resize_bar = document.getElementById(win_id + "_resize_bar_x"); if (x_resize_bar !== null) { x_resize_bar.style.display = "block"; } y_resize_bar = document.getElementById(win_id + "_resize_bar_y"); if (y_resize_bar !== null) { y_resize_bar.style.display = "block"; } } function remove_ui_content_blocking_image(win_id) { var blocking_img = null; blocking_img = document.getElementById(win_id + "_block_window_content_container_img"); if (blocking_img !== null) { blocking_img.parentNode.removeChild(blocking_img); } } //a function that returns all tabbed windows //in an array. function get_all_tabbed_windows() { var tabs_container = null; var wins = null; var wins_count = null; var i = null; var win = null; var is_tabbed = null; var tabbed_windows = []; tabs_container = document.getElementById("tabbed_windows_container"); if (tabs_container !== null) { wins = document.getElementsByName("web_window"); if (wins !== null) { wins_count = wins.length; for (i = 0; i < wins_count; i++) { win = wins[i]; if (win !== null) { if (win.hasAttribute("data-window_state") === true) { is_tabbed = is_window_tabbed(win.id); if (is_tabbed === true || is_tabbed === "true") { tabbed_windows.push(win); } } } } } } return tabbed_windows; } function left_offset_all_tabbed_windows() { var tabbed_windows = null; var i = null; var tabbed_window_count = null; var win = null; var win_id = null; tabbed_windows = get_all_tabbed_windows(); if (tabbed_windows !== null && tabbed_windows.length > 0) { tabbed_window_count = tabbed_windows.length; for (i = 0; i < tabbed_window_count; i++) { win = tabbed_windows[i]; if (win !== null) { win_id = win.getAttribute("id"); if (win_id !== null && win_id.length > 0) { //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); } } } } } function stow_minimized_scroll_box() { var scroll_box = null; scroll_box = document.getElementById("scroll_box"); if (scroll_box !== null) { scroll_box.style.overflowX = "hidden"; scroll_box.style.width = "3px"; scroll_box.style.display = "none"; } } //2024-05-17: //this function offsets tabbed windows and the tab box container to the left //when minimized windows are in a stowed formation. //see files: 'stow_minimized_windows.js' and 'show_hide_stowed.js' function offset_left_when_minimized_windows_stowed_untucked() { var stow_minimized_windows_box = null; var stow_minimized_windows_box_width = null; var tabbed_windows = null; var tabbed_windows_count = null; var i = null; var tabbed_window = null; var tab_boxes_container = null; stow_minimized_windows_box = document.getElementById("stow_minimized_windows_box"); if (stow_minimized_windows_box !== null) { if (get_are_minimized_windows_stowed_attribute() === true) { if (get_are_minimized_windows_tucked_attribute() !== true) { stow_minimized_windows_box_width = parseFloat(stow_minimized_windows_box.offsetWidth); tabbed_windows = get_all_tabbed_windows(); if (tabbed_windows !== null) { tabbed_windows_count = tabbed_windows.length; if (tabbed_windows_count > 0) { for (i = 0; i < tabbed_windows_count; i++) { tabbed_window = tabbed_windows[i]; if (tabbed_window !== null) { tabbed_window.style.left = stow_minimized_windows_box_width + "px"; } tab_boxes_container = get_tabbed_window_tabs_container(); if (tab_boxes_container !== null) { tab_boxes_container.style.left = stow_minimized_windows_box_width + "px"; } } } } } } } } //2024-05-17: //keep in mind that there is a function with a name similar to this function's //name. the other function is called: 'get_are_minimized_windows_stowed_tucked()'. //this function returns true if minimized windows are stowed and UNTUCKED. not tucked. //this function returns true if there are minimized windows //present, and they are stowed, and they are also untucked. //stowing minimized windows, and tucking miimized stowed //windows functions are handled by other scripts. //see files: 'stow_minimized_windows.js', and 'hide_show_stowed.js' function get_are_minimized_windows_stowed_untucked() { var stow_minimized_windows_box = null; var are_stowed_untucked = null; stow_minimized_windows_box = document.getElementById("stow_minimized_windows_box"); if (stow_minimized_windows_box !== null) { if (get_are_minimized_windows_stowed_attribute() === true) { if (get_are_minimized_windows_tucked_attribute() !== true) { are_stowed_untucked = true; } } } return are_stowed_untucked; } //2024-05-17: //keep in mind that there is a function with a name similar to this function's //name. the other function is called: 'get_are_minimized_windows_stowed_untucked()'. //this function returns true if minimized windows are stowed and TUCKED. not untucked. function get_are_minimized_windows_stowed_tucked() { var stow_minimized_windows_box = null; var are_stowed_tucked = null; stow_minimized_windows_box = document.getElementById("stow_minimized_windows_box"); if (stow_minimized_windows_box !== null) { if (get_are_minimized_windows_stowed_attribute() !== false) { if (get_are_minimized_windows_tucked_attribute() !== false) { are_stowed_tucked = true; } } } return are_stowed_tucked; } //2024-05-17: //if the minimized windows are in a stowed configuration, and they are also //untucked, then get the left margin width to keep the stow minimized windows box/button //visible when a window is tabbed. //for the functions that handle stowing and tucking minimized windows, //see files: 'stow_minimized_windows.js', and 'hide_show_stowed.js' function get_stowed_minimized_windows_box_untucked_width() { var stow_minimized_windows_box = null; var are_stowed_untucked = null; var stow_minimized_windows_box_width = null; stow_minimized_windows_box_width = 0; stow_minimized_windows_box = document.getElementById("stow_minimized_windows_box"); if (stow_minimized_windows_box !== null) { if (get_are_minimized_windows_stowed_attribute() === true) { if (get_are_minimized_windows_tucked_attribute() !== true) { stow_minimized_windows_box_width = parseFloat(stow_minimized_windows_box.offsetWidth); } } } return stow_minimized_windows_box_width; } /* ----------------------------------------------------- //2024-05-20: THE THREE FUNCTIONS LOCATED BELOW SET THE CSS DISPLAY //PROPERTY OF THE TABBED WINDOWS TAB BOX CONTAINER //(IF THE CONTAINER EXISTS) DEPENDING ON IF MAXIMIZED //WINDOWS ARE PRESENT, OR NOT. ----------------------------------------------------- */ //2024-05-20; //NOTE: there is another function with a very similar //name to this functions name. one function is named //'if_maximized_exist_hide_tab_box_container()', and //the other function's similar name is //'if_no_maximized_exist_show_tab_box_container()'. //if any maximized windows exist, and the tabbed //window tab box container exists, then we want to //set the tabbed window tab boxes container to be //hidden by setting its CSS display property to "none". function if_maximized_exist_hide_tab_box_container() { var maximized_windows = null; var tab_box_container = null; var tab_box_container_display = null; maximized_windows = get_maximized_windows(); if (maximized_windows !== null) { if (parseFloat(maximized_windows.length) > 0) { tab_box_container = get_tabbed_window_tabs_container(); if (tab_box_container !== null) { if (tab_box_container.style.display === "flex" || tab_box_container.style.display === "block") { tab_box_container.style.display = "none"; } tab_box_container_display = tab_box_container.style.display; } } } return tab_box_container_display; } //2024-05-20; //NOTE: there is another function with a very similar //name to this functions name. one function is named //'if_maximized_exist_hide_tab_box_container()', and //the other function's similar name is //'if_no_maximized_exist_show_tab_box_container()'. //this function sets the display of tabbed windows tab //box container CSS display, if the container exists. //if no maximized windows exist, and tabbed windows do //exist, then we want to display the tabbed window tab //boxes container as visible by setting its CSS display //property to "flex", or another display property other //than "none". function if_no_maximized_exist_show_tab_box_container() { var maximized_windows = null; var tab_box_container = null; var tab_box_container_display = null; maximized_windows = get_maximized_windows(); if (maximized_windows !== null) { if (parseFloat(maximized_windows.length) < 1.0) { if (tabbed_windows_exist() === true) { tab_box_container = get_tabbed_window_tabs_container(); if (tab_box_container !== null) { if (tab_box_container.style.display !== "flex" && tab_box_container.style.display !== "block") { tab_box_container.style.display = "flex"; } tab_box_container_display = tab_box_container.style.display; } } } } else { if (tabbed_windows_exist() === true) { tab_box_container = get_tabbed_window_tabs_container(); if (tab_box_container !== null) { if (tab_box_container.style.display !== "flex" && tab_box_container.style.display !== "block") { tab_box_container.style.display = "flex"; } tab_box_container_display = tab_box_container.style.display; } } } return tab_box_container_display; } //whenever a window's state changes, call this function to set //the CSS display property of the tabbed window's tab box //container accordingly. if maximized windows are present, //then if the tabbed window tab box exists, set its display to //"none". if no maximized windows are present, and the tabbed //window tab box container exists, then set it to display as //"flex", or other CSS display property making it viewable. //currently, this function is being called within another script. //see file: 'windows_state_controls.js' function on_window_state_change_set_tab_box_container_display() { var maximized_windows = null; var tabbed_window_tab_box_container_display = null; maximized_windows = get_maximized_windows(); if (maximized_windows !== null) { if (parseFloat(maximized_windows.length) > 0) { tabbed_window_tab_box_container_display = if_maximized_exist_hide_tab_box_container(); } else { tabbed_window_tab_box_container_display = if_no_maximized_exist_show_tab_box_container(); } } else { tabbed_window_tab_box_container_display = if_no_maximized_exist_show_tab_box_container(); } return tabbed_window_tab_box_container_display; } /* ----------------------------------------------------- //2024-05-20: THE THREE FUNCTIONS LOCATED ABOVE SET THE CSS DISPLAY //PROPERTY OF THE TABBED WINDOWS TAB BOX CONTAINER //(IF THE CONTAINER EXISTS) DEPENDING ON IF MAXIMIZED //WINDOWS ARE PRESENT, OR NOT. ----------------------------------------------------- */