| ... | ... |
@@ -31,6 +31,21 @@ function NewsSection($sourceHTML) {
|
| 31 | 31 |
<link href="css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> |
| 32 | 32 |
<link rel="stylesheet" type="text/css" href="css/style.css" /> |
| 33 | 33 |
<script> |
| 34 |
+ function getStylesheet() {
|
|
| 35 |
+ var x = document.getElementById("style-active");
|
|
| 36 |
+ var btn = document.getElementById("style-btn");
|
|
| 37 |
+ var currentTime = new Date().getHours(); |
|
| 38 |
+ if (0 <= currentTime && currentTime < 8) {
|
|
| 39 |
+ document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>");
|
|
| 40 |
+ } else if (8 <= currentTime && currentTime < 19) {
|
|
| 41 |
+ document.write("<link rel='stylesheet' href='css/style-day.css' type='text/css'>");
|
|
| 42 |
+ } else if (19 <= currentTime && currentTime < 24) {
|
|
| 43 |
+ document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>");
|
|
| 44 |
+ } |
|
| 45 |
+ } |
|
| 46 |
+ getStylesheet(); |
|
| 47 |
+ </script> |
|
| 48 |
+ <script> |
|
| 34 | 49 |
function onArticle(index) {
|
| 35 | 50 |
var string_index = "article-"+index; |
| 36 | 51 |
var url = location.href; |
| ... | ... |
@@ -66,6 +81,23 @@ function NewsSection($sourceHTML) {
|
| 66 | 81 |
//document.write("<link rel='stylesheet' href='css/style-day.css' type='text/css'>");
|
| 67 | 82 |
} |
| 68 | 83 |
} |
| 84 |
+ |
|
| 85 |
+ window.onload = function () {
|
|
| 86 |
+ // Set Day/Night icon after load |
|
| 87 |
+ var x = document.getElementById("style-active");
|
|
| 88 |
+ var btn = document.getElementById("style-btn");
|
|
| 89 |
+ var currentTime = new Date().getHours(); |
|
| 90 |
+ if (0 <= currentTime && currentTime < 8) {
|
|
| 91 |
+ x.className = "night"; |
|
| 92 |
+ btn.innerHTML = '<i class="fa fa-moon-o fa-fw"></i>'; |
|
| 93 |
+ } else if (8 <= currentTime && currentTime < 19) {
|
|
| 94 |
+ x.className = "day"; |
|
| 95 |
+ btn.innerHTML = '<i class="fa fa-sun-o fa-fw"></i>'; |
|
| 96 |
+ } else if (19 <= currentTime && currentTime < 24) {
|
|
| 97 |
+ x.className = "night"; |
|
| 98 |
+ btn.innerHTML = '<i class="fa fa-moon-o fa-fw"></i>'; |
|
| 99 |
+ } |
|
| 100 |
+ } |
|
| 69 | 101 |
</script> |
| 70 | 102 |
<title>News.fr</title> |
| 71 | 103 |
</head> |
| ... | ... |
@@ -96,44 +128,24 @@ function NewsSection($sourceHTML) {
|
| 96 | 128 |
<!-- Main Display --> |
| 97 | 129 |
<?php |
| 98 | 130 |
//Default is first of the list |
| 99 |
- $GETgame = $imagelist[0]; |
|
| 100 |
- $GETexec = $contentlist[0]; |
|
| 131 |
+ $GETchannel = $imagelist[0]; |
|
| 132 |
+ $GETcontent = $contentlist[0]; |
|
| 101 | 133 |
if( isset( $_GET['channel'] ) ) {
|
| 102 |
- $GETgame = $_GET['channel']; |
|
| 134 |
+ $GETchannel = $_GET['channel']; |
|
| 103 | 135 |
$cpt = 0; |
| 104 |
- foreach ( $imagelist as $file ) {
|
|
| 105 |
- if( $file == $GETgame ) {
|
|
| 136 |
+ foreach ( $imagelist as $newsName ) {
|
|
| 137 |
+ if( $newsName == $GETchannel ) {
|
|
| 106 | 138 |
break; |
| 107 | 139 |
} |
| 108 | 140 |
$cpt++; |
| 109 | 141 |
} |
| 110 | 142 |
} |
| 143 |
+ |
|
| 111 | 144 |
$GETcontent = $contentlist[$cpt]; |
| 112 |
- echo NewsSection($GETexec); |
|
| 145 |
+ echo NewsSection($GETcontent); |
|
| 113 | 146 |
?> |
| 114 | 147 |
|
| 115 | 148 |
</div> |
| 116 | 149 |
</div> <!-- ./row --> |
| 117 | 150 |
</body> |
| 118 |
- <script> |
|
| 119 |
- function getStylesheet() {
|
|
| 120 |
- var x = document.getElementById("style-active");
|
|
| 121 |
- var btn = document.getElementById("style-btn");
|
|
| 122 |
- var currentTime = new Date().getHours(); |
|
| 123 |
- if (0 <= currentTime && currentTime < 8) {
|
|
| 124 |
- btn.innerHTML = '<i class="fa fa-moon-o fa-fw"></i>'; |
|
| 125 |
- x.className = "night"; |
|
| 126 |
- document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>");
|
|
| 127 |
- } else if (8 <= currentTime && currentTime < 19) {
|
|
| 128 |
- x.className = "day"; |
|
| 129 |
- btn.innerHTML = '<i class="fa fa-sun-o fa-fw"></i>'; |
|
| 130 |
- document.write("<link rel='stylesheet' href='css/style-day.css' type='text/css'>");
|
|
| 131 |
- } else if (19 <= currentTime && currentTime < 24) {
|
|
| 132 |
- x.className = "night"; |
|
| 133 |
- btn.innerHTML = '<i class="fa fa-moon-o fa-fw"></i>'; |
|
| 134 |
- document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>");
|
|
| 135 |
- } |
|
| 136 |
- } |
|
| 137 |
- getStylesheet(); |
|
| 138 |
- </script> |
|
| 139 | 151 |
</html> |