$(function() { $.getJSON('config.json', function(data) { $.each(data.apps, function(app, appdata) { if (!appdata['tiles-shown']) return true; var div = $('#'+app).show(); div.find('.login').text(appdata.login); div.find('.password').text(appdata.password); $.each(appdata.tiles, function(idx, tile) { $('#'+tile).show(); }); }); var host = data.host.domain + (data.host.port != '443' ? ':'+data.host.port : '') $('a').each(function(){ $(this).attr('href', $(this).attr('href').replace('{host}', host)); }); $('span').each(function(){ $(this).text($(this).text().replace('{host}', host)); }); }); });