Changeset 755142
- Timestamp:
- 08/12/2013 03:23:58 PM (13 years ago)
- Location:
- contact-form-7-datepicker/trunk
- Files:
-
- 2 edited
-
date-module.php (modified) (4 diffs)
-
datepicker.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
contact-form-7-datepicker/trunk/date-module.php
r695340 r755142 2 2 3 3 class ContactForm7Datepicker_Date { 4 5 static $inline_js = array(); 4 6 5 7 public static function register() { … … 26 28 // Messages 27 29 add_filter('wpcf7_messages', array(__CLASS__, 'messages')); 30 31 // Print inline javascript 32 add_action('wp_print_footer_scripts', array(__CLASS__, 'print_inline_js'), 99999); 28 33 } 29 34 … … 140 145 $dp = new CF7_DatePicker($dp_selector, $dpOptions); 141 146 142 return sprintf('<span class="wpcf7-form-control-wrap %s">%s %s</span>%s', 147 self::$inline_js[] = $dp->generate_code($inline); 148 149 return sprintf('<span class="wpcf7-form-control-wrap %s">%s %s</span>', 143 150 esc_attr($name), 144 151 $input, 145 $validation_error, 146 $dp->generate_code($inline) 152 $validation_error 147 153 ); 148 154 } … … 195 201 } 196 202 203 public static function print_inline_js() { 204 if (! wp_script_is('jquery-ui-datepicker', 'done') || empty(self::$inline_js)) 205 return; 206 207 $out = implode("\n\t", self::$inline_js); 208 $out = "jQuery(function($){\n\t$out\n});"; 209 210 echo "\n<script type=\"text/javascript\">\n{$out}\n</script>\n"; 211 } 212 197 213 private static function animate_dropdown() { 198 214 $html = "<select id=\"animate\">\n"; -
contact-form-7-datepicker/trunk/datepicker.php
r694544 r755142 138 138 139 139 // Remove watermark class onSelect 140 $out .= ".datepicker('option', 'onSelect', function(){ $(this).removeClass('watermark').trigger('change'); });\n"; 140 if (! $inline) 141 $out .= ".datepicker('option', 'onSelect', function(){ $(this).removeClass('watermark').trigger('change'); })"; 141 142 142 $out = "jQuery(function($){ $out });";143 $out .= ".datepicker('refresh');"; 143 144 144 return "\n<script type=\"text/javascript\">{$out}</script>\n";145 return $out; 145 146 } 146 147
Note: See TracChangeset
for help on using the changeset viewer.