Skip to content

Commit 1eb53ec

Browse files
authored
layouts/in-the-news.hbs: Use JS standard style (#1352)
1 parent d55cc19 commit 1eb53ec

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

layouts/in-the-news.hbs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,42 @@
2121

2222
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.4.2/tabletop.min.js"></script>
2323
<script type="text/javascript">
24-
var public_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/1jSxgB5MYd1xCOmhb5QZ90PbDiY57n4z4A0lcdQD-UG8/pubhtml';
25-
window.onload = function () {
26-
Tabletop.init( { key: public_spreadsheet_url,
27-
callback: showInfo,
28-
simpleSheet: true } )
29-
30-
function pad(str) { return ("0"+str).substr(-2) }
31-
32-
function parseDate(date) {
24+
/* global Tabletop */
25+
var publicSpreadsheetUrl = 'https://docs.google.com/spreadsheets/d/1jSxgB5MYd1xCOmhb5QZ90PbDiY57n4z4A0lcdQD-UG8/pubhtml'
26+
window.onload = function () {
27+
Tabletop.init({
28+
key: publicSpreadsheetUrl,
29+
callback: showInfo,
30+
simpleSheet: true
31+
})
32+
function pad (str) { return ('0' + str).substr(-2) }
33+
function parseDate (date) {
3334
try {
3435
var parsedDate = date.split('.')
3536
return new Date('20' + parsedDate[2], parsedDate[0] - 1, parsedDate[1])
36-
} catch(_){
37+
} catch (_) {
3738
return date
3839
}
3940
}
40-
41-
function formatDate(date) {
42-
return date == "Invalid Date" ? '' : date.getFullYear()+'-'+pad(date.getMonth()+1)+'-'+pad(date.getDate())
41+
function formatDate (date) {
42+
return date === 'Invalid Date' ? '' : date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate())
4343
}
44-
45-
function showInfo(data, tabletop) {
44+
function showInfo (data, tabletop) {
4645
data.reverse()
4746
var html = ''
4847
var list = document.getElementsByClassName('news-list')
49-
5048
data.forEach(function (row) {
5149
var date = parseDate(row.Date)
52-
html += '<li><time datetime="'+date+'">'+formatDate(date)+'</time><a href="'+row.Link+'">'+row.Title+'</a></li>'
50+
html += '<li><time datetime="' + date + '">' + formatDate(date) + '</time><a href="' + row.Link + '">' + row.Title + '</a></li>'
5351
})
5452
if (list && list[0]) list[0].innerHTML = html
5553
}
5654
}
57-
</script>
55+
</script>
5856

59-
</div>
6057
</div>
58+
</div>
6159

62-
{{> footer }}
63-
</body>
64-
</html>
60+
{{> footer }}
61+
</body>
62+
</html>

0 commit comments

Comments
 (0)