"use strict"; //2024-15-2024: //This script is made up of functions //that tend to be rarely used, take up //too many lines of code, disrupt from //the main code process (making code //easier to read) in a file for main //operations, or other various reasons //not mentioned, here. //The main processes are located in the file: //'tab_windows.js'. The aformentioned script //depends on this file in order to operate. //2024-15-2024: /* ------------------------------------------------ //BEGIN WINDOW LAYER (Z-INDEX) REORDERING FUNCTIONS --------------------------------------------------*/ //2024_15_2024: //This is where the feature begins. //its default argument is the id of //the globally active window. Otherwise, //the 'win_id' argument is designated //by the originating function call. //[END COMMENT] function start_arrange_tabbed_windows(win_id = global_active_window_id) { return arrange_tabbed_windows(win_id); //outputs true if successful. } //2024-15-2024: //This function is called in order to start running //the main (CSS z-index) rearrangement tasks. //Those tasks handle tabbed windows, and rearrange //them as layers (CSS z-index) in accoracne with //the respective window's id attribute. //[END COMMENT] function arrange_tabbed_windows(win_id) { var win = null; var output = null; win = document.getElementById(win_id); if (win !== null) { window_reset_zIndexes(); if (is_window_tabbed(win_id) === true) { set_tabbed_zIndex_backward(win_id); output = true; } else if (is_window_tabbed(win_id) === false) { ////win.style.zIndex = get_top_window_zIndex() + 1.0; move_to_front(win_id); output = true; } } return output; } //2024-15-2024: //Reset the z-index CSS number for all windows //so that they don't keep climbing in numbers. //This function resets all windows from 1, to //N, where N is the number of web windows. //[END COMMENT] function window_reset_zIndexes() { var wins = null; var win = null; var win_count = null; var i = null; wins = document.getElementsByName("web_window"); if (wins !== null) { win_count = wins.length; for (i = 0; i < win_count; i++) { win = wins[i]; win.style.zIndex = (i + 1); } } } //2024-15-2024: //This takes any window placed as a tabbed window, //and sets it to the bottom layer of all web-windows. //This function is set to take a window's id, get the z-index //of the lowest window, and place it at the bottom. //[END COMMENT] function set_tabbed_zIndex_backward(win_id) { var win = null; win = document.getElementById(win_id); if (win !== null) { win.style.zIndex = get_bottom_window_zIndex() - 1.0; } } //2024-15-2024: //If the window is being displayed as a tabbed window, //this function returns true. If the window is not being //displayed as as a tabbed window, it returns false. //For any other value, the function returns null. //Additionally, this windows "is tabbed" status, is //stored within the HTML tag for a window inside //the 'data-is_tabbed' attribute. Defaults to //returning null. //[END COMMENT] function is_window_tabbed(win_id) { var win = null; var is_tabbed = null; var attr = null; win = document.getElementById(win_id); if (win !== null) { if (win.hasAttribute("data-is_tabbed") === true) { attr = win.getAttribute("data-is_tabbed"); if (attr === "true" || attr === true) { is_tabbed = true; } else if (attr === "false" || attr === false) { is_tabbed = false; } } } return is_tabbed; } /* ------------------------------------------------ //END WINDOW LAYER (Z-INDEX) REORDERING FUNCTIONS --------------------------------------------------*/