diff --git a/var/www/Flasks/Flask_browsepastes.py b/var/www/Flasks/Flask_browsepastes.py index e5aa5b84..b393ab9e 100644 --- a/var/www/Flasks/Flask_browsepastes.py +++ b/var/www/Flasks/Flask_browsepastes.py @@ -79,9 +79,9 @@ def importantPasteByModule(): paste_linenum.append(paste.get_lines_info()[0]) if len(allPastes) > 10: - finished = "" + finished = False else: - finished = "display: none;" + finished = True return render_template("important_paste_by_module.html", moduleName=module_name, diff --git a/var/www/templates/important_paste_by_module.html b/var/www/templates/important_paste_by_module.html index ca98ce59..3a1c1c64 100644 --- a/var/www/templates/important_paste_by_module.html +++ b/var/www/templates/important_paste_by_module.html @@ -29,7 +29,7 @@
-
+
@@ -38,13 +38,15 @@ var json_array = []; var all_data_received = false; var curr_numElem; -var elem_added = 0; -var tot_num_entry = 0; +var elem_added = 10; //10 elements are added by default in the page loading +var tot_num_entry = 10; //10 elements are added by default in the page loading function deploy_source() { var button_load_more_displayed = false; if(typeof(EventSource) !== "undefined" && typeof(source) !== "") { + $("#load_more_json_button1").show(); + $("#load_more_json_button2").show(); var source = new EventSource("{{ url_for('getImportantPasteByModule') }}"+"?moduleName="+moduleName); source.onmessage = function(event) { var feed = jQuery.parseJSON( event.data ); @@ -52,8 +54,6 @@ function deploy_source() { if (feed.index > curr_numElem & feed.module == moduleName) { // Avoid doubling the pastes json_array.push(feed); tot_num_entry++; - $("#load_more_json_button1").show(); - $("#load_more_json_button2").show(); $("#nbr_entry").text(tot_num_entry + " entries available, " + (tot_num_entry - elem_added) + " not displayed"); $("#myTable_"+moduleName).attr('data-numElem', curr_numElem+1); @@ -125,7 +125,14 @@ $(document).ready(function(){ search_table = $('#myTable_'+moduleName).DataTable({ "order": [[ 2, "desc" ]] }); - deploy_source(); + if( "{{ finished }}" == "True"){ + $("#load_more_json_button1").hide(); + $("#load_more_json_button2").hide(); + $("#nbr_entry").hide(); + $("#loading_gif_browse").hide(); + } else { + deploy_source(); + } });