You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.7 KiB

4 years ago
  1. ! function (e) {
  2. "use strict";
  3. var t = function () { };
  4. t.prototype.init = function () {
  5. if (e.isFunction(e.fn.fullCalendar)) {
  6. e("#external-events .fc-event").each(function () {
  7. var t = {
  8. title: e.trim(e(this).text())
  9. };
  10. e(this).data("eventObject", t), e(this).draggable({
  11. zIndex: 999,
  12. revert: !0,
  13. revertDuration: 0
  14. })
  15. });
  16. var t = new Date,
  17. a = t.getDate(),
  18. n = t.getMonth(),
  19. r = t.getFullYear();
  20. e("#calendar").fullCalendar({
  21. header: {
  22. left: "prev,next today",
  23. center: "title",
  24. right: "month,basicWeek,basicDay"
  25. },
  26. editable: !0,
  27. eventLimit: !0,
  28. droppable: !0,
  29. drop: function (t, a) {
  30. var n = e(this).data("eventObject"),
  31. r = e.extend({}, n);
  32. r.start = t, r.allDay = a, e("#calendar").fullCalendar("renderEvent", r, !0), e("#drop-remove").is(":checked") && e(this).remove()
  33. },
  34. events: [{
  35. title: "All Day Event",
  36. start: new Date(r, n, 1)
  37. }, {
  38. title: "Long Event",
  39. start: new Date(r, n, a - 5),
  40. end: new Date(r, n, a - 2)
  41. }, {
  42. id: 999,
  43. title: "Repeating Event",
  44. start: new Date(r, n, a - 3, 16, 0),
  45. allDay: !1
  46. }, {
  47. id: 999,
  48. title: "Repeating Event",
  49. start: new Date(r, n, a + 4, 16, 0),
  50. allDay: !1
  51. }, {
  52. title: "Meeting",
  53. start: new Date(r, n, a, 10, 30),
  54. allDay: !1
  55. }, {
  56. title: "Lunch",
  57. start: new Date(r, n, a, 12, 0),
  58. end: new Date(r, n, a, 14, 0),
  59. allDay: !1
  60. }, {
  61. title: "Birthday Party",
  62. start: new Date(r, n, a + 1, 19, 0),
  63. end: new Date(r, n, a + 1, 22, 30),
  64. allDay: !1
  65. }, {
  66. title: "Click for Google",
  67. start: new Date(r, n, 28),
  68. end: new Date(r, n, 29),
  69. url: "http://google.com/"
  70. }]
  71. }), e("#add_event_form").on("submit", function (t) {
  72. t.preventDefault();
  73. var a = e(this).find(".new-event-form"),
  74. n = a.val();
  75. if (n.length < 3) a.focus();
  76. else {
  77. var r = "new" + Math.random().toString(36).substring(7);
  78. e("#external-events").append('<div id="' + r + '" class="fc-event">' + n + "</div>");
  79. var i = {
  80. title: e.trim(e("#" + r).text())
  81. };
  82. e("#" + r).data("eventObject", i), e("#" + r).draggable({
  83. revert: !0,
  84. revertDuration: 0,
  85. zIndex: 999
  86. }), a.val("").focus()
  87. }
  88. })
  89. } else alert("Calendar plugin is not installed")
  90. }, e.CalendarPage = new t, e.CalendarPage.Constructor = t
  91. }(window.jQuery),
  92. function (e) {
  93. "use strict";
  94. e.CalendarPage.init()
  95. }(window.jQuery);