Open thewaywest opened 6 years ago
Since this is a flat site (no node), the module export fails. I have preceded that call with a quick test of "modules" to avoid errors in the build -- seems to be unobtrusive for other implementations...
lines 1207-1209:
(() => {
if (typeof module !== 'undefined') module.exports = {JSCalendar, JSCalendarEvent}
})(JSCalendar, JSCalendarEvent)
I've hacked the source js to add three options that support my flat site needs -- a hundred characters or so, adding if () statements are listener instatin blocks, or before callog lines. If interested, let me know and I will check in:
var calendar = new JSCalendar(calNode, {
titleCropSize: 30,
height: 500,
width: (desk ? 1170 : winx - 20),
buttonsVocab: buttons[lang],
monthsVocab: months[lang],
daysVocab: days[lang],
ampm: false,
noDrag: true, <<< turn off draggability for read-only calendars
noDrill: true, <<< diables drill-to-day from week or month view when not allowing switching
noLog: true <<< disable the console log when not needed for debugging
});
Thanks for this great, light calendar. I am using it with a Hugo website, and have applied a few hacks to simplify my use case. One or two of these might be useful to incorporate in a future version... :)
I've employed a few css hacks as well, most importantly resizing the calendar widget as a whole to 100%... for some reason, in my inherited website, the responsive option wasn't playing well (likely a problem with my page grid classes...). I put the coloring into my LESS file so I could easily use a color-picker ... not necessary but helpful in VsCode (actually, no good for multiple colors, so I am reverting that). I also added a COLOR attrib so that I could go with lighter backgrounds.
// add new events to the top of the list var events = [ { d:"2018-09-15 08:30", h:"8.5", r:"29", n:"Day of Mindfulness", c:"", l:"/pages/dayofmindfulness" }, { d:"2018-09-05 17:30", h:"2.5", r:"12,19,26", n:"Meditation", c:"", l:"/practices/practice" } ];
// js language resources var buttons = {}; buttons['en'] = { previous: "previous", today: "TODAY", next: "next" }; buttons['ca'] = { previous: "anterior", today: "AVUI", next: "pròxim" }; buttons['es'] = { previous: "anterior", today: "HOY", next: "próximo" };
var days = {}; days['en'] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; days['ca'] = ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Disabtes"]; days['es'] = ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"];
var months = {}; months['en'] = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; months['ca'] = ["Gener", "Fevrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"]; months['es'] = ["Enero", "Fevrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];