mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
move time into its own file and folder
This commit is contained in:
parent
0dee9c0bd9
commit
c2f9d0a06c
@ -24,11 +24,12 @@
|
||||
<script src="js/jquery.js"></script>
|
||||
<script src="js/jquery.feedToJSON.js"></script>
|
||||
<script src="js/ical_parser.js"></script>
|
||||
<script src="js/moment-with-langs.min.js"></script>
|
||||
<script src="js/moment-with-locales.min.js"></script>
|
||||
<script src="js/config.js"></script>
|
||||
<script src="js/rrule.js"></script>
|
||||
<script src="js/compliments/compliments.js" type="text/javascript"></script>
|
||||
<script src="js/weather/weather.js" type="text/javascript"></script>
|
||||
<script src="js/time/time.js" type="text/javascript"></script>
|
||||
<script src="js/main.js?nocache=<?php echo md5(microtime()) ?>"></script>
|
||||
<!-- <script src="js/socket.io.min.js"></script> -->
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
var config = {
|
||||
lang: 'en',
|
||||
time: {
|
||||
timeFormat: 12
|
||||
},
|
||||
weather: {
|
||||
//change weather params here:
|
||||
//units: metric or imperial
|
||||
|
16
js/main.js
16
js/main.js
@ -34,7 +34,7 @@ jQuery(document).ready(function($) {
|
||||
var lastCompliment;
|
||||
var compliment;
|
||||
|
||||
moment.lang(config.lang);
|
||||
moment.locale(config.lang);
|
||||
|
||||
//connect do Xbee monitor
|
||||
// var socket = io.connect('http://rpi-alarm.local:8082');
|
||||
@ -64,19 +64,7 @@ jQuery(document).ready(function($) {
|
||||
}, 3000);
|
||||
})();
|
||||
|
||||
(function updateTime()
|
||||
{
|
||||
var now = moment();
|
||||
var date = now.format('LLLL').split(' ',4);
|
||||
date = date[0] + ' ' + date[1] + ' ' + date[2] + ' ' + date[3];
|
||||
|
||||
$('.date').html(date);
|
||||
$('.time').html(now.format('HH') + ':' + now.format('mm') + '<span class="sec">'+now.format('ss')+'</span>');
|
||||
|
||||
setTimeout(function() {
|
||||
updateTime();
|
||||
}, 1000);
|
||||
})();
|
||||
time.init();
|
||||
|
||||
(function updateCalendarData()
|
||||
{
|
||||
|
9
js/moment-with-langs.min.js
vendored
9
js/moment-with-langs.min.js
vendored
File diff suppressed because one or more lines are too long
80
js/moment-with-locales.min.js
vendored
Normal file
80
js/moment-with-locales.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
31
js/time/time.js
Normal file
31
js/time/time.js
Normal file
@ -0,0 +1,31 @@
|
||||
var time = {
|
||||
timeFormat: config.time.timeFormat || 24,
|
||||
dateLocation: '.date',
|
||||
timeLocation: '.time',
|
||||
updateInterval: 1000,
|
||||
intervalId: null
|
||||
};
|
||||
|
||||
time.updateTime = function () {
|
||||
|
||||
var _now = moment(),
|
||||
_date = _now.format('dddd, LL');
|
||||
|
||||
$(this.dateLocation).html(_date);
|
||||
$(this.timeLocation).html(_now.format(this._timeFormat+':mm[<span class="sec">]ss[</span>]'));
|
||||
|
||||
}
|
||||
|
||||
time.init = function () {
|
||||
|
||||
if (parseInt(time.timeFormat) === 12) {
|
||||
time._timeFormat = 'hh'
|
||||
} else {
|
||||
time._timeFormat = 'HH';
|
||||
}
|
||||
|
||||
this.intervalId = setInterval(function () {
|
||||
this.updateTime();
|
||||
}.bind(this), 1000);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user