"use strict"; function set_active_window(win_id) { var win_z_index = null; var is_minimized = null; global_active_window = document.getElementById(win_id); global_active_window_id = win_id; //global_active_window.style.boxShadow = "3px 3px 6px 6px #333333"; if (global_active_window != null) { is_minimized = global_active_window.getAttribute("data-is_minimized"); if (is_minimized === "true") { ////global_active_window.style.boxShadow = global_hide_window_dropshadow; ////global_active_window.style.boxShadow = global_inactive_window_dropshadow;// global_hide_window_dropshadow; } else { global_active_window.style.boxShadow = global_active_window_dropshadow; } //enable_entire_window(global_active_window.id); //console.log("Global Active Window: " + global_active_window_id); //this code calls functions in show_window_details.js /* if (options_menu_showing(win_id) == true) { update_details(win_id); } */ global_active_window_loc_x = parseFloat(global_active_window.style.left); global_active_window_loc_y = parseFloat(global_active_window.style.top); global_active_window_offsetWidth = parseFloat(global_active_window.offsetWidth); global_active_window_offsetHeight = parseFloat(global_active_window.offsetHeight); move_to_front(win_id); //block the contents container of each web window to prevent interaction block_all_window_content_containers(); unblock_window_content_container(win_id); global_window_mode = "active"; //turn_blue_fade_white(global_active_window_id); //2024-07-16: //for every open window, check to see if its option menu is showing. //if the options menu is showing, update all options data. //see file: 'show_window_details.js'. update_all_window_details_menus(); //2024-07-16: //set an HTML attribute in each open window's HTML //indicating whether it is currently the 'global_active_window' //see file: 'show_window_details.js'. set_is_global_active_window_attribute(win_id); //console.log("New Active Window:" + global_active_window.id); return global_active_window.id; } else { return false; } } //function enable_active_window() { // enable_entire_window(global_active_window.id); //} //function disable_windows() { // var web_windows = null; // var win = null; // var i = null; // web_windows = document.getElementsByName("web_window"); // for (i = 0; i < web_windows.length; i++) { // win = web_windows[i]; // disable_entire_window(win.id); // } //} function deactivate_global_active_window() { var active_window = null; var active_win_id = null; var win_obj = null; var is_minimized = null; var win_id = null; //disable_entire_window(global_active_window.id); active_win_id = global_active_window_id; win_obj = document.getElementById(active_win_id); //alert(global_active_window_id); if (win_obj != null) { win_id = win_obj.id; title_to_white(win_obj.id); global_active_window.style.opacity = global_window_opacity; //win_obj.style.boxShadow = "none"; is_minimized = win_obj.getAttribute("data-is_minimized"); if (is_minimized === "true") { ///win_obj.style.boxShadow = global_hide_window_dropshadow; } else { win_obj.style.boxShadow = global_inactive_window_dropshadow; } //win_obj.style.boxShadow = global_inactive_window_dropshadow; set_window_title_white(win_obj.id); global_active_window = null; global_active_window_id = null; global_active_window_loc_x = null; global_active_window_loc_y = null; global_active_window_offsetHeight = null; global_active_window_offsetWidth = null; global_window_mode = "standby"; win_obj = null; } //2024-07-16: //for every open window, check to see if its option menu is showing. //if the options menu is showing, update all options data. //see file: 'show_window_details.js'. update_all_window_details_menus(); //2024-07-16: //set an HTML attribute in each open window's HTML //indicating whether it is currently the 'global_active_window'. //in this case, it should set all open windows to be inactive (false). //the "none" argument to inactivate all open windows. set_is_global_active_window_attribute(); return global_active_window_id; } /* function set_active_window(win_id) { var win = null; win = document.getElementById(win_id); global_active_window = win; global_active_window_id = win.id; global_active_window_left = parseFloat(win.style.left); global_active_window_top = parseFloat(win.style.top); global_active_window_width = parseFloat(win.style.width); global_active_window_height = parseFloat(win.style.height); //move_to_front(win.id); //set_active_window_params(); //get_top_window_z_index(); return global_active_window_id; } function get_active_window() { if (global_active_window != null) { return global_active_window; } else { return false; } } */ /* function deselect_active_window() { global_active_window_id = null; global_active_window_left = null; global_active_window_top = null; global_active_window_width = null; global_active_window_height = null; return null; } */ /* function set_active_window_params() { if (global_active_window != null) { global_active_window_top = parseFloat(global_active_window.style.top); global_active_window_left = parseFloat(global_active_window.style.left); global_active_window_width = parseFloat(global_active_window.style.width); global_active_window_height = parseFloat(global_active_window.style.height); global_active_window_id = global_active_window.id; return true; } else { return false; } } */ function get_z_index(elem_id) { var elem = null; var z = null; elem = document.getElementById(elem_id); z = parseFloat(elem.style.zIndex); if (z > 0) { return z; } else { return null; } } /* function move_to_front(elem_id) //remember, desktop object has z-index of 0. all web windows created are 'stacked' upon the dekstop. { var elem = null; var z_index = null; elem = document.getElementById(elem_id); z_index = get_top_window_z_index(); if (z_index > -1 && typeof z_index == "number") { z_index = (parseFloat((z_index)) + 1); elem.style.zIndex = parseInt(z_index); } else { web_windows = document.getElementsByName("web_window"); num_windows = parseFloat(web_windows.length); elem.style.zIndex = parseInt(num_windows) + 1; } } function get_top_window_z_index() { var web_windows = []; var i = null var num_windows = null; var win = null; var top_z = null; web_windows = document.getElementsByName("web_window"); num_windows = parseFloat(web_windows.length); top_z = -1; for (i = 0; i < num_windows; i++) { if (i > top_z && typeof top_z == "number") { top_z = i; } } if (i > -1 && typeof i == "number") { return (i + 2); } else { web_windows = document.getElementsByName("web_window"); num_windows = parseFloat(web_windows.length); return (num_windows + 2); } } function set_z_index(win_id) { var win = null; var z_index = null; win = document.getElementById(win_id); z_index = parseFloat(win.style.zIndex); if (z_index > -1 && typeof z_index == "number") { win.style.zIndex = z_index; } else { web_windows = document.getElementsByName("web_window"); num_windows = parseFloat(web_windows.length); z_index = parseInt(num_windows); win.style.zIndex = z_index; } } */ function move_to_front(win_id) { var top_win_z_index = null; var new_z_index = null; var win = null; win = document.getElementById(win_id); top_win_z_index = get_top_window_z_index(); //alert(top_win_z_index); if (top_win_z_index > -1 && win != null) { new_z_index = parseFloat(top_win_z_index) + 1; // alert("window_z_index: " + win.style.zIndex); win.style.zIndex = new_z_index; //console.log("Window to Top Z-Index: " + new_z_index); } else if (top_win_z_index > -1) { win = document.getElementById(global_active_window_id); if (win != null) { new_z_index = parseFloat(top_win_z_index) + 1; // alert("window_z_index: " + win.style.zIndex); win.style.zIndex = new_z_index; //console.log("Window to Top Z-Index: " + new_z_index); } } else { // alert("win: " + top_win_z_index); win.style.zIndex = 1; //console.log("Window to Top Z-Index: 1"); } } function get_top_window_z_index() //gets the z-index value of the top window { var window_collection = null; var highest_z_index = null; var current_window = null; var current_window_z_index = null; var new_z_index = null; var window_collection_length = null; var i = null; window_collection = document.getElementsByName("web_window"); window_collection_length = parseFloat(window_collection.length); highest_z_index = 0; for (i = 0; i < window_collection_length; i++) { current_window = window_collection[i]; current_window_z_index = parseFloat(current_window.style.zIndex); if (current_window_z_index > highest_z_index) { highest_z_index = current_window_z_index; } } return highest_z_index; } /* function disable_wins_enable_active_win() { return; var web_windows = null; var win_id = null; var i = null; web_windows = document.getElementsByName("web_window"); //var window_0001 = null; for (i = 0; i < web_windows.length; i++) { win_id = web_windows[i].getAttribute("id"); //alert(win_id); if (win_id == global_active_window_id) //this window is the active window { //alert("testing"); //enable_entire_window(web_windows[i].getAttribute("id")); //alert(web_windows[i].innerHTML); //alert(web_windows[i].getAttribute("id")); // web_windows[i].style.opacity = "1.0"; } else { //the ID of the window does not match the ID of the active window web_windows[i].style.opacity = "0.3"; //disable_entire_window(web_windows[i].getAttribute("id")); //get_top_window_z_index(); } } enable_entire_window(global_active_window.id); global_active_window.style.opacity = global_window_opacity; } */ //2024-07-16: //set the window's "data-is_global_active_window" attribute //to indicate that the window is the active window, or not. //if the 'win_id' argument is not provided by the function //caller, then it defaults to a string: "none". this string //will not match the HTML id attribute of any window, thus //all windows have the HTML attribute set to "false" function set_is_global_active_window_attribute(win_id = "none") { var wins = null; var win_count = null; var w = null; var i = null; wins = document.getElementsByName("web_window"); if (wins !== null) { if (wins.length > 0) { win_count = wins.length; for (i = 0; i < win_count; i++) { w = wins[i]; if (w !== null) { if (global_active_window !== null && win_id !== null) { if (global_active_window.id === win_id) { w.setAttribute("data-is_global_active_window", "true"); } else { w.setAttribute("data-is_global_active_window", "false"); } } else { w.setAttribute("data-is_global_active_window", "false"); } } } } } } //2024-07-16: //get the window's "data-is_global_active_window" attribute //to indicate that the window is the active window, or not. //if the HTML attribute does not exist, or has an invalid //value, then this function returns null; function get_is_global_active_window_attribute(win_id) { var w = null; var is_global_active_window = null; w = document.getElementById(win_id); if (w !== null) { is_global_active_window = w.getAttribute("data-is_global_active_window"); if (is_global_active_window === "true" || is_global_active_window === true) { return true; } else { if (is_global_active_window === "false" || is_global_active_window === false) { return false; } else { return null; } } } else { return null; } }