aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/widgets/clock/source.php
blob: 04c3939e858aaded284a5f32071bfa241d2fc923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<div id="widget-space">
    <div style="text-align: center;"><h3 id="widget-clock-time">00:00:00</h3><span id="widget-clock-date">????? ??? ??????? ????</span></div>
</div>
<script>

setInterval(() => {
    time = new Date()
    hours = time.getHours()
    minutes = time.getMinutes()
    seconds = time.getSeconds()
    day = time.getDate()
    month = time.getMonth() + 1
    year = time.getFullYear()
    dow = time.getDay() + 1
    if (hours < 10) {
        hours_str = "0" + hours
    } else {
        hours_str = hours
    }
    if (minutes < 10) {
        minutes_str = "0" + minutes
    } else {
        minutes_str = minutes
    }
    if (seconds < 10) {
        seconds_str = "0" + seconds
    } else {
        seconds_str = seconds
    }
    if (day == 1) {
        day_str = "<?= $lang["widgets"]["clock"]["ordinal"] ?>"
    } else {
        day_str = day
    }
    if (dow == 2) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][0] ?>"
    }
    if (dow == 3) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][1] ?>"
    }
    if (dow == 4) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][2] ?>"
    }
    if (dow == 5) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][3] ?>"
    }
    if (dow == 6) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][4] ?>"
    }
    if (dow == 7) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][5] ?>"
    }
    if (dow == 1) {
        dow_str = "<?= $lang["widgets"]["clock"]["days"][6] ?>"
    }
    if (month == 1) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][0] ?>"
    }
    if (month == 2) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][1] ?>"
    }
    if (month == 3) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][2] ?>"
    }
    if (month == 4) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][3] ?>"
    }
    if (month == 5) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][4] ?>"
    }
    if (month == 6) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][5] ?>"
    }
    if (month == 7) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][6] ?>"
    }
    if (month == 8) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][7] ?>"
    }
    if (month == 9) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][8] ?>"
    }
    if (month == 10) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][9] ?>"
    }
    if (month == 11) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][10] ?>"
    }
    if (month == 12) {
        month_str = "<?= $lang["widgets"]["clock"]["months"][11] ?>"
    }
    document.getElementById('widget-clock-time').innerHTML = hours_str + ":" + minutes_str + ":" + seconds_str
    document.getElementById('widget-clock-date').innerHTML = dow_str + " " + day_str + " " + month_str + " " + year
}, 100)

</script>