-
Notifications
You must be signed in to change notification settings - Fork 4
/
ui-period-bar.htm
93 lines (65 loc) · 2.95 KB
/
ui-period-bar.htm
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
<!DOCTYPE html>
<html>
<head>
<title>UI Period Bar</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="basic/basic.min.css">
<script src="basic/basic.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/custom/ui-period-bar/ui-period-bar.js" type="text/javascript" charset="utf-8"></script>
<script>
const start = function() {
page.color = "white";
periodBar.create();
periodBar.createItemsByDataList(getMonthNameAndTitleDataList());
periodBar.selectItemByIndex(periodBar.getLastItemIndex())
periodBar.setVisible(1);
}
const getMonthNameAndTitleDataList = function() {
var dataList = [];
var currentIndex = date.monthNumber - 1;
var currentYear = date.year;
for (var i = 0; i < 12; i++) {
var dataObject = {};
if (i == 0) {
dataObject.title = "TODAY";
dataObject.name = date.today + " " + basic.months[currentIndex];
dataObject.day = date.today;
} else if (i == 1) {
dataObject.title = "LAST MONTH";
dataObject.name = basic.months[currentIndex];
dataObject.day = 0;
} else {
dataObject.title = ("{value} MONTHS AGO").replace("{value}", i);
if (currentYear == date.year) {
dataObject.name = basic.months[currentIndex];
} else {
dataObject.name = basic.months[currentIndex] + " " + currentYear;
}
dataObject.day = 0;
}
dataObject.year = currentYear;
dataObject.monthNumber = currentIndex + 1;
dataList.unshift(dataObject);
currentIndex--;
if (currentIndex < 0) {
currentIndex = 11;
currentYear--;
}
}
/*
var dataList = [
{ "title": "3 AY ÖNCE", "name": "Mart", "mount": "5", "day": "30", "year": "2022" },
{ "title": "2 AY ÖNCE", "name": "Nisan", "mount": "5", "day": "30", "year": "2022" },
{ "title": "GEÇEN AY", "name": "Mayıs", "mount": "5", "day": "30", "year": "2022" },
{ "title": "BU AY", "name": "24 Haziran", "mount": "5", "day": "30", "year": "2022" },
]
*/
return dataList;
}
</script>
</head>
<body>
<!-- HTML content -->
</body>
</html>