"use strict"; //2024-03-19: //begin with this function. make the new icon object, //and insert it into the specified window's table as //a new icon. this icon's purpose is to display //a submenu of additional window actions that //alter the window's state. //(for example, the current actions are things such as: //'cascade', 'minimize', 'maximize', 'resize', etc.). //this script adds a new icon to the window's tab to //provide other window actions, such as the 'tab window' //window action. function start_more_window_actions(win_id) { var cloned_icon_td = null; cloned_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_window_actions"); if (cloned_icon_td !== null) { return; } else { cloned_icon_td = make_more_window_actions_icon(win_id); if (cloned_icon_td !== null) { insert_more_window_actions_td(win_id, cloned_icon_td); //alert(cloned_icon_td.outerHTML); } } } //create the new icon's table cell object by cloning //an existing icon table cell, removing its contents (the icon image), //and inserting the new image icon into the new table cell object. function make_more_window_actions_icon(win_id) { var win = null; var icon_td = null; var cloned_td = null; var icon_img = null; win = document.getElementById(win_id); if (win !== null) { icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_0002"); if (icon_td !== null) { cloned_td = icon_td.cloneNode(true); if (cloned_td !== null) { cloned_td.setAttribute("id", win_id + "_tbl_0000_tr_0000_td_window_actions"); cloned_td.innerHTML = ""; icon_img = create_new_window_icon_td_image(win_id); if (icon_img !== null) { cloned_td.appendChild(icon_img); } } } } return cloned_td; } //create the down-arrow icon image object. set its image source, //id, width, and height attributes. return the new image. function create_new_window_icon_td_image(win_id) { var win = null; var icon_img = null; win = document.getElementById(win_id); if (win !== null) { icon_img = document.createElement("img"); icon_img.setAttribute("id", win_id + "_tbl_0000_tr_0000_td_window_actions_icon"); icon_img.setAttribute("src", "/chromosphere/images/ui/icons/down_arrow_icon_2.png"); icon_img.setAttribute("width", "19"); icon_img.setAttribute("height", "19"); } return icon_img; } //add an configure the new table cell for the 'more actions' icon //to the existing window's table. set the 'colspan' attributes //for other table cells in the data. add event listeners to the new //icon table cell, and stylize it the same as the current window //style icon table cells. function insert_more_window_actions_td(win_id, win_actions_td) { var win = null; var td_obj = null; var title_td_id = null; var title_td = null; var cascade_icon_td_id = null; var cascade_icon_td = null; var window_top_row_id = null; var window_top_row = null; win = document.getElementById(win_id); if (win !== null) { td_obj = win_actions_td; if (td_obj !== null) { title_td_id = win_id + "_tbl_0000_tr_0000_td_0001"; title_td = document.getElementById(title_td_id); cascade_icon_td_id = win_id + "_tbl_0000_tr_0000_td_0002"; cascade_icon_td = document.getElementById(cascade_icon_td_id); window_top_row_id = win_id + "_tbl_0000_tr_0000"; window_top_row = document.getElementById(window_top_row_id); if (title_td !== null && cascade_icon_td !== null && window_top_row !== null) { window_top_row.insertBefore(td_obj, cascade_icon_td); update_td_colspans(win_id); more_window_actions_icon_add_event_listeners(td_obj, win_id); set_style_icon_td(td_obj); set_new_icon_helper_captions(td_obj, win_id); } } } } //since a new table cell for the new icon has been created //inside the window's table, the other table cells need to //have thier 'colspan' attributes set in order to display //properly function update_td_colspans(win_id) { var contents_td = null; var footer_td = null; var contents_td_colspan = null; var footer_td_colspan = null; contents_td = document.getElementById(win_id + "_tbl_0000_tr_0001_td_0000"); footer_td = document.getElementById(win_id + "_tbl_0000_tr_0002_td_0000"); if (contents_td !== null && footer_td !== null) { if (contents_td.hasAttribute("colspan") === true) { contents_td_colspan = parseFloat(contents_td.getAttribute("colspan")); if (typeof contents_td_colspan === "number" && contents_td_colspan >= 0) { contents_td_colspan++; contents_td.setAttribute("colspan", contents_td_colspan); } } if (footer_td.hasAttribute("colspan") === true) { footer_td_colspan = parseFloat(footer_td.getAttribute("colspan")); if (typeof footer_td_colspan === "number" && footer_td_colspan >= 0) { footer_td_colspan++; footer_td.setAttribute("colspan", footer_td_colspan.toString()); } } } } //2024-03-19: //set the event listeners to the icon td that the other //window icons have. See file 'create_window.js' and file //'create_window_functions.js'. function more_window_actions_icon_add_event_listeners(td_icon, win_id) { td_icon.addEventListener("mousedown", function () { turn_blue_fade_white(win_id); td_icon.style.backgroundColor = "#ffffff"; if (more_window_actions_box_is_showing(win_id) !== true) { ////display_more_window_actions_list(win_id); } else { ////remove_more_window_actions_box(win_id); } }); td_icon.addEventListener("mouseup", function () { td_icon.style.background = "none"; }); td_icon.addEventListener("click", function () { }); td_icon.addEventListener("mousemove", function () { //cancel the timer which removes the "more window actions" //list box. clearTimeout(global_more_actions_icon_mouseout_timer_id); td_icon.style.backgroundColor = "#0000ff"; //hide all existing window actions list boxes that may currently //exist. hide_all_more_window_options_list_boxes(); //show the window actions list box that is to be shown display_more_window_actions_list(win_id); }); td_icon.addEventListener("mouseout", function () { td_icon.style.background = "none"; ////remove_more_window_actions_box(win_id); clearTimeout(global_more_actions_icon_mouseout_timer_id); global_more_actions_icon_mouseout_timer_id = setTimeout(function () { remove_more_window_actions_box(win_id); }, 100); }); } //2024-03-19: //set the style parameters to the same properties //as other window icons. See file 'create_window.js' and //file 'create_window_functions.js'. function set_style_icon_td(td) { var icon_td = null; icon_td = td; if (icon_td !== null) { icon_td.style.paddingTop = "4px"; icon_td.style.paddingLeft = "1px"; icon_td.style.borderCollapse = "collapse"; icon_td.style.maxHeight = "19px"; icon_td.style.overflow = "hidden"; prevent_drag_select(icon_td); icon_td.style.opacity = global_icon_opacity; } } //2024-03-19: //this function implements the 'helper captions' feature //so that when a user hovers the mouse cursor of the icon, //a small caption box is displayed containing a short //description of the icon's action. The code for this function //has been copied from the file 'create_window.js', and has //been modified to suit the new window icon. function set_new_icon_helper_captions(icon_td, win_id) { if (icon_td !== null) { icon_td.setAttribute("data-title", "More Window Actions"); icon_td.setAttribute("data-desc", "perform other window actions such as 'tabbed window view'"); icon_td.addEventListener("mousemove", function (event) { var box = null; //this function is located in file 'functions_3.js' //checking if a window's current state is tabbed, or cascaded. //if the windo is not tabbed or cascaded, exit the function. if (!is_window_cascaded_or_tabbed(win_id)) { box = document.getElementById("helper_caption_box"); if (box !== null) { box.style.opacity = 0.0; box.style.display = "none"; box.parentNode.removeChild(box); } return; } else { move_caption_box(this, event); //function is located in the file helper_captions_[X].js } }); icon_td.addEventListener("mousedown", function () { var box = document.getElementById("helper_caption_box"); if (box !== null) { box.style.opacity = 0.0; box.style.display = "none"; box.parentNode.removeChild(box); } }); icon_td.addEventListener("mouseout", function () { var box = document.getElementById("helper_caption_box"); if (box !== null) { box.style.opacity = 0.0; box.style.display = "none"; box.parentNode.removeChild(box); } }); } } function display_more_window_actions_list(win_id) { var is_minimized = null; var window_actions_box = null; var win = null; var win_state = null; var more_actions_icon_td = null; var is_maximized = null; if (more_window_actions_lost_box_exists(win_id) !== false) { remove_more_window_actions_box(win_id); } win = document.getElementById(win_id); is_minimized = win.getAttribute("data-is_minimized"); is_maximized = win.getAttribute("data-is_maximized"); win_state = win.getAttribute("data-window_state"); if (win_state === "Cascade" && is_minimized !== "true" && is_minimized !== true && is_maximized !== "true" && is_maximized !== true) { if (is_window_tabbed(win_id) === true || is_window_tabbed(win_id) === "true") { //cascaded window is tabbed. do nothing and continue. ////alert("mmo0o!"); } else { more_actions_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_window_actions"); if (more_actions_icon_td !== null) { window_actions_box = make_more_window_actions_box(win_id); win.appendChild(window_actions_box); window_actions_box.style.position = "absolute"; window_actions_box.style.width = "auto"; ////window_actions_box.style.height = "19px"; window_actions_box.style.left = (parseFloat(more_actions_icon_td.offsetLeft) + parseFloat(more_actions_icon_td.offsetWidth) - parseFloat(window_actions_box.offsetWidth) + 7) + "px"; window_actions_box.style.top = (parseFloat(more_actions_icon_td.scrollTop) + parseFloat(more_actions_icon_td.offsetHeight) - 3) + "px"; window_actions_box.style.boxShadow = "9px 9px 10px -4px rgba(0,0,0,0.29)"; //2024-03-19: //a setTimeout timer id for displaying the "more window actions" box. //The timer must be cancelled before calling the setTimeout function //so that it resets before it is displayed. Otherwise, the pause for //hiding a displayed "more windows actions" box executes multiple //times as it toggles visibility. /* if (global_window_actions_box_display_timer_id !== null) { clearTimeout(global_window_actions_box_display_timer_id); } global_window_actions_box_display_timer_id = setTimeout(function () { remove_more_window_actions_box(win_id); }, 2500); */ ////alert(win_state); } } } else if (win_state === "Maximize") { more_actions_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_window_actions"); if (more_actions_icon_td !== null) { window_actions_box = make_more_window_actions_box(win_id); win.appendChild(window_actions_box); window_actions_box.style.position = "absolute"; window_actions_box.style.width = "auto"; ////window_actions_box.style.height = "19px"; window_actions_box.style.left = (parseFloat(more_actions_icon_td.offsetLeft) + parseFloat(more_actions_icon_td.offsetWidth) - parseFloat(window_actions_box.offsetWidth) + 7) + "px"; window_actions_box.style.top = (parseFloat(more_actions_icon_td.scrollTop) + parseFloat(more_actions_icon_td.offsetHeight) - 3) + "px"; window_actions_box.style.boxShadow = "9px 9px 10px -4px rgba(0,0,0,0.29)"; } } else if (win_state === "Minimize") { /* more_actions_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_window_actions"); if (more_actions_icon_td !== null) { window_actions_box = make_more_window_actions_box(win_id); win.appendChild(window_actions_box); window_actions_box.style.position = "absolute"; window_actions_box.style.width = "auto"; ////window_actions_box.style.height = "19px"; window_actions_box.style.left = (parseFloat(more_actions_icon_td.offsetLeft) + parseFloat(more_actions_icon_td.offsetWidth) - parseFloat(window_actions_box.offsetWidth) + 7) + "px"; window_actions_box.style.top = (parseFloat(more_actions_icon_td.scrollTop) + parseFloat(more_actions_icon_td.offsetHeight) - 3) + "px"; window_actions_box.style.boxShadow = "9px 9px 10px -4px rgba(0,0,0,0.29)"; } */ } } function make_more_window_actions_box(win_id) { var tbl = null; var tr_0000 = null; var td_0000 = null; var td_0001 = null; var div_box = null; var tab_window_icon = null; div_box = document.createElement("div"); div_box.setAttribute("id", (win_id + "_more_window_actions_list_box")); div_box.setAttribute("name", "more_window_actions_list_box"); div_box.style.width = "auto"; ////div_box.style.height = "19px"; div_box.style.padding = "4px"; div_box.style.margin = "1px"; div_box.style.marginTop = "0"; div_box.style.backgroundColor = "#8f8f8f"; div_box.style.border = "0.5px solid rgba(51,51,51,1.0)"; div_box.style.borderRadius = "4px"; ////div_box.style.display = "block"; tbl = document.createElement("table"); tbl.setAttribute("id", (win_id + "_more_window_actions_list_table")); tbl.setAttribute("border", "0"); //tbl.setAttribute("cellpadding", "0"); //tbl.setAttribute("cellspacing", "0"); //tbl.style.padding = "4px"; //tbl.style.margin = "0"; tbl.style.width = parseFloat(div_box.style.width) + "px"; tr_0000 = document.createElement("tr"); td_0000 = document.createElement("td"); td_0001 = document.createElement("td"); tab_window_icon = new Image(); tab_window_icon.src = "/chromosphere/images/ui/icons/tab_window_icon_3.png"; tab_window_icon.style.height = "19px"; tab_window_icon.style.width = "19px"; //tab_window_icon.style.padding = "0"; //tab_window_icon.style.margin = "0"; tr_0000.style.width = parseFloat(div_box.style.width) + "px"; tr_0000.style.height = "19px"; //tr_0000.style.padding = "0"; //tr_0000.style.margin = "0"; td_0000.style.width = "auto"; //td_0000.style.padding = "0"; //td_0000.style.margin = "0"; td_0000.style.fontFamily = "Microsoft Sans Serif, Arial, Helvetica"; td_0000.style.fontSize = "11pt"; td_0000.style.color = "rgba(255,255,255,1.0)"; td_0000.style.textAlign = "right"; td_0000.style.paddingRight = "7px"; td_0000.style.borderCollapse = "collapse"; ////td_0000.style.maxHeight = "19px"; //td_0001.style.padding = "0"; td_0000.style.overflow = "hidden"; td_0000.innerHTML = "tabbed view"; td_0000.style.textShadow = global_window_status_text_shadow; td_0000.addEventListener("mouseover", function () { td_0000.style.textDecoration = "underline"; }); td_0000.addEventListener("mouseout", function () { td_0000.style.textDecoration = "none"; }); td_0000.addEventListener("click", function (event) { view_window_as_tabbed(win_id, event); div_box.parentNode.removeChild(div_box); //this function is located in the file: 'tab_windows.js' //calling it ensures that all tabbed windows are moved //to the correct left position in order to give the stack of //minimized windows are given a clear left margin allowing the //minimized window stack to be seen easily. setTimeout(function () { left_offset_all_tabbed_windows(); }, 150); event.preventDefault(); event.stopPropagation(); return; }, false); td_0000.addEventListener("mousedown", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); td_0000.addEventListener("mouseup", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); td_0001.style.borderCollapse = "collapse"; td_0001.style.maxHeight = "19px"; //td_0001.style.padding = "0"; td_0001.style.overflow = "hidden"; td_0001.style.paddingTop = "5px"; td_0001.style.paddingLeft = "3px"; td_0001.addEventListener("click", function (event) { view_window_as_tabbed(win_id, event); div_box.parentNode.removeChild(div_box); td_0001.style.backgroundColor = "rgba(255,255,255,1.0)"; //this function is located in the file: 'tab_windows.js' //calling it ensures that all tabbed windows are moved //to the correct left position in order to give the stack of //minimized windows are given a clear left margin allowing the //minimized window stack to be seen easily. setTimeout(function () { left_offset_all_tabbed_windows(); }, 150); event.preventDefault(); event.stopPropagation(); return; }, false); td_0001.addEventListener("mousedown", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); td_0001.addEventListener("mouseup", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); td_0001.addEventListener("mouseover", function () { td_0001.style.backgroundColor = "rgba(0,0,255,1.0)"; }); td_0001.addEventListener("mouseout", function () { td_0001.style.background = "none"; }); div_box.addEventListener("mousemove", function () { clearTimeout(global_more_actions_icon_mouseout_timer_id); div_box.style.display = "block"; }); div_box.addEventListener("mouseout", function () { //alert("c0oVV!1"); clearTimeout(global_more_actions_icon_mouseout_timer_id); global_more_actions_icon_mouseout_timer_id = setTimeout(function () { remove_more_window_actions_box(win_id); }, 100); }); div_box.addEventListener("onclick", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); div_box.addEventListener("mousedown", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); div_box.addEventListener("mouseup", function (event) { event.preventDefault(); event.stopPropagation(); return; }, false); tbl.appendChild(tr_0000); tr_0000.appendChild(td_0000); tr_0000.appendChild(td_0001); td_0001.appendChild(tab_window_icon); div_box.appendChild(tbl); return div_box; } function more_window_actions_box_is_showing(win_id) { var actions_list_box = null; actions_list_box = document.getElementById(win_id + "_more_window_actions_list_box"); if (actions_list_box !== null) { return true; } else { return false; } } function remove_more_window_actions_box(win_id) { var more_windows_actions_box = null; more_windows_actions_box = document.getElementById(win_id + "_more_window_actions_list_box"); if (more_windows_actions_box !== null) { more_windows_actions_box.remove(); } } function view_window_as_tabbed(win_id, ev) { var win = null; if (is_window_cascaded(win_id) === "true" || is_window_cascaded === true) { //window is cascaded. if (is_window_tabbed(win_id) === "true" || is_window_tabbed(win_id) === true) { //the window is already cascaded and tabbed. do nothing. continue. return; } else { //window is cascaded, but not tabbed. do nothing. continue. } } else { //set the window to a cascaded window state. ////restore_tabbed_window_to_cascade(win_id); cascade_window(win_id); } win = document.getElementById(win_id); if (win !== null) { //config, and start the window tabbed view feature processs. //this is the entry point where tabbing a window begins. //see file: 'tab_windows.js' init_tab_window(win_id); //hide any visible tabbed windows that may be showing in the tabbed window viewport. //place the window to be tabbed into the tabbed window viewport. //select the tabbed window and size it to fit the viewport. //add an event listener to handle any resizing of the browser so that //the tabbed window automatically fits within the tabbed window viewport. tab_window(win_id); //arrange the tabbed windows in a layer array //ordered so that the tabbed window is located //at the very bottom of the stack (z-index) //see file: tab_windows_functions.js start_arrange_tabbed_windows(win_id); //move the newly tabbed window to the top, or in front //of other windows. move_to_front(win_id); //move all cascaded windows to the top, or in front //of the newly tabbed window. move_cascaded_windows_to_front(); //reset the UI blocking image which is placed over //each cascaded window so that its size and location //match the tabbed window in its new size. ////start_reset_ui_blocking_imgs_tabbed_windows(win_id); } //2024-05-21: //this function checks to see how many windows are //minimized.if there are 0 minimized windows, //then hide the stow minimized windows box/button. //see file: 'stow_minimized_windows.js' hide_stow_minimized_windows_box_if_no_minimized_exist(); //2024-05-21: //if there are minimized windows, then set the minimized //windows above other windows, except for maximized. move_all_minimized_windows_to_front(); //halt all other event actions from occuring. //prevent propagation of the event object. //do not perform any other event listeners associated with this //event (commented right now; not needed in this situation). //exit the function, returning nothing. prohibit capture. ev.preventDefault(); ev.stopPropagation(); return; } //hide the table cell in the window where the "show more window actions" icon table //cell is located. function hide_more_window_actions_icon(win_id) { var more_actions_icon_td = null; more_actions_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_window_actions"); if (more_actions_icon_td !== null) { more_actions_icon_td.style.opacity = 0.0; } } function show_more_window_actions_icon(win_id) { var more_actions_icon_td = null; more_actions_icon_td = document.getElementById(win_id + "_tbl_0000_tr_0000_td_window_actions"); if (more_actions_icon_td !== null) { //more_actions_icon_td.style.display = "table-cell"; more_actions_icon_td.style.opacity = 1.0; } } function more_window_actions_lost_box_exists(win_id) { var more_windows_actions_box = null; more_windows_actions_box = document.getElementById(win_id + "_more_window_actions_list_box"); if (more_windows_actions_box !== null) { return true; } else { return false; } } function hide_all_more_window_options_list_boxes() { var list_boxes = null; var list_box = null; var list_box_count = null; var i = null; var win_id = null; list_boxes = document.getElementsByName("more_window_actions_list_box"); if (list_boxes !== null) { if (list_boxes.length > 0) { list_box_count = list_boxes.length; for (i = 0; i < list_box_count; i++) { list_box = list_boxes[i]; win_id = list_box.id.replace("_more_window_actions_list_box", ""); remove_more_window_actions_box(win_id); } } } }