Compare commits

..

39 commits

Author SHA1 Message Date
Denis Knauf faa16696d2 Makefile: Makefile instead shellscript 2012-01-23 13:29:56 +01:00
Wojciech Zylinski b2941025f1 Calculate slot height based on the second row instead of first inner div. The reason we pick second row is to substract height of the first row (without border-top) to also calculate border-size. This should fix following issues:
* 1229: In "Week" and "Day" modes, selection doesn't work correctly if font-size != 14px
* 650: my events does not render correctly
* 1035:	On select click event selection start below mouse position
* 1149: strange behavior in selectable demo
2012-01-08 22:46:27 +00:00
Wojciech Zylinski d234db1972 Fix for Issue 1179: Call to eventElement.draggable() in draggableDayEvent() throws exception 2012-01-08 04:18:33 +00:00
Wojciech Zylinski 41dbc6d238 Applied patch for Issue 970: fix bad division slash in code 2012-01-08 04:09:48 +00:00
Wojciech Zylinski 6ae1be4ca1 Fix for Issue 1130: updateEvent backgroundColor bug 2012-01-08 04:00:23 +00:00
Wojciech Zylinski f078b47b86 Define events variable. 2012-01-08 03:49:07 +00:00
Wojciech Zylinski 20d46ef2d7 Merge remote-tracking branch 'FagnerMartinsBrack/master' 2012-01-08 03:39:20 +00:00
Wojciech Zylinski 75abd3f0cc Merge remote-tracking branch 'sergio-fry/master' 2012-01-08 03:37:00 +00:00
Wojciech Zylinski f01997d4e9 Merge remote-tracking branch 'teambox/master' 2012-01-08 03:33:21 +00:00
Wojciech Zylinski 96e6978923 Merge remote-tracking branch 'althaus/devel' 2012-01-08 03:29:21 +00:00
Wojciech Zylinski 572741f5f0 Merge remote-tracking branch 'jerrett/master' 2012-01-08 03:26:43 +00:00
Wojciech Zylinski ad5dbabb35 Merge remote-tracking branch 'joeyespo/master' 2012-01-08 03:22:18 +00:00
Wojciech Zylinski 8c6b761bbd Merge remote-tracking branch 'Solgema/master' 2012-01-08 03:20:28 +00:00
Wojciech Zylinski 277b14fc06 Merge remote-tracking branch 'mastahu/master' 2012-01-08 03:19:32 +00:00
Wojciech Zylinski f800f3c492 Merge remote-tracking branch 'adobo/master' 2012-01-08 03:18:05 +00:00
James McLaughlin 418399988a Change bodyVisible to check the body element actually exists before accessing offsetWidth.
This prevents errors if FC is used before the DOM has loaded (ie. on an invisible element).
2012-01-02 16:56:30 +00:00
Jorge López Pérez d3e3047bf8 Merge branch 'buttons-ui' 2011-12-23 13:55:54 +01:00
Jorge López Pérez 3a4dab8936 Apply ui-button class to buttons when needed 2011-12-23 13:43:25 +01:00
Jorge López Pérez 698dddf846 Merge remote-tracking branch 'upstream/master' 2011-12-23 13:01:49 +01:00
Your Name 73bb0ad051 Fixed ussue 1206: Moving from "allDay" event to Day timeline should set end time/date 2011-12-14 19:38:28 +01:00
Solgema 74ba72cdfa added minSlotNumber and maxSlotNumber to be able to limit the size of the event that can be added. 2011-12-13 15:40:50 +01:00
Joe Esposito 1109667cd4 Added the 'eventTransform' option to allow event transformations coming from a JSON event source. 2011-12-05 10:44:19 -05:00
Adam Shaw 56ae9f1cbf using jquery 1.7, latest jquery ui, and fixed dragging bug (issue 1168) 2011-11-19 18:21:10 -08:00
Jerrett 383e3d23e4 option for date only for next/prev... 2011-10-26 17:16:29 -07:00
Matthias Althaus afd38c48df Merge branch 'dayrender' into devel 2011-10-26 11:44:24 +02:00
Jorge López Pérez c0e8970c66 Add startParamUTC and endParamUTC options 2011-10-24 14:23:31 +02:00
Matthias Althaus 9fd8c4fab1 Added dayRender trigger
Thanks to manchev for code snippet.
2011-10-21 11:40:29 +02:00
Matthias Althaus 47a5c83caf Merge branch 'linked-events' of git@github.com:althaus/fullcalendar into linked-events 2011-10-20 12:43:36 +02:00
root 5b3f14fe70 Added an option to link events by an extra property 2011-10-20 12:41:29 +02:00
root 4f07a74e69 Added an option to link events by an extra property 2011-10-20 12:27:34 +02:00
Pablo Villalba 7508cf185e Adding 4 weeks view 2011-09-10 17:55:12 +02:00
Adam Shaw 477c2960a8 final touches for 1.5.2 2011-08-21 22:06:09 -07:00
Adam Shaw b33e6aeed9 fixed issue 750 (Z in date parsing) and added test 2011-08-21 21:56:48 -07:00
Sergei O. Udalov 342325766b redundant function removed (thanks to Thinkscape) 2011-08-10 13:04:47 +04:00
Sergei O. Udalov ef75b50052 link to I18n page 2011-07-19 17:13:29 +04:00
Sergei O. Udalov 3eab5ff72e i18n readme updated 2011-07-19 17:02:18 +04:00
Sergei O. Udalov f87648f7d4 i18n via $.datepicker 2011-07-06 16:49:07 +04:00
FagnerMartinsBrack bb1078959c Calendar.js: Allow the use of height: 'auto' to remove the Agenda ScrollBar. Fixed #521 - Can't Remove Agenda ScrollBar 2011-06-27 08:24:06 -07:00
FagnerMartinsBrack 5044683aec Calendar.js: Allow the use of height: 'auto' to remove the Agenda ScrollBar. Fixed #521 - Can't Remove Agenda ScrollBar 2011-06-27 08:22:40 -07:00
36 changed files with 1202 additions and 1350 deletions

176
Makefile
View file

@ -8,24 +8,24 @@ OTHER_FILES = \
MIT-LICENSE.txt \ MIT-LICENSE.txt \
GPL-LICENSE.txt GPL-LICENSE.txt
VER = $$(cat version.txt) VER = $(shell cat version.txt)
VER_SED = sed s/@VERSION/"${VER}"/ VER_SED = sed s/@VERSION/"$(VER)"/
DATE = $$(git log -1 --pretty=format:%ad) DATE = $(shell git log -1 --pretty=format:%ad)
DATE_SED = sed s/@DATE/"${DATE}"/ DATE_SED = sed s/@DATE/"$(DATE)"/
JQ = $$(sed -nE "s/.*JQUERY[ \t]*=[ \t]*[\"'](.*)[\"'].*/\1/p" "${SRC_DIR}/_loader.js") JQ = $(shell sed -ne "s/.*JQUERY[ \t]*=[ \t]*[\"']\(.*\)[\"'].*/\1/p" "$(SRC_DIR)/_loader.js")
JQUI = $$(sed -nE "s/.*JQUERY_UI[ \t]*=[ \t]*[\"'](.*)[\"'].*/\1/p" "${SRC_DIR}/_loader.js") JQUI = $(shell sed -ne "s/.*JQUERY_UI[ \t]*=[ \t]*[\"']\(.*\)[\"'].*/\1/p" "$(SRC_DIR)/_loader.js")
DEMO_FILES = $$(cd ${DEMOS_DIR}; find . -mindepth 1 -maxdepth 1 -type f) DEMO_FILES = $(shell cd $(DEMOS_DIR); find . -mindepth 1 -maxdepth 1 -type f)
DEMO_SUBDIRS = $$(cd ${DEMOS_DIR}; find . -mindepth 1 -maxdepth 1 -type d) DEMO_SUBDIRS = $(shell cd $(DEMOS_DIR); find . -mindepth 1 -maxdepth 1 -type d)
DEMO_RE = (<script[^>]*_loader\.js[^>]*><\/script>|<!--\[\[|\]\]-->)[^<]* DEMO_RE = (<script[^>]*_loader\.js[^>]*><\/script>|<!--\[\[|\]\]-->)[^<]*
DEMO_SED = sed -nE '1h;1!H;$${;g;s/${DEMO_RE}//g;p;}' DEMO_SED = sed -ne '1h;1!H;$${;g;s/$(DEMO_RE)//g;p;}'
JS_SED = sed -nE "s/[ \t]*js\([\"'](.*)[\"']\).*/\1/p" JS_SED = sed -ne "s/[ \t]*js([\"']\(.*\)[\"']).*/\1/p"
CSS_SED = sed -nE "s/[ \t]*css\([\"'](.*)[\"']\).*/\1/p" CSS_SED = sed -ne "s/[ \t]*css([\"']\(.*\)[\"']).*/\1/p"
concat_js = \ concat_js = \
files=$$(cat "$(1)/_loader.js" | ${JS_SED}); \ files=$$($(JS_SED) "$(1)/_loader.js"); \
if [ -f "$(1)/intro.js" ]; then \ if [ -f "$(1)/intro.js" ]; then \
files="intro.js $$files"; \ files="intro.js $$files"; \
fi; \ fi; \
@ -33,80 +33,110 @@ concat_js = \
files="$$files outro.js"; \ files="$$files outro.js"; \
fi; \ fi; \
old=$$PWD; \ old=$$PWD; \
(cd "$(1)"; cat $$files; cd "$$old") \ if ! [ X = "X$$files" ]; then \
| ${VER_SED} \ (cd "$(1)"; cat $$files; cd "$$old") \
| ${DATE_SED} \ | $(VER_SED) \
> "$(2)" | $(DATE_SED) \
> "$(2)" ; \
fi
concat_css = \ concat_css = \
files=$$(cat "$(1)/_loader.js" | ${CSS_SED}); \ files=$$($(CSS_SED) "$(1)/_loader.js"); \
if [ "$$files" ]; then \ if ! [ X = "X$$files" ]; then \
old=$$PWD; \ old=$$PWD; \
(cd "$(1)"; cat $$files; cd "$$old") \ (cd "$(1)"; cat $$files; cd "$$old") \
| ${VER_SED} \ | ${VER_SED} \
| ${DATE_SED} \ | ${DATE_SED} \
> "$(2)"; \ > "$(2)"; \
fi fi
zip: FC_V_DIR = $(BUILD_DIR)/fullcalendar-$(VER)
@rm -rf ${BUILD_DIR}/fullcalendar FC_DIR = $(FC_V_DIR)/fullcalendar
@rm -rf ${BUILD_DIR}/fullcalendar-* FCJS = $(FC_DIR)/fullcalendar.js
@mkdir -p ${BUILD_DIR}/fullcalendar/fullcalendar/ FCCSS = $(FC_DIR)/fullcalendar.css
FCPCSS = $(FC_DIR)/fullcalendar.print.css
@echo "building core..." FCMJS = $(FC_DIR)/fullcalendar.min.js
@$(call concat_js,${SRC_DIR},"${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.js") JQ_DIR = $(FC_V_DIR)/jquery
@$(call concat_css,${SRC_DIR},"${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.css") DEMOS_DIR = $(FC_V_DIR)/demos
@cat "${SRC_DIR}/common/print.css" \ FC_ZIP = $(FC_V_DIR).zip
| ${VER_SED} \ DIST = $(DIST_DIR)/$(shell basename $(FC_ZIP))
| ${DATE_SED} \
> "${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.print.css" .PHONY: all distribute dist
all: distribute
@echo "compressing core js..." distribute: core plugins jquery demos others
@java -jar ${BUILD_DIR}/compiler.jar --warning_level VERBOSE --jscomp_off checkTypes --externs build/externs.js \
--js ${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.js \ .PHONY: clean
> ${BUILD_DIR}/fullcalendar/fullcalendar/fullcalendar.min.js; \ clean: Makefile
rm -rf $(FC_ZIP)
@echo "building plugins..." rm -rf $(FC_V_DIR)
@for loader in ${SRC_DIR}/*/_loader.js; do \ rm -rf $(DIST_DIR)
$(FC_V_DIR): Makefile
mkdir -p $@
$(FC_DIR):
mkdir -p $@
$(DEMOS_DIR):
mkdir -p $@
$(JQ_DIR):
mkdir -p $@
$(DIST_DIR):
mkdir -p $@
$(FCJS): $(FC_DIR)
$(call concat_js,$(SRC_DIR),$@)
$(FCCSS): $(FC_DIR)
$(call concat_css,$(SRC_DIR),$@)
$(FCPCSS): $(SRC_DIR)/common/print.css $(FC_DIR)
$(VER_SED) $< | $(DATE_SED) > $@
.PHONY: core
core: $(FCJS) $(FCCSS) $(FCPCSS)
$(FCMJS): $(FCJS)
java -jar $(BUILD_DIR)/compiler.jar --warning_level VERBOSE --jscomp_off checkTypes --externs build/externs.js --js $< > $@
.PHONY: plugins
plugins: $(FCMJS) core
for loader in $(SRC_DIR)/*/_loader.js; do \
dir=`dirname $$loader`; \ dir=`dirname $$loader`; \
name=`basename $$dir`; \ name=`basename $$dir`; \
$(call concat_js,$$dir,"${BUILD_DIR}/fullcalendar/fullcalendar/$$name.js"); \ $(call concat_js,$$dir,$(FC_DIR)/$$name.js); \
done done
@echo "copying jquery..." $(JQ_DIR)/$(JQ): lib/$(JQ) $(JQ_DIR)
@mkdir -p ${BUILD_DIR}/fullcalendar/jquery cp $< $@
@cp lib/${JQ} ${BUILD_DIR}/fullcalendar/jquery
@cp lib/${JQUI} ${BUILD_DIR}/fullcalendar/jquery $(JQ_DIR)/$(JQUI): lib/$(JQUI) $(JQ_DIR)
cp $< $@
@echo "building demos..."
@mkdir -p ${BUILD_DIR}/fullcalendar/demos .PHONY: jquery
@for f in ${DEMO_FILES}; do \ jquery: $(JQ_DIR)/$(JQ) $(JQ_DIR)/$(JQUI)
cat ${DEMOS_DIR}/$$f \
| ${DEMO_SED} \ .PHONY: demos
demos: $(FC_DIR) $(DEMOS_DIR)
for f in $(DEMO_FILES); do \
cat $(DEMOS_DIR)/$$f \
| $(DEMO_SED) \
| sed "s/jquery\.js/${JQ}/" \ | sed "s/jquery\.js/${JQ}/" \
| sed "s/jquery-ui\.js/${JQUI}/" \ | sed "s/jquery-ui\.js/${JQUI}/" \
> ${BUILD_DIR}/fullcalendar/demos/$$f; \ > $(DEMOS_DIR)/$$f; \
done done
@for d in ${DEMO_SUBDIRS}; do \ for d in $(DEMO_SUBDIRS); do \
cp -r ${DEMOS_DIR}/$$d ${BUILD_DIR}/fullcalendar/demos/$$d; \ cp -r $(DEMOS_DIR)/$$d $(DEMOS_DIR)/$$d; \
done done
@echo "copying other files..."
@cp -r ${OTHER_FILES} ${BUILD_DIR}/fullcalendar
@echo "zipping..."
@mv ${BUILD_DIR}/fullcalendar ${BUILD_DIR}/fullcalendar-${VER}
@cd ${BUILD_DIR}; for f in fullcalendar-*; do \
zip -q -r $$f.zip $$f; \
done
@mv ${BUILD_DIR}/fullcalendar-${VER} ${BUILD_DIR}/fullcalendar
@mkdir -p ${DIST_DIR}
@mv ${BUILD_DIR}/fullcalendar-${VER}.zip ${DIST_DIR}
@echo "done."
clean: .PHONY: others
@rm -rf ${BUILD_DIR}/fullcalendar others: $(FC_DIR)
@rm -rf ${BUILD_DIR}/fullcalendar-* cp -r $(OTHER_FILES) $(FC_DIR)
@rm -rf ${DIST_DIR}/*
$(FC_ZIP): $(FC_V_DIR) distribute
zip -q -r $@ $<
$(DIST): $(FC_ZIP) $(DIST_DIR)
mv $@ $<

View file

@ -45,3 +45,21 @@ Here is an example of doing it within an element having an `id` of `calendar`:
}); });
To see a full list of all available options, please consult the [FullCalendar documentation &raquo;](http://arshaw.com/fullcalendar/docs/) To see a full list of all available options, please consult the [FullCalendar documentation &raquo;](http://arshaw.com/fullcalendar/docs/)
I18n
----
To localize fullCalendar You can use i18n for jquery datepicker.
$.fullCalendar.applyLocale($.datepicker.regional['ru']);
Other texts could be modified via method setDefaults:
$.fullCalendar.setDefaults({
buttonText: {
month: 'month',
week: 'week',
day: 'day'
}
});
See all available locales here: [I18n](https://github.com/sergio-fry/fullcalendar/wiki/I18n)

View file

@ -1,4 +1,7 @@
version 1.5.2 (8/21/11)
- correctly process UTC "Z" ISO8601 date strings (issue 750)
version 1.5.1 (4/9/11) version 1.5.1 (4/9/11)
- more flexible ISO8601 date parsing (issue 814) - more flexible ISO8601 date parsing (issue 814)
- more flexible parsing of UNIX timestamps (issue 826) - more flexible parsing of UNIX timestamps (issue 826)
@ -30,7 +33,7 @@ version 1.5 (3/19/11)
an `events` property (function or array) with additional properties that will an `events` property (function or array) with additional properties that will
be applied to the entire event source: be applied to the entire event source:
- color (changes both background and border) - color (changes both background and border)
- backgroudColor - backgroundColor
- borderColor - borderColor
- textColor - textColor
- className - className

File diff suppressed because one or more lines are too long

4
lib/jquery-1.7.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,147 +0,0 @@
/*!
* jQuery UI 1.8.11
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.11",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
* jQuery UI Widget 1.8.11
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Widget
*/
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
* jQuery UI Mouse 1.8.11
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Mouse
*
* Depends:
* jquery.ui.widget.js
*/
(function(b){b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=
a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,e=a.which==1,f=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(d){return c._mouseMove(d)};this._mouseUpDelegate=function(d){return c._mouseUp(d)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=
true}},_mouseMove:function(a){if(b.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
* jQuery UI Draggable 1.8.11
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Draggables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-
this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();
d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||
this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&
this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),
height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?
document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),
10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),
10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&
d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=
this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?
e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():
f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,
offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.11"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g.refreshPositions();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},
b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=
d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};
a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&
this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",
{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+
"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",
a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+
c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<
c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+
c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),
f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=
c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=
c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),
{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=
parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
;/*
* jQuery UI Resizable 1.8.11
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Resizables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),
d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=
this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:
this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",
b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;
f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");
this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=
null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=l(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=l(b.width)&&a.minWidth&&a.minWidth>b.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+
this.size.height,k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=
[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=
this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,
a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,
c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,
originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.11"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=
b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width",
"height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};
if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-
g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,
height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=
e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,
d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?
d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=
a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&
/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");
b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/
(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
;

150
lib/jquery-ui-1.8.16.custom.min.js vendored Executable file
View file

@ -0,0 +1,150 @@
/*!
* jQuery UI 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
* jQuery UI Widget 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Widget
*/
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
* jQuery UI Mouse 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Mouse
*
* Depends:
* jquery.ui.widget.js
*/
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
* jQuery UI Draggable 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Draggables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;if(b.iframeFix)d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;
this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true},
_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=
false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,
10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||
!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&
a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=
this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),
10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,
(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!=
"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),
10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+
this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&
!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.left<g[0])e=g[0]+this.offset.click.left;
if(a.pageY-this.offset.click.top<g[1])h=g[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>g[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.top<g[1]||h-this.offset.click.top>g[3])?h:!(h-this.offset.click.top<g[1])?h-b.grid[1]:h+b.grid[1]:h;e=b.grid[0]?this.originalPageX+Math.round((e-this.originalPageX)/
b.grid[0])*b.grid[0]:this.originalPageX;e=g?!(e-this.offset.click.left<g[0]||e-this.offset.click.left>g[2])?e:!(e-this.offset.click.left<g[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<
526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,
c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.16"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var h=d.data(this,"sortable");if(h&&!h.options.disabled){c.sortables.push({instance:h,shouldRevert:h.options.revert});
h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=
false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",true);
this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;
c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&
this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=
a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!=
"x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<
c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-
c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,
width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,h=b.offset.left,g=h+c.helperProportions.width,n=b.offset.top,o=n+c.helperProportions.height,i=c.snapElements.length-1;i>=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e<h&&h<l+e&&k-e<n&&n<m+e||j-e<h&&h<l+e&&k-e<o&&o<m+e||j-e<g&&g<l+e&&k-e<n&&n<m+e||j-e<g&&g<l+e&&k-e<o&&
o<m+e){if(f.snapMode!="inner"){var p=Math.abs(k-o)<=e,q=Math.abs(m-n)<=e,r=Math.abs(j-g)<=e,s=Math.abs(l-h)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l}).left-c.margins.left}var t=
p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math.abs(j-h)<=e;s=Math.abs(l-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[i].snapping&&
(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=p||q||r||s||t}else{c.snapElements[i].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),
10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
;/*
* jQuery UI Resizable 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Resizables
*
* Depends:
* jquery.ui.core.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
*/
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();
var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=
false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});
this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff=
{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];
if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},
_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,
{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight:
Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(c<a.maxWidth)a.maxWidth=c;if(f<a.maxHeight)a.maxHeight=f}this._vBoundaries=a},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=
b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(k(b.height))b.width=b.height*this.aspectRatio;else if(k(b.width))b.height=b.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this._vBoundaries,c=this.axis,d=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=k(b.width)&&a.minWidth&&
a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=
null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||
0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+
a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+
c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);
b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.16"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),
10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-
f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?
e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=
e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,
step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=
e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;
var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:
a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-
d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,
f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,
display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=
e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=
d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
;

View file

@ -1,4 +1,3 @@
function Calendar(element, options, eventSources) { function Calendar(element, options, eventSources) {
var t = this; var t = this;
@ -22,8 +21,8 @@ function Calendar(element, options, eventSources) {
t.today = today; t.today = today;
t.gotoDate = gotoDate; t.gotoDate = gotoDate;
t.incrementDate = incrementDate; t.incrementDate = incrementDate;
t.formatDate = function(date, format) { return date.toString(format, options) }; t.formatDate = function(format, date) { return formatDate(format, date, options) };
t.formatDates = function(date1, date2, format) { return date1.toString(date2, format, options) }; t.formatDates = function(format, date1, date2) { return formatDates(format, date1, date2, options) };
t.getDate = getDate; t.getDate = getDate;
t.getView = getView; t.getView = getView;
t.option = option; t.option = option;
@ -49,7 +48,7 @@ function Calendar(element, options, eventSources) {
var absoluteViewElement; var absoluteViewElement;
var resizeUID = 0; var resizeUID = 0;
var ignoreWindowResize = 0; var ignoreWindowResize = 0;
var date = new MightyDate(); var date = new Date();
var events = []; var events = [];
var _dragElement; var _dragElement;
@ -59,13 +58,7 @@ function Calendar(element, options, eventSources) {
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
if (options.year) { setYMD(date, options.year, options.month, options.date);
date = new MightyDate(
options.year,
options.month || 0,
options.date || 1
);
}
function render(inc) { function render(inc) {
@ -131,7 +124,8 @@ function Calendar(element, options, eventSources) {
function bodyVisible() { function bodyVisible() {
return $('body')[0].offsetWidth !== 0; var body = $('body');
return body.length > 0 && body [0].offsetWidth !== 0;
} }
@ -204,9 +198,7 @@ function Calendar(element, options, eventSources) {
} }
var forceEventRender = false; var forceEventRender = false;
if ( if (!currentView.start || inc || date < currentView.start || date >= currentView.end) {
!currentView.start || inc || date.before(currentView.start) || !date.before(currentView.end)
) {
// view must render an entire new date range (and refetch/render events) // view must render an entire new date range (and refetch/render events)
currentView.render(date, inc || 0); // responsible for clearing events currentView.render(date, inc || 0); // responsible for clearing events
setSize(true); setSize(true);
@ -229,8 +221,8 @@ function Calendar(element, options, eventSources) {
elementOuterWidth = element.outerWidth(); elementOuterWidth = element.outerWidth();
header.updateTitle(currentView.title); header.updateTitle(currentView.title);
var today = new MightyDate(); var today = new Date();
if (!today.before(currentView.start) && today.before(currentView.end)) { // within range if (today >= currentView.start && today < currentView.end) {
header.disableButton('today'); header.disableButton('today');
}else{ }else{
header.enableButton('today'); header.enableButton('today');
@ -270,11 +262,13 @@ function Calendar(element, options, eventSources) {
function calcSize() { function calcSize() {
if (options.contentHeight) { if (options.contentHeight) {
suggestedViewHeight = options.contentHeight; suggestedViewHeight = options.contentHeight;
} } else if (options.height) {
else if (options.height) { if(options.height.toString().match(new RegExp("^[0-9]+(px)?$"))) {
suggestedViewHeight = options.height - (headerElement ? headerElement.height() : 0) - vsides(content); suggestedViewHeight = parseInt(options.height) - (headerElement ? headerElement.height() : 0) - vsides(content);
} } else {
else { suggestedViewHeight = options.height;
}
} else {
suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5)); suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5));
} }
} }
@ -399,32 +393,28 @@ function Calendar(element, options, eventSources) {
function prevYear() { function prevYear() {
date.addYears(-1, true); addYears(date, -1);
renderView(); renderView();
} }
function nextYear() { function nextYear() {
date.addYears(1, true); addYears(date, 1);
renderView(); renderView();
} }
function today() { function today() {
date = new MightyDate(); date = new Date();
renderView(); renderView();
} }
function gotoDate(year, month, dateOfMonth) { function gotoDate(year, month, dateOfMonth) {
if (typeof year == 'object') { if (year instanceof Date) {
date = new MightyDate(year); // provided 1 argument, a Date or MightyDate date = cloneDate(year); // provided 1 argument, a Date
}else{ }else{
date = new MightyDate( setYMD(date, year, month, dateOfMonth);
year,
month || 0,
dateOfMonth || 1
);
} }
renderView(); renderView();
} }
@ -432,20 +422,20 @@ function Calendar(element, options, eventSources) {
function incrementDate(years, months, days) { function incrementDate(years, months, days) {
if (years !== undefined) { if (years !== undefined) {
date.addYears(years, true); addYears(date, years);
} }
if (months !== undefined) { if (months !== undefined) {
date.addMonths(months, true); addMonths(date, months);
} }
if (days !== undefined) { if (days !== undefined) {
date.addDays(days); addDays(date, days);
} }
renderView(); renderView();
} }
function getDate() { function getDate() {
return date.clone(); return cloneDate(date);
} }

View file

@ -53,7 +53,7 @@ function EventManager(options, _sources) {
function isFetchNeeded(start, end) { function isFetchNeeded(start, end) {
return !rangeStart || start.before(rangeStart) || end.after(rangeEnd); return !rangeStart || start < rangeStart || end > rangeEnd;
} }
@ -94,7 +94,7 @@ function EventManager(options, _sources) {
var fetchers = fc.sourceFetchers; var fetchers = fc.sourceFetchers;
var res; var res;
for (i=0; i<fetchers.length; i++) { for (i=0; i<fetchers.length; i++) {
res = fetchers[i](source, rangeStart.clone(), rangeEnd.clone(), callback); res = fetchers[i](source, rangeStart, rangeEnd, callback);
if (res === true) { if (res === true) {
// the fetcher is in charge. made its own async request // the fetcher is in charge. made its own async request
return; return;
@ -109,7 +109,7 @@ function EventManager(options, _sources) {
if (events) { if (events) {
if ($.isFunction(events)) { if ($.isFunction(events)) {
pushLoading(); pushLoading();
events(rangeStart.clone(), rangeEnd.clone(), function(events) { events(cloneDate(rangeStart), cloneDate(rangeEnd), function(events) {
callback(events); callback(events);
popLoading(); popLoading();
}); });
@ -122,6 +122,7 @@ function EventManager(options, _sources) {
} }
}else{ }else{
var url = source.url; var url = source.url;
var eventTransform = source.eventTransform || options.eventTransform;
if (url) { if (url) {
var success = source.success; var success = source.success;
var error = source.error; var error = source.error;
@ -130,10 +131,10 @@ function EventManager(options, _sources) {
var startParam = firstDefined(source.startParam, options.startParam); var startParam = firstDefined(source.startParam, options.startParam);
var endParam = firstDefined(source.endParam, options.endParam); var endParam = firstDefined(source.endParam, options.endParam);
if (startParam) { if (startParam) {
data[startParam] = Math.round(+rangeStart / 1000); data[startParam] = (options.startEndDateOnly) ? (rangeStart.getYear()+'-'+(rangeStart.getMonth()+1)+'-'+rangeStart.getDate()) : Math.round(+rangeStart / 1000);
} }
if (endParam) { if (endParam) {
data[endParam] = Math.round(+rangeEnd / 1000); data[endParam] = (options.startEndDateOnly) ? (rangeEnd.getYear()+'-'+(rangeEnd.getMonth()+1)+'-'+rangeEnd.getDate()) : Math.round(+rangeEnd / 1000);
} }
pushLoading(); pushLoading();
$.ajax($.extend({}, ajaxDefaults, source, { $.ajax($.extend({}, ajaxDefaults, source, {
@ -144,7 +145,9 @@ function EventManager(options, _sources) {
if ($.isArray(res)) { if ($.isArray(res)) {
events = res; events = res;
} }
callback(events); callback(events && eventTransform
? $.map(events, eventTransform)
: events);
}, },
error: function() { error: function() {
applyAll(error, this, arguments); applyAll(error, this, arguments);
@ -208,23 +211,22 @@ function EventManager(options, _sources) {
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
function updateEvent(event) { // update an existing event // TODO: test thoroughly function updateEvent(event) { // update an existing event
var i, len = cache.length, e, var i, len = cache.length, e,
defaultEventEnd = getView().defaultEventEnd, // getView??? defaultEventEnd = getView().defaultEventEnd, // getView???
startDelta = event._start.diffMilliseconds(event.start), startDelta = event.start - event._start,
endDelta = endDelta = event.end ?
event.end ? (event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end
(event._end || defaultEventEnd(event)).diffMilliseconds(event.end) : // event._end would be null if event.end : 0; // was null and event was just resized
0; // was null and event was just resized
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
e = cache[i]; e = cache[i];
if (e._id == event._id && e != event) { if (e._id == event._id && e != event) {
e.start.addMilliseconds(startDelta); e.start = new Date(+e.start + startDelta);
if (event.end) { if (event.end) {
if (e.end) { if (e.end) {
e.end.addMilliseconds(endDelta); e.end = new Date(+e.end + endDelta);
}else{ }else{
e.end = defaultEventEnd(e).addMilliseconds(endDelta); e.end = new Date(+defaultEventEnd(e) + endDelta);
} }
}else{ }else{
e.end = null; e.end = null;
@ -235,7 +237,7 @@ function EventManager(options, _sources) {
e.className = event.className; e.className = event.className;
e.editable = event.editable; e.editable = event.editable;
e.color = event.color; e.color = event.color;
e.backgroudColor = event.backgroudColor; e.backgroundColor = event.backgroundColor;
e.borderColor = event.borderColor; e.borderColor = event.borderColor;
e.textColor = event.textColor; e.textColor = event.textColor;
normalizeEvent(e); normalizeEvent(e);
@ -335,12 +337,12 @@ function EventManager(options, _sources) {
} }
delete event.date; delete event.date;
} }
event._start = (event.start = parseDate(event.start, ignoreTimezone)).clone(); event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone));
event.end = parseDate(event.end, ignoreTimezone); event.end = parseDate(event.end, ignoreTimezone);
if (event.end && !event.end.after(event.start)) { if (event.end && event.end <= event.start) {
event.end = null; event.end = null;
} }
event._end = event.end ? event.end.clone() : null; event._end = event.end ? cloneDate(event.end) : null;
if (event.allDay === undefined) { if (event.allDay === undefined) {
event.allDay = firstDefined(source.allDayDefault, options.allDayDefault); event.allDay = firstDefined(source.allDayDefault, options.allDayDefault);
} }

View file

@ -71,7 +71,7 @@ function Header(calendar, options) {
var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why are we using smartProperty here? var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why are we using smartProperty here?
var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here? var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here?
var button = $( var button = $(
"<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" + "<span class='fc-button "+(tm == 'ui' ? 'ui-button' : '')+" fc-button-" + buttonName + " " + tm + "-state-default'>" +
"<span class='fc-button-inner'>" + "<span class='fc-button-inner'>" +
"<span class='fc-button-content'>" + "<span class='fc-button-content'>" +
(icon ? (icon ?

18
src/I18n.js Normal file
View file

@ -0,0 +1,18 @@
var applyLocale = function(locale) {
setDefaults({
isRTL: locale.isRTL,
firstDay: locale.firstDay,
monthNames: locale.monthNames,
monthNamesShort: locale.monthNamesShort,
dayNames: locale.dayNames,
dayNamesShort: locale.dayNamesShort,
buttonText: {
today: locale.currentText
}
});
}
$.fullCalendar.applyLocale = function(locale) {
applyLocale(locale);
}

View file

@ -1,7 +1,7 @@
(function() { (function() {
var JQUERY = 'jquery-1.5.2.min.js'; var JQUERY = 'jquery-1.7.min.js';
var JQUERY_UI = 'jquery-ui-1.8.11.custom.min.js'; var JQUERY_UI = 'jquery-ui-1.8.16.custom.min.js';
var JQUERY_LEGACY = 'jquery-1.3.2.min.js'; var JQUERY_LEGACY = 'jquery-1.3.2.min.js';
var JQUERY_UI_LEGACY = 'jquery-ui-1.7.3.custom.min.js'; var JQUERY_UI_LEGACY = 'jquery-ui-1.7.3.custom.min.js';
@ -42,10 +42,12 @@ js('main.js');
js('Calendar.js'); js('Calendar.js');
js('Header.js'); js('Header.js');
js('EventManager.js'); js('EventManager.js');
js('mightydate.js'); js('date_util.js');
js('util.js'); js('util.js');
js('I18n.js');
js('basic/MonthView.js'); js('basic/MonthView.js');
js('basic/FourWeeksView.js');
js('basic/BasicWeekView.js'); js('basic/BasicWeekView.js');
js('basic/BasicDayView.js'); js('basic/BasicDayView.js');
js('basic/BasicView.js'); js('basic/BasicView.js');

View file

@ -19,13 +19,13 @@ function AgendaDayView(element, calendar) {
function render(date, delta) { function render(date, delta) {
if (delta) { if (delta) {
date.addDays(delta); addDays(date, delta);
if (!opt('weekends')) { if (!opt('weekends')) {
skipWeekend(date, delta < 0 ? -1 : 1); skipWeekend(date, delta < 0 ? -1 : 1);
} }
} }
var start = date.clone().clearTime(); var start = cloneDate(date, true);
var end = start.clone().addDays(1); var end = addDays(cloneDate(start), 1);
t.title = formatDate(date, opt('titleFormat')); t.title = formatDate(date, opt('titleFormat'));
t.start = t.visStart = start; t.start = t.visStart = start;
t.end = t.visEnd = end; t.end = t.visEnd = end;

View file

@ -36,6 +36,8 @@ function AgendaEventRenderer() {
var getColCnt = t.getColCnt; var getColCnt = t.getColCnt;
var getColWidth = t.getColWidth; var getColWidth = t.getColWidth;
var getSlotHeight = t.getSlotHeight; var getSlotHeight = t.getSlotHeight;
var getBorderHeight = t.getBorderHeight;
var getSlotTableHeight = t.getSlotTableHeight;
var getBodyContent = t.getBodyContent; var getBodyContent = t.getBodyContent;
var reportEventElement = t.reportEventElement; var reportEventElement = t.reportEventElement;
var showEvents = t.showEvents; var showEvents = t.showEvents;
@ -103,14 +105,14 @@ function AgendaEventRenderer() {
var colCnt = getColCnt(), var colCnt = getColCnt(),
minMinute = getMinMinute(), minMinute = getMinMinute(),
maxMinute = getMaxMinute(), maxMinute = getMaxMinute(),
d = t.visStart.clone().addMinutes(minMinute), d = addMinutes(cloneDate(t.visStart), minMinute),
visEventEnds = $.map(events, slotEventEnd), visEventEnds = $.map(events, slotEventEnd),
i, col, i, col,
j, level, j, level,
k, seg, k, seg,
segs=[]; segs=[];
for (i=0; i<colCnt; i++) { for (i=0; i<colCnt; i++) {
col = stackSegs(sliceSegs(events, visEventEnds, d, d.clone().addMinutes(maxMinute-minMinute))); col = stackSegs(sliceSegs(events, visEventEnds, d, addMinutes(cloneDate(d), maxMinute-minMinute)));
countForwardSegs(col); countForwardSegs(col);
for (j=0; j<col.length; j++) { for (j=0; j<col.length; j++) {
level = col[j]; level = col[j];
@ -121,7 +123,7 @@ function AgendaEventRenderer() {
segs.push(seg); segs.push(seg);
} }
} }
d.addDays(1); addDays(d, 1, true);
} }
return segs; return segs;
} }
@ -129,9 +131,9 @@ function AgendaEventRenderer() {
function slotEventEnd(event) { function slotEventEnd(event) {
if (event.end) { if (event.end) {
return event.end.clone(); return cloneDate(event.end);
}else{ }else{
return event.start.clone().addMinutes(opt('defaultEventMinutes')); return addMinutes(cloneDate(event.start), opt('defaultEventMinutes'));
} }
} }
@ -139,7 +141,6 @@ function AgendaEventRenderer() {
// renders events in the 'time slots' at the bottom // renders events in the 'time slots' at the bottom
function renderSlotSegs(segs, modifiedEventId) { function renderSlotSegs(segs, modifiedEventId) {
var i, segCnt=segs.length, seg, var i, segCnt=segs.length, seg,
event, event,
classes, classes,
@ -160,7 +161,9 @@ function AgendaEventRenderer() {
height, height,
slotSegmentContainer = getSlotSegmentContainer(), slotSegmentContainer = getSlotSegmentContainer(),
rtl, dis, dit, rtl, dis, dit,
colCnt = getColCnt(); colCnt = getColCnt(),
borderHeight = getBorderHeight(),
slotTableHeight = getSlotTableHeight();
if (rtl = opt('isRTL')) { if (rtl = opt('isRTL')) {
dis = -1; dis = -1;
@ -176,6 +179,9 @@ function AgendaEventRenderer() {
event = seg.event; event = seg.event;
top = timePosition(seg.start, seg.start); top = timePosition(seg.start, seg.start);
bottom = timePosition(seg.start, seg.end); bottom = timePosition(seg.start, seg.end);
if (bottom < slotTableHeight) {
bottom -= borderHeight;
}
colI = seg.col; colI = seg.col;
levelI = seg.level; levelI = seg.level;
forward = seg.forward || 0; forward = seg.forward || 0;
@ -357,6 +363,8 @@ function AgendaEventRenderer() {
// when event starts out FULL-DAY // when event starts out FULL-DAY
function draggableDayEvent(event, eventElement, isStart) { function draggableDayEvent(event, eventElement, isStart) {
if (!eventElement.draggable)
return;
var origWidth; var origWidth;
var revert; var revert;
var allDay=true; var allDay=true;
@ -383,8 +391,8 @@ function AgendaEventRenderer() {
if (!cell.row) { if (!cell.row) {
// on full-days // on full-days
renderDayOverlay( renderDayOverlay(
event.start.clone().addDays(dayDelta).clearTime(), addDays(cloneDate(event.start), dayDelta),
exclEndDay(event).addDays(dayDelta).clearTime() addDays(exclEndDay(event), dayDelta)
); );
resetElement(); resetElement();
}else{ }else{
@ -396,7 +404,7 @@ function AgendaEventRenderer() {
setOuterHeight( setOuterHeight(
eventElement, eventElement,
slotHeight * Math.round( slotHeight * Math.round(
(event.end ? event.start.diffMinutes(event.end) : opt('defaultEventMinutes')) / opt('slotMinutes') (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) / opt('slotMinutes')
) )
); );
eventElement.draggable('option', 'grid', [colWidth, 1]); eventElement.draggable('option', 'grid', [colWidth, 1]);
@ -489,8 +497,8 @@ function AgendaEventRenderer() {
eventElement.draggable('option', 'grid', null); eventElement.draggable('option', 'grid', null);
} }
renderDayOverlay( renderDayOverlay(
event.start.clone().addDays(dayDelta).clearTime(), addDays(cloneDate(event.start), dayDelta),
exclEndDay(event).addDays(dayDelta).clearTime() addDays(exclEndDay(event), dayDelta)
); );
}else{ }else{
// on slots // on slots
@ -526,10 +534,10 @@ function AgendaEventRenderer() {
} }
}); });
function updateTimeText(minuteDelta) { function updateTimeText(minuteDelta) {
var newStart = event.start.clone().addMinutes(minuteDelta); var newStart = addMinutes(cloneDate(event.start), minuteDelta);
var newEnd; var newEnd;
if (event.end) { if (event.end) {
newEnd = event.end.clone().addMinutes(minuteDelta); newEnd = addMinutes(cloneDate(event.end), minuteDelta);
} }
timeElement.text(formatDates(newStart, newEnd, opt('timeFormat'))); timeElement.text(formatDates(newStart, newEnd, opt('timeFormat')));
} }
@ -571,7 +579,7 @@ function AgendaEventRenderer() {
formatDates( formatDates(
event.start, event.start,
(!slotDelta && !event.end) ? null : // no change, so don't display time range (!slotDelta && !event.end) ? null : // no change, so don't display time range
eventEnd(event).addMinutes(opt('slotMinutes')*slotDelta), addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta),
opt('timeFormat') opt('timeFormat')
) )
); );

View file

@ -1,9 +1,10 @@
setDefaults({ setDefaults({
allDaySlot: true, allDaySlot: true,
allDayText: 'all-day', allDayText: 'all-day',
firstHour: 6, firstHour: 6,
slotMinutes: 30, slotMinutes: 30,
minSlotNumber: 0,
maxSlotNumber: 0,
defaultEventMinutes: 120, defaultEventMinutes: 120,
axisFormat: 'h(:mm)tt', axisFormat: 'h(:mm)tt',
timeFormat: { timeFormat: {
@ -51,6 +52,8 @@ function AgendaView(element, calendar, viewName) {
t.getColCnt = function() { return colCnt }; t.getColCnt = function() { return colCnt };
t.getColWidth = function() { return colWidth }; t.getColWidth = function() { return colWidth };
t.getSlotHeight = function() { return slotHeight }; t.getSlotHeight = function() { return slotHeight };
t.getBorderHeight = function() { return borderHeight };
t.getSlotTableHeight = function() { return slotTable.height() };
t.defaultSelectionEnd = defaultSelectionEnd; t.defaultSelectionEnd = defaultSelectionEnd;
t.renderDayOverlay = renderDayOverlay; t.renderDayOverlay = renderDayOverlay;
t.renderSelection = renderSelection; t.renderSelection = renderSelection;
@ -95,7 +98,8 @@ function AgendaView(element, calendar, viewName) {
var slotContent; var slotContent;
var slotSegmentContainer; var slotSegmentContainer;
var slotTable; var slotTable;
var slotTableFirstInner; var slotTableFirstRow;
var slotTableSecondRow;
var axisFirstCells; var axisFirstCells;
var gutterCells; var gutterCells;
var selectionHelper; var selectionHelper;
@ -106,6 +110,7 @@ function AgendaView(element, calendar, viewName) {
var colWidth; var colWidth;
var gutterWidth; var gutterWidth;
var slotHeight; // TODO: what if slotHeight changes? (see issue 650) var slotHeight; // TODO: what if slotHeight changes? (see issue 650)
var borderHeight;
var savedScrollTop; var savedScrollTop;
var colCnt; var colCnt;
@ -273,11 +278,11 @@ function AgendaView(element, calendar, viewName) {
s = s =
"<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" + "<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" +
"<tbody>"; "<tbody>";
d = t.visStart.clone(); d = zeroDate();
maxd = d.clone().addMinutes(maxMinute); maxd = addMinutes(cloneDate(d), maxMinute);
d.addMinutes(minMinute); addMinutes(d, minMinute);
slotCnt = 0; slotCnt = 0;
for (i=0; d.before(maxd); i++) { for (i=0; d < maxd; i++) {
minutes = d.getMinutes(); minutes = d.getMinutes();
s += s +=
"<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" + "<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" +
@ -288,14 +293,15 @@ function AgendaView(element, calendar, viewName) {
"<div style='position:relative'>&nbsp;</div>" + "<div style='position:relative'>&nbsp;</div>" +
"</td>" + "</td>" +
"</tr>"; "</tr>";
d.addMinutes(opt('slotMinutes')); addMinutes(d, opt('slotMinutes'));
slotCnt++; slotCnt++;
} }
s += s +=
"</tbody>" + "</tbody>" +
"</table>"; "</table>";
slotTable = $(s).appendTo(slotContent); slotTable = $(s).appendTo(slotContent);
slotTableFirstInner = slotTable.find('div:first'); slotTableFirstRow = slotTable.find('tr:first');
slotTableSecondRow = slotTable.find('tr:nth-child(2)');
slotBind(slotTable.find('td')); slotBind(slotTable.find('td'));
@ -309,13 +315,13 @@ function AgendaView(element, calendar, viewName) {
var headCell; var headCell;
var bodyCell; var bodyCell;
var date; var date;
var today = new MightyDate().clearTime(); var today = clearTime(new Date());
for (i=0; i<colCnt; i++) { for (i=0; i<colCnt; i++) {
date = colDate(i); date = colDate(i);
headCell = dayHeadCells.eq(i); headCell = dayHeadCells.eq(i);
headCell.html(formatDate(date, colFormat)); headCell.html(formatDate(date, colFormat));
bodyCell = dayBodyCells.eq(i); bodyCell = dayBodyCells.eq(i);
if (date.equals(today)) { if (+date == +today) {
bodyCell.addClass(tm + '-state-highlight fc-today'); bodyCell.addClass(tm + '-state-highlight fc-today');
}else{ }else{
bodyCell.removeClass(tm + '-state-highlight fc-today'); bodyCell.removeClass(tm + '-state-highlight fc-today');
@ -334,20 +340,24 @@ function AgendaView(element, calendar, viewName) {
slotTopCache = {}; slotTopCache = {};
var headHeight = dayBody.position().top; var headHeight = dayBody.position().top;
var allDayHeight = slotScroller.position().top; // including divider
var bodyHeight = Math.min( // total body height, including borders
height - headHeight, // when scrollbars
slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border
);
dayBodyFirstCellStretcher
.height(bodyHeight - vsides(dayBodyFirstCell));
if($.type(height) === 'number') {
var allDayHeight = slotScroller.position().top; // including divider
var bodyHeight = Math.min( // total body height, including borders
height - headHeight, // when scrollbars
slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border
);
slotScroller.height(bodyHeight - allDayHeight - 1);
dayBodyFirstCellStretcher.height(bodyHeight - vsides(dayBodyFirstCell));
} else {
slotScroller.height(height);
dayBodyFirstCellStretcher.height(slotScroller.height());
}
slotLayer.css('top', headHeight); slotLayer.css('top', headHeight);
slotScroller.height(bodyHeight - allDayHeight - 1); slotHeight = slotTableSecondRow.outerHeight();
borderHeight = slotHeight - slotTableFirstRow.outerHeight();
slotHeight = slotTableFirstInner.height() + 1; // +1 for border
if (dateChanged) { if (dateChanged) {
resetScroll(); resetScroll();
@ -394,10 +404,10 @@ function AgendaView(element, calendar, viewName) {
function resetScroll() { function resetScroll() {
var d0 = t.visStart.clone(); var d0 = zeroDate();
var scrollDate = d0.clone(); var scrollDate = cloneDate(d0);
scrollDate.setHours(opt('firstHour')); scrollDate.setHours(opt('firstHour'));
var top = timePosition(d0, scrollDate) + 1; // +1 for the border var top = timePosition(d0, scrollDate) + borderHeight;
function scroll() { function scroll() {
slotScroller.scrollTop(top); slotScroller.scrollTop(top);
} }
@ -457,18 +467,17 @@ function AgendaView(element, calendar, viewName) {
function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive
// TODO: get straight whether caller needs to do clearTime or not
if (refreshCoordinateGrid) { if (refreshCoordinateGrid) {
coordinateGrid.build(); coordinateGrid.build();
} }
var visStart = t.visStart; var visStart = cloneDate(t.visStart);
var startCol, endCol; var startCol, endCol;
if (rtl) { if (rtl) {
startCol = visStart.diffDays(endDate)*dis+dit+1; startCol = dayDiff(endDate, visStart)*dis+dit+1;
endCol = visStart.diffDays(startDate)*dis+dit+1; endCol = dayDiff(startDate, visStart)*dis+dit+1;
}else{ }else{
startCol = visStart.diffDays(startDate); startCol = dayDiff(startDate, visStart);
endCol = visStart.diffDays(endDate); endCol = dayDiff(endDate, visStart);
} }
startCol = Math.max(0, startCol); startCol = Math.max(0, startCol);
endCol = Math.min(colCnt, endCol); endCol = Math.min(colCnt, endCol);
@ -487,12 +496,12 @@ function AgendaView(element, calendar, viewName) {
function renderSlotOverlay(overlayStart, overlayEnd) { function renderSlotOverlay(overlayStart, overlayEnd) {
var dayStart = t.visStart.clone(); var dayStart = cloneDate(t.visStart);
var dayEnd = dayStart.clone().addDays(1); var dayEnd = addDays(cloneDate(dayStart), 1);
for (var i=0; i<colCnt; i++) { for (var i=0; i<colCnt; i++) {
var stretchStart = overlayStart.before(dayStart) ? dayStart : overlayStart; var stretchStart = new Date(Math.max(dayStart, overlayStart));
var stretchEnd = overlayEnd.after(dayEnd) ? dayEnd : overlayEnd; var stretchEnd = new Date(Math.min(dayEnd, overlayEnd));
if (stretchStart.before(stretchEnd)) { if (stretchStart < stretchEnd) {
var col = i*dis+dit; var col = i*dis+dit;
var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords
var top = timePosition(dayStart, stretchStart); var top = timePosition(dayStart, stretchStart);
@ -503,8 +512,8 @@ function AgendaView(element, calendar, viewName) {
renderOverlay(rect, slotContent) renderOverlay(rect, slotContent)
); );
} }
dayStart.addDays(1); addDays(dayStart, 1);
dayEnd.addDays(1); addDays(dayEnd, 1);
} }
} }
@ -568,7 +577,7 @@ function AgendaView(element, calendar, viewName) {
function dateCell(date) { // "cell" terminology is now confusing function dateCell(date) { // "cell" terminology is now confusing
return { return {
row: t.visStart.diffWeeks(date), row: Math.floor(dayDiff(date, t.visStart) / 7),
col: dayOfWeekCol(date.getDay()) col: dayOfWeekCol(date.getDay())
}; };
} }
@ -581,14 +590,14 @@ function AgendaView(element, calendar, viewName) {
slotIndex--; slotIndex--;
} }
if (slotIndex >= 0) { if (slotIndex >= 0) {
d.addMinutes(minMinute + slotIndex * opt('slotMinutes')); addMinutes(d, minMinute + slotIndex * opt('slotMinutes'));
} }
return d; return d;
} }
function colDate(col) { // returns dates with 00:00:00 function colDate(col) { // returns dates with 00:00:00
return t.visStart.clone().addDays(col*dis+dit); return addDays(cloneDate(t.visStart), col*dis+dit);
} }
@ -606,11 +615,11 @@ function AgendaView(element, calendar, viewName) {
// get the Y coordinate of the given time on the given day (both Date objects) // get the Y coordinate of the given time on the given day (both Date objects)
function timePosition(day, time) { // both date objects. day holds 00:00 of current day function timePosition(day, time) { // both date objects. day holds 00:00 of current day
day = day.clone().clearTime(); day = cloneDate(day, true);
if (time.before(day.clone().addMinutes(minMinute))) { if (time < addMinutes(cloneDate(day), minMinute)) {
return 0; return 0;
} }
if (!time.before(day.clone().addMinutes(maxMinute))) { if (time >= addMinutes(cloneDate(day), maxMinute)) {
return slotTable.height(); return slotTable.height();
} }
var slotMinutes = opt('slotMinutes'), var slotMinutes = opt('slotMinutes'),
@ -621,7 +630,7 @@ function AgendaView(element, calendar, viewName) {
slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization??? slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization???
} }
return Math.max(0, Math.round( return Math.max(0, Math.round(
slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) slotTop + slotHeight * ((minutes % slotMinutes) / slotMinutes)
)); ));
} }
@ -640,11 +649,11 @@ function AgendaView(element, calendar, viewName) {
function defaultEventEnd(event) { function defaultEventEnd(event) {
var start = event.start.clone(); var start = cloneDate(event.start);
if (event.allDay) { if (event.allDay) {
return start; return start;
} }
return start.addMinutes(opt('defaultEventMinutes')); return addMinutes(start, opt('defaultEventMinutes'));
} }
@ -655,20 +664,16 @@ function AgendaView(element, calendar, viewName) {
function defaultSelectionEnd(startDate, allDay) { function defaultSelectionEnd(startDate, allDay) {
if (allDay) { if (allDay) {
return startDate.clone(); return cloneDate(startDate);
} }
return startDate.clone().addMinutes(opt('slotMinutes')); return addMinutes(cloneDate(startDate), opt('slotMinutes'));
} }
function renderSelection(startDate, endDate, allDay) { // only for all-day function renderSelection(startDate, endDate, allDay) { // only for all-day
if (allDay) { if (allDay) {
if (opt('allDaySlot')) { if (opt('allDaySlot')) {
renderDayOverlay( renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true);
startDate.clone().clearTime(),
endDate.clone().addDays(1).clearTime(), // TODO: use util
true
);
} }
}else{ }else{
renderSlotSelection(startDate, endDate); renderSlotSelection(startDate, endDate);
@ -680,11 +685,14 @@ function AgendaView(element, calendar, viewName) {
var helperOption = opt('selectHelper'); var helperOption = opt('selectHelper');
coordinateGrid.build(); coordinateGrid.build();
if (helperOption) { if (helperOption) {
var col = t.visStart.diffDays(startDate) * dis + dit; var col = dayDiff(startDate, t.visStart) * dis + dit;
if (col >= 0 && col < colCnt) { // only works when times are on same day if (col >= 0 && col < colCnt) { // only works when times are on same day
var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords
var top = timePosition(startDate, startDate); var top = timePosition(startDate, startDate);
var bottom = timePosition(startDate, endDate); var bottom = timePosition(startDate, endDate);
if (bottom < slotTable.height()) {
bottom -= borderHeight;
}
if (bottom > top) { // protect against selections that are entirely before or after visible range if (bottom > top) { // protect against selections that are entirely before or after visible range
rect.top = top; rect.top = top;
rect.height = bottom - top; rect.height = bottom - top;
@ -741,17 +749,36 @@ function AgendaView(element, calendar, viewName) {
if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button
unselect(ev); unselect(ev);
var dates; var dates;
var minSlotNumber = opt('minSlotNumber');
if (minSlotNumber <= 0) minSlotNumber = 1;
var maxSlotNumber = opt('maxSlotNumber');
hoverListener.start(function(cell, origCell) { hoverListener.start(function(cell, origCell) {
clearSelection(); clearSelection();
if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) { if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) {
var d1 = cellDate(origCell); var d1 = cellDate(origCell);
var d2 = cellDate(cell); var d2 = cellDate(cell);
dates = [ if (d2>d1) {
d1, var date1 = d1
d1.clone().addMinutes(opt('slotMinutes')), var date2 = d2
d2, } else {
d2.clone().addMinutes(opt('slotMinutes')) var date1 = d2
].sort(cmp); var date2 = d1
}
if (maxSlotNumber != 0 && (date2-date1) >= maxSlotNumber*opt('slotMinutes')*60000) {
dates = [
date1,
addMinutes(cloneDate(date1), minSlotNumber*opt('slotMinutes')),
date1,
addMinutes(cloneDate(date1), maxSlotNumber*opt('slotMinutes'))
].sort(cmp);
} else {
dates = [
date1,
addMinutes(cloneDate(date1), minSlotNumber*opt('slotMinutes')),
date2,
addMinutes(cloneDate(date2), opt('slotMinutes'))
].sort(cmp);
}
renderSlotSelection(dates[0], dates[3]); renderSlotSelection(dates[0], dates[3]);
}else{ }else{
dates = null; dates = null;
@ -760,7 +787,7 @@ function AgendaView(element, calendar, viewName) {
$(document).one('mouseup', function(ev) { $(document).one('mouseup', function(ev) {
hoverListener.stop(); hoverListener.stop();
if (dates) { if (dates) {
if (dates[0].equals(dates[1])) { if (+dates[0] == +dates[1]) {
reportDayClick(dates[0], false, ev); reportDayClick(dates[0], false, ev);
} }
reportSelection(dates[0], dates[3], false, ev); reportSelection(dates[0], dates[3], false, ev);
@ -771,7 +798,7 @@ function AgendaView(element, calendar, viewName) {
function reportDayClick(date, allDay, ev) { function reportDayClick(date, allDay, ev) {
trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date.clone(), allDay, ev); trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date, allDay, ev);
} }
@ -788,7 +815,7 @@ function AgendaView(element, calendar, viewName) {
renderCellOverlay(cell.row, cell.col, cell.row, cell.col); renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
}else{ }else{
var d1 = cellDate(cell); var d1 = cellDate(cell);
var d2 = d1.clone().addMinutes(opt('defaultEventMinutes')); var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes'));
renderSlotOverlay(d1, d2); renderSlotOverlay(d1, d2);
} }
} }

View file

@ -19,12 +19,12 @@ function AgendaWeekView(element, calendar) {
function render(date, delta) { function render(date, delta) {
if (delta) { if (delta) {
date.addWeeks(delta); addDays(date, delta * 7);
} }
var start = date.clone().clearTime().addDays(-((date.getDay() - opt('firstDay') + 7) % 7)); var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
var end = start.clone().addWeeks(1); var end = addDays(cloneDate(start), 7);
var visStart = start.clone(); var visStart = cloneDate(start);
var visEnd = end.clone(); var visEnd = cloneDate(end);
var weekends = opt('weekends'); var weekends = opt('weekends');
if (!weekends) { if (!weekends) {
skipWeekend(visStart); skipWeekend(visStart);
@ -32,7 +32,7 @@ function AgendaWeekView(element, calendar) {
} }
t.title = formatDates( t.title = formatDates(
visStart, visStart,
visEnd.clone().addDays(-1), addDays(cloneDate(visEnd), -1),
opt('titleFormat') opt('titleFormat')
); );
t.start = start; t.start = start;

View file

@ -22,14 +22,14 @@ function BasicDayView(element, calendar) {
function render(date, delta) { function render(date, delta) {
if (delta) { if (delta) {
date.addDays(delta); addDays(date, delta);
if (!opt('weekends')) { if (!opt('weekends')) {
skipWeekend(date, delta < 0 ? -1 : 1); skipWeekend(date, delta < 0 ? -1 : 1);
} }
} }
t.title = formatDate(date, opt('titleFormat')); t.title = formatDate(date, opt('titleFormat'));
t.start = t.visStart = date.clone().clearTime(); t.start = t.visStart = cloneDate(date, true);
t.end = t.visEnd = t.start.clone().addDays(1); t.end = t.visEnd = addDays(cloneDate(t.start), 1);
renderBasic(1, 1, 1, false); renderBasic(1, 1, 1, false);
} }

View file

@ -53,8 +53,8 @@ function BasicEventRenderer() {
function compileSegs(events) { function compileSegs(events) {
var rowCnt = getRowCnt(), var rowCnt = getRowCnt(),
colCnt = getColCnt(), colCnt = getColCnt(),
d1 = t.visStart.clone(), d1 = cloneDate(t.visStart),
d2 = d1.clone().addDays(colCnt), d2 = addDays(cloneDate(d1), colCnt),
visEventsEnds = $.map(events, exclEndDay), visEventsEnds = $.map(events, exclEndDay),
i, row, i, row,
j, level, j, level,
@ -71,8 +71,8 @@ function BasicEventRenderer() {
segs.push(seg); segs.push(seg);
} }
} }
d1.addWeeks(1); addDays(d1, 7);
d2.addWeeks(1); addDays(d2, 7);
} }
return segs; return segs;
} }
@ -96,6 +96,9 @@ function BasicEventRenderer() {
function draggableDayEvent(event, eventElement) { function draggableDayEvent(event, eventElement) {
if (!eventElement.draggable)
return;
var hoverListener = getHoverListener(); var hoverListener = getHoverListener();
var dayDelta; var dayDelta;
eventElement.draggable({ eventElement.draggable({
@ -113,8 +116,8 @@ function BasicEventRenderer() {
//setOverflowHidden(true); //setOverflowHidden(true);
dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1); dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1);
renderDayOverlay( renderDayOverlay(
event.start.clone().addDays(dayDelta).clearTime(), addDays(cloneDate(event.start), dayDelta),
exclEndDay(event).addDays(dayDelta).clearTime() addDays(exclEndDay(event), dayDelta)
); );
}else{ }else{
//setOverflowHidden(false); //setOverflowHidden(false);

View file

@ -184,7 +184,7 @@ function BasicView(element, calendar, viewName) {
function updateCells(firstTime) { function updateCells(firstTime) {
var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating? var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
var month = t.start.getMonth(); var month = t.start.getMonth();
var today = new MightyDate().clearTime(); var today = clearTime(new Date());
var cell; var cell;
var date; var date;
var row; var row;
@ -206,12 +206,13 @@ function BasicView(element, calendar, viewName) {
}else{ }else{
cell.addClass('fc-other-month'); cell.addClass('fc-other-month');
} }
if (date.equals(today)) { if (+date == +today) {
cell.addClass(tm + '-state-highlight fc-today'); cell.addClass(tm + '-state-highlight fc-today');
}else{ }else{
cell.removeClass(tm + '-state-highlight fc-today'); cell.removeClass(tm + '-state-highlight fc-today');
} }
cell.find('div.fc-day-number').text(date.getDate()); cell.find('div.fc-day-number').text(date.getDate());
trigger('dayRender', t, date, cell);
if (dowDirty) { if (dowDirty) {
setDayID(cell, date); setDayID(cell, date);
} }
@ -296,30 +297,29 @@ function BasicView(element, calendar, viewName) {
function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
// TODO: get straight whether caller needs to do clearTime or not
if (refreshCoordinateGrid) { if (refreshCoordinateGrid) {
coordinateGrid.build(); coordinateGrid.build();
} }
var rowStart = t.visStart.clone(); var rowStart = cloneDate(t.visStart);
var rowEnd = rowStart.clone().addDays(colCnt); var rowEnd = addDays(cloneDate(rowStart), colCnt);
for (var i=0; i<rowCnt; i++) { for (var i=0; i<rowCnt; i++) {
var stretchStart = overlayStart.before(rowStart) ? rowStart : overlayStart; var stretchStart = new Date(Math.max(rowStart, overlayStart));
var stretchEnd = overlayEnd.after(rowEnd) ? rowEnd : overlayEnd; var stretchEnd = new Date(Math.min(rowEnd, overlayEnd));
if (stretchStart.before(stretchEnd)) { if (stretchStart < stretchEnd) {
var colStart, colEnd; var colStart, colEnd;
if (rtl) { if (rtl) {
colStart = rowStart.diffDays(stretchEnd)*dis+dit+1; colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1;
colEnd = rowStart.diffDays(stretchStart)*dis+dit+1; colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1;
}else{ }else{
colStart = rowStart.diffDays(stretchStart); colStart = dayDiff(stretchStart, rowStart);
colEnd = rowStart.diffDays(stretchEnd); colEnd = dayDiff(stretchEnd, rowStart);
} }
dayBind( dayBind(
renderCellOverlay(i, colStart, i, colEnd-1) renderCellOverlay(i, colStart, i, colEnd-1)
); );
} }
rowStart.addWeeks(1); addDays(rowStart, 7);
rowEnd.addWeeks(1); addDays(rowEnd, 7);
} }
} }
@ -336,16 +336,12 @@ function BasicView(element, calendar, viewName) {
function defaultSelectionEnd(startDate, allDay) { function defaultSelectionEnd(startDate, allDay) {
return startDate.clone(); return cloneDate(startDate);
} }
function renderSelection(startDate, endDate, allDay) { function renderSelection(startDate, endDate, allDay) {
renderDayOverlay( renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time???
startDate.clone().clearTime(),
endDate.clone().addDays(1).clearTime(), // TODO: use util
true // rebuild every time???
);
} }
@ -357,7 +353,7 @@ function BasicView(element, calendar, viewName) {
function reportDayClick(date, allDay, ev) { function reportDayClick(date, allDay, ev) {
var cell = dateCell(date); var cell = dateCell(date);
var _element = bodyCells[cell.row*colCnt + cell.col]; var _element = bodyCells[cell.row*colCnt + cell.col];
trigger('dayClick', _element, date.clone(), allDay, ev); trigger('dayClick', _element, date, allDay, ev);
} }
@ -392,7 +388,7 @@ function BasicView(element, calendar, viewName) {
function defaultEventEnd(event) { function defaultEventEnd(event) {
return event.start.clone(); return cloneDate(event.start);
} }
@ -445,7 +441,7 @@ function BasicView(element, calendar, viewName) {
function dateCell(date) { function dateCell(date) {
return { return {
row: t.visStart.diffWeeks(date), row: Math.floor(dayDiff(date, t.visStart) / 7),
col: dayOfWeekCol(date.getDay()) col: dayOfWeekCol(date.getDay())
}; };
} }
@ -457,7 +453,7 @@ function BasicView(element, calendar, viewName) {
function _cellDate(row, col) { function _cellDate(row, col) {
return t.visStart.clone().addDays(row*7 + col*dis+dit); return addDays(cloneDate(t.visStart), row*7 + col*dis+dit);
// what about weekends in middle of week? // what about weekends in middle of week?
} }

View file

@ -19,12 +19,12 @@ function BasicWeekView(element, calendar) {
function render(date, delta) { function render(date, delta) {
if (delta) { if (delta) {
date.addWeeks(delta); addDays(date, delta * 7);
} }
var start = date.clone().clearTime().addDays(-((date.getDay() - opt('firstDay') + 7) % 7)); var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
var end = start.clone().addWeeks(1); var end = addDays(cloneDate(start), 7);
var visStart = start.clone(); var visStart = cloneDate(start);
var visEnd = end.clone(); var visEnd = cloneDate(end);
var weekends = opt('weekends'); var weekends = opt('weekends');
if (!weekends) { if (!weekends) {
skipWeekend(visStart); skipWeekend(visStart);
@ -32,7 +32,7 @@ function BasicWeekView(element, calendar) {
} }
t.title = formatDates( t.title = formatDates(
visStart, visStart,
visEnd.clone().addDays(-1), addDays(cloneDate(visEnd), -1),
opt('titleFormat') opt('titleFormat')
); );
t.start = start; t.start = start;

View file

@ -0,0 +1,46 @@
fcViews.fourWeeks = FourWeeksView;
function FourWeeksView(element, calendar) {
var t = this;
// exports
t.render = render;
// imports
BasicView.call(t, element, calendar, 'fourWeeks');
var opt = t.opt;
var renderBasic = t.renderBasic;
var formatDates = calendar.formatDates;
function render(date, delta) {
if (delta) {
addDays(date, delta * 7);
}
var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
var end = addDays(cloneDate(start), 7*4);
var visStart = cloneDate(start);
var visEnd = cloneDate(end);
var weekends = opt('weekends');
if (!weekends) {
skipWeekend(visStart);
skipWeekend(visEnd, -1, true);
}
t.title = formatDates(
visStart,
addDays(cloneDate(visEnd), -1),
opt('titleFormat')
);
t.start = start;
t.end = end;
t.visStart = visStart;
t.visEnd = visEnd;
renderBasic(4, 4, weekends ? 7 : 5, true);
}
}

View file

@ -19,23 +19,25 @@ function MonthView(element, calendar) {
function render(date, delta) { function render(date, delta) {
if (delta) { if (delta) {
date.setDate(1).addMonths(delta); addMonths(date, delta);
date.setDate(1);
} }
var start = date.clone().setDate(1).clearTime(); var start = cloneDate(date, true);
var end = start.clone().addMonths(1); start.setDate(1);
var visStart = start.clone(); var end = addMonths(cloneDate(start), 1);
var visEnd = end.clone(); var visStart = cloneDate(start);
var visEnd = cloneDate(end);
var firstDay = opt('firstDay'); var firstDay = opt('firstDay');
var nwe = opt('weekends') ? 0 : 1; var nwe = opt('weekends') ? 0 : 1;
if (nwe) { if (nwe) {
skipWeekend(visStart); skipWeekend(visStart);
skipWeekend(visEnd, -1, true); skipWeekend(visEnd, -1, true);
} }
visStart.addDays(-((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7)); addDays(visStart, -((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7));
visEnd.addDays((7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7); addDays(visEnd, (7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7);
var rowCnt = visStart.diffWeeks(visEnd); var rowCnt = Math.round((visEnd - visStart) / (DAY_MS * 7));
if (opt('weekMode') == 'fixed') { if (opt('weekMode') == 'fixed') {
visEnd.addWeeks(6 - rowCnt); addDays(visEnd, (6 - rowCnt) * 7);
rowCnt = 6; rowCnt = 6;
} }
t.title = formatDate(start, opt('titleFormat')); t.title = formatDate(start, opt('titleFormat'));

View file

@ -438,7 +438,7 @@ function DayEventRenderer() {
} }
} }
dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit); dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit);
var newEnd = eventEnd(event).addDays(dayDelta); var newEnd = addDays(eventEnd(event), dayDelta, true);
if (dayDelta) { if (dayDelta) {
eventCopy.end = newEnd; eventCopy.end = newEnd;
var oldHelpers = helpers; var oldHelpers = helpers;
@ -456,11 +456,7 @@ function DayEventRenderer() {
} }
} }
clearOverlays(); clearOverlays();
renderDayOverlay( renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start
event.start.clone().clearTime(),
newEnd.clone().addDays(1).clearTime() // TODO: use util
);
// coordinate grid already rebuild at hoverListener.start
} }
}, ev); }, ev);

View file

@ -20,6 +20,7 @@ function HoverListener(coordinateGrid) {
function mouse(ev) { function mouse(ev) {
_fixUIEvent(ev);
var newCell = coordinateGrid.cell(ev.pageX, ev.pageY); var newCell = coordinateGrid.cell(ev.pageX, ev.pageY);
if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) { if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) {
if (newCell) { if (newCell) {
@ -42,3 +43,11 @@ function HoverListener(coordinateGrid) {
} }
function _fixUIEvent(event) { // jQuery 1.7 workaround (for issue 1168)
if (event.pageX === undefined) {
event.pageX = event.originalEvent.pageX;
event.pageY = event.originalEvent.pageY;
}
}

View file

@ -60,7 +60,7 @@ function SelectionManager() {
function reportSelection(startDate, endDate, allDay, ev) { function reportSelection(startDate, endDate, allDay, ev) {
selected = true; selected = true;
trigger('select', null, startDate.clone(), endDate.clone(), allDay, ev); trigger('select', null, startDate, endDate, allDay, ev);
} }
@ -85,7 +85,7 @@ function SelectionManager() {
$(document).one('mouseup', function(ev) { $(document).one('mouseup', function(ev) {
hoverListener.stop(); hoverListener.stop();
if (dates) { if (dates) {
if (dates[0].equals(dates[1])) { if (+dates[0] == +dates[1]) {
reportDayClick(dates[0], true, ev); reportDayClick(dates[0], true, ev);
} }
reportSelection(dates[0], dates[1], true, ev); reportSelection(dates[0], dates[1], true, ev);

View file

@ -102,7 +102,19 @@ function View(element, calendar, viewName) {
// returns a Date object for an event's end // returns a Date object for an event's end
function eventEnd(event) { function eventEnd(event) {
return event.end ? event.end.clone() : defaultEventEnd(event); return event.end ? cloneDate(event.end) : defaultEventEnd(event);
}
// returns all events with a matching propery value
function eventsByProp(property, value)
{
var id, i, len, events = [];
for(id in eventsByID)
for(i=0, len=eventsByID[id].length; i<len; i++)
if (eventsByID[id][i][property] == value)
events.push(eventsByID[id][i]);
return events;
} }
@ -177,9 +189,15 @@ function View(element, calendar, viewName) {
function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui) { function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui) {
var events;
var oldAllDay = event.allDay; var oldAllDay = event.allDay;
var eventId = event._id; var eventId = event._id;
moveEvents(eventsByID[eventId], dayDelta, minuteDelta, allDay); var prop = opt('eventGroupProperty') || 'id';
if (prop != 'id')
events = eventsByProp(prop, event[prop]);
else
events = eventsByID[eventId];
moveEvents(events, dayDelta, minuteDelta, allDay);
trigger( trigger(
'eventDrop', 'eventDrop',
e, e,
@ -189,7 +207,7 @@ function View(element, calendar, viewName) {
allDay, allDay,
function() { function() {
// TODO: investigate cases where this inverse technique might not work // TODO: investigate cases where this inverse technique might not work
moveEvents(eventsByID[eventId], -dayDelta, -minuteDelta, oldAllDay); moveEvents(events, -dayDelta, -minuteDelta, oldAllDay);
reportEventChange(eventId); reportEventChange(eventId);
}, },
ev, ev,
@ -200,8 +218,14 @@ function View(element, calendar, viewName) {
function eventResize(e, event, dayDelta, minuteDelta, ev, ui) { function eventResize(e, event, dayDelta, minuteDelta, ev, ui) {
var events;
var eventId = event._id; var eventId = event._id;
elongateEvents(eventsByID[eventId], dayDelta, minuteDelta); var prop = opt('eventGroupProperty') || 'id';
if (prop != 'id')
events = eventsByProp(prop, event[prop]);
else
events = eventsByID[eventId];
elongateEvents(events, dayDelta, minuteDelta);
trigger( trigger(
'eventResize', 'eventResize',
e, e,
@ -210,7 +234,7 @@ function View(element, calendar, viewName) {
minuteDelta, minuteDelta,
function() { function() {
// TODO: investigate cases where this inverse technique might not work // TODO: investigate cases where this inverse technique might not work
elongateEvents(eventsByID[eventId], -dayDelta, -minuteDelta); elongateEvents(events, -dayDelta, -minuteDelta);
reportEventChange(eventId); reportEventChange(eventId);
}, },
ev, ev,
@ -232,9 +256,11 @@ function View(element, calendar, viewName) {
if (allDay !== undefined) { if (allDay !== undefined) {
e.allDay = allDay; e.allDay = allDay;
} }
e.start.addDays(dayDelta).addMinutes(minuteDelta); addMinutes(addDays(e.start, dayDelta, true), minuteDelta);
if (e.end) { if (e.end) {
e.end.addDays(dayDelta).addMinutes(minuteDelta); e.end = addMinutes(addDays(e.end, dayDelta, true), minuteDelta);
} else {
e.end = defaultEventEnd(e);
} }
normalizeEvent(e, options); normalizeEvent(e, options);
} }
@ -245,7 +271,7 @@ function View(element, calendar, viewName) {
minuteDelta = minuteDelta || 0; minuteDelta = minuteDelta || 0;
for (var e, len=events.length, i=0; i<len; i++) { for (var e, len=events.length, i=0; i<len; i++) {
e = events[i]; e = events[i];
e.end = eventEnd(e).addDays(dayDelta).addMinutes(minuteDelta); e.end = addMinutes(addDays(eventEnd(e), dayDelta, true), minuteDelta);
normalizeEvent(e, options); normalizeEvent(e, options);
} }
} }

359
src/date_util.js Normal file
View file

@ -0,0 +1,359 @@
fc.addDays = addDays;
fc.cloneDate = cloneDate;
fc.parseDate = parseDate;
fc.parseISO8601 = parseISO8601;
fc.parseTime = parseTime;
fc.formatDate = formatDate;
fc.formatDates = formatDates;
/* Date Math
-----------------------------------------------------------------------------*/
var dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],
DAY_MS = 86400000,
HOUR_MS = 3600000,
MINUTE_MS = 60000;
function addYears(d, n, keepTime) {
d.setFullYear(d.getFullYear() + n);
if (!keepTime) {
clearTime(d);
}
return d;
}
function addMonths(d, n, keepTime) { // prevents day overflow/underflow
if (+d) { // prevent infinite looping on invalid dates
var m = d.getMonth() + n,
check = cloneDate(d);
check.setDate(1);
check.setMonth(m);
d.setMonth(m);
if (!keepTime) {
clearTime(d);
}
while (d.getMonth() != check.getMonth()) {
d.setDate(d.getDate() + (d < check ? 1 : -1));
}
}
return d;
}
function addDays(d, n, keepTime) { // deals with daylight savings
if (+d) {
var dd = d.getDate() + n,
check = cloneDate(d);
check.setHours(9); // set to middle of day
check.setDate(dd);
d.setDate(dd);
if (!keepTime) {
clearTime(d);
}
fixDate(d, check);
}
return d;
}
function fixDate(d, check) { // force d to be on check's YMD, for daylight savings purposes
if (+d) { // prevent infinite looping on invalid dates
while (d.getDate() != check.getDate()) {
d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS);
}
}
}
function addMinutes(d, n) {
d.setMinutes(d.getMinutes() + n);
return d;
}
function clearTime(d) {
d.setHours(0);
d.setMinutes(0);
d.setSeconds(0);
d.setMilliseconds(0);
return d;
}
function cloneDate(d, dontKeepTime) {
if (dontKeepTime) {
return clearTime(new Date(+d));
}
return new Date(+d);
}
function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1
var i=0, d;
do {
d = new Date(1970, i++, 1);
} while (d.getHours()); // != 0
return d;
}
function skipWeekend(date, inc, excl) {
inc = inc || 1;
while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
addDays(date, inc);
}
return date;
}
function dayDiff(d1, d2) { // d1 - d2
return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS);
}
function setYMD(date, y, m, d) {
if (y !== undefined && y != date.getFullYear()) {
date.setDate(1);
date.setMonth(0);
date.setFullYear(y);
}
if (m !== undefined && m != date.getMonth()) {
date.setDate(1);
date.setMonth(m);
}
if (d !== undefined) {
date.setDate(d);
}
}
/* Date Parsing
-----------------------------------------------------------------------------*/
function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
if (typeof s == 'object') { // already a Date object
return s;
}
if (typeof s == 'number') { // a UNIX timestamp
return new Date(s * 1000);
}
if (typeof s == 'string') {
if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp
return new Date(parseFloat(s) * 1000);
}
if (ignoreTimezone === undefined) {
ignoreTimezone = true;
}
return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
}
// TODO: never return invalid dates (like from new Date(<string>)), return null instead
return null;
}
function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
// derived from http://delete.me.uk/2005/03/iso8601.html
// TODO: for a know glitch/feature, read tests/issue_206_parseDate_dst.html
var m = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);
if (!m) {
return null;
}
var date = new Date(m[1], 0, 1);
if (ignoreTimezone || !m[13]) {
var check = new Date(m[1], 0, 1, 9, 0);
if (m[3]) {
date.setMonth(m[3] - 1);
check.setMonth(m[3] - 1);
}
if (m[5]) {
date.setDate(m[5]);
check.setDate(m[5]);
}
fixDate(date, check);
if (m[7]) {
date.setHours(m[7]);
}
if (m[8]) {
date.setMinutes(m[8]);
}
if (m[10]) {
date.setSeconds(m[10]);
}
if (m[12]) {
date.setMilliseconds(Number("0." + m[12]) * 1000);
}
fixDate(date, check);
}else{
date.setUTCFullYear(
m[1],
m[3] ? m[3] - 1 : 0,
m[5] || 1
);
date.setUTCHours(
m[7] || 0,
m[8] || 0,
m[10] || 0,
m[12] ? Number("0." + m[12]) * 1000 : 0
);
if (m[14]) {
var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
offset *= m[15] == '-' ? 1 : -1;
date = new Date(+date + (offset * 60 * 1000));
}
}
return date;
}
function parseTime(s) { // returns minutes since start of day
if (typeof s == 'number') { // an hour
return s * 60;
}
if (typeof s == 'object') { // a Date object
return s.getHours() * 60 + s.getMinutes();
}
var m = s.match(/(\d+)(?::(\d+))?\s*(\w+)?/);
if (m) {
var h = parseInt(m[1], 10);
if (m[3]) {
h %= 12;
if (m[3].toLowerCase().charAt(0) == 'p') {
h += 12;
}
}
return h * 60 + (m[2] ? parseInt(m[2], 10) : 0);
}
}
/* Date Formatting
-----------------------------------------------------------------------------*/
// TODO: use same function formatDate(date, [date2], format, [options])
function formatDate(date, format, options) {
return formatDates(date, null, format, options);
}
function formatDates(date1, date2, format, options) {
options = options || defaults;
var date = date1,
otherDate = date2,
i, len = format.length, c,
i2, formatter,
res = '';
for (i=0; i<len; i++) {
c = format.charAt(i);
if (c == "'") {
for (i2=i+1; i2<len; i2++) {
if (format.charAt(i2) == "'") {
if (date) {
if (i2 == i+1) {
res += "'";
}else{
res += format.substring(i+1, i2);
}
i = i2;
}
break;
}
}
}
else if (c == '(') {
for (i2=i+1; i2<len; i2++) {
if (format.charAt(i2) == ')') {
var subres = formatDate(date, format.substring(i+1, i2), options);
if (parseInt(subres.replace(/\D/, ''), 10)) {
res += subres;
}
i = i2;
break;
}
}
}
else if (c == '[') {
for (i2=i+1; i2<len; i2++) {
if (format.charAt(i2) == ']') {
var subformat = format.substring(i+1, i2);
var subres = formatDate(date, subformat, options);
if (subres != formatDate(otherDate, subformat, options)) {
res += subres;
}
i = i2;
break;
}
}
}
else if (c == '{') {
date = date2;
otherDate = date1;
}
else if (c == '}') {
date = date1;
otherDate = date2;
}
else {
for (i2=len; i2>i; i2--) {
if (formatter = dateFormatters[format.substring(i, i2)]) {
if (date) {
res += formatter(date, options);
}
i = i2 - 1;
break;
}
}
if (i2 == i) {
if (date) {
res += c;
}
}
}
}
return res;
};
var dateFormatters = {
s : function(d) { return d.getSeconds() },
ss : function(d) { return zeroPad(d.getSeconds()) },
m : function(d) { return d.getMinutes() },
mm : function(d) { return zeroPad(d.getMinutes()) },
h : function(d) { return d.getHours() % 12 || 12 },
hh : function(d) { return zeroPad(d.getHours() % 12 || 12) },
H : function(d) { return d.getHours() },
HH : function(d) { return zeroPad(d.getHours()) },
d : function(d) { return d.getDate() },
dd : function(d) { return zeroPad(d.getDate()) },
ddd : function(d,o) { return o.dayNamesShort[d.getDay()] },
dddd: function(d,o) { return o.dayNames[d.getDay()] },
M : function(d) { return d.getMonth() + 1 },
MM : function(d) { return zeroPad(d.getMonth() + 1) },
MMM : function(d,o) { return o.monthNamesShort[d.getMonth()] },
MMMM: function(d,o) { return o.monthNames[d.getMonth()] },
yy : function(d) { return (d.getFullYear()+'').substring(2) },
yyyy: function(d) { return d.getFullYear() },
t : function(d) { return d.getHours() < 12 ? 'a' : 'p' },
tt : function(d) { return d.getHours() < 12 ? 'am' : 'pm' },
T : function(d) { return d.getHours() < 12 ? 'A' : 'P' },
TT : function(d) { return d.getHours() < 12 ? 'AM' : 'PM' },
u : function(d) { return formatDate(d, "yyyy-MM-dd'T'HH:mm:ss'Z'") },
S : function(d) {
var date = d.getDate();
if (date > 10 && date < 20) {
return 'th';
}
return ['st', 'nd', 'rd'][date%10-1] || 'th';
}
};

View file

@ -19,19 +19,23 @@ var defaults = {
allDayDefault: true, allDayDefault: true,
ignoreTimezone: true, ignoreTimezone: true,
// event ajax // event ajax
lazyFetching: true, lazyFetching: true,
startParam: 'start', startParam: 'start',
endParam: 'end', endParam: 'end',
startEndDateOnly: false,
// time formats // time formats
titleFormat: { titleFormat: {
month: 'MMMM yyyy', month: 'MMMM yyyy',
fourWeeks: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",
week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}", week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",
day: 'dddd, MMM d, yyyy' day: 'dddd, MMM d, yyyy'
}, },
columnFormat: { columnFormat: {
month: 'ddd', month: 'ddd',
fourWeeks: "ddd",
week: 'ddd M/d', week: 'ddd M/d',
day: 'dddd M/d' day: 'dddd M/d'
}, },
@ -42,6 +46,10 @@ var defaults = {
// locale // locale
isRTL: false, isRTL: false,
firstDay: 0, firstDay: 0,
monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
buttonText: { buttonText: {
prev: '&nbsp;&#9668;&nbsp;', prev: '&nbsp;&#9668;&nbsp;',
next: '&nbsp;&#9658;&nbsp;', next: '&nbsp;&#9658;&nbsp;',
@ -50,6 +58,7 @@ var defaults = {
today: 'today', today: 'today',
month: 'month', month: 'month',
week: 'week', week: 'week',
fourWeeks: "4 weeks",
day: 'day' day: 'day'
}, },

View file

@ -13,7 +13,9 @@
var fc = $.fullCalendar; var fc = $.fullCalendar;
var parseDate = fc.parseDate; var formatDate = fc.formatDate;
var parseISO8601 = fc.parseISO8601;
var addDays = fc.addDays;
var applyAll = fc.applyAll; var applyAll = fc.applyAll;
@ -40,8 +42,8 @@ function transformOptions(sourceOptions, start, end) {
var success = sourceOptions.success; var success = sourceOptions.success;
var data = $.extend({}, sourceOptions.data || {}, { var data = $.extend({}, sourceOptions.data || {}, {
'start-min': start.toString('u'), 'start-min': formatDate(start, 'u'),
'start-max': end.toString('u'), 'start-max': formatDate(end, 'u'),
'singleevents': true, 'singleevents': true,
'max-results': 9999 'max-results': 9999
}); });
@ -62,8 +64,8 @@ function transformOptions(sourceOptions, start, end) {
if (data.feed.entry) { if (data.feed.entry) {
$.each(data.feed.entry, function(i, entry) { $.each(data.feed.entry, function(i, entry) {
var startStr = entry['gd$when'][0]['startTime']; var startStr = entry['gd$when'][0]['startTime'];
var start = parseDate(startStr, true); // true for ignoreTimezone var start = parseISO8601(startStr, true);
var end = parseDate(entry['gd$when'][0]['endTime'], true); // true for ignoreTimezone var end = parseISO8601(entry['gd$when'][0]['endTime'], true);
var allDay = startStr.indexOf('T') == -1; var allDay = startStr.indexOf('T') == -1;
var url; var url;
$.each(entry.link, function(i, link) { $.each(entry.link, function(i, link) {
@ -75,7 +77,7 @@ function transformOptions(sourceOptions, start, end) {
} }
}); });
if (allDay) { if (allDay) {
end.addDays(-1); // make inclusive addDays(end, -1); // make inclusive
} }
events.push({ events.push({
id: entry['gCal$uid']['value'], id: entry['gCal$uid']['value'],

View file

@ -36,31 +36,32 @@ $.fn.fullCalendar = function(options) {
eventSources.push(options.events); eventSources.push(options.events);
delete options.events; delete options.events;
} }
options = $.extend(true, {}, options = $.extend(true, {},
defaults, defaults,
(options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {}, (options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {},
options options
); );
this.each(function(i, _element) { this.each(function(i, _element) {
var element = $(_element); var element = $(_element);
var calendar = new Calendar(element, options, eventSources); var calendar = new Calendar(element, options, eventSources);
element.data('fullCalendar', calendar); // TODO: look into memory leak implications element.data('fullCalendar', calendar); // TODO: look into memory leak implications
calendar.render(); calendar.render();
}); });
return this; return this;
}; };
// function for adding/overriding defaults // function for adding/overriding defaults
function setDefaults(d) { var setDefaults = function(d) {
$.extend(true, defaults, d); $.extend(true, defaults, d);
} }
$.fullCalendar.setDefaults = setDefaults;

View file

@ -1,795 +0,0 @@
/**
* @preserve MightyDate v0.4
* http://github.com/arshaw/mightydate
*
* Copyright 2011, Adam Shaw
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Date: Sun May 8 00:19:07 2011 -0700
*/
var MightyDate = (function(Date, undefined) {
/** @const */ var FULLYEAR_INDEX = 0;
/** @const */ var MONTH_INDEX = 1;
/** @const */ var DATE_INDEX = 2;
/** @const */ var HOURS_INDEX = 3;
/** @const */ var MINUTES_INDEX = 4;
/** @const */ var SECONDS_INDEX = 5;
/** @const */ var MILLISECONDS_INDEX = 6;
/** @const */ var DAY_INDEX = 7;
/** @const */ var YEAR_INDEX = 8;
/** @const */ var WEEK_INDEX = 9;
/** @const */ var DAY_MS = 86400000;
var methodSubjects = [
'FullYear', // 0
'Month', // 1
'Date', // 2
'Hours', // 3
'Minutes', // 4
'Seconds', // 5
'Milliseconds', // 6
'Day', // 7
'Year' // 8
];
var subjectPlurals = [
'Years', // 0
'Months', // 1
'Days' // 2
];
var otherGetters = [
'getTimezoneOffset',
'getTime',
'valueOf',
'toDateString',
'toTimeString',
'toLocaleString',
'toLocaleDateString',
'toLocaleTimeString',
'toJSON'
];
var formatStringRE = new RegExp(
"(" + // 1
"\\((" + "('.*?'|\\(.*?\\)|.)*?" + ")\\)" + "|" + // 2 3
"\\{(" + "('.*?'|.)*?" + ")\\}" + "|" + // 4 5
"\\[(" + "('.*?'|.)*?" + ")\\]" + "|" + // 6 7
"'(.*?)'" + "|" + // 8
"(.[^({[']*)" + // 9
")" +
"(.*)" // 10
);
var UTC = Date.UTC;
var proto = MightyDate.prototype;
var i;
var noopSignal = {};
/* Constructor
------------------------------------------------------------------------------*/
function MightyDate() {
if (!(this instanceof MightyDate)) {
// when MightyDate is called as a method. TODO: write test
return init(new MightyDate(noopSignal), arguments);
}
init(this, arguments);
}
function init(mightyDate, args) {
var len = args.length;
if (!len) {
// set to now
setLocalDate(mightyDate, new Date());
}
else if (len == 1) {
var arg = args[0];
if (isNumber(arg)) {
setLocalDate(mightyDate, new Date(arg));
}
else if (isString(arg)) {
_setUniversalDate(mightyDate, new Date(0));
parse(mightyDate, arg);
}
else if (arg instanceof Date) {
setLocalDate(mightyDate, new Date(+arg));
}
else if (arg instanceof MightyDate) {
_setUniversalDate(mightyDate, new Date(+getUniversalDate(arg)));
}
else if (arg != noopSignal) {
_setUniversalDate(mightyDate, NaN); // make it an Invalid Date. TODO: write test
}
}
else {
_setUniversalDate(mightyDate, new Date(UTC.apply(Date, args)));
}
return mightyDate;
}
/* Standard Methods + Adding/Diffing Methods
-----------------------------------------------------------------------------*/
for (i=0; i<WEEK_INDEX; i++) (function(subject, i) { // TODO: rename i to fieldIndex
if (i != YEAR_INDEX) { // there is no getUTCYear
// getFullYear
// getMonth
// getDate
// getHours
// getMinutes
// getSeconds
// getMilliseconds
// getDay
proto['get' + subject] = function() {
return getUniversalDate(this)['getUTC' + subject]();
};
}
// getFullYear
// getMonth
// getDate
// getHours
// getMinutes
// getSeconds
// getMilliseconds
// getDay
// getYear
proto['getUTC' + subject] = function() {
return getLocalDate(this)['getUTC' + subject]();
};
if (i != DAY_INDEX) { // there is no setDay or setUTCDay methods
// setFullYear
// setMonth
// setDate
// setHours
// setMinutes
// setSeconds
// setMilliseconds
// setYear
proto['set' + subject] = function(value, preventOverflow) {
value = parseInt(value); // TODO: write tests
var month = i == MONTH_INDEX ? value % 12 : this.getMonth();
var args = arguments;
if (args.length == 2 && (isBoolean(preventOverflow) || preventOverflow === undefined)) {
args = [value];
}
getUniversalDate(this)['setUTC' + subject].apply(
getUniversalDate(this),
args
);
clearLocalDate(this);
// TODO: write tests for year overflow
if (i < DATE_INDEX && preventOverflow === true && this.getMonth() != month) { // fullyear or month
this.addMonths(-1)
.setDate(
getDaysInMonth(this.getFullYear(), this.getMonth())
);
}
return this; // for chaining
};
if (i != YEAR_INDEX) { // there is no setUTCYear method
// setUTCFullYear
// setUTCMonth
// setUTCDate
// setUTCHours
// setUTCMinutes
// setUTCMilliseconds
proto['setUTC' + subject] = function() {
var localDate = getLocalDate(this);
localDate['setUTC' + subject].apply(
localDate,
arguments
);
setUniversalDate(this, localToUniversal(localDate));
return this; // for chaining
};
}
}
if (i < DAY_INDEX) { // not day and not year
// addYears
// addMonths
// addDays
// addHours
// addMinutes
// addSeconds
// addMilliseconds
proto['add' + (subjectPlurals[i] || subject)] = function(delta, preventOverflow) {
delta = parseInt(delta);
this['set' + subject](
this['get' + subject]() + delta,
preventOverflow
);
return this; // for chaining
};
// diffYears
// diffMonths
// diffDays
// diffHours
// diffMinutes
// diffSeconds
// diffMilliseconds
proto['diff' + (subjectPlurals[i] || subject)] = function(otherDate, exact) {
return diff(i, this, otherDate, exact);
};
}
})(methodSubjects[i], i);
for (i=0; i<otherGetters.length; i++) (function(getter) {
proto[getter] = function() {
return getLocalDate(this)[getter]();
};
})(otherGetters[i]);
proto.getYear = function() {
return getUniversalDate(this).getUTCFullYear() - 1900;
};
proto.setTime = function(t) {
setLocalDate(this, new Date(t));
};
function diff(fieldIndex, date, otherDate, exact) { // TODO: write tests
var d1 = getUniversalDate(date);
var d2 = extractUniversalDate(otherDate);
var v;
if (fieldIndex < DATE_INDEX) { // fullyear or month
v = (d2.getUTCFullYear() * 12 + d2.getUTCMonth()) -
(d1.getUTCFullYear() * 12 + d1.getUTCMonth()) +
((d2 - UTC(d2.getUTCFullYear(), d2.getUTCMonth(), 1)) -
(d1 - UTC(d1.getUTCFullYear(), d1.getUTCMonth(), 1))) / DAY_MS / 31;
if (fieldIndex == FULLYEAR_INDEX) {
v /= 12;
}
}else{
v = (d2 - d1) / [ // milliseconds in a...
DAY_MS, // day
3600000, // hour
60000, // minute
1000, // second
1, // millisecond
0,
0,
DAY_MS * 7 // week
][fieldIndex - 2];
}
if (!exact) {
v = Math.floor(v);
}
return v;
}
/* Week (TODO: write tests)
----------------------------------------------------------------------------*/
proto.diffWeeks = function(otherDate, exact) {
return diff(WEEK_INDEX, this, otherDate, exact);
};
proto.addWeeks = function(delta) {
return this.addDays(delta * 7);
};
proto.getWeek = function(d) {
return _getWeek(this.getFullYear(), this.getMonth(), this.getDate());
};
proto.getUTCWeek = function(d) {
return _getWeek(this.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate());
};
function _getWeek(year, month, date) {
var d = new Date(UTC(year, month, date));
var currentWeek1 = getWeek1(year);
var week1 = currentWeek1;
if (d < currentWeek1) {
week1 = getWeek1(year-1);
}else{
var nextWeek1 = getWeek1(year+1);
if (d >= nextWeek1) {
week1 = nextWeek1;
}
}
return Math.floor(Math.round((d - week1) / DAY_MS) / 7) + 1;
}
function getWeek1(year) {
var d = new Date(UTC(year, 0, 4));
d.setUTCDate(d.getUTCDate() - (d.getUTCDay() + 6) % 7);
return d;
}
/* Non-Standard Methods
-----------------------------------------------------------------------------*/
proto.equals = function(date) {
return +getUniversalDate(this) == +extractUniversalDate(date);
};
proto.before = function(date) {
return getUniversalDate(this) < extractUniversalDate(date);
};
proto.after = function(date) {
return getUniversalDate(this) > extractUniversalDate(date);
};
proto.valid = function() {
return !isNaN(+getUniversalDate(this));
};
proto.clearTime = function() {
return this.setHours(0, 0, 0, 0);
};
proto.clone = function() {
return new MightyDate(this);
};
proto.toDate = function() {
return new Date(+this);
};
/* Parsing
-----------------------------------------------------------------------------*/
MightyDate.parsers = [
parseISO
];
MightyDate.parse = function(str) {
return +new MightyDate(''+str);
};
function parse(date, str) {
var parsers = MightyDate.parsers;
for (var i=0; i<parsers.length; i++) {
if (parsers[i](date, str)) {
return;
}
}
setLocalDate(date, new Date(str));
}
function parseISO(date, str) {
var m = str.match(/^(\d{4})(-(\d{2})(-(\d{2})([T ](\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/);
if (!m) {
return false;
}
var args1 = [
m[1],
m[3] ? m[3] - 1 : 0,
m[5] || 1
];
var args2 = [
m[7] || 0,
m[8] || 0,
m[10] || 0,
m[12] ? Number('0.' + m[12]) * 1000 : 0
];
if (m[14]) {
date.setUTCFullYear.apply(date, args1);
date.setUTCHours.apply(date, args2);
var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
offset *= m[15] == '-' ? 1 : -1;
date.addMinutes(offset);
}else{
date.setFullYear.apply(date, args1);
date.setHours.apply(date, args2);
}
return true;
}
/* Formatting
---------------------------------------------------------------------------------------*/
MightyDate.defaultLocale = '';
MightyDate.locales = {
'': {
monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
amDesignator: 'AM',
pmDesignator: 'PM'
}
};
MightyDate.formatters = {
i: "yyyy-MM-dd'T'HH:mm:ss",
u: "yyyy-MM-dd'T'HH:mm:ssK"
};
proto.toString = function(otherDate, formatString, settings) {
if (!arguments.length || !this.valid()) {
return getLocalDate(this).toString();
}
return format(false, this, otherDate, formatString, settings);
};
proto.toUTCString = proto.toGMTString = function(otherDate, formatString, settings) {
if (!arguments.length || !this.valid()) {
return getLocalDate(this).toUTCString();
}
return format(true, this, otherDate, formatString, settings);
};
function format(isUTC, date, otherDate, formatString, settings) {
if (isString(otherDate)) {
settings = formatString;
formatString = otherDate;
otherDate = null;
}
var locales = MightyDate.locales;
var localeSettings = locales[MightyDate.defaultLocale] || {};
if (isString(settings)) {
localeSettings = locales[settings] || localeSettings;
settings = {};
}else{
settings = settings || {};
}
function getSetting(name) {
return settings[name] || localeSettings[name];
}
return _format(isUTC, date, otherDate, formatString, getSetting);
}
function _format(isUTC, date, otherDate, formatString, getSetting, uniqueness) {
var match;
var tokenReplacement;
var subOutput;
var output = '';
var _getField = isUTC ? getUTCField : getLocalField;
function getField(i) {
if (uniqueness) {
for (var j=i; j>=0; j--) {
uniqueness.push(_getField(date, j));
}
}
return _getField(date, i);
}
while (formatString) {
match = formatStringRE.exec(formatString);
if (match[9] !== undefined) {
// tokens
var tokenSoup = match[9];
var tokenSoupLength = tokenSoup.length;
var tokenStart = 0;
var tokenEnd = tokenSoupLength;
while (tokenStart < tokenSoupLength) {
tokenReplacement = undefined;
// find the longest formatter starting at tokenStart
while (tokenEnd > tokenStart) {
tokenReplacement = getTokenReplacement(
tokenSoup.substring(tokenStart, tokenEnd), // the potential token
isUTC, date, getField, getSetting, uniqueness
);
if (tokenReplacement !== undefined) {
output += tokenReplacement;
tokenStart = tokenEnd; // continue looking after
break;
}
tokenEnd--;
}
if (tokenReplacement === undefined) {
// swallow single character and continue after
output += formatString.charAt(tokenStart);
tokenStart++;
}
tokenEnd = tokenSoupLength;
}
}
else if (match[2] !== undefined) {
// only if non-zero
subOutput = _format(isUTC, date, otherDate, match[2], getSetting);
if (Number(subOutput.replace(/\D/g, ''))) {
output += subOutput;
}
}
else if (match[4] !== undefined) {
// switch to other date
if (otherDate) {
output += _format(isUTC, otherDate, date, match[4], getSetting);
}
}
else if (match[6] !== undefined) {
// only if different
var otherSubUniqueness = [];
var otherSubOutput = _format(isUTC, otherDate, date, match[6], getSetting, otherSubUniqueness);
var subUniqueness = [];
subOutput = _format(isUTC, date, otherDate, match[6], getSetting, subUniqueness);
if (subOutput != otherSubOutput || subUniqueness.join() != otherSubUniqueness.join()) {
output += subOutput;
}
}
else if (match[8] !== undefined) {
if (match[8]) {
output += match[8]; // quoted text
}else{
output += "'"; // escaped quote
}
}
formatString = match[10];
}
return output;
}
function getTokenReplacement(token, isUTC, date, getField, getSetting, uniqueness) {
var formatter = MightyDate.formatters[token];
if (formatter) {
if (isString(formatter)) {
return _format(isUTC, date, null, formatter, getSetting, uniqueness);
}
return formatter(date, getSetting, isUTC);
}
switch (token) {
case 's' : return getField(SECONDS_INDEX);
case 'ss' : return zeroPad(getField(SECONDS_INDEX));
case 'm' : return getField(MINUTES_INDEX);
case 'mm' : return zeroPad(getField(MINUTES_INDEX));
case 'h' : return getField(HOURS_INDEX) % 12 || 12;
case 'hh' : return zeroPad(getField(HOURS_INDEX) % 12 || 12);
case 'H' : return getField(HOURS_INDEX);
case 'HH' : return zeroPad(getField(HOURS_INDEX));
case 'd' : return getField(DATE_INDEX);
case 'dd' : return zeroPad(getField(DATE_INDEX));
case 'ddd' : return getSetting('dayNamesShort')[getField(DAY_INDEX)];
case 'dddd' : return getSetting('dayNames')[getField(DAY_INDEX)];
case 'M' : return getField(MONTH_INDEX) + 1;
case 'MM' : return zeroPad(getField(MONTH_INDEX) + 1);
case 'MMM' : return getSetting('monthNamesShort')[getField(MONTH_INDEX)];
case 'MMMM' : return getSetting('monthNames')[getField(MONTH_INDEX)];
case 'yy' : return (getField(FULLYEAR_INDEX)+'').substring(2);
case 'yyyy' : return getField(FULLYEAR_INDEX);
case 't' :
case 'tt' :
case 'T' :
case 'TT' :
var s = getField(HOURS_INDEX) < 12 ? getSetting('amDesignator') : getSetting('pmDesignator');
if (token.length == 1) s = s.substr(0, 1);
if (token > 'TT') s = s.toLowerCase(); // token == 't' || token == 'tt'
return s;
case 'K' : if (isUTC) return 'Z';
case 'z' :
case 'zz' :
case 'zzz' :
var tzo = date.getTimezoneOffset();
var sign = tzo < 0 ? '+' : '-';
var hours = Math.floor((tzo = Math.abs(tzo)) / 60);
var minutes = tzo % 60;
return sign +
(token == 'z' ? hours : zeroPad(hours)) +
((token == 'z' || token == 'zz') ? '' : ':' + zeroPad(minutes));
case 'S' :
var d = getField(DATE_INDEX);
if (d > 10 && d < 20) return 'th';
return ['st', 'nd', 'rd'][d % 10 - 1] || 'th';
case 'W' :
return _getWeek(
getField(FULLYEAR_INDEX),
getField(MONTH_INDEX),
getField(DATE_INDEX)
);
case 'WW' :
return zeroPad(
_getWeek(
getField(FULLYEAR_INDEX),
getField(MONTH_INDEX),
getField(DATE_INDEX)
)
);
}
}
function getLocalField(date, i) {
return date['get' + methodSubjects[i]]();
}
function getUTCField(date, i) {
return date['getUTC' + methodSubjects[i]]();
}
/* Misc Class Methods
-----------------------------------------------------------------------------*/
MightyDate.now = Date.now;
MightyDate.UTC = UTC;
MightyDate.getDaysInMonth = getDaysInMonth;
/* Date Utilities
--------------------------------------------------------------------------------*/
function getDaysInMonth(year, month) {
return 32 - new Date(Date.UTC(year, month, 32)).getUTCDate();
}
function extractUniversalDate(date) {
if (date instanceof MightyDate) {
return getUniversalDate(date);
}
else if (date instanceof Date) {
return localToUniversal(date);
}
return getUniversalDate(new MightyDate(date));
}
function localToUniversal(localDate) {
return new Date(UTC(
localDate.getFullYear(),
localDate.getMonth(),
localDate.getDate(),
localDate.getHours(),
localDate.getMinutes(),
localDate.getSeconds(),
localDate.getMilliseconds()
));
}
function universalToLocal(universalDate) {
return new Date(
universalDate.getUTCFullYear(),
universalDate.getUTCMonth(),
universalDate.getUTCDate(),
universalDate.getUTCHours(),
universalDate.getUTCMinutes(),
universalDate.getUTCSeconds(),
universalDate.getUTCMilliseconds()
);
}
/* General Utilities
--------------------------------------------------------------------------------*/
function zeroPad(n) {
return (n < 10 ? '0' : '') + n;
}
function isString(x) {
return typeof x == 'string';
}
function isNumber(x) {
return typeof x == 'number';
}
function isBoolean(x) {
return typeof x == 'boolean';
}
/* Internal Utilities
---------------------------------------------------------------------------------*/
// _ is universal date
// $ is local date
function getUniversalDate(mightyDate) {
return mightyDate._;
}
function setUniversalDate(mightyDate, universalDate) {
_setUniversalDate(mightyDate, universalDate);
clearLocalDate(mightyDate);
}
function _setUniversalDate(mightyDate, universalDate) {
mightyDate._ = universalDate;
}
function getLocalDate(mightyDate) {
if (mightyDate.$ === undefined) {
mightyDate.$ = universalToLocal(mightyDate._);
}
return mightyDate.$;
}
function setLocalDate(mightyDate, localDate) {
mightyDate.$ = localDate;
mightyDate._ = localToUniversal(localDate);
}
function clearLocalDate(mightyDate) {
delete mightyDate.$;
}
return MightyDate;
})(Date);

View file

@ -1,85 +1,5 @@
fc.applyAll = applyAll; fc.applyAll = applyAll;
fc.Date = MightyDate;
fc.parseDate = parseDate;
fc.parseISO8601 = parseISO8601;
fc.formatDate = formatDate;
fc.formatDates = formatDates;
var dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
/* Date
--------------------------------------------------------------------------------*/
function skipWeekend(date, inc, excl) {
inc = inc || 1;
while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
date.addDays(inc);
}
return date;
}
function parseTime(s) { // returns minutes since start of day
if (typeof s == 'number') { // an hour
return s * 60;
}
if (typeof s == 'object') { // a Date object
return s.getHours() * 60 + s.getMinutes();
}
var m = s.match(/(\d+)(?::(\d+))?\s*(\w+)?/);
if (m) {
var h = parseInt(m[1], 10);
if (m[3]) {
h %= 12;
if (m[3].toLowerCase().charAt(0) == 'p') {
h += 12;
}
}
return h * 60 + (m[2] ? parseInt(m[2], 10) : 0);
}
}
// TODO: change ignoreTimezone default
function parseDate(input, ignoreTimezone) { // ignoreTimezone DEFAULTS TO TRUE!!! :(
// handles more than just strings
if (ignoreTimezone === undefined) {
ignoreTimezone = true;
}
if (ignoreTimezone && typeof input == 'string') {
input = stripTimezone(input);
}
return new MightyDate(input);
}
// TODO: deprecate
function parseISO8601(input, ignoreTimezone) { // ignoreTimezone DEFAULTS TO FALSE
if (ignoreTimezone === undefined) {
ignoreTimezone = false;
}
return parseDate(input, ignoreTimezone);
}
function stripTimezone(s) {
return s.replace(/^(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(\.\d+)?)(.*)$/, '$1');
}
function formatDate(date, formatString, settings) {
return new MightyDate(date).toString(formatString, settings);
}
function formatDates(date1, date2, formatString, settings) {
return new MightyDate(date1).toString(date2, formatString, settings);
}
/* Event Date Math /* Event Date Math
@ -90,27 +10,24 @@ function exclEndDay(event) {
if (event.end) { if (event.end) {
return _exclEndDay(event.end, event.allDay); return _exclEndDay(event.end, event.allDay);
}else{ }else{
return event.start.clone().addDays(1).clearTime(); return addDays(cloneDate(event.start), 1);
} }
} }
function _exclEndDay(end, allDay) { function _exclEndDay(end, allDay) {
end = end.clone(); end = cloneDate(end);
if (allDay || end.getHours() || end.getMinutes()) { return allDay || end.getHours() || end.getMinutes() ? addDays(end, 1) : clearTime(end);
end.addDays(1);
}
return end.clearTime();
} }
function segCmp(a, b) { function segCmp(a, b) {
return (b.msLength - a.msLength) * 100 + b.event.start.diffMilliseconds(a.event.start); return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start);
} }
function segsCollide(seg1, seg2) { function segsCollide(seg1, seg2) {
return seg1.end.after(seg2.start) && seg1.start.before(seg2.end); return seg1.end > seg2.start && seg1.start < seg2.end;
} }
@ -130,16 +47,16 @@ function sliceSegs(events, visEventEnds, start, end) {
event = events[i]; event = events[i];
eventStart = event.start; eventStart = event.start;
eventEnd = visEventEnds[i]; eventEnd = visEventEnds[i];
if (eventEnd.after(start) && eventStart.before(end)) { if (eventEnd > start && eventStart < end) {
if (eventStart.before(start)) { if (eventStart < start) {
segStart = start.clone(); segStart = cloneDate(start);
isStart = false; isStart = false;
}else{ }else{
segStart = eventStart; segStart = eventStart;
isStart = true; isStart = true;
} }
if (eventEnd.after(end)) { if (eventEnd > end) {
segEnd = end.clone(); segEnd = cloneDate(end);
isEnd = false; isEnd = false;
}else{ }else{
segEnd = eventEnd; segEnd = eventEnd;
@ -151,7 +68,7 @@ function sliceSegs(events, visEventEnds, start, end) {
end: segEnd, end: segEnd,
isStart: isStart, isStart: isStart,
isEnd: isEnd, isEnd: isEnd,
msLength: segStart.diffMilliseconds(segEnd) msLength: segEnd - segStart
}); });
} }
} }

92
tests/four_weeks.html Normal file
View file

@ -0,0 +1,92 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type='text/javascript' src='../src/_loader.js?debug'></script>
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,fourWeeks,agendaWeek,basicWeek,agendaDay,basicDay'
},
//defaultView: 'fourWeeks',
editable: true,
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 5),
end: new Date(y, m, d, 14, 43),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>

95
tests/issue_750.html Normal file
View file

@ -0,0 +1,95 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type='text/javascript' src='../src/_loader.js?debug'></script>
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
},
editable: true,
year: 2011,
month: 6, // august
ignoreTimezone: false,
events: [
{
title: 'All Day Event',
start: '2011-07-05T12:00:00Z', // august
allDay: false
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 5),
end: new Date(y, m, d, 14, 43),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>

View file

@ -46,6 +46,11 @@
start: y + '-06-06T10:20:00-02:00', start: y + '-06-06T10:20:00-02:00',
allDay: false allDay: false
}, },
{
title: 'U event',
start: y + '-06-06T14:30:00Z',
allDay: false
},
{ {
id: 999, id: 999,
title: 'Repeating Event', title: 'Repeating Event',

View file

@ -1 +1 @@
1.5.1 1.5.2