Welcome to mirror list, hosted at ThFree Co, Russian Federation.

app.js « js « static - github.com/rz3n/hugo-theme-freshstart.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7bd0920bd0b61827c25cb2d5030170ccf1b77eb5 (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
function init() {
  initClock();
  loadLists();
}

function initClock() {
  var today = new Date();
  var h = today.getHours();
  var m = today.getMinutes();
  var s = today.getSeconds();
  var dd = today.getDate();
  var mm = today.getMonth() + 1; //January is 0!
  var yyyy = today.getFullYear();

  if (dd < 10)
    dd = '0' + dd
  if (mm < 10)
    mm = '0' + mm
  if (h < 10)
    h = '0' + h
  if (m < 10)
    m = '0' + m
  if (s < 10)
    s = '0' + s

  $(".time-hours").html(h);
  $(".time-minutes").html(m);
  $(".time-seconds").html(s);
  $(".date-day").html(dd);
  $(".date-month").html(mm);
  $(".date-year").html(yyyy);

  if (h < 12) {
    $(".greetings-title").html("Good Morning");
  } else if (h >= 12 && h < 19) {
    $(".greetings-title").html("Good Afternoon");
  } else {
    $(".greetings-title").html("Good Evening");
  }

  var t = setTimeout(initClock, 500);
}

function loadLists() {
  var into = $('#result');

  function fileRetrieved(contents) {
    var lines = contents.split('\n');
    for (var i = 0; i < lines.length; i += 1) {
      createListElement(lines[i]);
    }
  }

  function createListElement(text) {
    var el = $('<li></li>').html(text);
    el.appendTo(into);
  }

  var text = $('#text').html();
  fileRetrieved(text);
}