diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-06-05 10:20:15 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-06-05 10:20:15 +0200 |
commit | 65c33071c9f00eb445095b891cebd07bdffff4e5 (patch) | |
tree | b235f80710b0c29a597b6d2f3451b612fb7387dd | |
parent | cb1e9f1f15c38f68c1859b2dfd67870b0ed81240 (diff) | |
download | Ishtar-65c33071c9f00eb445095b891cebd07bdffff4e5.tar.bz2 Ishtar-65c33071c9f00eb445095b891cebd07bdffff4e5.zip |
🚑️ JS: put load_window at the end of ishtar.js to prevent loading error
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 025b05a56..02dd3ac44 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -602,52 +602,6 @@ function close_wait(){ } } -var last_window; - -function load_window(url, speed, on_success, no_jump){ - $('.modal-progress').modal('show'); - $.ajax({ - url: url, - cache: false, - success:function(html){ - close_wait(); - $(".previous_page").remove(); - $(".next_page").remove(); - var register_id = $(html).find(".card-header").attr("data-sheet-id"); - var current_sheet = $('[data-sheet-id="' + register_id + '"]'); - if (current_sheet.length){ - current_sheet.parent().remove(); - } - var current_id = $(html).find(".card-header").parent().attr("id"); - var current_label = $(html).find(".card-label").html(); - var new_sheet_list = new Array(); - for (idx in sheet_list){ - if (sheet_list[idx]['register_id'] != register_id){ - new_sheet_list.push(sheet_list[idx]); - } - } - sheet_list = new_sheet_list; - sheet_list.push({'id': current_id, 'label': current_label, - 'register_id': register_id}); - $("#window").append(html); - $("#" + last_window).show(); - update_window_menu(); - $(".lg-close").click(); // close a potential lightgallery view - if (!no_jump){ - // jump to this window - var url = location.href; - location.href = "#" + last_window; - history.replaceState(null, null, url); - } - register_wait_button(); - if (on_success) on_success(); - }, - error:function(XMLHttpRequest, textStatus, errorThrows){ - close_wait(); - } - }); -} - function load_current_window(url, model_name){ var id; if (advanced_menu){ @@ -2198,3 +2152,51 @@ var import_csv_check_ignored = function(){ import_table_update_import_list(import_ids); }); } + +/* keep load_window function at the end of this file */ + +var last_window; + +function load_window(url, speed, on_success, no_jump){ + $('.modal-progress').modal('show'); + $.ajax({ + url: url, + cache: false, + success:function(html){ + close_wait(); + $(".previous_page").remove(); + $(".next_page").remove(); + var register_id = $(html).find(".card-header").attr("data-sheet-id"); + var current_sheet = $('[data-sheet-id="' + register_id + '"]'); + if (current_sheet.length){ + current_sheet.parent().remove(); + } + var current_id = $(html).find(".card-header").parent().attr("id"); + var current_label = $(html).find(".card-label").html(); + var new_sheet_list = new Array(); + for (idx in sheet_list){ + if (sheet_list[idx]['register_id'] != register_id){ + new_sheet_list.push(sheet_list[idx]); + } + } + sheet_list = new_sheet_list; + sheet_list.push({'id': current_id, 'label': current_label, + 'register_id': register_id}); + $("#window").append(html); + $("#" + last_window).show(); + update_window_menu(); + $(".lg-close").click(); // close a potential lightgallery view + if (!no_jump){ + // jump to this window + var url = location.href; + location.href = "#" + last_window; + history.replaceState(null, null, url); + } + register_wait_button(); + if (on_success) on_success(); + }, + error:function(XMLHttpRequest, textStatus, errorThrows){ + close_wait(); + } + }); +} |