1jQuery(document).ready( function ($) { 2 // Download the JSON data from the SpaceAPI endpoint 3 var jqxhr = $.getJSON(php_vars.url, function(data) { 4 // Show status 5 if (data.state.open) { 6 var status_value = 'Geöffnet'; 7 // If there is an status open-image get the link 8 if (data.state.icon.open) { 9 $('.opening_status_img').attr("src", data.state.icon.open); 10 } 11 } else { 12 var status_value = 'Geschlossen'; 13 if (data.state.icon.closed) { 14 $('.opening_status_img').attr("src",data.state.icon.closed); 15 } 16 } 17 //alert(data.state.icon.closed) 18 if (data.sensors.power_consumption[0].value) { 19 $('.power_consumption').text( data.sensors.power_consumption[0].value 20 + " " 21 + data.sensors.power_consumption[0].unit); 22 } 23 // If lastchange is set we use it 24 if (data.state.lastchange) { 25 // Auskommentiert weil das der letzt Statuschange ist 26 // wir nehmen lieber den lastchange wert vom Stromzähler 27 var lastchange = new Date(data.state.lastchange*1000); 28 //var lastchange = new Date(data.sensors.power_consumption[0].lastchange*1000); 29 console.log(data.state.lastchange*1000) 30 $('.opening_status_lastchange').text( lastchange.getDate().toString().padStart(2, "0") + "." 31 + (lastchange.getMonth()+1).toString().padStart(2, "0") + "." 32 + lastchange.getFullYear() + " " 33 + lastchange.getHours().toString().padStart(2, "0") + ":" 34 + lastchange.getMinutes().toString().padStart(2, "0") 35 ); 36 } 37 38 // If a message is provided, append it to the status 39 if (data.state.message) { 40 $('.opening_status_value').text(status_value + ':'); 41 $('.opening_status_message').text(data.state.message); 42 } else { 43 $('.opening_status_value').text(status_value); 44 } 45 46 }) 47});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.