-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.html
More file actions
161 lines (153 loc) · 5.4 KB
/
Copy pathtemplate.html
File metadata and controls
161 lines (153 loc) · 5.4 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LineageOS Devices by Release Date</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f4f9;
}
h1 {
text-align: center;
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
overflow-x: auto; /* Allows horizontal scroll on small screens */
}
th, td {
padding: 12px 15px;
text-align: left;
word-wrap: break-word; /* Allows long words to break and fit in cells */
}
th {
background-color: #167c80;
color: #ffffff;
font-weight: bold;
}
th.sortable {
cursor: pointer;
user-select: none;
}
th.sortable:hover {
background-color: #1a9499;
}
th.sortable::after {
content: ' \2195';
opacity: 0.5;
font-size: 0.8em;
}
th.sortable.asc::after {
content: ' \2191';
opacity: 1;
}
th.sortable.desc::after {
content: ' \2193';
opacity: 1;
}
tr:nth-child(even) {
background-color: #f3f3f3;
}
tr:hover {
background-color: #f1f1f1;
}
td {
border-bottom: 1px solid #dddddd;
}
.update-note, .source-code {
text-align: center;
color: #555;
font-size: 0.9em;
margin-top: 10px;
}
@media (max-width: 768px) {
table {
font-size: 0.9em; /* Adjust font size on smaller screens */
}
th, td {
padding: 8px 10px; /* Adjust padding on smaller screens */
}
}
@media (max-width: 480px) {
table {
font-size: 0.8em; /* Further adjust font size on very small screens */
}
th, td {
padding: 6px 8px; /* Further adjust padding on very small screens */
}
.update-note, .source-code {
font-size: 0.8em; /* Adjust font size of notes on very small screens */
}
}
</style>
</head>
<body>
<h1>LineageOS devices by release date</h1>
<table>
${header}
${table_data}
</table>
<div class="update-note">
Last updated on: ${date_update}
</div>
<div class="source-code">
<a href="https://github.com/dbeley/lineageos-devices-timeline">Source code</a>
</div>
<script>
(function() {
var table = document.querySelector('table');
var tbody = table.querySelector('tbody');
var rows = Array.from(tbody.querySelectorAll('tr'));
var headers = Array.from(table.querySelectorAll('th.sortable'));
var currentSort = { column: null, asc: false };
function getCellValue(row, colIndex) {
return row.children[colIndex].textContent.trim();
}
function sortTable(colIndex, asc) {
var sortedRows = rows.sort(function(a, b) {
var aVal = getCellValue(a, colIndex);
var bVal = getCellValue(b, colIndex);
if (aVal === 'Unknown') aVal = '0000-00-00';
if (bVal === 'Unknown') bVal = '0000-00-00';
if (!isNaN(aVal) && !isNaN(bVal)) {
return asc ? aVal - bVal : bVal - aVal;
}
return asc ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
});
sortedRows.forEach(function(row) { tbody.appendChild(row); });
}
headers.forEach(function(th) {
th.addEventListener('click', function() {
var colIndex = Array.from(this.parentNode.children).indexOf(this);
var column = this.getAttribute('data-column');
var asc = true;
if (currentSort.column === column) {
asc = !currentSort.asc;
} else if (this.hasAttribute('data-default-sort')) {
asc = this.getAttribute('data-default-sort') === 'asc';
}
headers.forEach(function(h) { h.classList.remove('asc', 'desc'); });
this.classList.add(asc ? 'asc' : 'desc');
sortTable(colIndex, asc);
currentSort = { column: column, asc: asc };
});
});
var defaultHeader = table.querySelector('th[data-default-sort]');
if (defaultHeader) {
var colIndex = Array.from(defaultHeader.parentNode.children).indexOf(defaultHeader);
var asc = defaultHeader.getAttribute('data-default-sort') === 'asc';
defaultHeader.classList.add(asc ? 'asc' : 'desc');
sortTable(colIndex, asc);
currentSort = { column: defaultHeader.getAttribute('data-column'), asc: asc };
}
})();
</script>
</body>
</html>