Skip to content
This repository was archived by the owner on May 16, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions js/timelineScheduler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Copyright (c) 2013 Zallist
/*! Copyright (c) 2013 Zallist

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -26,6 +26,12 @@
/// <reference path="jquery-ui-1.10.2.custom.min.js" />
/// <reference path="moment.min.js" />

;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.TimeScheduler = factory()
}(this, (function () { 'use strict';
var isEven,time;
var TimeScheduler = {
Options: {
/* The function to call to fill up Sections.
Expand Down Expand Up @@ -160,7 +166,10 @@ var TimeScheduler = {
ItemEventMouseEnter: null,

// function (eventData, itemData)
ItemEventMouseLeave: null
ItemEventMouseLeave: null,

// function (item, start, period)
TimeShiftClicked: null
},

// Should dragging be enabled?
Expand Down Expand Up @@ -249,7 +258,11 @@ var TimeScheduler = {

TimeScheduler.Options.Start = moment(TimeScheduler.Options.Start);

TimeScheduler.Options.Element.find('.ui-draggable').draggable('destroy');
// it only destroys draggable element if dragging is enabled
if(TimeScheduler.Options.AllowDragging){
TimeScheduler.Options.Element.find('.ui-draggable').draggable('destroy');
}

TimeScheduler.Options.Element.empty();

TimeScheduler.Wrapper = $(document.createElement('div'))
Expand Down Expand Up @@ -1059,6 +1072,7 @@ var TimeScheduler = {
})
.appendTo($(this))
.datepicker({
dateFormat: "yy-mm-dd",
onClose: function () {
$(this).remove();
},
Expand Down Expand Up @@ -1086,7 +1100,9 @@ var TimeScheduler = {
else if ($(this).is('.time-sch-time-button-next')) {
TimeScheduler.Options.Start.tsAdd('minutes', period.TimeframeOverall);
}

if ( TimeScheduler.Options.Events.TimeShiftClicked ) {
TimeScheduler.Options.Events.TimeShiftClicked.call(this, TimeScheduler.Options.Start, period);
}
TimeScheduler.Init();
},

Expand All @@ -1100,4 +1116,8 @@ var TimeScheduler = {
event.preventDefault();
TimeScheduler.SelectPeriod($(this).data('period').Name);
}
};
};

return TimeScheduler;

})));