add test suit. almost at 1.2

This commit is contained in:
Adam Shaw 2009-05-31 20:56:02 +00:00
parent 103b87ff2d
commit e56ffb3d99
14 changed files with 1030 additions and 90 deletions

View file

@ -5,30 +5,33 @@ FILES =\
examples\
changelog.txt
VER = `cat version.txt`
VVER = `cat ../version.txt`
DATE = `svn info | grep Date: | sed 's/.*: //g'`
REV = `svn info | grep Rev: | sed 's/.*: //g'`
min:
@java -jar build/yuicompressor-2.4.2.jar -o build/fullcalendar.min.js fullcalendar/fullcalendar.js
sed -i "s/* FullCalendar/& v`cat version.txt`/" build/fullcalendar.min.js
sed -i "s/* Date:/& `svn info fullcalendar/fullcalendar.js | grep Date: | sed 's/.*: //g'`/" build/fullcalendar.min.js
sed -i "s/* Revision:/& `svn info fullcalendar/fullcalendar.js | grep Rev: | sed 's/.*: //g'`/" build/fullcalendar.min.js
zip:
@mkdir -p build/F
@cp -rt build/F ${FILES} .svn
@for f in build/F/fullcalendar/*.js; do\
sed -i "s/* FullCalendar/& v`cat version.txt`/" $$f;\
sed -i "s/* Date:/& `svn info $$f | grep Date: | sed 's/.*: //g'`/" $$f;\
sed -i "s/* Revision:/& `svn info $$f | grep Rev: | sed 's/.*: //g'`/" $$f;\
done
@rm -rf `find build/F -type d -name .svn`
@mkdir -p build/fullcalendar-${VER}
@cp -rt build/fullcalendar-${VER} ${FILES}
@if [ -e build/fullcalendar.min.js ];\
then cp build/fullcalendar.min.js build/F/fullcalendar;\
else echo "WARNING: fullcalendar.js not yet minified.";\
then cp build/fullcalendar.min.js build/fullcalendar-${VER}/fullcalendar;\
else echo "\n!!! WARNING: fullcalendar.js not yet minified.\n";\
fi
@cd build/F; zip -r fullcalendar-`cat ../../version.txt`.zip *
@mv build/F/fullcalendar-*.zip dist
@rm -rf build/F
@rm -rf `find build -type d -name .svn`
@for f in build/fullcalendar-${VER}/fullcalendar/*.js; do\
sed -i "s/* FullCalendar/& v${VER}/" $$f;\
sed -i "s/* Date:/& ${DATE}/" $$f;\
sed -i "s/* Revision:/& ${REV}/" $$f;\
done
@cd build; zip -r fullcalendar-${VVER}.zip fullcalendar-${VVER}
@mv build/fullcalendar-${VER}.zip dist
@rm -rf build/fullcalendar-${VER}
@rm -f build/fullcalendar.min.js
clean:
@rm -rf dist/*
@rm -rf build/fullcalendar-*
@rm -f build/*.js

View file

@ -1,11 +1,25 @@
version 1.2
- cssClass attribute for CalEvents
- multiple event sources (using an array for the 'events' option)
- the 'events' option for fullCalendar() and gcalFullCalendar() is now optional
- bugs w/ month date formatting
- change behavior for parsing number strings (now as unix timestamp)
- allow multiple classes in cssClass
version 1.2 (5/31/09)
- expanded API
- 'className' CalEvent attribute
- 'source' CalEvent attribute
- dynamically get/add/remove/update events of current month
- locale improvements: change month/day name text
- better date formatting ($.fullCalendar.formatDate)
- multiple 'event sources' allowed
- dynamically add/remove event sources
- docs have been reworked (include addition of Google Calendar docs)
- changed behavior of parseDate for number strings
(now interpets as unix timestamp, not MS times)
- bugfixes
- rightToLeft month start bug
- off-by-one errors with month formatting commands
- events from previous months sticking when clicking prev/next quickly
- Google Calendar API changed to work w/ multiple event sources
- can also provide 'className' and 'draggable' options
- date utilties moved from $ properties to $.fullCalendar
- minified version of fullcalendar.js
- test suit (available from svn)
version 1.1 (5/10/09)
- Added the following options:

View file

@ -2,7 +2,7 @@
Main Usage
==========
The following code initializes a FullCalendar within an element with ID 'calendar'::
The following code initializes a FullCalendar within an element of ID 'calendar'::
$('#calendar').fullCalendar({
@ -101,8 +101,9 @@ special happens:
**eventRender**: function(calEvent, element)
Triggered before an element is rendered for the given :ref:`CalEvent <CalEvents>`.
``element`` is the jQuery element that will be used by default. You can modify
``element`` is the jQuery element that will be used by default. You may modify
this element or return a brand new element that will be used instead.
Returning ``false`` will prevent the event from being rendered at all.
This function is great for attaching other jQuery plugins to each event
element, such as a `qTip <http://craigsworks.com/projects/qtip/docs/>`_
@ -265,11 +266,10 @@ CalEvent:
do this automatically.
The following methods can be called on a FullCalendar that has already been
initialized. These methods get/add/remove/update the event elements that
currently reside on the calendar. Note that when you are using a JSON feed or custom
event source, your event is never *permanently* deleted, because it may be
refetched from the source at a later time. It is up to the developer to delete
the event(s) from any database.
initialized. These methods get/add/update/remove events on the current month.
For JSON and custom event sources, changes are never *permanent* because they
may be overwritten by a refetch. The developer is responsible for updating
any remote databases.
**.fullCalendar(** ``'addEvent'``, **calEvent)**
Add an event to the current month on-the-fly. ``calEvent`` is an object

View file

@ -25,25 +25,6 @@
$(document).ready(function() {
$('input').click(function() {
/*$('#calendar').fullCalendar("addEvent", {
id: 999,
title: "Adam Shaw",
start: "2009-05-18"
});*/
//$('#calendar').fullCalendar("removeEvent", 3);
var events = $('#calendar').fullCalendar('getEventsById', 2);
var ev1 = events[0];
ev1.title = "yo";
ev1.start = '2009-05-14';
ev1.end = '2009-05-16';
$('#calendar').fullCalendar('updateEvent', ev1);
});
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth();
@ -87,7 +68,6 @@
</script>
</head>
<body>
<input type='button' />
<div id='calendar'></div>
</body>
</html>

View file

@ -126,6 +126,15 @@
font-weight: bold;
}
/* To change the color of events on a per-class basis (such as with the
* "className" attribute of a CalEvent), do something like this:
*
* .full-calendar-month .myclass td {
* background: green;
* }
*/
/* the rectangle that covers a day when dragging an event */

View file

@ -218,7 +218,13 @@
addEventSource: function(src) {
eventSources.push(src);
if (options.loading) {
options.loading(true);
}
fetchEventSource(src, function() {
if (options.loading) {
options.loading(false);
}
clearEventElements();
renderEvents();
});
@ -530,7 +536,7 @@
});
}
});
segs.sort(segSort);
segs.sort(segCmp);
var levels = [];
$.each(segs, function(j, seg) {
var l = 0; // level index
@ -784,15 +790,17 @@
events[i]._start = cloneDate(events[i].start);
}
}
if (options.eventDrop)
if (options.eventDrop) {
options.eventDrop.call(this, event, delta, ev, ui);
}
clearEventElements();
renderEvents();
}
dayOverlay.hide();
if (options.eventDragStop)
if (options.eventDragStop) {
options.eventDragStop.call(this, event, ev, ui);
}
}
});
}
@ -880,12 +888,16 @@
//
function dayDate(td) {
var i, tds = tbody.get(0).getElementsByTagName('td');
for (i=0; i<tds.length; i++) {
if (tds[i] == td) break;
}
var i, trs = tbody.get(0).getElementsByTagName('tr');
for (i=0; i<trs.length; i++) {
var tr = trs[i];
for (var j=0; j<7; j++) {
if (tr.childNodes[j] == td) {
var d = cloneDate(start);
return addDays(d, i);
return addDays(d, i*7 + j*dis + dit);
}
}
}
}
//
@ -924,6 +936,7 @@
function fetchEvents(callback) {
events = [];
if (eventSources.length > 0) {
var queued = eventSources.length;
var sourceDone = function() {
if (--queued == 0) {
@ -942,6 +955,7 @@
fetchEventSource(eventSources[i], sourceDone);
}
}
}
//
@ -949,12 +963,16 @@
//
function fetchEventSource(src, callback) {
var y = date.getFullYear();
var m = date.getMonth();
var reportEvents = function(a) {
if (date.getFullYear() == y && date.getMonth() == m) {
for (var i=0; i<a.length; i++) {
normalizeEvent(a[i]);
a[i].source = src;
}
events = events.concat(a);
}
if (callback) {
callback(a);
}
@ -1040,7 +1058,7 @@
return event;
}
function segSort(a, b) {
function segCmp(a, b) {
return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start);
}

View file

@ -1,22 +1,16 @@
/*
* gcalFullCalendar extension for fullCalendar
* http://arshaw.com/fullcalendar/
/*!
* FullCalendar Google Calendar Extension
*
* Same usage/options as fullCalendar.
* However, enter your Google Calendar's public feed URL in the 'events' option.
* Here is how to find it in the Google Calendar interface:
*
* -> click the arrow next to your calendar's name
* -> click "Share this calendar"
* -> check "Make this calendar public" and then Save
* -> click the arrow again, then click "Calendar settings"
* -> in the "Calendar Address" section, click the XML rectangle
* -> the URL is displayed
* Visit http://arshaw.com/fullcalendar/docs/#google-calendar
* for docs and examples.
*
* Copyright (c) 2009 Adam Shaw
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Date:
* Revision:
*/
(function($) {

134
test/actions.html Normal file
View file

@ -0,0 +1,134 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='jgrowl/jgrowl.css' />
<script type='text/javascript' src='../jquery/jquery.js'></script>
<script type='text/javascript' src='../jquery/ui.core.js'></script>
<script type='text/javascript' src='../jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.js'></script>
<script type='text/javascript' src='jgrowl/jgrowl.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth();
$('#calendar').fullCalendar({
monthDisplay: function(year, month, monthTitle) {
$.jGrowl("<b>monthDisplay</b><br />" +
year + "-" + month + "<br />" +
monthTitle);
},
loading: function(bool) {
$.jGrowl("<b>loading</b>: " + bool);
},
resize: function() {
$.jGrowl("<b>resize</b>");
},
dayClick: function(date) {
$.jGrowl("<b>dayClick</b><br />" +
date + "<br />" +
this.nodeName);
},
eventRender: function(event, element) {
if (event.id == 3) {
//return false;
return $("<div style='background:red' />").text(event.title);
}
},
eventClick: function(event, ev) {
$.jGrowl("<b>eventClick</b><br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
this.nodeName);
//return false;
},
/*eventMouseover: function(event, ev) {
$.jGrowl("<b>eventMouseover</b><br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
this.nodeName);
},
eventMouseout: function(event, ev) {
$.jGrowl("<b>eventMouseout</b><br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
this.nodeName);
},*/
eventDragStart: function(event, ev, ui) {
$.jGrowl("<b>eventDragStart</b><br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
ui);
},
eventDragStop: function(event, ev, ui) {
$.jGrowl("<b>eventDragStop</b><br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
ui);
},
eventDrop: function(event, delta, ev, ui) {
$.jGrowl("<b>eventDrop</b><br />" +
delta + "<br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
ui);
},
draggable: true,
events: [
{
id: 1,
title: "Long Event",
start: new Date(y, m, 6, 14, 0),
end: new Date(y, m, 11)
},
{
id: 2,
title: "Repeating Event",
start: new Date(y, m, 2)
},
{
id: 2,
title: "Repeating Event",
start: new Date(y, m, 9)
},
{
id: 3,
title: "Meeting",
start: new Date(y, m, 20, 9, 0)
},
{
id: 4,
title: "Click for Facebook",
start: new Date(y, m, 27, 16),
end: new Date(y, m, 29),
url: "http://facebook.com/"
}
]
});
});
</script>
</head>
<body style='font-size:14px;font-family:Arial'>
<div id='calendar' style='width:75%'></div>
</body>
</html>

119
test/jgrowl/jgrowl.css Executable file
View file

@ -0,0 +1,119 @@
div.jGrowl {
padding: 10px;
z-index: 9999;
}
/** Special IE6 Style Positioning **/
div.ie6 {
position: absolute;
}
div.ie6.top-right {
right: auto;
bottom: auto;
left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
div.ie6.top-left {
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
div.ie6.bottom-right {
left: expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
div.ie6.bottom-left {
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
div.ie6.center {
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
width: 100%;
}
/** Normal Style Positions **/
body > div.jGrowl {
position: fixed;
}
body > div.jGrowl.top-left {
left: 0px;
top: 0px;
}
body > div.jGrowl.top-right {
right: 0px;
top: 0px;
}
body > div.jGrowl.bottom-left {
left: 0px;
bottom: 0px;
}
body > div.jGrowl.bottom-right {
right: 0px;
bottom: 0px;
}
body > div.jGrowl.center {
top: 0px;
width: 50%;
left: 25%;
}
/** Cross Browser Styling **/
div.center div.jGrowl-notification, div.center div.jGrowl-closer {
margin-left: auto;
margin-right: auto;
}
div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer {
background-color: #000;
color: #fff;
opacity: .85;
filter: alpha(opacity = 85);
zoom: 1;
width: 235px;
padding: 10px;
margin-top: 5px;
margin-bottom: 5px;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
text-align: left;
display: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
div.jGrowl div.jGrowl-notification {
min-height: 40px;
}
div.jGrowl div.jGrowl-notification div.header {
font-weight: bold;
font-size: 10px;
}
div.jGrowl div.jGrowl-notification div.close {
float: right;
font-weight: bold;
font-size: 12px;
cursor: pointer;
}
div.jGrowl div.jGrowl-closer {
height: 15px;
padding-top: 4px;
padding-bottom: 4px;
cursor: pointer;
font-size: 11px;
font-weight: bold;
text-align: center;
}

241
test/jgrowl/jgrowl.js Executable file
View file

@ -0,0 +1,241 @@
/**
* jGrowl 1.2.0
*
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Written by Stan Lemon <stanlemon@mac.com>
* Last updated: 2009.05.11
*
* jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These
* notifications function similarly to the Growl Framework available for
* Mac OS X (http://growl.info).
*
* To Do:
* - Move library settings to containers and allow them to be changed per container
*
* Changes in 1.2.0
* - Added message pooling to limit the number of messages appearing at a given time.
* - Closing a notification is now bound to the notification object and triggered by the close button.
*
* Changes in 1.1.2
* - Added iPhone styled example
* - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
* - Added template for the close button, so that it's content could be customized.
*
* Changes in 1.1.1
* - Fixed CSS styling bug for ie6 caused by a mispelling
* - Changes height restriction on default notifications to min-height
* - Added skinned examples using a variety of images
* - Added the ability to customize the content of the [close all] box
* - Added jTweet, an example of using jGrowl + Twitter
*
* Changes in 1.1.0
* - Multiple container and instances.
* - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container.
* - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName)
* - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container
* - Added new log callback which is called before anything is done for the notification
* - Corner's attribute are now applied on an individual notification basis.
*
* Changes in 1.0.4
* - Various CSS fixes so that jGrowl renders correctly in IE6.
*
* Changes in 1.0.3
* - Fixed bug with options persisting across notifications
* - Fixed theme application bug
* - Simplified some selectors and manipulations.
* - Added beforeOpen and beforeClose callbacks
* - Reorganized some lines of code to be more readable
* - Removed unnecessary this.defaults context
* - If corners plugin is present, it's now customizable.
* - Customizable open animation.
* - Customizable close animation.
* - Customizable animation easing.
* - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center)
*
* Changes in 1.0.2
* - All CSS styling is now external.
* - Added a theme parameter which specifies a secondary class for styling, such
* that notifications can be customized in appearance on a per message basis.
* - Notification life span is now customizable on a per message basis.
* - Added the ability to disable the global closer, enabled by default.
* - Added callbacks for when a notification is opened or closed.
* - Added callback for the global closer.
* - Customizable animation speed.
* - jGrowl now set itself up and tears itself down.
*
* Changes in 1.0.1:
* - Removed dependency on metadata plugin in favor of .data()
* - Namespaced all events
*/
(function($) {
/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
$.jGrowl = function( m , o ) {
// To maintain compatibility with older version that only supported one instance we'll create the base container.
if ( $('#jGrowl').size() == 0 ) $('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');
// Create a notification on the container.
$('#jGrowl').jGrowl(m,o);
};
/** Raise jGrowl Notification on a jGrowl Container **/
$.fn.jGrowl = function( m , o ) {
if ( $.isFunction(this.each) ) {
var args = arguments;
return this.each(function() {
var self = this;
/** Create a jGrowl Instance on the Container if it does not exist **/
if ( $(this).data('jGrowl.instance') == undefined ) {
$(this).data('jGrowl.instance', new $.fn.jGrowl());
$(this).data('jGrowl.instance').startup( this );
}
/** Optionally call jGrowl instance methods, or just raise a normal notification **/
if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) {
$(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) );
} else {
$(this).data('jGrowl.instance').create( m , o );
}
});
};
};
$.extend( $.fn.jGrowl.prototype , {
/** Default JGrowl Settings **/
defaults: {
pool: 0,
header: '',
group: '',
sticky: false,
position: 'top-right', // Is this still needed?
glue: 'after',
theme: 'default',
corners: '10px',
check: 250,
life: 3000,
speed: 'normal',
easing: 'swing',
closer: true,
closeTemplate: '&times;',
closerTemplate: '<div>[ close all ]</div>',
log: function(e,m,o) {},
beforeOpen: function(e,m,o) {},
open: function(e,m,o) {},
beforeClose: function(e,m,o) {},
close: function(e,m,o) {},
animateOpen: {
opacity: 'show'
},
animateClose: {
opacity: 'hide'
}
},
notifications: [],
/** jGrowl Container Node **/
element: null,
/** Interval Function **/
interval: null,
/** Create a Notification **/
create: function( message , o ) {
var o = $.extend({}, this.defaults, o);
this.notifications[ this.notifications.length ] = { message: message , options: o };
o.log.apply( this.element , [this.element,message,o] );
},
render: function( notification ) {
var self = this;
var message = notification.message;
var o = notification.options;
var notification = $('<div class="jGrowl-notification' + ((o.group != undefined && o.group != '') ? ' ' + o.group : '') + '"><div class="close">' + o.closeTemplate + '</div><div class="header">' + o.header + '</div><div class="message">' + message + '</div></div>')
.data("jGrowl", o).addClass(o.theme).children('div.close').bind("click.jGrowl", function() {
$(this).parent().trigger('jGrowl.close');
}).parent();
( o.glue == 'after' ) ? $('div.jGrowl-notification:last', this.element).after(notification) : $('div.jGrowl-notification:first', this.element).before(notification);
/** Notification Actions **/
$(notification).bind("mouseover.jGrowl", function() {
$(this).data("jGrowl").pause = true;
}).bind("mouseout.jGrowl", function() {
$(this).data("jGrowl").pause = false;
}).bind('jGrowl.beforeOpen', function() {
o.beforeOpen.apply( self.element , [self.element,message,o] );
}).bind('jGrowl.open', function() {
o.open.apply( self.element , [self.element,message,o] );
}).bind('jGrowl.beforeClose', function() {
o.beforeClose.apply( self.element , [self.element,message,o] );
}).bind('jGrowl.close', function() {
$(this).trigger('jGrowl.beforeClose').animate(o.animateClose, o.speed, o.easing, function() {
$(this).remove();
o.close.apply( self.element , [self.element,message,o] );
});
}).trigger('jGrowl.beforeOpen').animate(o.animateOpen, o.speed, o.easing, function() {
$(this).data("jGrowl").created = new Date();
}).trigger('jGrowl.open');
/** Optional Corners Plugin **/
if ( $.fn.corner != undefined ) $(notification).corner( o.corners );
/** Add a Global Closer if more than one notification exists **/
if ( $('div.jGrowl-notification:parent', this.element).size() > 1 && $('div.jGrowl-closer', this.element).size() == 0 && this.defaults.closer != false ) {
$(this.defaults.closerTemplate).addClass('jGrowl-closer').addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing).bind("click.jGrowl", function() {
$(this).siblings().children('div.close').trigger("click.jGrowl");
if ( $.isFunction( self.defaults.closer ) ) self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
});
};
},
/** Update the jGrowl Container, removing old jGrowl notifications **/
update: function() {
$(this.element).find('div.jGrowl-notification:parent').each( function() {
if ( $(this).data("jGrowl") != undefined && $(this).data("jGrowl").created != undefined && ($(this).data("jGrowl").created.getTime() + $(this).data("jGrowl").life) < (new Date()).getTime() && $(this).data("jGrowl").sticky != true &&
($(this).data("jGrowl").pause == undefined || $(this).data("jGrowl").pause != true) ) {
$(this).trigger('jGrowl.close');
}
});
if ( this.notifications.length > 0 && (this.defaults.pool == 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) ) {
this.render( this.notifications.shift() );
}
if ( $(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
$(this).remove();
});
};
},
/** Setup the jGrowl Notification Container **/
startup: function(e) {
this.element = $(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');
this.interval = setInterval( function() {
jQuery(e).data('jGrowl.instance').update();
}, this.defaults.check);
if ($.browser.msie && parseInt($.browser.version) < 7 && !window["XMLHttpRequest"]) $(this.element).addClass('ie6');
},
/** Shutdown jGrowl, removing it and clearing the interval **/
shutdown: function() {
$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();
clearInterval( this.interval );
}
});
/** Reference the Defaults Object for compatibility with older versions of jGrowl **/
$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
})(jQuery);

89
test/locale.html Normal file
View file

@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='jgrowl/jgrowl.css' />
<script type='text/javascript' src='../jquery/jquery.js'></script>
<script type='text/javascript' src='../jquery/ui.core.js'></script>
<script type='text/javascript' src='../jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.js'></script>
<script type='text/javascript' src='jgrowl/jgrowl.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
$.fullCalendar.monthNames = ["januari", "februari", "maart", "april", "mei", "juni","juli", "augustus", "september", "oktober", "november", "december"];
$.fullCalendar.monthAbbrevs = ["jan", "feb", "maa", "apr", "mei", "jun", "jul", "aug","sep", "okt", "nov", "dec"];
$.fullCalendar.dayNames = ['zondag', 'maandag', 'dinsdag', 'woensdag','donderdag', 'vrijdag', 'zaterdag'];
$.fullCalendar.dayAbbrevs = ["zo", "ma", "di", "wo", "do", "vr", "za", "zo"];
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth();
$('#calendar').fullCalendar({
abbrevDayHeadings: false,
weekStart: 1,
rightToLeft: true,
events: [
{
id: 1,
title: "Long Event",
start: new Date(y, m, 6, 14, 0),
end: new Date(y, m, 11)
},
{
id: 2,
title: "Repeating Event",
start: new Date(y, m, 2)
},
{
id: 2,
title: "Repeating Event",
start: new Date(y, m, 9)
},
{
id: 3,
title: "Meeting",
start: new Date(y, m, 20, 9, 0)
},
{
id: 4,
title: "Click for Facebook",
start: new Date(y, m, 27, 16),
end: new Date(y, m, 29),
url: "http://facebook.com/"
}
],
draggable: true,
dayClick: function(date) {
$(this).css('background', 'lightblue');
$.jGrowl("<b>dayClick</b><br />" +
date + "<br />" +
this.nodeName);
},
eventDrop: function(event, delta, ev, ui) {
$.jGrowl("<b>eventDrop</b><br />" +
delta + "<br />" +
event.title + "<br />" +
ev.pageX + "," + ev.pageY + "<br />" +
ui);
}
});
});
</script>
</head>
<body style='font-size:14px;font-family:Arial'>
<div id='calendar' style='width:75%'></div>
</body>
</html>

108
test/methods.html Normal file
View file

@ -0,0 +1,108 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='jgrowl/jgrowl.css' />
<style type='text/css'>
.newclass { color: red }
</style>
<script type='text/javascript' src='../jquery/jquery.js'></script>
<script type='text/javascript' src='../jquery/ui.core.js'></script>
<script type='text/javascript' src='../jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.js'></script>
<script type='text/javascript' src='jgrowl/jgrowl.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
$('#calendar').fullCalendar({
title: false,
buttons: false,
monthDisplay: function(year, month, title) {
$('h3').text(title);
},
draggable: true
});
});
function addTestEvents() {
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth()+1;
if (m<10) m = '0' + m;
$('#calendar').fullCalendar('addEvent', {
id: 99,
title: 'Some event',
start: y+'-'+m+'-02'
});
$('#calendar').fullCalendar('addEvent', {
id: 99,
title: 'Some event',
start: y+'-'+m+'-09'
});
$('#calendar').fullCalendar('addEvent', {
id: 5,
title: 'Birthday',
start: y+'-'+m+'-20'
});
}
function updateTestEvents() {
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth()+1;
if (m<10) m = '0' + m;
var reps = $('#calendar').fullCalendar('getEventsById', 99);
var e = reps[1];
e.title = "Better Title!";
e.start = y+'-'+m+'-11';
e.end = y+'-'+m+'-13';
e.className = 'newclass';
e.draggable = false;
e.showTime = true;
$('#calendar').fullCalendar('updateEvent', e);
}
function removeTestEvents(therepeating) {
if (therepeating) {
$('#calendar').fullCalendar('removeEvent', 99);
}else{
$('#calendar').fullCalendar('removeEvent', 5);
}
}
</script>
</head>
<body style='font-size:14px;font-family:Arial'>
<div style='float:right'>
<input type='button' value='add test events' onclick='addTestEvents()' /><br />
<input type='button' value='update test events' onclick='updateTestEvents()' /><br />
<input type='button' value='delete repeating events' onclick='removeTestEvents(true)' /><br />
<input type='button' value='delete single event' onclick='removeTestEvents(false)' /><br />
</div>
<h3></h3>
<p>
<a href='#' onclick="$('#calendar').fullCalendar('today')">today</a> &nbsp;
<a href='#' onclick="$('#calendar').fullCalendar('prevMonth')">prev</a> &nbsp;
<a href='#' onclick="$('#calendar').fullCalendar('nextMonth')">next</a> &nbsp;
<a href='#' onclick="$('#calendar').fullCalendar('gotoMonth', 1986, 5)">June 1986</a>
</p>
<div id='calendar' style='width:75%'></div>
</body>
</html>

95
test/options.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>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='jgrowl/jgrowl.css' />
<style type='text/css'>
.full-calendar-month .rep td { background: green }
.full-calendar-month .cool td { color: yellow }
.full-calendar-month .long td { background: red }
</style>
<script type='text/javascript' src='../jquery/jquery.js'></script>
<script type='text/javascript' src='../jquery/ui.core.js'></script>
<script type='text/javascript' src='../jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.js'></script>
<script type='text/javascript' src='jgrowl/jgrowl.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
$('#calendar').fullCalendar({
year: 2009,
month: 3,
draggable: true,
fixedWeeks: false,
abbrevDayHeadings: false,
//title: false,
titleFormat: 'm/Y', //'n/Y', //'M y',
//buttons: false,
buttons: { today:false, prev:"prev", next:"next" },
showTime: true,
timeFormat: 'H:i', //'ha', //'GA', //'gX',
eventDragOpacity: .5,
eventRevertDuration: 2000,
// test for CalEvent.source
eventDrop: function(event) {
$.jGrowl(event.source);
},
events: [
{
id: 1,
title: "Long Event",
start: new Date(2009, 3, 6, 14, 0),
end: new Date(2009, 3, 11),
showTime: false, // showTime
className: 'long',
draggable: false // draggable
},
{
id: 2,
title: "Repeating Event",
start: new Date(2009, 3, 2),
className: 'rep cool'
},
{
id: 2,
title: "Repeating Event",
start: new Date(2009, 3, 9),
className: ['rep', 'cool']
},
{
id: 3,
title: "Meeting",
date: new Date(2009, 3, 20, 9, 30) // date alias
},
{
id: 4,
title: "Click for Facebook",
start: new Date(2009, 3, 27, 16),
end: new Date(2009, 3, 29),
url: "http://facebook.com/"
}
]
});
});
</script>
</head>
<body style='font-size:14px;font-family:Arial'>
<div id='calendar' style='width:75%'></div>
</body>
</html>

136
test/sources.html Normal file
View file

@ -0,0 +1,136 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='jgrowl/jgrowl.css' />
<style type='text/css'>
.full-calendar-month .static td {
background: blue;
color: yellow;
}
.full-calendar-month .gcal td {
background: lightgreen;
}
</style>
<script type='text/javascript' src='../jquery/jquery.js'></script>
<script type='text/javascript' src='../jquery/ui.core.js'></script>
<script type='text/javascript' src='../jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.js'></script>
<script type='text/javascript' src='../fullcalendar/gcal.js'></script>
<script type='text/javascript' src='jgrowl/jgrowl.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth();
var gcalSource = $.fullCalendar.gcalFeed(
'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic',
{draggable: true, className: 'gcal'}
);
var staticSource = [
{
id: 1,
title: "Long Event",
start: new Date(y, m, 6, 14, 0),
end: new Date(y, m, 11),
className: 'static'
},
{
id: 2,
title: "Repeating Event",
start: new Date(y, m, 2),
className: 'static'
},
{
id: 2,
title: "Repeating Event",
start: new Date(y, m, 9),
className: 'static'
},
{
id: 3,
title: "Meeting",
start: new Date(y, m, 20, 9, 0),
className: 'static'
},
{
id: 4,
title: "Click for Facebook",
start: new Date(y, m, 27, 16),
end: new Date(y, m, 29),
url: "http://facebook.com/",
className: 'static'
}
];
var jsonSource = "../examples/json_events.php";
$('#calendar').fullCalendar({
draggable: true,
eventSources: [staticSource, gcalSource],
loading: function(bool) {
if (bool) {
$('#loading').css('visibility', 'visible');
}else{
$('#loading').css('visibility', 'hidden');
}
}
});
window.addStaticSource = function() {
$('#calendar').fullCalendar('addEventSource', staticSource);
};
window.addJsonSource = function() {
$('#calendar').fullCalendar('addEventSource', jsonSource);
};
window.addGcalSource = function() {
$('#calendar').fullCalendar('addEventSource', gcalSource);
};
window.removeStaticSource = function() {
$('#calendar').fullCalendar('removeEventSource', staticSource);
};
window.removeJsonSource = function() {
$('#calendar').fullCalendar('removeEventSource', jsonSource);
};
window.removeGcalSource = function() {
$('#calendar').fullCalendar('removeEventSource', gcalSource);
};
});
</script>
</head>
<body style='font-size:14px;font-family:Arial'>
<div style='float:right'>
<input type='button' value='add static event source' onclick='addStaticSource()' /><br />
<input type='button' value='* add json event source' onclick='addJsonSource()' /><br />
<input type='button' value='add gcal event source' onclick='addGcalSource()' /><br />
<br />
<input type='button' value='remove static event source' onclick='removeStaticSource()' /><br />
<input type='button' value='remove json event source' onclick='removeJsonSource()' /><br />
<input type='button' value='remove gcal event source' onclick='removeGcalSource()' /><br />
<br />
<input type='button' value='refresh' onclick="$('#calendar').fullCalendar('refresh')" />
</div>
<div style='visibility:hidden' id='loading'>loading...</div>
<div id='calendar' style='float:left;width:75%'></div>
</body>
</html>