"use strict"; function setup_resize_bars_x(win_id) { var win = null; var bar_x = null; if (resize_bar_exists_x(win_id) !== true) { bar_x = make_resize_bar_x(win_id); if (bar_x !== null) { win = document.getElementById(win_id); if (win !== null) { place_resize_bar_x(win_id, bar_x); set_resize_bar_x_event_listeners(win_id, bar_x); //2023-09-22: //Set the resize x bar to animate upon changing //width, height, top, left, box-shadow CSS values. //See file 'transformations.js' //2023-09-22: //temporarily comment this out. ////default_config_elem_for_animation(win_id); //2023-09-22: //instead of assigning default CSS animations for all //CSS properties, assign CSS animations to a window depending //on its action. This function removes CSS animations from //the window, and sets animation to the width and height. //See file: 'window_2.js' set_animations_resize_window(win_id); set_size_resize_bar_x(win_id); ////show_resize_bar_x(win_id); } } } else { bar_x = get_resize_bar_x(win_id); //2023-09-22: //Set the resize x bar to animate upon changing //width, height, top, left, box-shadow CSS values. //See file 'transformations.js' //2023-09-22: //temporarily comment this out. ////default_config_elem_for_animation(win_id); //place_resize_bar_x(win_id); set_size_resize_bar_x(win_id); //set_resize_bar_x_event_listeners(win_id); //show_resize_bar_x(win_id); } } function make_resize_bar_x(win_id) { var bar_x = null; var bar_x_exists = null; bar_x_exists = resize_bar_exists_x(win_id); if (bar_x_exists === true) { bar_x = get_resize_bar_x(win_id); } else { bar_x = document.createElement("div"); bar_x.setAttribute("id", win_id + "_resize_bar_x"); bar_x.style.position = "absolute"; //2023-09-23: //If the web app is running in "test mode", display //the resize height bar in blue. Otherwise, set the opacity //of the resize height bar to 0 (transparent). if (global_test_mode === true) { bar_x.style.backgroundColor = "rgba(0,0,255,1.0)"; } else if (global_test_mode !== true) { bar_x.style.backgroundColor = "rgba(0,0,255,0)"; } } return bar_x; } function get_resize_bar_x(win_id) { var win = null; var bar_x = null; win = document.getElementById(win_id); if (win !== null) { bar_x = document.getElementById(win_id + "_resize_bar_x"); if (bar_x !== null) { return bar_x; } /* else { bar_x = make_resize_bar_x(win_id); place_resize_bar_x(win_id); set_size_resize_bar_x(win_id); set_resize_bar_x_event_listeners(win_id); show_resize_bar_x(win_id); return bar_x; } */ } } function set_size_resize_bar_x(win_id) { var win = null; var td_width = null; var bar_x = null; var bar_x_width = null; var bar_x_height = null; var bar_x_left = null; var bar_x_top = null; var bar_x_right = null; var bar_x_bottom = null; var pixel_ratio = null; pixel_ratio = get_pixel_ratio(); win = document.getElementById(win_id); //win_id + "_resize_bar_x" if (win !== null) { bar_x = get_resize_bar_x(win_id); if (bar_x !== null) { bar_x_width = 8.9895 / pixel_ratio; bar_x_height = get_window_contents_td_height(win_id); bar_x_top = get_window_contents_td_top(win_id); bar_x_left = get_window_contents_td_left(win_id); td_width = get_window_contents_td_width(win_id); bar_x.style.height = (bar_x_height - parseFloat(2)) + "px"; bar_x.style.width = bar_x_width + "px"; bar_x.style.top = bar_x_top + "px"; bar_x.style.left = ((bar_x_left + td_width) + (parseFloat(2.2532 * pixel_ratio))) + "px"; } } } function place_resize_bar_x(win_id, resize_bar_x) { var win = null; var bar_x = null; var bar_x_exists = null; bar_x = resize_bar_x; win = document.getElementById(win_id); if (win !== null) { bar_x_exists = resize_bar_exists_x(win_id); if (bar_x_exists !== true) { bar_x = make_resize_bar_x(win_id); //win.appendChild(bar_x); //document.insertBefore(bar_x, win.childNodes[1]); ////win.children[0].insertAdjacentElement("afterend", bar_x); win.appendChild(bar_x); ////set_size_resize_bar_x(win_id); ////set_resize_bar_x_event_listeners(win_id); ////show_resize_bar_x(win_id); } } } function set_resize_bar_x_event_listeners(win_id, barX) { var win = null; var bar_x = null; win = document.getElementById(win_id); if (win !== null) { bar_x = get_resize_bar_x(win_id); if (bar_x !== null) { //continue } else { bar_x = make_resize_bar_x(win_id); } bar_x.addEventListener("mouseover", function () { bar_x.style.cursor = "ew-resize"; //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, "x"); }); bar_x.addEventListener("mouseout", function () { bar_x.style.cursor = "initial"; //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"); }); bar_x.addEventListener("mousedown", function () { global_left_mouse_button_down = true; init_before_resize(win_id); event.preventDefault(); event.stopPropagation(); }); bar_x.addEventListener("mouseup", function () { global_left_mouse_button_down = false; deactivate_global_active_window(); event.preventDefault(); event.stopPropagation(); }); } } /* function example_set_resize_bar_x_event_listeners(win_id, bar_x) { //alert(bar_x); bar_x.addEventListener("mouseout", function () { bar_x.style.cursor = "initial"; }); bar_x.addEventListener("mouseover", function () { alert("werty"); bar_x.style.cursor = "ew-resize"; }); bar_x.addEventListener("mousedown", function () { global_left_mouse_button_down = true; init_before_resize(win_id); event.preventDefault(); event.stopPropagation(); }); bar_x.addEventListener("mouseup", function () { global_left_mouse_button_down = false; deactivate_global_active_window(); event.preventDefault(); event.stopPropagation(); }); top.addEventListener("mousemove", function () { if (global_left_mouse_button_down == true) { // console.log("x"); // resize_web_window(); } }); //return bar_x; } */ function move_resize_bar_x(win_id) { } function hide_resize_bar_x(win_id) { } function show_resize_bar_x(win_id) { var bar_x = null; bar_x = get_resize_bar_x(win_id); if (bar_x !== null) { bar_x.style.display = "block"; } } function remove_resize_bar_x(win_id) { } function resize_bar_exists_x(win_id) { var bar_x = null; var exists = null; bar_x = document.getElementById(win_id + "_resize_bar_x"); if (bar_x !== null) { exists = true; } else { exists = false; } return exists; } //duplicate functions; commented out. //they are now placed in the file: 'resize_window.js' /* function set_win_resize_xy_attribute(win_id, xy) { var win = null; var resize_xy = null; win = document.getElementById(win_id); if (win !== null) { resize_xy = xy; if (resize_xy === "xy" || resize_xy === "x" || resize_xy === "y") { } else { resize_xy = "xy"; } win.setAttribute("data-resize_xy", resize_xy); } } */ //2023-09-23: //duplicate functions; commented out. //they are now placed in the file: 'resize_window.js' /* function get_win_resize_xy_attribute(win_id) { var win = null; var resize_xy = null; var xy = null; win = document.getElementById(win_id); if (win !== null) { resize_xy = win.getAttribute("data-resize_xy"); if (resize_xy !== null) { if (typeof resize_xy === "string") { if (resize_xy.length > 0) { xy = resize_xy; } else { xy = "xy"; set_win_resize_xy_attribute(win_id, xy); } } else { xy = "xy"; set_win_resize_xy_attribute(win_id, xy); } } else { xy = "xy"; set_win_resize_xy_attribute(win_id, xy); } } return xy; } */