moved javascript from html file to external script
This commit is contained in:
		
							
								
								
									
										37
									
								
								Software/data_src/static/js/script.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Software/data_src/static/js/script.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| $(".navbar-nav>li>a").on("click", function () { | ||||
|   $(".navbar-collapse").collapse("hide"); | ||||
| }); | ||||
|  | ||||
| document | ||||
|   .querySelector(".custom-file-input") | ||||
|   .addEventListener("change", function (e) { | ||||
|     var fileName = document.getElementById("fw-update-file").files[0].name; | ||||
|     var nextSibling = e.target.nextElementSibling; | ||||
|     nextSibling.innerText = fileName; | ||||
|   }); | ||||
|  | ||||
| $("table").on("click", "tr[data-dtc]", function () { | ||||
|   var dtc = $(this).data("dtc"); | ||||
|   var debugval = $(this).data("debugval"); | ||||
|   var modal = $("#dtcModal"); | ||||
|  | ||||
|   getDescriptionForDTCNumber(dtc, function (error, title, description) { | ||||
|     if (error) { | ||||
|       console.error("Fehler beim Abrufen der Beschreibung:", error); | ||||
|       modal.find(".modal-title").text("Fehler"); | ||||
|       modal | ||||
|         .find(".dtc-desc") | ||||
|         .text("DTC-Beschreibung konnte nicht geladen werden"); | ||||
|     } else { | ||||
|       modal.find(".modal-title").text(title); | ||||
|       modal.find(".dtc-desc").text(description); | ||||
|       if (debugval > 0) { | ||||
|         modal.find(".dtc-debugval").text("Debugvalue: " + debugval); | ||||
|       } else { | ||||
|         modal.find(".dtc-debugval").remove(); | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
|   // Modal anzeigen | ||||
|   modal.modal("show"); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user