UNPKG

calenstyle

Version:

CalenStyle is a Responsive Drag-and-Drop Event Calendar for Web, iOS, Android & Windows. CalenStyle is customizable plugin having multiple, clean-designed event calendar templates specially designed for web & mobile applications.

202 lines (155 loc) 6.88 kB
<!DOCTYPE html> <html> <head> <title>MonthView with Event List for Mobile</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-custom-1.11.2.min.js"></script> <link rel="stylesheet" type="text/css" href="../css/jquery-ui-custom-1.11.2.min.css" /> <script type="text/javascript" src="../js/jquery.ui.touch-punch.js"></script> <script type="text/javascript" src="../js/hammer.min.js"></script> <script type="text/javascript" src="../js/fastclick.js"></script> <link rel="stylesheet" type="text/css" href="../../src/calenstyle.css" /> <link rel="stylesheet" type="text/css" href="../../src/calenstyle-jquery-ui-override.css" /> <link rel="stylesheet" type="text/css" href="../../src/calenstyle-iconfont.css" /> <script type="text/javascript" src="../../src/calenstyle.js"></script> <link rel="stylesheet" type="text/css" href="../css/CalEventList.css" /> <script type="text/javascript" src="../js/CalJsonGenerator.js"></script> <style type="text/css"> .calendarContOuter { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; font-size: 14px; text-shadow: none; } .cElemDatePicker { font-size: 13px; } .cActionBar { line-height: 30px; background: #F5F5F5; } .cs-ex-actionbar { margin-left: 30px; color: #9E9E9E; } .cs-ex-actionbutton { margin-left: 10px; padding: 3px 5px; border-radius: 2px; background: #444444; font-size: 80%; color: #FFFFFF; cursor: not-allowed; } </style> <script type="text/javascript"> $(document).ready(function() { FastClick.attach(document.body); var oCal1; $(".calendarContOuter").CalenStyle( { initialize: function() { oCal1 = this; console.log(oCal1); }, visibleView: "MonthView", sectionsList: ["Header", "Calendar", "ActionBar", "EventList"], headerSectionsList: { left: ["HeaderLabelWithDropdownMenuArrow"], center: [], right: ["PreviousButton", "NextButton"] }, dropdownMenuElements: ["DatePicker"], displayWeekNumberInMonthView: false, isTooltipInMonthView: false, calDataSource: [ { sourceFetchType: "DateRange", sourceType: "FUNCTION", source: function(fetchStartDate, fetchEndDate, durationStartDate, durationEndDate, oConfig, loadViewCallback) { var calObj1 = this; calObj1.incrementDataLoadingCount(1); var oEventResponse = generateJsonEvents(fetchStartDate, fetchEndDate); console.log("Response " + fetchStartDate + " " + fetchEndDate); console.log(oEventResponse); if(oEventResponse != undefined) { if(oEventResponse[0]) { calObj1.parseDataSource("eventSource", oEventResponse[1], durationStartDate, durationEndDate, loadViewCallback, oConfig, false); } } } } ], isDragNDropInMonthView: false, displayEventsForPeriodInList: function(listStartDate, listEndDate) { return displayEventsInList(this, listStartDate, listEndDate); }, eventListAppended: function() { adjustList(); }, cellClicked: function(sView, dSelectedDate, bIsAllDay, pClickedAt) { console.log("Cell Clicked : " + dSelectedDate); }, eventClicked: function() { console.log("Event Clicked"); }, useHammerjsAsGestureLibrary: true, //hideEventIcon: {Default: false}, hideEventTime: {Default: true}, modifyActionBarView: function($oActionBar, sVisibleView) { $oActionBar.append("<span class='cs-ex-actionbar'>This is Action Bar. You can add any UI component here.</span><span class='cs-ex-actionbutton'>e.g Text, Button</span>"); } }); setTimeout(function() { adjustList(); oCal1.adjustMonthTable(); }, 0); $(window).resize(function() { adjustList(); }); function adjustList() { var oCal3 = $(".calendarContOuter").CalenStyle(); var iEventWidth = $(oCal3.elem).width(), iEventColorWidth = $(".cListEventColor").outerWidth(true), iEventIconWidth = $(".cListEventIcon span").outerWidth(true), oElems = $(".cListEventTime span"); var iMaxWidth = Math.max.apply(null, $(oElems).map(function() { return $(this).outerWidth(true); }).get()); iMaxWidth += 5; $(".cListEventTime").css({"width": iMaxWidth}); var iEventTitleWidth = iEventWidth - (iEventColorWidth + iMaxWidth + iEventIconWidth) - 25; $(".cListEventTitle").css({"width": iEventTitleWidth}); } }); </script> </head> <body> <div class="calendarContOuter"></div> </body> </html>