+function($){ "use strict"; $('.external-event').each(function(){ $(this).data('event', { title: $.trim($(this).text()), className: [$(this).data('class')] }); }); $('.external-event').draggable({ revert: true, revertDuration: 0 }); var cal = $('#fullcalendar').fullCalendar({ theme: true, editable: false, droppable: false, header: { left: 'prev, today, next', center: 'title' }, buttonText: { prev: '', next: '' }, events: [ { "category": "online", "title": "Online: 01 h 15 min", "start": "2024-01-05", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 45 min", "start": "2024-01-06", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 54 min", "start": "2024-01-07", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 18 min", "start": "2024-01-23", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 57 min", "start": "2024-01-24", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 15 min", "start": "2024-01-25", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 06 min", "start": "2024-01-26", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 51 min", "start": "2024-01-27", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 15 min", "start": "2024-01-28", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 18 min", "start": "2024-01-30", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 24 min", "start": "2024-02-02", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 48 min", "start": "2024-02-03", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 39 min", "start": "2024-03-20", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 24 min", "start": "2024-03-22", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 54 min", "start": "2024-03-24", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 12 min", "start": "2024-03-30", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 51 min", "start": "2024-03-31", "className": ["success"] }, { "category": "online", "title": "Online: 04 h 03 min", "start": "2024-04-01", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 12 min", "start": "2024-04-02", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 24 min", "start": "2024-04-03", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 51 min", "start": "2024-04-04", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 03 min", "start": "2024-04-06", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 21 min", "start": "2024-04-11", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 33 min", "start": "2024-05-10", "className": ["success"] }, { "category": "online", "title": "Online: 03 h 18 min", "start": "2024-05-11", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 42 min", "start": "2024-05-12", "className": ["success"] }, { "category": "online", "title": "Online: 03 h 12 min", "start": "2024-05-14", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 00 min", "start": "2024-05-17", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 09 min", "start": "2024-05-20", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 27 min", "start": "2024-05-23", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 54 min", "start": "2024-05-25", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 42 min", "start": "2024-06-20", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 24 min", "start": "2024-06-21", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 24 min", "start": "2024-06-29", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 24 min", "start": "2024-06-30", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 27 min", "start": "2024-07-18", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 15 min", "start": "2024-08-05", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 30 min", "start": "2024-08-06", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 15 min", "start": "2024-08-09", "className": ["success"] }, { "category": "online", "title": "Online: 02 h 18 min", "start": "2024-08-10", "className": ["success"] }, { "category": "online", "title": "Online: 04 h 06 min", "start": "2024-08-11", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 24 min", "start": "2024-08-18", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 21 min", "start": "2024-08-19", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 27 min", "start": "2024-08-20", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 15 min", "start": "2024-08-23", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 27 min", "start": "2024-08-28", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 09 min", "start": "2024-08-29", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 57 min", "start": "2024-08-30", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 51 min", "start": "2024-09-05", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 18 min", "start": "2024-09-23", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 18 min", "start": "2024-09-25", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 39 min", "start": "2024-10-20", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 12 min", "start": "2024-10-21", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 18 min", "start": "2024-10-22", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 09 min", "start": "2024-10-23", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 54 min", "start": "2024-10-24", "className": ["success"] }, { "category": "online", "title": "Online: 00 h 57 min", "start": "2024-11-03", "className": ["success"] }, { "category": "online", "title": "Online: 01 h 27 min", "start": "2024-11-10", "className": ["success"] }, { "category": "Score", "title": "Max score: 931", "start": "2024-01-05", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1190", "start": "2024-01-06", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1043", "start": "2024-01-07", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1734", "start": "2024-01-23", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2192", "start": "2024-01-24", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1205", "start": "2024-01-25", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1402", "start": "2024-01-26", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1172", "start": "2024-01-27", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2133", "start": "2024-01-28", "className": ["primary"] }, { "category": "Score", "title": "Max score: 970", "start": "2024-01-30", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1639", "start": "2024-02-02", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1779", "start": "2024-02-03", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2795", "start": "2024-03-20", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2419", "start": "2024-03-22", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3668", "start": "2024-03-24", "className": ["primary"] }, { "category": "Score", "title": "Max score: 855", "start": "2024-03-30", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1354", "start": "2024-03-31", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2287", "start": "2024-04-01", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2278", "start": "2024-04-02", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1912", "start": "2024-04-03", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1696", "start": "2024-04-04", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2036", "start": "2024-04-06", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1811", "start": "2024-04-11", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3301", "start": "2024-05-10", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2695", "start": "2024-05-11", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1841", "start": "2024-05-12", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2500", "start": "2024-05-14", "className": ["primary"] }, { "category": "Score", "title": "Max score: 1842", "start": "2024-05-17", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3226", "start": "2024-05-20", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3153", "start": "2024-05-23", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2545", "start": "2024-05-25", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2846", "start": "2024-06-20", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2005", "start": "2024-06-21", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2589", "start": "2024-06-29", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3101", "start": "2024-06-30", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2668", "start": "2024-07-18", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2179", "start": "2024-08-05", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3684", "start": "2024-08-06", "className": ["primary"] }, { "category": "Score", "title": "Max score: 4199", "start": "2024-08-09", "className": ["primary"] }, { "category": "Score", "title": "Max score: 4199", "start": "2024-08-10", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3933", "start": "2024-08-11", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2966", "start": "2024-08-18", "className": ["primary"] }, { "category": "Score", "title": "Max score: 4440", "start": "2024-08-19", "className": ["primary"] }, { "category": "Score", "title": "Max score: 4380", "start": "2024-08-20", "className": ["primary"] }, { "category": "Score", "title": "Max score: 147", "start": "2024-08-23", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3546", "start": "2024-08-28", "className": ["primary"] }, { "category": "Score", "title": "Max score: 5071", "start": "2024-08-29", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3145", "start": "2024-08-30", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3430", "start": "2024-09-05", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3622", "start": "2024-09-23", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2758", "start": "2024-09-25", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2802", "start": "2024-10-20", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2789", "start": "2024-10-21", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2617", "start": "2024-10-22", "className": ["primary"] }, { "category": "Score", "title": "Max score: 2400", "start": "2024-10-23", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3099", "start": "2024-10-24", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3372", "start": "2024-11-03", "className": ["primary"] }, { "category": "Score", "title": "Max score: 3523", "start": "2024-11-10", "className": ["primary"] }, { "category": "likes", "title": "New Likes: 2248", "start": "2024-01-06", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2460", "start": "2024-01-07", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2031", "start": "2024-01-23", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1653", "start": "2024-01-24", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 491", "start": "2024-01-25", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 760", "start": "2024-01-26", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 334", "start": "2024-01-27", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1609", "start": "2024-01-28", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 299", "start": "2024-01-30", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1187", "start": "2024-02-02", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2239", "start": "2024-02-03", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 248", "start": "2024-03-20", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 425", "start": "2024-03-22", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 855", "start": "2024-03-24", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 103", "start": "2024-03-30", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 293", "start": "2024-03-31", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 4017", "start": "2024-04-01", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1842", "start": "2024-04-02", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 829", "start": "2024-04-03", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 691", "start": "2024-04-04", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1335", "start": "2024-04-06", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1056", "start": "2024-04-11", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1463", "start": "2024-05-10", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1622", "start": "2024-05-11", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 418", "start": "2024-05-12", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 881", "start": "2024-05-14", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 392", "start": "2024-05-17", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2275", "start": "2024-05-20", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 555", "start": "2024-05-23", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 852", "start": "2024-05-25", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 727", "start": "2024-06-20", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 495", "start": "2024-06-21", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 808", "start": "2024-06-29", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 513", "start": "2024-06-30", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 844", "start": "2024-07-18", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 689", "start": "2024-08-05", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 963", "start": "2024-08-06", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1171", "start": "2024-08-09", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1335", "start": "2024-08-10", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2010", "start": "2024-08-11", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 361", "start": "2024-08-18", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 953", "start": "2024-08-19", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2083", "start": "2024-08-20", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 62", "start": "2024-08-23", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 603", "start": "2024-08-28", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1012", "start": "2024-08-29", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 891", "start": "2024-08-30", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 526", "start": "2024-09-05", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 324", "start": "2024-09-23", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 203", "start": "2024-09-25", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 799", "start": "2024-10-20", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 486", "start": "2024-10-21", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 437", "start": "2024-10-22", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 315", "start": "2024-10-23", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 1834", "start": "2024-10-24", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 2376", "start": "2024-11-03", "className": ["purple"] }, { "category": "likes", "title": "New Likes: 8221", "start": "2024-11-10", "className": ["purple"] } ], drop: function(date) { if ($('#drop-remove').is(':checked')) { $(this).remove(); } }, dayClick: function(date, jsEvent, view) { var modal = $('#new_event_modal'); modal.modal('show'); modal.find('#event_start').val(date.format()); } }); $.fn.windowCheck = function() { var ww = $(window).width(); if(ww > 768) { cal.fullCalendar('changeView', 'month'); } else if(ww < 768 && ww > 540) { cal.fullCalendar('changeView', 'basicWeek'); } else { cal.fullCalendar('changeView', 'basicDay'); } }; $(window).on('resize', function(e){ $().windowCheck(); }); $('.fc-prev-button').append(''); $('.fc-next-button').append(''); // add new event category $('#new_event_cat_form').on('submit', function(e){ e.preventDefault(); var name = $(this).find('#category_name').val(); var color = $(this).find('#category_color').val(); var category = $('
'); category.text(name); category.addClass(color); category.data('event', { title: name, className: [color] }); category.draggable({ revert: true, revertDuration: 0 }); $('#external-events').append(category); $('#new_event_cat_modal').modal('hide'); }); // add new event $('#new_event_form').on('submit', function(e){ e.preventDefault(); var title = $(this).find('#event_title').val(); var category = $(this).find('#event_category').val(); var start = $(this).find('#event_start').val(); cal.fullCalendar('addEventSource', [ { title: title, start: start, className: [category] } ]) $('#new_event_modal').modal('hide'); }); }(jQuery);