Adam Shaw 16 лет назад
Родитель
Сommit
589d7ff181
9 измененных файлов с 132 добавлено и 39 удалено
  1. 2 1
      Makefile
  2. 6 1
      changelog.txt
  3. 26 6
      docs/index.txt
  4. 25 12
      fullcalendar/fullcalendar.css
  5. 55 15
      fullcalendar/fullcalendar.js
  6. 1 1
      test/locale.html
  7. 2 0
      test/methods.html
  8. 7 3
      test/options.html
  9. 8 0
      test/sources.html

+ 2 - 1
Makefile

@@ -20,13 +20,14 @@ zip:
 		then cp build/fullcalendar.min.js build/fullcalendar-${VER}/fullcalendar;\
 		else echo "\n!!! WARNING: fullcalendar.js not yet minified.\n";\
 		fi
-	@rm -rf `find build -type d -name .svn`
+	@rm -rf `find build/fullcalendar-* -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}
+	@mkdir -p dist
 	@mv build/fullcalendar-${VER}.zip dist
 	@rm -rf build/fullcalendar-${VER}
 	@rm -f build/fullcalendar.min.js

+ 6 - 1
changelog.txt

@@ -8,6 +8,7 @@ version 1.2 (5/31/09)
 		- better date formatting ($.fullCalendar.formatDate)
 		- multiple 'event sources' allowed
 			- dynamically add/remove event sources
+	- options for prevYear and nextYear buttons
 	- 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)
@@ -17,9 +18,13 @@ version 1.2 (5/31/09)
 		- 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
+	- date utilties moved from $ to $.fullCalendar
+	- more documentation in source code
 	- minified version of fullcalendar.js
 	- test suit (available from svn)
+	- top buttons now use <button> w/ an inner <span> for better css cusomization
+		- thus CSS has changed. IF UPGRADING FROM PREVIOUS VERSIONS,
+		  UPGRADE YOUR FULLCALENDAR.CSS FILE!!!
 
 version 1.1 (5/10/09)
 	- Added the following options:

+ 26 - 6
docs/index.txt

@@ -45,11 +45,25 @@ General Options
       list of commands.
    
    **buttons**: boolean/hash, default:``true``
-      Determines whether navigation buttons will be displayed at the top of the
-      calendar. A hash such as ``{today:false, prev:true, next:true}`` can be
-      provided to display only certain buttons. A hash such as
-      ``{today:false, prev:"Last Month", next:"Next Month"}`` can be provided
-      to display only certain buttons AND change a button's text.
+      ``true`` will display a previous-month, next-month, and "today" button.
+      The "today" button will only be visible for months other than the current.
+      
+      ``false`` will display absolutely no buttons.
+      
+      An object hash can be provided to display only *certain* buttons. The hash
+      can have the following properties::
+      
+         {
+            today:     bool/string,
+            prevYear:  bool/string,
+            prevMonth: bool/string,
+            nextMonth: bool/string,
+            nextYear:  bool/string
+         }
+         
+      A value of ``false`` will not display the button. A value of ``true`` will
+      display the button with some default text. A *string* value will display
+      the button *and* customize its text.
       
    **showTime**: boolean/ ``"guess"``, default:``"guess"``
       Determines if times will be displayed before each event's title.
@@ -308,9 +322,15 @@ initialized:
    **.fullCalendar(** ``'gotoMonth'``, **year, month)**
       Visits an arbitrary month. ``month`` is zero-based (0 is January, 1 is
       February, etc).
-   
+      
    **.fullCalendar(** ``'today'`` **)**
       Visits the current month.
+      
+   **.fullCalendar(** ``'prevYear'`` **)**
+      Moves one year back.
+      
+   **.fullCalendar(** ``'nextYear'`` **)**
+      Moves one year ahead.
    
    **.fullCalendar(** ``'refresh'`` **)**
       Refetch and redraw the events for the current month.

+ 25 - 12
fullcalendar/fullcalendar.css

@@ -10,17 +10,24 @@
 	margin: 0 0 1em;
 	}
 	
-.full-calendar-buttons input {
+.full-calendar-buttons button {
 	vertical-align: middle;
 	margin: 0 0 0 5px;
 	font-size: 1em;
 	}
 	
-.full-calendar-prev,
-.full-calendar-next {
-	width: 40px;
+.full-calendar-buttons button span {
+	padding: 0 10px;
 	}
 	
+	/* To always display the "today" button:
+	 *
+	 * .full-calendar-buttons button.today {
+	 *    visibility: visible !important;
+	 *    }
+	 */
+	
+	
 	
 	
 /* table layout & outer border */
@@ -42,14 +49,15 @@
 	
 	
 	
+	
 /* cell styling */
 	
 .full-calendar-month th,
 .full-calendar-month td.day {
 	padding: 0;
 	vertical-align: top;
-	border-style: solid; /* inner border style */
-	border-color: #ccc;  /* inner border color */
+	border-style: solid;    /* inner border style */
+	border-color: #ccc;     /* inner border color */
 	border-width: 1px 0 0 1px;
 	}
 	
@@ -80,10 +88,14 @@
 	padding: 2px 2px 0; /* distance between events and day edges */
 	}
 	
-.full-calendar-month td.day {
-	/* FullCalendar automatically chooses a height, but this can be overridden: */
-	/* height: 100px !important; */
-	}
+	/* FullCalendar automatically chooses a cell's height,
+	 * but this can be overridden:
+	 *
+	 * .full-calendar-month td.day {
+	 *    height: 100px !important;
+	 *    }
+	 */
+	 
 	
 
 
@@ -142,11 +154,12 @@
 .full-calendar-month .over-day {
 	background: #ADDBFF;
 	opacity: .2;
-	filter: alpha(opacity=20);
+	filter: alpha(opacity=20); /* for IE */
 	}
 	
 	
 	
+	
 /* right-to-left support */
 
 .r2l .full-calendar-title {
@@ -157,7 +170,7 @@
 	float: left;
 	}
 	
-.r2l .full-calendar-buttons input {
+.r2l .full-calendar-buttons button {
 	margin: 0 5px 0 0;
 	}
 	

+ 55 - 15
fullcalendar/fullcalendar.js

@@ -121,6 +121,16 @@
 				refreshMonth();
 			}
 			
+			function prevYear() {
+				addYears(date, -1);
+				refreshMonth();
+			}
+			
+			function nextYear() {
+				addYears(date, 1);
+				refreshMonth();
+			}
+			
 			
 			
 			//
@@ -133,6 +143,8 @@
 				nextMonth: nextMonth,
 				today: gotoToday,
 				gotoMonth: gotoMonth,
+				prevYear: prevYear,
+				nextYear: nextYear,
 				
 				
 				//
@@ -276,31 +288,53 @@
 			
 			if (bo) { // "button options"
 				var buttons = $("<div class='full-calendar-buttons'/>").appendTo(header);
-				var prevButton, nextButton;
-				if (bo == true || bo.today != false) {
-					todayButton = $("<input type='button' class='full-calendar-today' value='today'/>")
+				if (bo == true || bo.today !== false) {
+					todayButton = $("<button class='today' />")
+						.append($("<span />").html(
+							typeof bo.today == 'string' ?
+								bo.today : "today"))
 						.click(gotoToday);
-					if (typeof bo.today == 'string') todayButton.val(bo.today);
 					buttons.append(todayButton);
 				}
-				if (bo == true || bo.prev != false) {
-					prevButton = $("<input type='button' class='full-calendar-prev' value='" + (r2l ? "&gt;" : "&lt;") + "'/>")
+				if (bo.prevYear) {
+					var b = $("<button class='prev-year' />")
+						.append($("<span />")
+							.html(typeof bo.prevYear == 'string' ?
+								bo.prevYear : "&laquo;"))
+						.click(prevYear);
+					if (r2l) buttons.prepend(b);
+					else buttons.append(b);
+				}
+				if (bo == true || bo.prevMonth !== false) {
+					var b = $("<button class='prev-month' />")
+						.append($("<span />")
+							.html(typeof bo.prevMonth == 'string' ?
+								bo.prevMonth : (r2l ? "&gt;" : "&lt;")))
 						.click(prevMonth);
-					if (typeof bo.prev == 'string') prevButton.val(bo.prev);
-					if (r2l) buttons.prepend(prevButton);
-					else buttons.append(prevButton);
+					if (r2l) buttons.prepend(b);
+					else buttons.append(b);
 				}
-				if (bo == true || bo.next != false) {
-					nextButton = $("<input type='button' class='full-calendar-next' value='" + (r2l ? "&lt;" : "&gt;") + "'/>")
+				if (bo == true || bo.nextMonth !== false) {
+					var b = $("<button class='next-month' />")
+						.append($("<span />").html(typeof bo.nextMonth == 'string' ?
+							bo.nextMonth : (r2l ? "&lt;" : "&gt;")))
 						.click(nextMonth);
-					if (typeof bo.next == 'string') nextButton.val(bo.next);
-					if (r2l) buttons.prepend(nextButton);
-					else buttons.append(nextButton);
+					if (r2l) buttons.prepend(b);
+					else buttons.append(b);
+				}
+				if (bo.nextYear) {
+					var b = $("<button class='next-year' />")
+						.append($("<span />").html(typeof bo.nextYear == 'string'
+							? bo.nextYear : "&raquo;"))
+						.click(nextYear);
+					if (r2l) buttons.prepend(b);
+					else buttons.append(b);
 				}
 			}
 			
-			if (options.title !== false)
+			if (options.title !== false) {
 				titleElement = $("<h2 class='full-calendar-title'/>").appendTo(header);
+			}
 		
 			monthElement = $("<div class='full-calendar-month' style='position:relative'/>")
 				.appendTo($("<div class='full-calendar-month-wrap'/>").appendTo(this));
@@ -1082,6 +1116,12 @@
 		return clearTime(d);
 	}
 	
+	function addYears(d, n, keepTime) {
+		d.setFullYear(d.getFullYear() + n);
+		if (keepTime) return d;
+		return clearTime(d);
+	}
+	
 	function addDays(d, n, keepTime) {
 		d.setDate(d.getDate() + n);
 		if (keepTime) return d;

+ 1 - 1
test/locale.html

@@ -27,7 +27,7 @@ $(document).ready(function() {
 		
 		weekStart: 1,
 		
-		rightToLeft: true,
+		//rightToLeft: true,
 		
 		events: [
 			{

+ 2 - 0
test/methods.html

@@ -101,6 +101,8 @@ function removeTestEvents(therepeating) {
 <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('prevYear')">prevyear</a> &nbsp;
+<a href='#' onclick="$('#calendar').fullCalendar('nextYear')">nextyear</a> &nbsp;
 <a href='#' onclick="$('#calendar').fullCalendar('gotoMonth', 1986, 5)">June 1986</a>
 </p>
 <div id='calendar' style='width:75%'></div>

+ 7 - 3
test/options.html

@@ -26,7 +26,7 @@ $(document).ready(function() {
 		
 		draggable: true,
 		
-		fixedWeeks: false,
+		fixedWeeks: true,
 		
 		abbrevDayHeadings: false,
 		
@@ -34,10 +34,14 @@ $(document).ready(function() {
 		titleFormat: 'm/Y', //'n/Y', //'M y',
 		
 		//buttons: false,
-		buttons: { today:false, prev:"prev", next:"next" },
+		//buttons: { today:false },
+		//buttons: { today:false, prevMonth:"prev", nextMonth:"next" },
+		//buttons: { today:true, prevMonth:false, nextMonth:"next" },
+		//buttons: { prevYear:true, nextYear:true },
+		//buttons: { today:true, prevYear:"py", prevMonth:true, nextMonth:true, nextYear:"ny" },
 		
 		showTime: true,
-		timeFormat: 'H:i', //'ha', //'GA', //'gX',
+		timeFormat: 'ha', //'H:i', //'GA', //'gX',
 		
 		eventDragOpacity: .5,
 		eventRevertDuration: 2000,

+ 8 - 0
test/sources.html

@@ -15,10 +15,18 @@
 	}
 
 </style>
+
+<!--
+<script type='text/javascript' src='legacy_jquery/jquery.js'></script>
+<script type='text/javascript' src='legacy_jquery/ui.core.js'></script>
+<script type='text/javascript' src='legacy_jquery/ui.draggable.js'></script>
+-->
 <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='../build/fullcalendar.min.js'></script>-->
 <script type='text/javascript' src='../fullcalendar/gcal.js'></script>
 <script type='text/javascript' src='jgrowl/jgrowl.js'></script>
 <script type='text/javascript'>