... | ... |
@@ -75,6 +75,7 @@ iframe { |
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
|
78 |
+#style-btn, |
|
78 | 79 |
#menu-btn { |
79 | 80 |
/*position: absolute;*/ |
80 | 81 |
background-color: #5b7e96; |
... | ... |
@@ -2,17 +2,16 @@ |
2 | 2 |
//List available images |
3 | 3 |
$newslist = array(); |
4 | 4 |
$imagelist = array(); |
5 |
-$cmdlist = array(); |
|
5 |
+$contentlist = array(); |
|
6 | 6 |
$content = file_get_contents("sources/news.json"); |
7 | 7 |
$newsdetails = json_decode($content,true); |
8 | 8 |
foreach( $newsdetails as $news ) { |
9 | 9 |
array_push($newslist, $news['name']); |
10 | 10 |
array_push($imagelist, $news['image']); |
11 |
- array_push($cmdlist, $news['html']); |
|
11 |
+ array_push($contentlist, $news['html']); |
|
12 | 12 |
} |
13 | 13 |
|
14 |
-//Generate HTML code section for dosbox |
|
15 |
-function NewsSection($title, $game, $sourceHTML) { |
|
14 |
+function NewsSection($sourceHTML) { |
|
16 | 15 |
$html=""; |
17 | 16 |
$html .= '<div class="col-4 col-s-8">'.PHP_EOL; |
18 | 17 |
$content = file_get_contents($sourceHTML); |
... | ... |
@@ -41,19 +40,6 @@ function NewsSection($title, $game, $sourceHTML) { |
41 | 40 |
} |
42 | 41 |
</script> |
43 | 42 |
<script> |
44 |
- function getStylesheet() { |
|
45 |
- var currentTime = new Date().getHours(); |
|
46 |
- if (0 <= currentTime && currentTime < 8) { |
|
47 |
- document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>"); |
|
48 |
- } else if (8 <= currentTime && currentTime < 19) { |
|
49 |
- document.write("<link rel='stylesheet' href='css/style-day.css' type='text/css'>"); |
|
50 |
- } else if (19 <= currentTime && currentTime < 24) { |
|
51 |
- document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>"); |
|
52 |
- } |
|
53 |
- } |
|
54 |
- getStylesheet(); |
|
55 |
- </script> |
|
56 |
- <script> |
|
57 | 43 |
function hideMenu() { |
58 | 44 |
var x = document.getElementById("menu-news"); |
59 | 45 |
var btn = document.getElementById("menu-btn"); |
... | ... |
@@ -67,19 +53,32 @@ function NewsSection($title, $game, $sourceHTML) { |
67 | 53 |
document.getElementById('article-display').setAttribute("class", "col-8"); |
68 | 54 |
} |
69 | 55 |
} |
56 |
+ function forceStylesheet() { |
|
57 |
+ var x = document.getElementById("style-active"); |
|
58 |
+ var btn = document.getElementById("style-btn"); |
|
59 |
+ if (x.className === "night") { |
|
60 |
+ x.className = "day"; |
|
61 |
+ btn.innerHTML = '<i class="fa fa-sun-o fa-fw"></i>'; |
|
62 |
+ //document.write("<link rel='stylesheet' href='css/style-night.css' type='text/css'>"); |
|
63 |
+ } else { |
|
64 |
+ x.className = "night"; |
|
65 |
+ btn.innerHTML = '<i class="fa fa-moon-o fa-fw"></i>'; |
|
66 |
+ //document.write("<link rel='stylesheet' href='css/style-day.css' type='text/css'>"); |
|
67 |
+ } |
|
68 |
+ } |
|
70 | 69 |
</script> |
71 | 70 |
<title>News.fr</title> |
72 | 71 |
</head> |
73 | 72 |
<body> |
74 | 73 |
<div class="row"> |
75 |
- <div class="col-11 col-s-11"> |
|
76 |
- <div class="header"> |
|
77 |
- <h1><i class="fa fa-newspaper-o fa-fw"></i> News.fr</h1> |
|
78 |
- </div> |
|
74 |
+ <div class="col-12 col-s-12"> |
|
75 |
+ <div class="header"> |
|
76 |
+ <span id="style-active" class="day"></span> |
|
77 |
+ <button id="menu-btn" onclick="hideMenu()"><i class="fa fa-eye-slash fa-fw"></i></button> |
|
78 |
+ <button id="style-btn" onclick="forceStylesheet()"><i class="fa fa-sun-o fa-fw"></i></button> |
|
79 |
+ <h1 style="display: inline"><i class="fa fa-newspaper-o fa-fw"></i> News.fr</h1> |
|
80 |
+ </div> |
|
79 | 81 |
</div><!-- ./col-11 --> |
80 |
- <div class="col-1 col-s-1"> |
|
81 |
- <button id="menu-btn" onclick="hideMenu()"><i class="fa fa-eye-slash fa-fw"></i></button> |
|
82 |
- </div><!-- ./col-1 --> |
|
83 | 82 |
</div><!-- ./row --> |
84 | 83 |
|
85 | 84 |
<div class="row"> |
... | ... |
@@ -97,9 +96,8 @@ function NewsSection($title, $game, $sourceHTML) { |
97 | 96 |
<!-- Main Display --> |
98 | 97 |
<?php |
99 | 98 |
//Default is first of the list |
100 |
- $GETtitle = $newslist[0]; |
|
101 | 99 |
$GETgame = $imagelist[0]; |
102 |
- $GETexec = $cmdlist[0]; |
|
100 |
+ $GETexec = $contentlist[0]; |
|
103 | 101 |
if( isset( $_GET['channel'] ) ) { |
104 | 102 |
$GETgame = $_GET['channel']; |
105 | 103 |
$cpt = 0; |
... | ... |
@@ -110,26 +108,32 @@ function NewsSection($title, $game, $sourceHTML) { |
110 | 108 |
$cpt++; |
111 | 109 |
} |
112 | 110 |
} |
113 |
- $GETexec = $cmdlist[$cpt]; // Game Executable |
|
114 |
- $GETtitle = $newslist[$cpt]; // Game Title |
|
115 |
- echo NewsSection($GETtitle, $GETgame, $GETexec); |
|
111 |
+ $GETcontent = $contentlist[$cpt]; |
|
112 |
+ echo NewsSection($GETexec); |
|
116 | 113 |
?> |
117 | 114 |
|
118 | 115 |
</div> |
119 |
- <!-- Right-Side Column --> |
|
120 |
- <!-- |
|
121 |
- <div class="col-3 col-s-12"> |
|
122 |
- <div class="aside"> |
|
123 |
- <h1>Aside</h1> |
|
124 |
- </div> |
|
125 |
- </div> |
|
126 |
- --> |
|
127 | 116 |
</div> <!-- ./row --> |
128 |
- <!-- Footer --> |
|
129 |
- <!-- |
|
130 |
- <div class="footer"> |
|
131 |
- <p>Resize the browser window to see how the content respond to the resizing.</p> |
|
132 |
- </div> |
|
133 |
- --> |
|
134 | 117 |
</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> |
|
135 | 139 |
</html> |