From 4d82c726c39ebca56bde30665f00d728c2d7a20b Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 5 Apr 2016 15:03:12 -0300 Subject: Dynamically show events on tabcalendar --- public/js/calendar.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/public/js/calendar.js b/public/js/calendar.js index 2f402ae..8818c99 100644 --- a/public/js/calendar.js +++ b/public/js/calendar.js @@ -1,7 +1,27 @@ +var hide_events = function() { + $('.tabcalendar-event-details').hide(); +}; +var show_event = function(event_id) { + hide_events(); + $('.tabcalendar-event-details' + event_id).show(); +}; + $(function() { $('.calendar-listing>p').click(function() { $(this).next().toggle('fast'); return false; }).next().hide(); + $('.tabcal-cell a').each(function(i,a) { + var hashpos = a.href.indexOf('#'); + if (haspos < 0) + return true; + var hash = a.href.slice(hashpos); + if (!hash.startsWith('#event-')) + return true; + a.click(function() { + show_event(hash); + return false; + }); + }); + hide_events(); }); - -- cgit v1.2.1