From 54dfabbb9a5269f8a9417fb6ce8206e62f2aa2f9 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@imag.fr> Date: Tue, 11 Apr 2017 11:38:53 +0200 Subject: [PATCH] Remove inline scripts in style for Content Security Policy --- src/www/discs.js | 7 +++++++ src/www/header.php | 4 ++-- src/www/index.php | 20 ++------------------ src/www/mainlog.js | 7 +++++++ src/www/style.css | 7 +++++++ 5 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 src/www/discs.js create mode 100644 src/www/mainlog.js diff --git a/src/www/discs.js b/src/www/discs.js new file mode 100644 index 0000000..fa95ded --- /dev/null +++ b/src/www/discs.js @@ -0,0 +1,7 @@ +$(function() { + var myInterval0 = setInterval(function(){ + $.get('discs.php', function(data) { + $('#discs').html(data); + }); + }, 15000); +}); diff --git a/src/www/header.php b/src/www/header.php index 0895548..5323f72 100644 --- a/src/www/header.php +++ b/src/www/header.php @@ -1,6 +1,6 @@ <div id="logos"> -<img style="float:left" src="tl.png" alt="Tetras Libre" /> -<img style="float:right;margin-top: 25px" src="dt.png" alt="Demo-TIC" /> +<img class="top-left" src="tl.png" alt="Tetras Libre" /> +<img class="top-right" src="dt.png" alt="Demo-TIC" /> <h1> Tetras Back </h1> diff --git a/src/www/index.php b/src/www/index.php index 4f545bb..30ce91f 100644 --- a/src/www/index.php +++ b/src/www/index.php @@ -17,24 +17,8 @@ <div id="mainlog"> <?php require './log.php'; ?> </div> -<script> -$(function() { - var myInterval = setInterval(function(){ - $.get('log.php', function(data) { - $('#mainlog').html(data); - }); - }, 5000); -}); -</script> -<script> -$(function() { - var myInterval0 = setInterval(function(){ - $.get('discs.php', function(data) { - $('#discs').html(data); - }); - }, 15000); -}); -</script> +<script src='./mainlog.js'></script> +<script src='./discs.js'></script> <?php include("footer.php"); ?> diff --git a/src/www/mainlog.js b/src/www/mainlog.js new file mode 100644 index 0000000..75576fb --- /dev/null +++ b/src/www/mainlog.js @@ -0,0 +1,7 @@ +$(function() { + var myInterval = setInterval(function(){ + $.get('log.php', function(data) { + $('#mainlog').html(data); + }); + }, 5000); +}); diff --git a/src/www/style.css b/src/www/style.css index d1241c7..0d8baf7 100644 --- a/src/www/style.css +++ b/src/www/style.css @@ -69,6 +69,13 @@ img.right{ margin : auto auto 5% 5%; padding : 0.1em; } +img.top-left{ + float : left; +} +img.top-right{ + float: right; + margin-top 25px; +} /*Comportement des liens*/ a { -- GitLab