%PDF- %PDF-
Direktori : /home/nailstv/public_html/es.nails.tv/ |
Current File : /home/nailstv/public_html/es.nails.tv/_sample-academy-promotion.php |
<!DOCTYPE html> <html lang="en"> <head> <title>Sample for displaying Academy Ads</title> <meta charset="UTF-8"> <meta name=description content=""> <meta name=viewport content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap CSS --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <h1 class="text-center">Sample for displaying Academy Ads</h1> <div class="jumbotron"> <div class="container"> <h1></h1> <p id="presenter1">Contents...1</p> ------------------------------------ <p id="presenter2">Contents...2</p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> var timer; var active_promo = 0; $(document).ready(function () { console.log("init()"); init_poll(3000); }); function init_poll(sec) { timer = setInterval(function () { $.getJSON("_academyPromotion.php?v=" + active_promo, function () { }) .done(function (data) { console.info("Data received"); var text = $('.container h1'); var container1 = $('#presenter1'); var container2 = $('#presenter2'); if (data == 0) { console.log('No information avaible..'); text.html(''); //container.html(''); } else { container1.html('<ul>'); container2.html('<ul>'); text.html('New promotions are avaible!'); active_promo = data.id; console.info('New id: ' + active_promo); var presenter_number = 1; $.each(data.presenters, function (key, val) { $.each(val, function (key2, val2) { if (presenter_number == 1) { container1.html(container1.html() + "<li>" + key+" "+ val2['name'] + "<img class='thumbnail img-rounded' width='40px' src='http://crystalnails.hu/bolt/img/galeria/"+val2['file']+"'></li>"); } else { container2.html(container2.html()+"<li>" + key+" "+ val2['name'] + "<img class='thumbnail img-rounded' width='40px' src='http://crystalnails.hu/bolt/img/galeria/"+val2['file']+"'></li>"); } }); presenter_number++; }); container1.html(container1.html()+'</ul>'); container2.html(container2.html()+'</ul>'); stop_poll(); init_poll(10000) } }) .fail(function () { console.error("error"); }); }, sec); } function stop_poll() { console.error(" Poll deactivated! "); clearInterval(timer); } </script> </body> </html>