Skip to main content

Search and Top Navigation

Ticket #4528: ui.datepicker.highlight_v2.patch
File ui.datepicker.highlight_v2.patch, 4.0 KB (added by mstepnicki, May 15, 2009 06:42AM UTC)
--- ui_datepicker.js.orig	2009-05-02 19:29:00.000000000 +0200
+++ ui.datepicker.js	2009-05-15 08:34:30.000000000 +0200
@@ -11,6 +11,18 @@
  *	ui.core.js
  */
 
+/* Testing for a Value in JavaScript Array
+ * http://snook.ca/archives/javascript/testing_for_a_v/ */
+function oc(a)
+{
+  var o = {};
+  for(var i=0;i' + // actions
 							(otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : // display for other months
-							(unselectable ? '' + printDate.getDate() + '' : '' + printDate.getDate() + '' : '' + printDate.getDate() + '')) + ''; // display for this month
@@ -1416,6 +1445,21 @@
 		return html;
 	},
 
+	/* check if given date belongs to any classes and return their names
+	 * return default 'ui-state-default' otherwise
+	 */
+	_setHighlight: function (printDate) {
+		/* return classes of the given date */
+		var classes = '';
+		var highlight = this.highlight;
+		for (var i in highlight) {
+			if (printDate in oc(highlight[i])) {
+				classes += ' ' + i;
+			}			
+		}
+		return (( classes == '') ? 'ui-state-default' : classes);  
+	},
+
 	/* Generate the month and year header. */
 	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
 			selectedDate, secondary, monthNames, monthNamesShort) {

Download in other formats:

Original Format