mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
auto reloader
This commit is contained in:
parent
cfff71a936
commit
657eb061cd
2
githash.php
Normal file
2
githash.php
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
echo json_encode(array('gitHash'=>trim(`git rev-parse HEAD`)));
|
24
index.php
Normal file
24
index.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Magic Mirror</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/main.css?nocache=<?php echo md5(microtime()) ?>">
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/weather-icons.css">
|
||||||
|
<script type="text/javascript">
|
||||||
|
var gitHash = '<?php echo trim(`git rev-parse HEAD`) ?>';
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="TopLeft time"></div>
|
||||||
|
<div class="TopRight temp"></div>
|
||||||
|
<div class="Center compliment"></div>
|
||||||
|
<div class="Bottom">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/jquery.js"></script>
|
||||||
|
<script src="js/jquery.feedToJSON.js"></script>
|
||||||
|
<script src="js/main.js?nocache=<?php echo md5(microtime()) ?>"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
18
js/main.js
18
js/main.js
@ -24,6 +24,23 @@ jQuery(document).ready(function($) {
|
|||||||
var news = [];
|
var news = [];
|
||||||
var newsIndex = 0;
|
var newsIndex = 0;
|
||||||
|
|
||||||
|
(function checkVersion()
|
||||||
|
{
|
||||||
|
$.getJSON('githash.php', {}, function(json, textStatus) {
|
||||||
|
if (json) {
|
||||||
|
if (json.gitHash != gitHash) {
|
||||||
|
console.log('refresh');
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
console.log('up to date');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setTimeout(function() {
|
||||||
|
checkVersion();
|
||||||
|
}, 3000);
|
||||||
|
})();
|
||||||
|
|
||||||
(function updateTime()
|
(function updateTime()
|
||||||
{
|
{
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
@ -95,7 +112,6 @@ jQuery(document).ready(function($) {
|
|||||||
}, 60000);
|
}, 60000);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
(function fetchNews() {
|
(function fetchNews() {
|
||||||
$.feedToJson({
|
$.feedToJson({
|
||||||
feed:'http://feeds.nos.nl/nosjournaal?format=rss',
|
feed:'http://feeds.nos.nl/nosjournaal?format=rss',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user