diff options
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 89 |
1 files changed, 2 insertions, 87 deletions
@@ -16,94 +16,9 @@ <script src="js/bootstrap.min.js"></script> <script src="js/mustache.js"></script> <script src="js/underscore.min.js"></script> - <script type="text/javascript"> - - var strip = function(data) { return data.split('.')[0] }; - - render = { - 'index' : function() { - jQuery.get('data/metadata/hosts', function(raw) { - var data = jsyaml.load(raw), - hosts = []; - - for(var i=0; i < data.hosts.length; i++) { - var entry = data.hosts[i]; - hosts.push({ - 'name' : strip(entry), - 'uri' : entry - }); - } - - $.Mustache.load('./templates/index.html').done(function () { - $('#content').mustache('hosts', {'hosts':hosts}, {method: 'html'}); - - $("#hosts a").click("hover", function(event){ - var uri = $(this).attr('data-uri'); - render.host(uri); - History.pushState({host: uri}, 'Hostinfo: ' + uri, 'index.html?'+uri); - return false; - }); - }); - }); - }, - - 'host' : function(uri) { - jQuery.get('data/'+uri, function(raw) { - var data = jsyaml.load(raw); - - data.name = strip(data.hostname); - data.interfaces = _.map( - _.groupBy( - _.filter(data.addresses, function(x) { - return typeof x.vserver == 'undefined'; - }), - function(x) { - return x.interface; - }), - function(obj, key) { - obj.device = key; - return obj; - }); - - $.Mustache.load('./templates/host.html').done(function () { - $('#content').mustache('hostinfo', data, {method: 'html'}); - - $("#index").click("hover", function(event){ - render.index(); - History.pushState({host: undefined}, 'Hostinfo: Overview', 'index.html'); - return false; - }); - }); - }); - } - }; - - $(document).ready(function() { - var History = window.History; - if (History.enabled) { - History.Adapter.bind(window,'statechange',function(){ - var State = History.getState(); - if (State.data.host) { - render.host(State.data.host); - } - else { - render.index(); - } - }); - } - - var host = window.location.search.split('?')[1] || undefined; - if (host) { - render.host(host); - document.title = 'Hostinfo: ' + host; - History.replaceState({host: host}, 'Hostinfo: ' + host, 'index.html?' + host); - } - else { - render.index(); - } - }); - </script> + <script src="js/page.js"></script> </head> + <body> <div class="container"> <div class="row"> |