"use strict";
function make_new_div_content_container(win_id) {
var div_content = null;
var content_id = null;
var content_id = null;
//remove_all_window_content(win_id);
//get the content id value
//content_id = get_content_id_attribute(win_id);
content_id = win_id.split("_")[2];
div_content = return_new_elem("div", win_id, "_tbl_0000_tr_0001_td_0000_div_0000");
//div_content.style.backgroundColor = "#3f3f3f";
//div_content.style.backgroundColor = "#6a6a6a";
//div_content.style.backgroundColor = "#b9b9b8";
div_content.style.backgroundColor = global_window_content_bgColor;
div_content.style.width = "99.8%";
div_content.style.height = "99.9%";
div_content.style.borderStyle = global_window_contents_container_border_style;
div_content.style.borderWidth = global_window_contents_container_border_width;
//div_content.style.borderWidth = "0.5px";
//div_content.style.borderStyle = "solid";
//div_content.style.borderTopColor = "#333333";
//div_content.style.borderLeftColor = "#11111";
//div_content.style.borderRightColor = "#bbbbbb";
//div_content.style.borderBottomColor = "#cccccc";
div_content.style.borderTopColor = global_window_contents_container_border_top_color;
div_content.style.borderLeftColor = global_window_contents_container_border_left_color;
div_content.style.borderRightColor = global_window_contents_container_border_right_color;
div_content.style.borderBottomColor = global_window_contents_container_border_bottom_color;
div_content.style.opacity = global_window_opacity;
//div_content.style.opacity = 0.0;
div_content.setAttribute("data-window_id", win_id);
div_content.setAttribute("name", "contents_div");
div_content.innerHTML = "";
//call a function that places the web window's default content.
//itas a single pixel image that when it loads, it begins the
//process of loading window content
div_content.innerHTML = "" + content_id + "
No Data
";
div_content.style.boxShadow = global_window_innerShadow;
div_content.style.borderRadius = global_window_contents_container_border_radius;
//div_content.style.backgroundImage = "url(/chromosphere/images/desktop_backgrounds/content_bg_steel.png)";
div_content.style.userSelect = "auto";
div_content.addEventListener("mousemove", function () {
//console.log("MOUSEOVER");
if (global_mouseover_content == true) {
//do nothing
}
else {
global_mouseover_content = true;
}
});
div_content.addEventListener("mouseover", function () {
//console.log("MOUSEOVER");
if (global_mouseover_content == true) {
//do nothing
}
else {
global_mouseover_content = true;
}
});
div_content.addEventListener("mouseout", function () {
//console.log("MOUSEOUT");
global_mouseover_content = false;
});
return div_content;
}
//function called if the blank pixel image fails to load
//if the number of attempts of reloading the image are
//exceeded, then recursion calls for this function are
//discontinued. must be numeric, between 1 and 6. a
//recursion value of 0 allows the function to exit.
function reload_image_load_content(load_content_image, retry_count = 0) {
var img = null;
var retry = null;
img = load_content_image;
retry = retry_count;
if (typeof (img) === "object" && img !== null && img !== undefined) {
if (!isNaN(retry) === true) {
if (typeof (retry) === "number") {
if (retry > 0) {
if (retry < 6) {
reload_image_load_content(img, retry++);
}
else {
return retry;
}
}
else {
return retry;
}
}
else {
return null;
}
}
else {
return null;
}
}
else {
return null;
}
}
function prevent_drag_select(elem) {
elem.setAttribute("onselectstart", "return only_allow_contents_select(this)");
elem.setAttribute("onselect", "return only_allow_contents_select(this)");
elem.style.userSelect = "none";
}
function only_allow_contents_select(elem) {
var id_substr = null;
id_sub_str = "_tbl_0000_tr_0001_td_0000_div_0000";
if (elem.getAttribute("id").indexOf(id_sub_str) < 0) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
return false;
}
else {
if (global_mouseover_content == true) {
//notta
}
else {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
return false;
}
}
}
function get_content_id() {
var dbID = null;
dbID = make_unique_id(16);
return dbID;
//return 1000000000000000;
// "1,000,000,000,000,000";
}
function return_new_elem(elem_type, win_id, elem_id) {
var elem = null;
elem = document.createElement(elem_type);
elem.setAttribute("id", (win_id + elem_id));
return elem;
}
function create_options_icon(win_id) {
var td_icon = null;
td_icon = new Image();
td_icon.src = "/chromosphere/images/ui/icons/burger_19x19.png";
td_icon.style.height = "19px";
td_icon.style.width = "19px";
td_icon.setAttribute("id", (win_id + "_tbl_0000_tr_0000_td_0000_options_icon"));
return td_icon;
}
function options_icon_add_event_listeners(td_icon, win_id) {
td_icon.addEventListener("mousedown", function () {
turn_blue_fade_white(win_id);
});
td_icon.addEventListener("mouseup", function () {
//2023-06-22: Not using this event listener.
//Instead, adding an inline function call in
//'window_state_controls.js' for
//function 'create_details_menu(win_id)';
});
return td_icon;
}
function create_title_txt(win_id) {
var win = null;
var title_box = null;
win = document.getElementById(win_id);
title_box = document.createElement("div");
title_box.setAttribute("id", (win_id + "_title_box_container"));
title_box.style.position = "relative";
title_box.style.top = "0";
title_box.style.left = "0";
title_box.style.width = "inherit";
title_box.style.paddingRight = "3px";
title_box.style.height = "25px";
title_box.style.maxHeight = "25px";
title_box.innerHTML = "
Window Title
";
title_box.addEventListener("mousedown", function (event) {
global_left_mouse_button_down = true;
set_active_window(win_id);
init_before_move(win_id);
turn_blue_fade_white(win_id);
event.preventDefault();
event.stopPropagation();
});
title_box.addEventListener("mouseup", function (event) {
global_left_mouse_button_down = false;
deactivate_global_active_window();
event.preventDefault();
event.stopPropagation();
});
top.addEventListener("mousemove", function (event) {
if (global_left_mouse_button_down == true) {
move_elem_to_cursor(event);
}
}, true);
return title_box;
}
function change_title(win_id, title_txt) {
var title_id = null;
var title = null;
var win = null;
var win_title = null;
var caption_title = null;
win = document.getElementById(win_id);
title_id = (win_id + "_title_box");
title = document.getElementById(title_id);
if (title != null) {
title.innerHTML = title_txt.toString();
win_title = document.getElementById(win_id + "_window_title");
win_title.setAttribute("data-desc_text", title_txt);
caption_title = document.getElementById(win_id + "_tbl_0000_tr_0000_td_0001");
caption_title.setAttribute("data-title", title_txt);
win.setAttribute("data-desc_text", title_txt);
}
}
function create_minimize_icon(win_id) {
var td_icon = null;
var parent_elem = null;
td_icon = new Image();
td_icon.setAttribute("id", (win_id + "_tbl_0000_tr_0000_td_0002_img_0000"));
td_icon.src = "/chromosphere/images/ui/icons/cascade_19x19.png"; //load a cached image for later
td_icon.src = "/chromosphere/images/ui/icons/minimize_19x19.png";
td_icon.style.height = "19px";
td_icon.style.width = "19px";
return td_icon;
}
function minimize_icon_add_event_listeners(td_icon, win_id) {
//set_animation_event_listeners(win_id); //This sets up the animation for the object when a visual change has ocurred
td_icon.addEventListener("mousedown", function () {
turn_blue_fade_white(win_id);
//minimize_window(win_id);
// set_icons_for_minimized_win(win_id);
});
td_icon.addEventListener("mouseup", title_to_white(win_id));
return td_icon;
}
//this function isn't needed by default, but it will be called later when the web window state changes -- cascade, minimize, maximize...
/*
function cascade_icon_add_event_listeners(td_icon, win_id) {
td_icon.addEventListener("mouseover", function () {
set_animation_event_listeners(win_id); //This sets up the animation for the object when a visual change has ocurred
});
td_icon.addEventListener("mousedown", function () {
//set_icons_for_cascaded_win(win_id);
turn_blue_fade_white(win_id);
minimize_window(win_id);
});
td_icon.addEventListener("mouseup", title_to_white(win_id));
return td_icon;
}
*/
function create_maximize_icon(win_id) {
var td_icon = null;
td_icon = new Image();
td_icon.src = "/chromosphere/images/ui/icons/maximize_19x19.png";
td_icon.style.height = "19px";
td_icon.style.width = "19px";
return td_icon;
}
function maximize_icon_add_event_listeners(td_icon, win_id) {
//set_animation_event_listeners(win_id); //This sets up the animation for the object when a visual change has ocurred
//another "mousedown" event listener is added which conflicts with this one, so we need to remove any event listeners
td_icon.addEventListener("mousedown", function () {
//remove_eventlisteners(td_icon); //remove any conflicting event listeners that may already exist.
turn_blue_fade_white(win_id);
//maximize_window(win_id);
});
td_icon.addEventListener("mouseup", title_to_white(win_id));
return td_icon;
}
function create_close_icon(win_id) {
var td_icon = null;
td_icon = new Image();
td_icon.src = "/chromosphere/images/ui/icons/close_19x19.png";
td_icon.style.height = "19px";
td_icon.style.width = "19px";
return td_icon;
}
function close_icon_add_event_listeners(td_icon, win_id) {
//See the web window close functionality at file close_window.js
//set_animation_event_listeners(win_id); //This sets up the animation for the object when a visual change has ocurred
td_icon.addEventListener("mousedown", function () {
turn_blue_fade_white(win_id);
});
td_icon.addEventListener("mouseup", function (event) {
var win = document.getElementById(win_id);
if (win !== null) {
////win.style.display = "none";
////cascade_window(win_id);
////win.style.display = "block";
////win.style.overflow = "hidden";
////win.style.maxWidth = "0";
////win.style.maxHeight = "0";
////win.style.borderRadius = "0";
////win.style.margin = "0";
////win.style.padding = "0";
////win.style.border = "none";
close_window(win_id);
}
});
return td_icon;
}
function create_resize_icon(win_id) {
var td_icon = null;
var win = null;
win = document.getElementById(win_id);
td_icon = new Image();
td_icon.src = "/chromosphere/images/ui/icons/resize_19x19.png";
td_icon.style.height = "19px";
td_icon.style.width = "19px";
td_icon.style.overflow = "hidden";
td_icon.style.clip = "rect(0, 19px, 19px, 0)";
td_icon.setAttribute("id", (win_id + "_tbl_0000_tr_0002_td_0007_img_0007"));
top.addEventListener("mousemove", function () {
var xy = null;
//2023-09-22:
//The resize feature for the window has been
//resizing both X and Y simultaneously.
//with the new resize bars on windows,
//you constrict resizing to X, OR Y.
//See file: 'set_x_or_y_resize.js'
////xy = get_win_resize_xy_attribute(win_id);
////console.log(xy);
if (global_left_mouse_button_down == true) {
resize_web_window();
}
}, true);
return td_icon;
}
function resize_icon_add_event_listeners(td_icon, win_id) {
td_icon.addEventListener("mouseover", function () {
//2023-09-22:
//set an attribute in the window's HTML specifying
//the default value of resize window to resize
//both width (x), and height (y).
//See file: 'set_x_or_y_resize.js'
set_win_resize_xy_attribute(win_id, "xy");
event.preventDefault();
event.stopPropagation();
});
td_icon.addEventListener("mousedown", function () {
global_left_mouse_button_down = true;
init_before_resize(win_id);
turn_blue_fade_white(win_id);
event.preventDefault();
event.stopPropagation();
}, true);
td_icon.addEventListener("mouseup", function () {
title_to_white(win_id);
global_left_mouse_button_down = false;
deactivate_global_active_window();
event.preventDefault();
event.stopPropagation();
}, true);
/*td_icon.addEventListener("touchstart", function () {
global_left_mouse_button_down = true;
init_before_resize(win_id);
////event.preventDefault();
////event.stopPropagation();
}, true);
td_icon.addEventListener("touchend", function () {
global_left_mouse_button_down = false;
deactivate_global_active_window();
////event.preventDefault();
////event.stopPropagation();
}, true);*/
return td_icon;
}
function icon_mouseovers(elem) {
elem.addEventListener("mouseover", function () {
elem.style.backgroundColor = "#0000ff";
//elem.style.boxShadow = "inset 1px 1px 2px #444444";
});
elem.addEventListener("mouseout", function () {
elem.style.background = "none";
elem.style.boxShadow = "none";
});
elem.addEventListener("mousedown", function () {
elem.style.backgroundColor = "#ffffff";
//elem.style.boxShadow = "none";
});
elem.addEventListener("mouseup", function () {
elem.style.background = "none";
elem.style.boxShadow = "none";
});
/*
elem.addEventListener("touchstart", function () {
elem.style.backgroundColor = "#ffffff";
//elem.style.boxShadow = "none";
});
elem.addEventListener("touchend", function () {
elem.style.background = "none";
elem.style.boxShadow = "none";
});
*/
}
/*
2023-09-19:
IMPORTANT:
The win_id variable must be in the format of ("text_text_16DigitString"), or even
something like ("text-more-text_text-and-more-text_16DigitString") works too,
because the string's value still has 3 parts, each separated by an underscore character ("_").
Don't input any underscore characters.
*/
//creates the client ID attribute of the element as "table_1000_1000000000000000"
function make_id(content_id) {
var num_windows = null;
var ID = null;
var rand = null;
var rand_str = null;
//var lBound = null;
//var uBound = null;
//lBound = 1000000000000000;
//uBound = 9000000000000000;
//rand = Math.abs(Math.floor(Math.random() * uBound) + lBound);
rand = content_id;
rand_str = rand.toString();
rand_str = "_" + rand_str;
num_windows = get_number_windows();
ID = (10001 + num_windows).toString();
ID = "window_" + ID.substring(1, ID.length);
ID = ID + rand_str;
return ID;
}
function place_content_enable_scrolling(win_id, content) {
var container_div, new_div, tble, window_obj, parent_cell_id, parent_cell_obj, options_displayed, styles, content_div, window_contents_div = null;
//2023-08-24: This removes ONLY the content container
//and inner content container provided either one exist.
//It does NOT delete the contents_div object inside
//the TD container, or any existing objects such as
//the Details Menu or Code Editor.
//UPDATE:
//This function has been moved and is now located within
//this document (i.e. 'create_window.js').
remove_all_window_content(win_id);
window_obj = document.getElementById(win_id);
window_contents_div = document.getElementById((win_id + "_tbl_0000_tr_0001_td_0000_div_0000"));
if (window_contents_div !== null) {
window_contents_div.style.borderRadius = "6px";
}
parent_cell_id = win_id + "_tbl_0000_tr_0001_td_0000";
parent_cell_obj = document.getElementById(parent_cell_id);
if (parent_cell_obj !== null) {
parent_cell_obj.style.borderRadius = "6px";
new_div = document.createElement("div");
new_div.style.height = (parseFloat(parent_cell_obj.clientHeight)) + "px";
new_div.style.width = (parseFloat(parent_cell_obj.offsetWidth)) + "px";
new_div.style.top = (parseFloat(parent_cell_obj.offsetTop)) + "px";
new_div.style.left = (parseFloat(parent_cell_obj.offsetLeft)) + "px";
new_div.style.borderRadius = "6px";
new_div.style.position = "absolute";
new_div.style.overflow = "auto";
new_div.setAttribute("id", win_id + "_contents_container");
new_div.setAttribute("data-win_id", win_id);
}
content_div = document.createElement("div");
content_div.style.height = "99.299%";
content_div.style.width = "99.777%";
content_div.setAttribute("id", win_id + "_inner_contents_container");
content_div.setAttribute("data-win_id", win_id);
content_div.innerHTML = content;
content_div.style.borderRadius = "6px";
content_div.style.userSelect = "auto";
//content_div.style.fontFamily = "Arial, Sans-Serif, Helvetica";
if (new_div !== null && content_div !== null && parent_cell_obj !== null) {
new_div.innerHTML = content_div.outerHTML;
parent_cell_obj.appendChild(new_div);
}
set_window_status("Window Loaded at: " + get_date_time()); //full_date);
status_loaded(win_id, "true");
////start_save_all(win_id);
}
function get_date_time() {
var full_date = null;
var d = null;
var year = null;
var month = null;
var day = null;
var hours = null;
var minutes = null;
var seconds = null;
var ampm = null;
d = new Date();
year = d.getFullYear().toString();
month = d.getMonth() + 1;
day = d.getDate().toString();
hours = d.getHours();
minutes = d.getMinutes().toString();
seconds = d.getSeconds();
if (hours > 11) {
ampm = "PM";
hours = hours - 12;
if (hours === 0) {
hours = 1;
}
}
else {
ampm = "AM";
}
hours = hours.toString();
month = month.toString();
if (month.length < 2) {
// month = "0" + month;
}
if (day.length < 2) {
//day = "0" + day;
}
if (hours.length < 2) {
//hours = "0" + hours;
}
if (minutes.length < 2) {
minutes = "0" + minutes;
}
if (seconds.toString().length < 2) {
seconds = "0" + seconds;
}
full_date = month + "/" + day + "/" + year + " " + hours + ":" + minutes + ":" + seconds + " " + ampm;
return full_date;
}
function resize_contents_container(win_id) {
var parent_cell_id = null;
var parent_cell_obj = null;
var contents_div_id = null;
var contents_div_obj = null;
parent_cell_id = win_id + "_tbl_0000_tr_0001_td_0000";
parent_cell_obj = document.getElementById(parent_cell_id);
contents_div_id = win_id + "_contents_container";
contents_div_obj = document.getElementById(contents_div_id);
if (contents_div_obj !== null) {
contents_div_obj.style.height = (parseFloat(parent_cell_obj.clientHeight)) + "px";
contents_div_obj.style.width = (parseFloat(parent_cell_obj.offsetWidth)) + "px";
contents_div_obj.style.top = (parseFloat(parent_cell_obj.offsetTop)) + "px";
contents_div_obj.style.left = (parseFloat(parent_cell_obj.offsetLeft)) + "px";
//2024-09-26:
//added a function to resize the existing UI blocking
//image to fit the 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(document.getElementById(win_id).style.paddingTop));
}
}
function hide_contents_container(win_id) {
var contents_div_id = null;
var contents_div_obj = null;
contents_div_id = win_id + "_contents_container";
contents_div_obj = document.getElementById(contents_div_id);
if (contents_div_obj !== null) {
contents_div_obj.style.display = "none";
}
}
function show_contents_container(win_id) {
var contents_div_id = null;
var contents_div_obj = null;
contents_div_id = win_id + "_contents_container";
contents_div_obj = document.getElementById(contents_div_id);
if (contents_div_obj !== null) {
contents_div_obj.style.display = "block";
}
}
//l for length
//t for table
//f for field
async function get_db_uniqueID(l, t, f) {
var URI = null;
var bp = null;
var qStr = null;
var path = null;
var full_URI = null;
var rand = null;
if (l !== "" && t !== "" && f !== "") {
path = "/chromosphere/scripts/js/ui/ss/unique_id/Default";
bp = get_base_path();
qStr = "l=" + l + "&t=" + t + "&f=" + f;
full_URI = bp + path + "?" + qStr;
rand = await getData(full_URI);
//console.log("window ID: " + rand);
if (rand == "0") {
get_db_uniqueID(l, t, f);
}
else {
return rand;
}
}
else {
return "0";
}
return "0";
}
function place_CSS_data(win_id, cid) {
var CSS_exists = null;
var css = null;
var script_base_url = null;
var script_path = null;
var full_path = null;
script_base_url = get_base_path();
script_path = "/chromosphere/scripts/js/ui/ss/contents_and_js/get_css/?i=" + cid.toString();
full_path = script_base_url + script_path;
CSS_exists = css_already_exists(full_path);
if (CSS_exists !== true) {
//
css = document.createElement("link");
css.setAttribute("id", win_id + "_css");
css.setAttribute("rel", "stylesheet");
css.setAttribute("type", "text/css");
css.setAttribute("href", full_path);
css.setAttribute("data-name", "css_link");
css.setAttribute("name", "web_window_css");
css.setAttribute("data-window_id", win_id);
css.setAttribute("data-contents_container", (win_id + "_contents_container"));
css.setAttribute("data-q_string", cid.toString());
//css.setAttribute("data-serial", document.getElementsByName("web_window").length.toString());
css.setAttribute("data-baseURI", self.location.hostname.toString());
//css.setAttribute("data-script_instance_count", (parseFloat(number_of_scripts()) + 1).toString());
//self.document.body.appendChild(script);
/*
script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("id", (win_id + "_javascript"));
script.setAttribute("name", "web_window_script");
script.setAttribute("data-window_id", win_id);
script.setAttribute("data-contents_container", (win_id + "_contents_container"));
script.setAttribute("data-q_string", cid.toString());
script.setAttribute("data-serial", document.getElementsByName("web_window").length.toString());
script.setAttribute("data-baseURI", self.location.hostname.toString());
script.setAttribute("src", self.location.href.replace("/Default", "/") + "scripts/js/ui/ss/contents_and_js/get_js?" + cid.toString());
script.setAttribute("data-script_instance_count", (parseFloat(number_of_scripts()) + 1).toString());
self.document.body.appendChild(script);
//win_obj.insertBefore(script, win_obj.childNodes[0]);
*/
//alert(css.outerHTML);
}
else {
css = document.getElementById((win_id + "_css"));
if (css !== null) {
//num_instances = script.setAttribute("data-script_instance_count", (parseFloat(number_of_scripts())).toString());
///add_instance = parseFloat(num_instances) + 1;
//add_instance = add_instance.toString();
//script.setAttribute("data-script_instance_count", add_instance);
}
}
return css;
}
function place_JS_data(win_id, cid) {
var script_exists = null;
var script = null;
var script_base_url = null;
var script_path = null;
var full_path = null;
script_base_url = get_base_path();
script_path = "/chromosphere/scripts/js/ui/ss/contents_and_js/get_js/?i=" + cid.toString() + "&r=" + (Math.floor(Math.random() * 900000000) + 1000000000).toString();
full_path = script_base_url + script_path;
//script_exists = script_already_exists(self.location.href.replace("/Default", "/") + "scripts/js/ui/ss/contents_and_js/get_js/?i=" + cid.toString());
script_exists = script_already_exists(full_path);
if (script_exists !== true) {
script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("id", (win_id + "_javascript"));
script.setAttribute("name", "web_window_script");
script.setAttribute("data-window_id", win_id);
script.setAttribute("data-contents_container", (win_id + "_contents_container"));
script.setAttribute("data-q_string", cid.toString());
script.setAttribute("data-serial", document.getElementsByName("web_window").length.toString());
script.setAttribute("data-baseURI", self.location.hostname.toString());
script.setAttribute("src", full_path);
script.setAttribute("data-script_instance_count", (parseFloat(number_of_scripts()) + 1).toString());
//self.document.body.appendChild(script);
//win_obj.insertBefore(script, win_obj.childNodes[0]);
}
else {
script = document.getElementById((win_id + "_javascript"));
if (script !== null) {
//num_instances = script.setAttribute("data-script_instance_count", (parseFloat(number_of_scripts())).toString());
///add_instance = parseFloat(num_instances) + 1;
//add_instance = add_instance.toString();
//script.setAttribute("data-script_instance_count", add_instance);
}
}
return script;
}
function make_JS_container() {
var c = null;
var exists = null;
exists = document.getElementById("javascripts_container");
if (exists === null) {
c = document.createElement("div");
c.setAttribute("id", "javascripts_container");
c.style.display = "none";
document.body.appendChild(c);
}
else {
c = document.getElementById("javascripts_container");
}
return c;
}
function make_css_container() {
var c = null;
var exists = null;
exists = document.getElementById("css_container");
if (exists === null) {
c = document.createElement("div");
c.setAttribute("id", "css_container");
c.style.display = "none";
document.head.appendChild(c);
}
else {
c = document.getElementById("css_container");
}
return c;
}
//function set_window_top_left_width_height(win_obj, L, T, W, H) {
// var window_state = null;
// var y_offset = null;
// if (L > -1 && typeof L === "number") {
// //make no changes
// L = L.toString();
// }
// else {
// L = Math.floor(Math.random() * 600) + 20;
// L = L.toString();
// }
// //2024-1-18:
// //Bringing this function call fromm script file: 'tab_windows.js'
// // I'm adding a window tabbing feature that is taking up more
// //vertical space at the top of the window.
// y_offset = parseFloat(get_Y_offset_for_tabbed_windows());
// y_offset = parseFloat(y_offset) + 150;
// if (T > y_offset && typeof T === "number") {
// //comment
// T = T.toString();
// }
// else {
// T = (Math.floor(Math.random() * 300) + y_offset) + 150;
// T = T.toString();
// }
// if (H > -1 && typeof H === "number" && H < 600) {
// H = H.toString();
// //make no changes
// }
// else {
// //H = Math.floor(Math.random() * 400) + 60;
// H = Math.floor(Math.random() * parseFloat((self.innerHeight * 0.4))) + 70;
// H = H.toString();
// }
// if (W > -1 && typeof W === "number") {
// if (W > parseFloat((self.innerWidth) * 3) - 20.0) { //don't let the window's width exceed the main window width
// W = parseFloat((self.innerWidth) * 3) - 20.0;
// }
// //make no changes
// W = W.toString();
// }
// else {
// W = Math.floor(Math.random() * (((parseFloat(self.innerWidth) * 3) - 20.0))) + 940;
// //W = Math.floor(Math.random() * 400) + 60;
// W = W.toString();
// }
// if (parseFloat(W) + parseFloat(L) > parseFloat(self.innerWidth)) {
// L = Math.floor(Math.random() * 400) + 30;
// W = Math.floor(Math.random() * 340) + 340;
// L = L.toString();
// W.toString();
// }
// if (parseFloat(H) + parseFloat(T) > parseFloat(self.innerHeight)) {
// T = Math.floor(Math.random() * 400) + 30;
// H = Math.floor(Math.random() * 300) + 200;
// T = T.toString();
// H = H.toString();
// }
// //win_obj.setAttribute("data-orig_x", parseFloat(win_obj.childNodes[0].style.left));
// //win_obj.setAttribute("data-orig_y", parseFloat(win_obj.childNodes[0].style.top));
// //win_obj.setAttribute("data-orig_w", parseFloat(win_obj.childNodes[0].style.width));
// //win_obj.setAttribute("data-orig_h", parseFloat(win_obj.childNodes[0].style.height));
// win_obj.style.left = L + "px";
// win_obj.style.top = T + "px";
// win_obj.style.width = W + "px";
// win_obj.style.height = H + "px";
// window_state = get_current_window_state(win_obj.id);
// if (window_state === "cascaded" || window_state === "unknown") {
// //alert("setting window dimensions");
// win_obj.setAttribute("data-orig_x", parseFloat(win_obj.style.left));
// win_obj.setAttribute("data-orig_y", parseFloat(win_obj.style.top));
// win_obj.setAttribute("data-orig_w", parseFloat(win_obj.style.width));
// win_obj.setAttribute("data-orig_h", parseFloat(win_obj.style.height));
// }
// return win_obj;
//}
function set_window_top_left_width_height(win_obj, L = 250, T = 150, W = 320, H = 240) {
var window_state = null;
//var y_offset = null;
if (L === null || typeof L !== "number") {
L = 250;
}
if (T === null || typeof T !== "number") {
T = 150;
}
if (W === null || typeof W !== "number") {
W = 320;
}
if (H === null || typeof H !== "number") {
H = 240;
}
//if (L > -1 && typeof L === "number") {
// //make no changes
// L = L.toString();
//}
//else {
// L = Math.floor(Math.random() * 600) + 20;
// L = L.toString();
//}
////2024-1-18:
////Bringing this function call fromm script file: 'tab_windows.js'
//// I'm adding a window tabbing feature that is taking up more
////vertical space at the top of the window.
//y_offset = parseFloat(get_Y_offset_for_tabbed_windows());
//y_offset = parseFloat(y_offset) + 150;
//if (T > y_offset && typeof T === "number") {
// //comment
// T = T.toString();
//}
//else {
// T = (Math.floor(Math.random() * 300) + y_offset) + 150;
// T = T.toString();
//}
//if (H > -1 && typeof H === "number" && H < 600) {
// H = H.toString();
// //make no changes
//}
//else {
// //H = Math.floor(Math.random() * 400) + 60;
// H = Math.floor(Math.random() * parseFloat((self.innerHeight * 0.4))) + 70;
// H = H.toString();
//}
//if (W > -1 && typeof W === "number") {
// if (W > parseFloat((self.innerWidth) * 3) - 20.0) { //don't let the window's width exceed the main window width
// W = parseFloat((self.innerWidth) * 3) - 20.0;
// }
// //make no changes
// W = W.toString();
//}
//else {
// W = Math.floor(Math.random() * (((parseFloat(self.innerWidth) * 3) - 20.0))) + 940;
// //W = Math.floor(Math.random() * 400) + 60;
// W = W.toString();
//}
//if (parseFloat(W) + parseFloat(L) > parseFloat(self.innerWidth)) {
// L = Math.floor(Math.random() * 400) + 30;
// W = Math.floor(Math.random() * 340) + 340;
// L = L.toString();
// W.toString();
//}
//if (parseFloat(H) + parseFloat(T) > parseFloat(self.innerHeight)) {
// T = Math.floor(Math.random() * 400) + 30;
// H = Math.floor(Math.random() * 300) + 200;
// T = T.toString();
// H = H.toString();
//}
//win_obj.setAttribute("data-orig_x", parseFloat(win_obj.childNodes[0].style.left));
//win_obj.setAttribute("data-orig_y", parseFloat(win_obj.childNodes[0].style.top));
//win_obj.setAttribute("data-orig_w", parseFloat(win_obj.childNodes[0].style.width));
//win_obj.setAttribute("data-orig_h", parseFloat(win_obj.childNodes[0].style.height));
win_obj.style.left = L + "px";
win_obj.style.top = T + "px";
win_obj.style.width = W + "px";
win_obj.style.height = H + "px";
window_state = get_current_window_state(win_obj.id);
if (window_state === "cascaded" || window_state === "unknown") {
//alert("setting window dimensions");
win_obj.setAttribute("data-orig_x", parseFloat(win_obj.style.left));
win_obj.setAttribute("data-orig_y", parseFloat(win_obj.style.top));
win_obj.setAttribute("data-orig_w", parseFloat(win_obj.style.width));
win_obj.setAttribute("data-orig_h", parseFloat(win_obj.style.height));
}
return win_obj;
}
function clear_window_content_do_reload(win_id) {
var content_cell_id = null;
var content_cell_obj = null;
var content_div_id = null;
var content_div_obj = null;
var win = null;
var content_div = null;
var options_displayed = null;
var code_editor_displayed = null;
win = document.getElementById(win_id);
if (win !== null) {
// equalize_window_size_to_table_size(win_id);
//If details/options is already showing
options_displayed = options_menu_showing(win_id);
if (options_displayed === true) {
remove_details_menu(win_id);
}
// If the code editor is displayed
code_editor_displayed = is_code_editor_showing(win_id);
if (code_editor_displayed) {
cancel_code_editor(win_id);
}
content_div_id = win_id + "_tbl_0000_tr_0001_td_0000_div_0000";
content_div_obj = document.getElementById(content_div_id);
if (content_div_obj !== null) {
content_cell_id = win_id + "_tbl_0000_tr_0001_td_0000";
content_cell_obj = document.getElementById(content_cell_id);
if (content_cell_obj !== null) {
content_cell_obj.innerHTML = "";
content_div = make_new_div_content_container(win_id);
content_cell_obj.appendChild(content_div);
//return;
//reset_window_to_original_dimensions(win_id);
//place_content_enable_scrolling(win_id);
equalize_window_size_to_table_size(win_id);
}
}
}
}
function reset_window_to_original_dimensions(win_id) {
var x = null;
var y = null;
var w = null;
var h = null;
var win = null;
win = document.getElementById(win_id);
if (win !== null) {
x = win.getAttribute("data-orig_x");
y = win.getAttribute("data-orig_y");
w = win.getAttribute("data-orig_w");
h = win.getAttribute("data-orig_h");
win.style.left = (typeof x === "number") ? (x + "px") : (win.offsetLeft + "px");
win.style.top = (typeof y === "number") ? (y + "px") : (win.offsetTop + "px");
win.style.width = (typeof w === "number") ? (w + "px") : (win.offsetWidth + "px");
win.style.height = (typeof h === "number") ? (h + "px") : (win.offsetHeight + "px");
}
}
//div_content = document.getElementById("contents_blankimage_" + win_id);
//div_content.innerHTML = "" + content_id + "
No Data
";
/*
async function when_duplicate_window_exists(win_id, duplicate_win_exists, choose_make_new_win) {
var content_id = null;
var choose_make_new_win = null;
if (duplicate_win_exists === true) {
//a web window with the same content id already exists.
//create a new content id value that is unique.
//make the window's HTML id attribute.
if (choose_make_new_win === true) {
content_id = await get_db_uniqueID("16", "15", "2");
/*if (window_id == null || typeof window_id != "string" || window_id == "" || window_id == undefined) {
win_id = make_id(cid);
}
else {
win_id = window_id.toString();
}
*/
/*
}
else {
content_id = win_id.split("_")[2];
}
}
else {
content_id = win_id.split("_")[2];
//window does not exist according to content id
}
return content_id;
}
*/
//2023-08-24:
//This function removes any existing content container, and inner content container
//from a window's content TD.
function remove_all_window_content(win_id) {
var inner_container = null;
var parent_container = null;
inner_container = document.getElementById(win_id + "_inner_contents_container");
if (inner_container !== null) {
inner_container.parentNode.removeChild(inner_container);
}
parent_container = document.getElementById(win_id + "_contents_container");
if (parent_container !== null) {
parent_container.parentNode.removeChild(parent_container);
}
}
//2023-09-21:
//This function doesn't seem to work.
//Keep it anyway.
//Trying to set CSS animations in this way
//needs to be revised in the future.
function set_window_CSS_animations(win_id) {
//2023-09-22:
//Preventing this function from running.
return;
var CSS_properties = null;
CSS_properties = "";
//2023-09-21:
//set the width and height resize animations individually
//to improve the performance of resizing windows.
////set_animation_event_listeners(win_id); //this sets the window animations to a default value.
CSS_properties = "width, height";
most_customizable_config_elem_for_animation(win_id, CSS_properties, "0.1", "0");
CSS_properties = "top, left";
most_customizable_config_elem_for_animation(win_id, CSS_properties, "0.5", "0.007");
CSS_properties = "drop-shadow";
most_customizable_config_elem_for_animation(win_id, CSS_properties, "0.1", "0.004");
//CSS_properties = "zoom";
//most_customizable_config_elem_for_animation(win_id, (CSS_properties = CSS_properties + ", zoom "), "0.4", "0.01");
//For reference: A copy of the default CSS animation code.
/*
element.style.transitionProperty = "left, top, width, height, box-shadow"; //if any of these CSS properties of an object changes, they will animate.
element.style.transitionDuration = "0.3" + "s"; //set the time in seconds
element.style.transitionDelay = "0.007" + "s"; //set the delay before starting the animation
element.style.transitionTimingFunction = "cubic-bezier(0, .55, .45, 1)"; //designate a curve by which the nature of the animation occurs
*/
}
//2023-09-22:
//This function sets the box shadow CSS animations for
//a window.
//Commenting this out, but keeping it for possible
//future use.
/*
function set_window_box_shadow_animations(elem_id) {
var element = null;
element = document.getElementById(elem_id);
if (element !== null) {
if (global_animations_on === true) {
//If the global variable 'global_animations_on' set to true -- animations are allowed
element.addEventListener("mouseenter", function () {
//2023-09-22:
//The code below sets animation on the element.
//commented out for now.
//Configure the element CSS for animation below
////default_config_elem_for_animation(elem_id); //This sets the CSS transform settings to make this object ready for animation
////set_window_CSS_animations(element.id); //fynction doesn't seem to work. Keep this here for future revisions of the function.
set_animations_boxshadow(elem_id);
});
element.addEventListener("mouseout", function () {
//when an animation on an object occurs, the object moves
//out from under the mouse cursor. Hence, the object calls the 'onmouseout'
//event. That's why turning off CSS animations wouldn't work here.
});
element.addEventListener("mousedown", function () {
//set the element so that when it is clicked on (mousedown) that it runs
//an animation given that the object is set to perform animations, and that the public
//variable 'global_animations_on' is set to true. Otherwise, no action is taken.
////execute_animation(elem_id);
});
}
}
}
*/
//it seems as though the javascript random
//number generator isn't as random as it
//could be. so, upon generating a unique
//id, check to see if any windows exist
//with the same unique content id.
function unique_id_generated_already_exists(unique_javascript_id_number) {
var wins = null;
var win_count = null;
var i = null;
var win = null;
var content_id = null;
var unique_id = null;
var does_exist = null;
does_exist = false;
unique_id = unique_javascript_id_number;
if (typeof (unique_id) === "number") {
wins = document.getElementsByName("web_window");
if (wins !== null) {
if (wins.length > 0) {
win_count = wins.length;
for (i = 0; i < win_count; i++) {
win = wins[i];
if (win !== null) {
if (win.hasAttribute("data-content_id") === true) {
content_id = win.getAttribute("data-content_id");
if (content_id !== null) {
if (typeof (content_id) === "number") {
content_id = parseFloat(content_id);
unique_id = parseFloat(unique_id);
if (content_id === unique_id) {
does_exist = true;
}
}
}
}
}
}
}
}
}
return does_exist;
}