//------------------------------------------------------------------------------ // CM - Hauptfunktion //------------------------------------------------------------------------------ class CM { constructor () { this.BodyDataAction(); console.log("CM LOADED"); } BodyDataAction () { var menuButtons = document.getElementById("navbarBtn"). getElementsByTagName("button"); for (var i = 0; i < menuButtons.length; i++) { menuButtons[i].onclick = function(evt) { var res = evt.target.id; CM_o.Menu(res); }; } } Menu (message) { var selectedId = $(".selected").attr('id'); switch (message) { case 'pageDevices': console.log( "pageDevices") this.LoadContent('html/devices.html'); document.getElementById('pageDevices').className = "btn btn-outline-light text-dark active"; document.getElementById('pageSettings').className = "btn btn-outline-light text-dark"; break; case 'pageSettings': console.log( "pageDevices") this.LoadContent('html/settings.html'); document.getElementById('pageDevices').className = "btn btn-outline-light text-dark"; document.getElementById('pageSettings').className = "btn btn-outline-light text-dark active"; break; default: alert ('[CM] Unbekannte Anfrage: ' + message); } } LoadContent ( path ) { $.get( path, function( data ) { $( ".content" ).html( data ); console.log( "Load was performed." ); }); } } $(function() { console.log("ONLOAD"); CM_o = new CM(); CM_o.Menu("pageDevices"); });