function eventtest(title,feed,link) {
$.getJSON(feed,printevents);
var enmonths = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
var frmonths = ["jan", "fév", "mar", "avr", "mai", "jun", "jul", "aoû", "sep", "oct", "nov", "déc"];
// checks if page is on the FR site
function isfrench() {
return $('.fr-CA').length;
}
// chooses FR or EN months
function month(month) {
if (isfrench()) {
return frmonths[month];
}
return enmonths[month];
}
// chooses FR or EN event link
function whichsite() {
if (isfrench()) {
return 'evenements';
}
return 'events';
}
// trims description to 65 characters
function trim(description) {
return $.trim(description).substring(0, 65).split(" ").slice(0, -1).join(" ") + "...";
}
// chooses FR or EN link text
function seeall() {
if (isfrench()) {
return '<p class="eventfooter"><a href="' + link + '">Tout afficher</a></p>';
}
return '<p class="eventfooter"><a href="' + link + '">See all events</a></p>';
}
// prints HTML on the page
function printevents(data) {
if (data.length) {
// inserts feed title
$("#eventfeed").append('<h2 class="nomargin">' + title + '</h2>\n<ul>\n</ul>');
// prints each event
for (var i = 0; i < data.length; i++) {
// fixes date format for IE and Safari
var rawdate = $.trim(data[i].node_data_field_event_date_field_event_date_value).substring(0, 10).split("-");
var eventdate = new Date(rawdate[0], rawdate[1]-1, rawdate[2]);
$("#eventfeed ul").append(
'<li>\n' +
'<div class="eventdate">\n' +
'<p class="eventday">' +...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.