"use strict"; //an easy to remember function name helps function reload_content(win_id) { refresh_window_content_data(win_id); } function win(win_id) { return get_window(win_id); } function get_window(win_id) { var w = null; w = document.getElementById(win_id); if (w !== null) { return w; } else { return false; } } async function refresh_window_content_data(win_id) { var content_id = null; var content_div = null; var do_reload = null; ////clear_window_content(win_id); ////make_progressing_progress_bar(); var win = null; win = document.getElementById(win_id); if (win !== null) { ////remove_all_window_content(win_id); do_reload = get_do_reload_attr(win_id); if (do_reload === true || do_reload === "true") { //win = make_new_window(win_id, win.offsetTop, win.offsetLeft, win.offsetWidth, win.offsetHeight, get_window_title(win_id), win_id.split("_")[2], true); win = await make_new_window(win_id, win.getAttribute("data-orig_y"), win.getAttribute("data-orig_x"), win.getAttribute("data-orig_w"), win.getAttribute("data-orig_h"), get_window_title(win_id), win_id.split("_")[2], true); // win.style.opacity = 0.0; //open_window(win_id.split("_")[2]); } else { } set_do_reload_window_false(win_id); equalize_window_size_to_table_size(win_id); } /* content_div = make_new_div_content_container(win_id); if (content_div !== null) { } //make_new_window(win_id, 100, 100, 100, 100, "reloaded window: ", win_id.split("_")[2]); //content_id = get_content_id_attribute(win_id); //make_new_window(win_id, 100, 100, 100, 100, "reloaded window: ", content_id); */ } function clear_window_content(win_id) { var w = null; var content_td = null; var content_div = null; //"window_0009_1000188275684800_tbl_0000_tr_0001_td_0000" if (get_window(win_id) !== null) { content_td = document.getElementById(win_id + "_tbl_0000_tr_0001_td_0000"); if (content_td !== null) { content_td.innerHTML = ""; content_div = make_new_div_content_container(win_id); content_td.appendChild(content_div); reload_CSS_object(win_id); //refreshes the window's CSS data reload_JS_object(win_id); //refreshes the window's JavaScript data } } } function reload_CSS_object(win_id) { var css = null; var href = null; var new_href = null; css = document.getElementById(win_id + "_css"); if (css !== null) { href = css.getAttribute("href"); new_href = return_non_cached_url(href); //this function sets/resets a "random=" + [random number] value in the url's querystring. See file 'functions_2.js' css.setAttribute("href", new_href); } } //2025-01-19: //this function removes, recreates, appends, and reloads //the javascript html element for a web window to make //sure that they're kept up to date with any changes. function reload_JS_object(win_id) { var elem = null; var new_elem = null; var javascript_container = null; var elem_src = null; var new_elem_src = null; var r_number_index = null; elem = document.getElementById(win_id + "_javascript"); if (elem !== null) { if (elem.hasAttribute("src") === true) { elem_src = elem.getAttribute("src"); new_elem_src = return_non_cached_url(elem_src); elem.removeAttribute("src"); } new_elem = recreate_element(win_id + "_javascript"); elem = document.getElementById(win_id + "_javascript"); if (elem !== null) { elem.parentNode.removeChild(elem); elem = undefined; } if (new_elem_src.indexOf("&r=") > -1.0) { r_number_index = new_elem_src.indexOf("&r="); new_elem_src = new_elem_src.substring(0, r_number_index); new_elem_src = new_elem_src + "&r=" + (Math.floor(Math.random() * 900000000) + 1000000000).toString(); new_elem.setAttribute("src", new_elem_src); } javascript_container = document.getElementById("javascripts_container"); if (javascript_container !== null) { javascript_container.appendChild(new_elem); } } } //2025-01-19: //instead of reloading just one script //element, this function reloads every //javascript element inside the javascript's //container. function reload_all_JS_elements() { var script_elem = null; var scripts = null; var i = null; var script_count = null; scripts = document.getElementsByName("web_window_script"); if (scripts !== null) { if (scripts.length > 0) { script_count = scripts.length; for (i = 0; i < script_count; i++) { script_elem = scripts[i]; if (script_elem !== null) { if (script_elem.hasAttribute("data-window_id") === true) { win_id = script_elem.getAttribute("data-window_id"); if (win_id !== null) { reload_JS_object(win_id); } } } } } } } //2025-01-18: //instead of changing the 'src' attribute of //the script element being changed, which doesn't //seem to work, then I'm replacing the whole script //element. It works, but needs refinement so I'm //going to revert back to using the original code //as before. this function may be used in the future //so please Keep it! function replace_script_element_with_new(win_id) { var win = null; var cid = null; var new_script_element = null; var script_container = null; win = document.getElementById(win_id); if (win !== null) { if (win.hasAttribute("data-content_id") === true) { cid = win.getAttribute("data-content_id"); if (cid !== null) { if (typeof (cid) === "number" || typeof (cid) === "string") { remove_JS_script_element(win_id); new_script_element = place_JS_data(win_id, cid); script_container = document.getElementById("javascripts_container"); if (script_container !== null) { if (script_container.hasChildNodes() === true) { script_container.insertBefore(new_script_element, script_container.childNodes[0]); } else { script_container.appendChild(new_script_element); } } else { script_container = make_JS_container(); script_container.appendChild(new_script_element); } } } } } } function remove_JS_script_element(win_id) { var win = null; var script_element = null; win = document.getElementById(win_id); if (win !== null) { script_element = document.getElementById(win_id + "_javascript"); if (script_element !== null) { script_element.parentNode.removeChild(script_element); } } } function set_do_reload_window_false(win_id) { var w = null; var do_reload = null; w = document.getElementById(win_id); if (w !== null) { do_reload = w.setAttribute("data-do_reload", false); } } function set_do_reload_window_true(win_id) { var w = null; var do_reload = null; w = document.getElementById(win_id); if (w !== null) { do_reload = w.setAttribute("data-do_reload", true); } } function get_do_reload_attr(win_id) { var w = null; var do_reload = null; w = document.getElementById(win_id); if (w !== null) { if (w.hasAttribute("data-do_reload") === true) { do_reload = w.getAttribute("data-do_reload"); } } return do_reload; } //gets the HTML content from the database and updates //the web window code window's content. async function reload_window_content_data(win_id) { var contents_container = null; var win = null; var text_contents = null; win = document.getElementById(win_id); if (win !== null) { contents_container = document.getElementById(win_id + "_inner_contents_container"); if (contents_container !== null) { contents_container.innerHTML = ""; text_contents = await get_code_editor_text_from_server(win_id, "html"); contents_container.innerHTML = text_contents; } } return text_contents; } //function remove_scrollbars_CSS(elem) { // //var elem = null; // //elem = document.getElementById("div_wrapper_0"); // if (elem !== null) { // //resize_top_menu_width(); // //most_customizable_config_elem_for_animation(elem.id, "left", "0.5", "0.05"); // elem.classList.add("hide_scroll_bars"); // } // } //elem.classList.add("hide_scroll_bars"); ////if (elem !== null && elem !== undefined) { //// elem.style["-webkit-scrollbar"] = "display:none"; //// elem.style["-ms-overflow-style"] = "none"; //// elem.style["scrollbar-width"] = "none"; //element.style.webkitTransform = "rotate(50deg) translateX(100px)"; //element.style["transform"] = "rotate(50deg)"; //element.style["-webkit-transform"] = "rotate(50deg)"; ////} // /* Hide scrollbar for Chrome, Safari and Opera */ // iframe:: -webkit-scrollbar { // display: none; // } ///* Hide scrollbar for IE, Edge and Firefox */ //iframe { // -ms-overflow-style: none; /* IE and Edge */ // scrollbar-width: none; /* Firefox */ // } //}