Index: trunk/extensions/SemanticFormsInputs/SFI_Inputs.php |
— | — | @@ -195,28 +195,13 @@ |
196 | 196 | $message = Xml::encodeJsVar( $message ); |
197 | 197 | $regexp = Xml::encodeJsVar( $regexp ); |
198 | 198 | |
199 | | - |
200 | | - // register this input for validation |
201 | | - // $sfgJSValidationCalls are sanitized for HTML by SF before output, no htmlspecialchars() here |
202 | | - if ( array_key_exists( 'part_of_multiple', $other_args ) && $other_args['part_of_multiple'] == 1 ) { |
203 | | - $jstext = "validate_input_with_regexp($sfgFieldNum, {$regexp}, {$inverseString}, {$message}, true)"; |
204 | | - } else { |
205 | | - $jstext = "validate_input_with_regexp($sfgFieldNum, {$regexp}, {$inverseString}, {$message}, false)"; |
206 | | - } |
207 | | - |
208 | | - // register event to validate regexp on submit |
209 | | - // TODO: Improve so regexp is also validated on preview |
| 199 | + // register event to validate regexp on submit/preview |
210 | 200 | $jstext = <<<JAVASCRIPT |
211 | | - |
212 | | - jQuery(function($){ |
213 | | - $('#sfForm').submit( function() { |
214 | | - return $jstext; |
215 | | - } ); |
216 | | - }); |
217 | | - |
| 201 | +jQuery(function(){ |
| 202 | + jQuery('#input_$sfgFieldNum').registerValidation( SFI_RE_validate, {retext: {$regexp}, inverse: {$inverseString}, message: {$message} }); |
| 203 | +}); |
218 | 204 | JAVASCRIPT; |
219 | 205 | |
220 | | - //$wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
221 | 206 | $wgOut->addInlineScript( $jstext ); |
222 | 207 | |
223 | 208 | // create other_args for base input type |
— | — | @@ -265,8 +250,8 @@ |
266 | 251 | |
267 | 252 | // set localized messages (use MW i18n, not jQuery i18n) |
268 | 253 | $jstext = |
269 | | - "jQuery(function($){\n" |
270 | | - . " $.datepicker.regional['wiki'] = {\n" |
| 254 | + "jQuery(function(){\n" |
| 255 | + . " jQuery.datepicker.regional['wiki'] = {\n" |
271 | 256 | . " closeText: '" . wfMsg( 'semanticformsinputs-close' ) . "',\n" |
272 | 257 | . " prevText: '" . wfMsg( 'semanticformsinputs-prev' ) . "',\n" |
273 | 258 | . " nextText: '" . wfMsg( 'semanticformsinputs-next' ) . "',\n" |
— | — | @@ -327,7 +312,7 @@ |
328 | 313 | . " isRTL: " . ( $wgLang->isRTL() ? "true":"false" ) . ",\n" |
329 | 314 | . " showMonthAfterYear: false,\n" |
330 | 315 | . " yearSuffix: ''};\n" |
331 | | - . " $.datepicker.setDefaults($.datepicker.regional['wiki']);\n" |
| 316 | + . " jQuery.datepicker.setDefaults(jQuery.datepicker.regional['wiki']);\n" |
332 | 317 | . "});\n"; |
333 | 318 | |
334 | 319 | |
— | — | @@ -657,16 +642,8 @@ |
658 | 643 | |
659 | 644 | // set datepicker widget attributes |
660 | 645 | $jsattribs = array( |
661 | | - 'showOn' => 'both', |
| 646 | + 'currValue' => $cur_value, |
662 | 647 | 'buttonImage' => $sfigSettings->scriptPath . '/images/DatePickerButton.gif', |
663 | | - 'buttonImageOnly' => false, |
664 | | - 'changeMonth' => true, |
665 | | - 'changeYear' => true, |
666 | | - 'altFormat' => "yy/mm/dd", |
667 | | - // Today button does not work (http://dev.jqueryui.com/ticket/4045) |
668 | | - // do not show button panel for now |
669 | | - // TODO: show date picker button panel when bug is fixed |
670 | | - 'showButtonPanel' => false |
671 | 648 | ); |
672 | 649 | |
673 | 650 | // set first day of the week |
— | — | @@ -683,7 +660,8 @@ |
684 | 661 | || ( !array_key_exists( 'hide week numbers', $other_args ) && $sfigSettings->datePickerShowWeekNumbers ) ) { |
685 | 662 | |
686 | 663 | $jsattribs['showWeek'] = true; |
687 | | - |
| 664 | + } else { |
| 665 | + $jsattribs['showWeek'] = false; |
688 | 666 | } |
689 | 667 | |
690 | 668 | // set date format |
— | — | @@ -837,45 +815,20 @@ |
838 | 816 | // build JS code from attributes array |
839 | 817 | $jsattribsString = Xml::encodeJsVar( $jsattribs ); |
840 | 818 | |
841 | | - // assemble JS code to attach datepicker to input field |
842 | | - $jstext = <<<JAVASCRIPT |
843 | | - jQuery("#" + inputId + "_show").datepicker( $jsattribsString ); |
844 | | - jQuery("#" + inputId + "_show").datepicker( "option", "altField", "#" + inputId); |
845 | | -JAVASCRIPT; |
846 | | - |
847 | | - // append setting of first date |
| 819 | + // store min date as JS attrib |
848 | 820 | if ( $minDate ) { |
849 | | - |
850 | | - $minDateString = $minDate->format( 'Y-m-d' ); |
851 | | - $jstext .= <<<JAVASCRIPT |
852 | | - jQuery("#" + inputId + "_show").datepicker( "option", "minDate", jQuery.datepicker.parseDate("yy/mm/dd", "$minDateString", null) ); |
853 | | - |
854 | | -JAVASCRIPT; |
| 821 | + $jsattribs['minDate'] = $minDate->format( 'Y/m/d' ); |
855 | 822 | } |
856 | 823 | |
857 | | - // append setting of last date |
| 824 | + // store max date as JS attrib |
858 | 825 | if ( $maxDate ) { |
859 | | - |
860 | | - $maxDateString = $maxDate->format( 'Y-m-d' ); |
861 | | - |
862 | | - $jstext .= <<<JAVASCRIPT |
863 | | - jQuery("#" + inputId + "_show").datepicker( "option", "maxDate", jQuery.datepicker.parseDate("yy/mm/dd", "$maxDateString", null) ); |
864 | | - |
865 | | -JAVASCRIPT; |
| 826 | + $jsattribs['maxDate'] = $maxDate->format( 'Y/m/d' ); |
866 | 827 | } |
867 | 828 | |
868 | 829 | |
869 | 830 | // add user-defined class(es) to all datepicker components |
870 | 831 | if ( array_key_exists( 'class', $other_args ) ) { |
871 | | - |
872 | | - // sanitize names of user-defined classes |
873 | | - $userClasses = Xml::encodeJsVar ( $userClasses ); |
874 | | - |
875 | | - $jstext .= <<<JAVASCRIPT |
876 | | - jQuery("#" + inputId + "_show").datepicker("widget").addClass({$userClasses}); |
877 | | - jQuery("#" + inputId + "_show + button").addClass({$userClasses}); |
878 | | - |
879 | | -JAVASCRIPT; |
| 832 | + $jsattribs['userClass'] = $userClasses; |
880 | 833 | } |
881 | 834 | |
882 | 835 | // attach event handler to handle disabled and highlighted dates |
— | — | @@ -885,7 +838,7 @@ |
886 | 839 | if ( count( $disabledDates ) ) { |
887 | 840 | |
888 | 841 | // convert the PHP array of date ranges into a JS array definition |
889 | | - $disabledDatesString = '[' . implode( ',', array_map( create_function ( '$range', ' |
| 842 | + $jsattribs["disabledDates"] = array_map( create_function ( '$range', ' |
890 | 843 | |
891 | 844 | $y0 = $range[0]->format( "Y" ); |
892 | 845 | $m0 = $range[0]->format( "m" ) - 1; |
— | — | @@ -895,19 +848,15 @@ |
896 | 849 | $m1 = $range[1]->format( "m" ) - 1; |
897 | 850 | $d1 = $range[1]->format( "d" ); |
898 | 851 | |
899 | | - return "[new Date({$y0}, {$m0}, {$d0}), new Date({$y1}, {$m1}, {$d1})]"; |
900 | | - ' ) , $disabledDates ) ) . ']'; |
901 | | - |
902 | | - // register array of disabled dates with datepicker |
903 | | - $jstext .= " jQuery(\"#\" + inputId + \"_show\").datepicker(\"option\", \"disabledDates\", $disabledDatesString);\n"; |
904 | | - |
| 852 | + return array($y0, $m0, $d0, $y1, $m1, $d1); |
| 853 | + ' ) , $disabledDates ); |
905 | 854 | } |
906 | 855 | |
907 | 856 | // then register highlighted dates with datepicker |
908 | 857 | if ( count( $highlightedDates ) > 0 ) { |
909 | 858 | |
910 | 859 | // convert the PHP array of date ranges into a JS array definition |
911 | | - $highlightedDatesString = '[' . implode( ',', array_map( create_function ( '$range', ' |
| 860 | + $jsattribs["highlightedDates"] = array_map( create_function ( '$range', ' |
912 | 861 | |
913 | 862 | $y0 = $range[0]->format( "Y" ); |
914 | 863 | $m0 = $range[0]->format( "m" ) - 1; |
— | — | @@ -917,53 +866,27 @@ |
918 | 867 | $m1 = $range[1]->format( "m" ) - 1; |
919 | 868 | $d1 = $range[1]->format( "d" ); |
920 | 869 | |
921 | | - return "[new Date({$y0}, {$m0}, {$d0}), new Date({$y1}, {$m1}, {$d1})]"; |
922 | | - ' ) , $highlightedDates ) ) . ']'; |
923 | | - |
924 | | - // register array of highlighted dates with datepicker |
925 | | - $jstext .= " jQuery(\"#\" + inputId + \"_show\").datepicker(\"option\", \"highlightedDates\", $highlightedDatesString);\n"; |
926 | | - |
| 870 | + return array($y0, $m0, $d0, $y1, $m1, $d1); |
| 871 | + ' ) , $highlightedDates ); |
927 | 872 | } |
928 | 873 | |
929 | 874 | // register disabled days of week with datepicker |
930 | 875 | if ( count( $disabledDays ) ) { |
931 | | - $disabledDaysString = Xml::encodeJsVar( $disabledDays ); |
932 | | - $jstext .= " jQuery(\"#\" + inputId + \"_show\").datepicker(\"option\", \"disabledDays\", $disabledDaysString);\n"; |
| 876 | + $jsattribs["disabledDays"] = $disabledDays; |
933 | 877 | } |
934 | 878 | |
935 | 879 | // register highlighted days of week with datepicker |
936 | 880 | if ( count( $highlightedDays ) ) { |
937 | | - $highlightedDaysString = Xml::encodeJsVar( $highlightedDays ); |
938 | | - $jstext .= " jQuery(\"#\" + inputId + \"_show\").datepicker(\"option\", \"highlightedDays\", $highlightedDaysString);\n"; |
| 881 | + $jsattribs["highlightedDays"] = $highlightedDays; |
939 | 882 | } |
940 | | - |
941 | | - // attach the event handler to the datepicker's beforeShowDay event |
942 | | - // the actual handler function is loaded separately and uses the |
943 | | - // data atached to the datepicker above |
944 | | - $jstext .= <<<JAVASCRIPT |
945 | | - |
946 | | - jQuery("#" + inputId + "_show").datepicker("option", "beforeShowDay", function (date) {return SFI_DP_checkDate(this, date);}); |
947 | | - |
948 | | -JAVASCRIPT; |
949 | 883 | } |
950 | 884 | |
951 | | - // set value of datepicker and wrap the JS code fragment in a |
952 | | - // function which can be called by SF for deferred init |
953 | | - $jstext = <<<JAVASCRIPT |
954 | | - function initInput$sfgFieldNum(inputId) { |
955 | | -$jstext |
956 | | - try { |
957 | | - re = /\d{4}\/\d{2}\/\d{2}/ |
958 | | - if ( ! re.test("$cur_value") ) {throw "Wrong date format!";} |
959 | | - jQuery("#" + inputId + "_show").datepicker( "setDate", jQuery.datepicker.parseDate("yy/mm/dd", "$cur_value", null) ); |
960 | | - } catch (e) { |
961 | | - jQuery("#" + inputId + "_show").attr("value", "$cur_value"); |
962 | | - jQuery("#" + inputId).attr("value", "$cur_value"); |
963 | | - } |
| 885 | + // build JS code from attributes array |
| 886 | + $jsattribsString = Xml::encodeJsVar( $jsattribs ); |
964 | 887 | |
965 | | - } |
966 | | - |
967 | | - addOnloadHook(function(){initInput$sfgFieldNum("input_$sfgFieldNum");}); |
| 888 | + // wrap the JS code fragment in a function for deferred init |
| 889 | + $jstext = <<<JAVASCRIPT |
| 890 | +jQuery(function(){ jQuery('#input_$sfgFieldNum').registerInitialisation(SFI_DP_init, $jsattribsString ); }); |
968 | 891 | JAVASCRIPT; |
969 | 892 | |
970 | 893 | |
— | — | @@ -972,8 +895,7 @@ |
973 | 896 | // add span for error messages (e.g. used for mandatory inputs) |
974 | 897 | $html .= Xml::element( "span", array( "id" => "info_$sfgFieldNum", "class" => "errorMessage" ) ); |
975 | 898 | |
976 | | - // directly insert the code of the JS init function into the pages code |
977 | | - // there seemed to be issues when this code was piped through SF |
| 899 | + // insert the code of the JS init function into the pages code |
978 | 900 | $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
979 | 901 | |
980 | 902 | return array( $html, "", "initInput$sfgFieldNum" ); |
— | — | @@ -1214,7 +1136,6 @@ |
1215 | 1137 | $wgOut->addScript( '<script type="text/javascript">' . $jstext . '</script>' ); |
1216 | 1138 | |
1217 | 1139 | // return HTML and name of JS init function |
1218 | | - //return array( $html, "", "initInput$sfgFieldNum" ); |
1219 | 1140 | return $html; |
1220 | 1141 | |
1221 | 1142 | } else { |
— | — | @@ -1276,13 +1197,13 @@ |
1277 | 1198 | 'name' => $input_name, |
1278 | 1199 | 'value' => $cur_value |
1279 | 1200 | ) ); |
1280 | | - |
1281 | | - |
| 1201 | + |
| 1202 | + |
1282 | 1203 | $html .= "<span class='SFI_menuselect' id='input_{$sfgFieldNum}_tree'>"; |
1283 | 1204 | |
1284 | 1205 | |
1285 | | - //if ( array_key_exists( 'delimiter', $other_args ) ) $delimiter = $other_args[ 'delimiter' ]; |
1286 | | - //else $delimiter = ' '; |
| 1206 | + // if ( array_key_exists( 'delimiter', $other_args ) ) $delimiter = $other_args[ 'delimiter' ]; |
| 1207 | + // else $delimiter = ' '; |
1287 | 1208 | |
1288 | 1209 | // parse menu structure |
1289 | 1210 | |
— | — | @@ -1291,15 +1212,15 @@ |
1292 | 1213 | $oldStripState = $wgParser->mStripState; |
1293 | 1214 | $wgParser->mStripState = new StripState(); |
1294 | 1215 | |
1295 | | - //FIXME: SF does not parse options correctly. Users have to replace | by {{!}} |
1296 | | - $structure = str_replace('{{!}}','|',$other_args["structure"]); |
| 1216 | + // FIXME: SF does not parse options correctly. Users have to replace | by {{!}} |
| 1217 | + $structure = str_replace( '{{!}}', '|', $other_args["structure"] ); |
1297 | 1218 | |
1298 | | - $structure = $wgParser->parse($structure, $wgTitle, $options )->getText(); |
| 1219 | + $structure = $wgParser->parse( $structure, $wgTitle, $options )->getText(); |
1299 | 1220 | |
1300 | 1221 | $wgParser->mStripState = $oldStripState; |
1301 | 1222 | |
1302 | 1223 | |
1303 | | - $html .= str_replace('<li', '<li class=\'ui-state-default\'', $structure); |
| 1224 | + $html .= str_replace( '<li', '<li class=\'ui-state-default\'', $structure ); |
1304 | 1225 | |
1305 | 1226 | $html .= "</span>"; |
1306 | 1227 | |
Index: trunk/extensions/SemanticFormsInputs/libs/regexp.js |
— | — | @@ -9,48 +9,23 @@ |
10 | 10 | /** |
11 | 11 | * Validates inputs of type regexp. |
12 | 12 | * |
13 | | - * @param input_number (Number) the number of the input to check |
14 | | - * @param retext (String) the regular expression the input's value has to match |
15 | | - * @param inverse (Boolean) if the check result shall be inverted |
16 | | - * @param message (String) the message too be printed if the input's value does not match |
17 | | - * @param multiple (Boolean) if the input is inside a multiple-instance formular |
| 13 | + * @param input_id (String) the id string of the input to check |
| 14 | + * @param params (Object) the parameter object for the check, contains |
| 15 | + * retext: (String) regular expression the input's value has to match |
| 16 | + * inverse: (Boolean) if the check result shall be inverted |
| 17 | + * message: (String) the message too be printed if the input's value does not match |
18 | 18 | * @return (Boolean) true, if the input's value matches the regular expression in |
19 | 19 | * retext, false otherwise; the value is inverted if inverse is true |
20 | 20 | */ |
21 | | -function validate_input_with_regexp( input_number, retext, inverse, message, multiple ){ |
| 21 | +function SFI_RE_validate ( input_id, params ) { //input_number, retext, inverse, message, multiple |
22 | 22 | |
23 | | - var decoded = jQuery( "<div/>" ).html( retext ).text(); |
24 | | - var re = new RegExp( decoded ); |
| 23 | + var re = new RegExp( jQuery( "<div/>" ).html( params.retext ).text() ); |
| 24 | + var match = re.test( jQuery('#' + input_id).attr("value") ); |
25 | 25 | |
26 | | - if ( multiple ) { |
27 | | - res = true; |
28 | | - for ( i = 1; i <= num_elements; i++ ) { |
29 | | - field = document.getElementById( 'input_' + i + "_" + input_number ); |
30 | | - if ( field ) { |
31 | | - match = re.test( field.value ); |
32 | | - |
33 | | - if ( !( match && !inverse ) && !( !match && inverse ) ) { |
34 | | - infobox = document.getElementById( 'info_' + i + "_" + input_number ); |
35 | | - infobox.innerHTML += " " + message; |
36 | | - res=false; |
37 | | - } |
38 | | - } |
39 | | - } |
40 | | - return res; |
| 26 | + if ( ( match && ! params.inverse ) || ( ! match && params.inverse ) ) { |
| 27 | + return true; |
41 | 28 | } else { |
42 | | - field = document.getElementById( 'input_' + input_number ); |
43 | | - |
44 | | - jQuery( '#input_' + input_number ).parent().children( '.sfiErrorMessage' ).remove(); |
45 | | - |
46 | | - match = re.test( field.value ); |
47 | | - |
48 | | - if ( ( match && !inverse ) || ( !match && inverse ) ) { |
49 | | - return true; |
50 | | - } else { |
51 | | - jQuery(field).after( '<span class="sfiErrorMessage"> ' + message + '</span>'); |
52 | | - //infobox = document.getElementById( 'info_' + input_number ); |
53 | | - //infobox.innerHTML += " " + message; |
54 | | - return false; |
55 | | - } |
| 29 | + jQuery( '#' + input_id ).parent().addErrorMessage(params.message); |
| 30 | + return false; |
56 | 31 | } |
57 | 32 | } |
Index: trunk/extensions/SemanticFormsInputs/libs/datepicker.js |
— | — | @@ -6,6 +6,86 @@ |
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
| 10 | +function SFI_DP_init ( input_id, params ) { |
| 11 | + |
| 12 | + var input = jQuery("#" + input_id + "_show"); |
| 13 | + |
| 14 | + input.datepicker( { |
| 15 | + "showOn": "both", |
| 16 | + "buttonImage": params.buttonImage, |
| 17 | + "buttonImageOnly": false, |
| 18 | + "changeMonth": true, |
| 19 | + "changeYear": true, |
| 20 | + "altFormat": "yy/mm/dd", |
| 21 | + // Today button does not work (http://dev.jqueryui.com/ticket/4045) |
| 22 | + // do not show button panel for now |
| 23 | + // TODO: show date picker button panel when bug is fixed |
| 24 | + "showButtonPanel": false, |
| 25 | + "firstDay": params.firstDay, |
| 26 | + "showWeek": params.showWeek, |
| 27 | + "dateFormat": params.dateFormat, |
| 28 | + "altField": "#" + input_id, |
| 29 | + "beforeShowDay": function (date) {return SFI_DP_checkDate("#" + input_id + "_show", date);} |
| 30 | + } ); |
| 31 | + |
| 32 | + if ( params.minDate ) { |
| 33 | + input.datepicker( "option", "minDate", |
| 34 | + jQuery.datepicker.parseDate("yy/mm/dd", params.minDate, null) ); |
| 35 | + } |
| 36 | + |
| 37 | + if ( params.maxDate ) { |
| 38 | + input.datepicker( "option", "maxDate", |
| 39 | + jQuery.datepicker.parseDate("yy/mm/dd", params.maxDate, null) ); |
| 40 | + } |
| 41 | + |
| 42 | + if ( params.userClass ) { |
| 43 | + input.datepicker("widget").addClass( params.userClass ); |
| 44 | + jQuery("#" + input_id + "_show + button").addClass( params.userClass ); |
| 45 | + } |
| 46 | + |
| 47 | + if ( params.disabledDates ) { |
| 48 | + |
| 49 | + var disabledDates = params.disabledDates.map(function(range) { |
| 50 | + return [new Date(range[0], range[1], range[2]), new Date(range[3], range[4], range[5])] |
| 51 | + }); |
| 52 | + |
| 53 | + input.datepicker("option", "disabledDates", disabledDates); |
| 54 | + } |
| 55 | + |
| 56 | + if ( params.highlightedDates ) { |
| 57 | + |
| 58 | + var highlightedDates = params.highlightedDates.map(function(range) { |
| 59 | + return [new Date(range[0], range[1], range[2]), new Date(range[3], range[4], range[5])] |
| 60 | + }); |
| 61 | + |
| 62 | + input.datepicker("option", "highlightedDates", highlightedDates); |
| 63 | + } |
| 64 | + |
| 65 | + if (params.disabledDays) { |
| 66 | + input.datepicker("option", "disabledDays", params.disabledDays); |
| 67 | + } |
| 68 | + |
| 69 | + if (params.highlightedDays) { |
| 70 | + input.datepicker("option", "highlightedDays", params.highlightedDays); |
| 71 | + } |
| 72 | + |
| 73 | + //input.datepicker("option", "beforeShowDay", function (date) {return SFI_DP_checkDate("#" + input_id + "_show", date);}); |
| 74 | + |
| 75 | + try { |
| 76 | + |
| 77 | + var re = /\d{4}\/\d{2}\/\d{2}/ |
| 78 | + if ( ! re.test( params.currValue ) ) { |
| 79 | + throw "Wrong date format!"; |
| 80 | + } |
| 81 | + input.datepicker( "setDate", jQuery.datepicker.parseDate( "yy/mm/dd", params.currValue, null ) ); |
| 82 | + |
| 83 | + } catch (e) { |
| 84 | + input.attr( "value", params.currValue ); |
| 85 | + jQuery( "#" + input_id).attr( "value", params.currValue ); |
| 86 | + } |
| 87 | + |
| 88 | +} |
| 89 | + |
10 | 90 | /** |
11 | 91 | * Checks a date if it is to be enabled or highlighted |
12 | 92 | * |
— | — | @@ -18,9 +98,9 @@ |
19 | 99 | */ |
20 | 100 | function SFI_DP_checkDate( input, date ) { |
21 | 101 | |
22 | | - enable = true |
| 102 | + var enable = true |
23 | 103 | |
24 | | - disabledDates = jQuery( input ).datepicker( "option", "disabledDates" ); |
| 104 | + var disabledDates = jQuery( input ).datepicker( "option", "disabledDates" ); |
25 | 105 | |
26 | 106 | if ( disabledDates ) { |
27 | 107 | for ( i = 0; i < disabledDates.length; ++i ) { |
— | — | @@ -31,17 +111,17 @@ |
32 | 112 | } |
33 | 113 | } |
34 | 114 | |
35 | | - disabledDays = jQuery( input ).datepicker( "option", "disabledDays" ); |
| 115 | + var disabledDays = jQuery( input ).datepicker( "option", "disabledDays" ); |
36 | 116 | |
37 | 117 | if ( disabledDays ) { |
38 | 118 | enable = enable && !disabledDays[ date.getDay() ]; |
39 | 119 | } |
40 | 120 | |
41 | | - highlightedDates = jQuery( input ).datepicker( "option", "highlightedDates" ); |
42 | | - highlight = ""; |
| 121 | + var highlightedDates = jQuery( input ).datepicker( "option", "highlightedDates" ); |
| 122 | + var highlight = ""; |
43 | 123 | |
44 | 124 | if ( highlightedDates ) { |
45 | | - for ( i = 0; i < highlightedDates.length; ++i ) { |
| 125 | + for ( var i = 0; i < highlightedDates.length; ++i ) { |
46 | 126 | if ( ( date >= highlightedDates[i][0] ) && ( date <= highlightedDates[i][1] ) ) { |
47 | 127 | highlight = "ui-state-highlight"; |
48 | 128 | break; |
— | — | @@ -49,7 +129,7 @@ |
50 | 130 | } |
51 | 131 | } |
52 | 132 | |
53 | | - highlightedDays = jQuery( input ).datepicker( "option", "highlightedDays" ); |
| 133 | + var highlightedDays = jQuery( input ).datepicker( "option", "highlightedDays" ); |
54 | 134 | |
55 | 135 | if ( highlightedDays ) { |
56 | 136 | if ( highlightedDays[ date.getDay() ] ) { |