Código Javascript:
Ver original
$.getJSON('test.json', function(_data) { function displayBattery(_data){var data=_data;var $battery=$("#battery");if(data['remain']<10){$battery.addClass("emergency");} else if(data['remain']<20){$battery.addClass("caution");} $battery.closest("figure").find("span").text("(Remain: "+data['remain']+"%)");$("#battery-mask",$battery).css({width:data['usage']+"px"});delete data,$battery;} });