如何运行另一个完整日历实例

时间:2018-08-02 07:51:20

标签: javascript jquery

我需要另一个完整日历实例,一个用于带有完整日历的页面,另一个用于模态窗口,用于日视图。

当我使用Modal calander窗口添加任何内容时,即使它也将其添加到页面中,灰都会显示在下面的图片中。

这是脚本,但是另一个实例无法正常工作。

var Calendar = function () {
    var a = function () {
        var a = $("#event-management");

        $("#event-categories div.event-category").each(function () {
            var a = {
                title: $.trim($(this).text())
            };
            $(this).data("eventObject", a), $(this).draggable({
                zIndex: 999,
                revert: !0,
                revertDuration: 50
            })
        });
        var b = new Date,
            c = b.getDate(),
            d = b.getMonth(),
            e = b.getFullYear(),
            f = "",
            g = $("#calendar").fullCalendar({
                themeButtonIcons: {
                    prev: '<i class="fa fa-angle-left"></i>',
                    next: '<i class="fa fa-angle-right"></i>'
                },
                header: {
                    //left: "prev,next today",
                    left: "prev,next",
                    right: "title",
                    // right: "agendaDay,agendaWeek,month"
                },

                editable: !0,
                droppable: !0,
                drop: function (a, b) {
                    var c = $(this).data("eventObject"),
                        d = $(this).attr("data-class"),
                        e = $.extend({}, c);
                    e.start = a, e.allDay = b, d && (e.className = [d]), $("#calendar").fullCalendar("renderEvent", e, !0), $("#drop-remove").is(":checked") && $(this).remove()
                },
                defaultView: 'agendaDay',
                selectable: !0,
                selectHelper: !0,
                select: function (b, c, d) {
                    a.modal({
                        backdrop: "static"
                    }), f = $("<form></form>"), f.append("<div class='row'></div>"), f.find(".row").append("<div class='col-md-6'><div class='form-group'><label class='control-label'>New Event Name</label><input class='form-control' placeholder='Insert Event Name' type=text name='title'/></div></div>").append("<div class='col-md-6'><div class='form-group'><label class='control-label'>Category</label><select class='form-control' name='category'></select></div></div>").find("select[name='category']").append("<option value='label-default'>Work</option>").append("<option value='label-green'>Home</option>").append("<option value='label-purple'>Holidays</option>").append("<option value='label-orange'>Party</option>").append("<option value='label-yellow'>Birthday</option>").append("<option value='label-teal'>Generic</option>").append("<option value='label-beige'>To Do</option>"), a.find(".remove-event").hide().end().find(".save-event").show().end().find(".modal-body").empty().prepend(f).end().find(".save-event").unbind("click").click(function () {
                        f.submit()
                    }), a.find("form").on("submit", function () {
                        return title = f.find("input[name='title']").val(), $categoryClass = f.find("select[name='category'] option:checked").val(), null !== title && g.fullCalendar("renderEvent", {
                            title: title,
                            start: b,
                            end: c,
                            allDay: d,
                            className: $categoryClass
                        }, !0), a.modal("hide"), !1
                    }), g.fullCalendar("unselect")
                },
                eventClick: function (b, c, d) {
                    var e = $("<form></form>");
                    e.append("<label>Change event name</label>"), e.append("<div class='input-group'><input class='form-control' type=text value='" + b.title + "' /><span class='input-group-btn'><button type='submit' class='btn btn-success'><i class='fa fa-check'></i> Save</button></span></div>"), a.modal({
                        backdrop: "static"
                    }), a.find(".remove-event").show().end().find(".save-event").hide().end().find(".modal-body").empty().prepend(e).end().find(".remove-event").unbind("click").click(function () {
                        g.fullCalendar("removeEvents", function (a) {
                            return a._id == b._id
                        }), a.modal("hide")
                    }), a.find("form").on("submit", function () {
                        return b.title = e.find("input[type=text]").val(), g.fullCalendar("updateEvent", b), a.modal("hide"), !1
                    })
                }
            })
    };
    return {
        init: function () {
            a()
        }
    }
}();

0 个答案:

没有答案