Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into Announcements
  • Loading branch information
pierreneter authored Sep 6, 2017
commit b3a81d8d9d495409ab7965e797c0819c799bdae2
41 changes: 20 additions & 21 deletions layouts/in-the-news.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,33 @@

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.4.2/tabletop.min.js"></script>
<script type="text/javascript">
var public_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/1jSxgB5MYd1xCOmhb5QZ90PbDiY57n4z4A0lcdQD-UG8/pubhtml';
window.onload = function () {
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
simpleSheet: true } );

function pad(str) { return ("0"+str).substr(-2); }

function parseDate(date) {
/* global Tabletop */
var publicSpreadsheetUrl = 'https://docs.google.com/spreadsheets/d/1jSxgB5MYd1xCOmhb5QZ90PbDiY57n4z4A0lcdQD-UG8/pubhtml'
window.onload = function () {
Tabletop.init({
key: publicSpreadsheetUrl,
callback: showInfo,
simpleSheet: true
})
function pad (str) { return ('0' + str).substr(-2) }
function parseDate (date) {
try {
var parsedDate = date.split('.');
return new Date('20' + parsedDate[2], parsedDate[0] - 1, parsedDate[1]);
} catch(_){
return date;
var parsedDate = date.split('.')
return new Date('20' + parsedDate[2], parsedDate[0] - 1, parsedDate[1])
} catch (_) {
return date
}
}
function formatDate (date) {
return date === 'Invalid Date' ? '' : date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate())
}

function showInfo(data, tabletop) {
data.reverse();
var html = '';
var list = document.getElementsByClassName('news-list');

function showInfo (data, tabletop) {
data.reverse()
var html = ''
var list = document.getElementsByClassName('news-list')
data.forEach(function (row) {
var date = parseDate(row.Date);
html += '<li><time datetime="'+date+'">'+formatDate(date)+'</time><a href="'+row.Link+'">'+row.Title+'</a></li>';
var date = parseDate(row.Date)
html += '<li><time datetime="' + date + '">' + formatDate(date) + '</time><a href="' + row.Link + '">' + row.Title + '</a></li>'
})
if (list && list[0]) list[0].innerHTML = html;
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.