"use strict"; //------------------------------------------------------------ //END NEW CLOSE WINDOW FUNCTIONS //------------------------------------------------------------ /* //2024-06-14: //this is the beginning function that is first called //to close a window. if the window is unsaved, then //confirm with the user that they would like to close //the window even though it is unsaved. function start_window_close(win_id) { var window_is_saved = null; var close_unsaved_window = null; var win = null; win = document.getElementById(win_id); if (win !== null) { window_is_saved = is_window_saved(win_id); if (window_is_saved === false) { //the window is unsaved. close_unsaved_window = user_confirm_prompt_close_window(win_id); if (close_unsaved_window === true) { //user chooses to close the window without saving ////close_window(win_id); ////on_close_window_config_minimized_windows(null); } else { //the user has chosen to stop the close window //process. return; } } else { //window is saved. close it. ////close_window(win_id); ////on_close_window_config_minimized_windows(null); } } } //this function is the new function //that closes a window function close_window(win_id) { var win = null; win = document.getElementById(win_id); if (win !== null) { win.parentNode.removeChild(win); } } //if the user is attempting to close an unsaved //window, ask them if they are sure they want to //close the window even though the window may have //unsaved changes. function user_confirm_prompt_close_window(win_id) { var user_confirm_prompt_close = null; user_confirm_prompt_close = confirm("This window may have unsaved changes.\n Are you sure you want to close this window\n with unsaved changes?"); if (user_confirm_prompt_close === true) { return true; } else { return false; } } function on_close_window_config_minimized_windows(win_id) { return; //if there is more than 0 minimized windows //if minimized windows are stowed, or //if minimized windows are tucked var min_win_count = null; var are_min_wins_stowed = null; var are_min_wins_tucked = null; var win = null; win = document.getElementById(win_id); //if the window is null, that's OK. min_win_count = minimized_window_count(); if (min_win_count > 0) { //at least one minimized window exists are_min_wins_stowed = get_are_minimized_windows_stowed_attribute(); if (are_min_wins_stowed === true) { //the minimized windows are in a stowed configuration are_min_wins_tucked = get_are_minimized_windows_tucked_attribute(); if (are_min_wins_tucked === true) { //the minimized windows are stowed, and tucked } else { //the minimized windows are stowed and not tucked } } else { //the minimized windows are not stowed minimize_window_main(win); } } else { //0 minimized windows exist //if there are no minimized windows present, then hide the box/button to stow //minimized windows. //see file: 'stow_minimized_windows.js' hide_stow_minimized_window_box(); //this function hides the small icon that retracts the stowed minimized windows //and the box/button that stows minimized windows. //see file: 'hide_show_stowed.js' hide_tuck_stowed_minimized_window_icon(); } } //check to see if the window is flagged //as being unsaved. //function is_window_unsaved(win_id) { // var is_saved_flag = null; // var is_unsaved = null; // is_saved_flag = is_window_saved(win_id); // if (is_saved_flag === "true" || is_saved_flag === true) { // //window is already saved. // is_unsaved = false; // } // else { // //window is unsaved. // is_unsaved = true; // } // return is_unsaved; //} //------------------------------------------------------------ //END NEW CLOSE WINDOW FUNCTIONS //------------------------------------------------------------ */ function close_window(win_id) { var closing_web_window = null; title_to_white(win_id); closing_web_window = document.getElementById(win_id); if (closing_web_window !== null && typeof(closing_web_window) === "object") { setTimeout(function () { //set opacity animation closing_web_window.style.opacity = 0.00; most_customizable_config_elem_for_animation(closing_web_window.id, "opacity", 0.200, 0.0); setTimeout(function () { setTimeout(function () { if (closing_web_window) { if (closing_web_window !== null && typeof (closing_web_window) === "object") { //closing_web_window.parentNode.removeChild(closing_web_window); closing_web_window.remove(); } } on_close_window_config_minimized_windows(); }, 50); }, 200); }, 10); } ////click_close(win_id); } //sets the way minimized windows are organized and configured //when you close a window. function on_close_window_config_minimized_windows() { //if there is more than 0 minimized windows //if minimized windows are stowed, or //if minimized windows are tucked var min_win_count = null; var are_min_wins_stowed = null; var are_min_wins_tucked = null; min_win_count = minimized_window_count(); if (min_win_count > 0) { //at least one minimized window exists are_min_wins_stowed = get_are_minimized_windows_stowed_attribute(); if (are_min_wins_stowed === true) { //the minimized windows are in a stowed configuration are_min_wins_tucked = get_are_minimized_windows_tucked_attribute(); if (are_min_wins_tucked === true) { //the minimized windows are stowed, and tucked } else { //the minimized windows are stowed and not tucked } } else { //the minimized windows are not stowed minimize_window_main(); } } else { //0 minimized windows exist //if there are no minimized windows present, then hide the box/button to stow //minimized windows. //see file: 'stow_minimized_windows.js' hide_stow_minimized_window_box(); //this function hides the small icon that retracts the stowed minimized windows //and the box/button that stows minimized windows. //see file: 'hide_show_stowed.js' hide_tuck_stowed_minimized_window_icon(); } } function click_close(win_id) { if (options_menu_showing(win_id) == true) { remove_details_menu(win_id); } display_close_confirm(win_id); } function window_close(win_id) { //alert(win_id); var win = null; win = document.getElementById(win_id); reset_css_pixel_ratio(); //IMPORTANT for resetting the pixel ratio. Sets the ratio of CSS and regular pixels to 1:1 //When closing a window, reset the pixel ratio. When a web window is maximized, and then closed, the css pixel ratio needs to be set back to what it would be. It's the same as cascading a web window from a maximized state. if (win != null) { fade_obj(win_id); //win.parentNode.removeChild(win); //win = null; return true; } else { return false; } } function display_close_confirm(win_id) { var is_minimized = null; var confirm_box = null; var win = null; win = document.getElementById(win_id); is_minimized = win.getAttribute("data-is_minimized"); is_maximized = win.getAttribute("data-is_maximized"); if (is_minimized != "true" || is_minimized.length <= 0 || is_minimized == null || is_minimized == undefined || typeof is_minimized != "string" || is_maximized == "true") { win.setAttribute("data-is_minimized", "false"); is_minimized = "false"; confirm_box = make_close_confirm_box(win_id); win.appendChild(confirm_box); confirm_box.style.position = "absolute"; confirm_box.style.right = "13px"; confirm_box.style.top = "4px"; confirm_box.style.width = "76px"; confirm_box.style.height = "38px"; global_close_timer = setTimeout("remove_close_prompt('" + win_id + "');clearTimeout(global_close_timer);", 2500); return true; } else if (is_minimized == "true") { return false; } else { return false; } } function make_close_confirm_box(win_id) { var tbl = null; var tr_001 = null; var tr_002 = null; var tr_001_td_001 = null; var tr_001_td_002 = null; var tr_002_td_001 = null; var blank_img = null; var close_icon = null; var close_confirm_button = null; var div_container = null; div_container = document.createElement("div"); div_container.setAttribute("id", (win_id + "_close_confirm")); div_container.setAttribute("width", "76"); div_container.setAttribute("height", "38"); tbl = document.createElement("table"); tbl.setAttribute("border", "0"); tbl.setAttribute("cellspacing", "0"); tr_001 = document.createElement("tr"); tr_002 = document.createElement("tr"); tr_001_td_001 = document.createElement("td"); tr_001_td_002 = document.createElement("td"); tr_002_td_001 = document.createElement("td"); tbl.setAttribute("width", "76"); tbl.appendChild(tr_001); tr_001.appendChild(tr_001_td_001); tr_001.appendChild(tr_001_td_002); tbl.appendChild(tr_002); tr_002.appendChild(tr_002_td_001); //tr_002.setAttribute("colspan", "2"); tr_001.setAttribute("width", "76"); tr_001_td_001.setAttribute("width", "57"); tr_001_td_002.setAttribute("width", "19"); tr_002.setAttribute("width", "76"); tr_002_td_001.setAttribute("width", "76"); tr_002_td_001.setAttribute("colspan", "2"); blank_img = new Image(); blank_img.src = "/chromosphere/images/blank.gif"; blank_img.setAttribute("width", "57"); blank_img.setAttribute("height", "19"); blank_img.addEventListener("click", function () { remove_close_prompt(win_id); }); tr_001_td_001.appendChild(blank_img); close_icon = new Image(); close_icon.src = "/chromosphere/images/ui/icons/close_19x19.png"; close_icon.setAttribute("width", "19"); close_icon.setAttribute("height", "19"); tr_001_td_002.appendChild(close_icon); tr_001_td_002.style.backgroundColor = "#8f8f8f"; close_icon.parentNode.addEventListener("mouseup", function () { if (div_container != null) { div_container.parentNode.removeChild(div_container); } else { display_close_confirm(win_id); } }); close_confirm_button = document.createElement("button"); close_confirm_button.innerText = "close"; close_confirm_button.addEventListener("mouseup", function () { div_container.parentNode.removeChild(div_container); window_close(win_id); }); close_confirm_button.style.width = "inherit"; close_confirm_button.style.fontSize = "11pt"; close_confirm_button.style.fontFamily = "Arial"; close_confirm_button.style.color = "black"; close_confirm_button.style.borderStyle = "solid"; close_confirm_button.style.borderWidth = "1px"; close_confirm_button.style.borderColor = "black"; tr_002_td_001.appendChild(close_confirm_button); tr_002_td_001.style.backgroundColor = global_window_bgColor; tr_002_td_001.setAttribute("align", "right"); tr_002_td_001.style.padding = "5px"; div_container.appendChild(tbl); return div_container; } function remove_close_prompt(win_id) { var close_prompt = null; close_prompt = document.getElementById(win_id + "_close_confirm"); if (close_prompt != null) { close_prompt.remove(); } }