|
21 | 21 |
|
22 | 22 | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.4.2/tabletop.min.js"></script> |
23 | 23 | <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) { |
33 | 34 | try { |
34 | 35 | var parsedDate = date.split('.') |
35 | 36 | return new Date('20' + parsedDate[2], parsedDate[0] - 1, parsedDate[1]) |
36 | | - } catch(_){ |
| 37 | + } catch (_) { |
37 | 38 | return date |
38 | 39 | } |
39 | 40 | } |
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()) |
43 | 43 | } |
44 | | -
|
45 | | - function showInfo(data, tabletop) { |
| 44 | + function showInfo (data, tabletop) { |
46 | 45 | data.reverse() |
47 | 46 | var html = '' |
48 | 47 | var list = document.getElementsByClassName('news-list') |
49 | | -
|
50 | 48 | data.forEach(function (row) { |
51 | 49 | 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>' |
53 | 51 | }) |
54 | 52 | if (list && list[0]) list[0].innerHTML = html |
55 | 53 | } |
56 | 54 | } |
57 | | - </script> |
| 55 | + </script> |
58 | 56 |
|
59 | | - </div> |
60 | 57 | </div> |
| 58 | + </div> |
61 | 59 |
|
62 | | - {{> footer }} |
63 | | - </body> |
64 | | - </html> |
| 60 | + {{> footer }} |
| 61 | +</body> |
| 62 | +</html> |
0 commit comments