var SITE_ROOTS = [ // usually, there would be a single URL here // but turns out that if you have both https and http // (which is NOT recommended), webmention treats them // as different URLs. 'https://indiewebcamp.com/', 'http://indiewebcamp.com/' ]; var MAX_CONTENT_LENGTH = 141; // better than twitter :p window.mentions = []; function resetMentions() { window.mentions = []; displayMentions(window.mentions); } function addMentions(data) { var links = data['links']; for (l in links) { if (links[l].data) { links[l].the_url = links[l].data.url||links[l].source; links[l].the_time = links[l].data.published||links[l].verified_date; } else { links[l].the_url = links[l].source; links[l].the_time = links[l].verified_date; } } window.mentions = window.mentions.concat(links); window.mentions.sort(function(a,b) { return b.the_time.localeCompare(a.the_time); }); displayMentions(window.mentions); } function displayMentions(data) { // This helper lets you format an ugly ISO timestamp // as a nice GMT time (for queen and country). // See how {{#FormatGMT}} is used in the template. var FormatGMT = function() { return function(text,render) { return new Date(render(text)).toGMTString().split(', ')[1]; }; }; // This helper lets you dehtmlize and truncate content // See how {{#FormatContent}} is used in the template. var FormatContent = function() { return function(text,render) { var s=render(text).replace(/(<.*?>)/ig,""); if (s.length