diff --git a/templates/index.html.ep b/templates/index.html.ep index 4256a884501cba755e7b0a20cf494f25cec5117f..b853a5f93dbd44b0d453865d3eabb4df017211bf 100644 --- a/templates/index.html.ep +++ b/templates/index.html.ep @@ -1,32 +1,12 @@ % layout 'default'; % title 'Piratské vysílání'; -<div id="streams-container"> +<div id="streams"> </div> <script> -// pure js, vole :) -var getHTML = function ( url, callback ) { - if ( !window.XMLHttpRequest ) return; - var xhr = new XMLHttpRequest(); - - xhr.onload = function() { - if ( callback && typeof( callback ) === 'function' ) { - callback( this.responseXML ); - } - } - - xhr.open( 'GET', url ); - xhr.responseType = 'document'; - xhr.send(); -}; - -function Streams () { - getHTML( '/streams', function (response) { - var target = document.querySelector( '#streams-container' ); - target.innerHTML = response.documentElement.innerHTML; - }); +function load_streams() { + $( "#streams" ).load( "/streams" ); } - -Streams(); -setInterval(Streams, 5000); - +load_streams(); +setInterval(load_streams, 5000); </script> +