Changeset 2057285
- Timestamp:
- 03/26/2019 04:57:47 AM (7 years ago)
- Location:
- sewol-count/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
sewol-count.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sewol-count/trunk/readme.txt
r2056552 r2057285 4 4 Requires at least: 3.0.1 5 5 Tested up to: 5.1.1 6 Stable tag: 1.1. 16 Stable tag: 1.1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 64 64 = 1.1.0 = 65 65 * fixed error 66 67 = 1.1.1 = 68 * adding font color 69 70 = 1.1.2 = 71 * adding color picker in font, background color -
sewol-count/trunk/sewol-count.php
r2056552 r2057285 4 4 Plugin URI: http://parkyong.com 5 5 Description: count day after Sewol Ferry Disaster 6 Version: 1.1. 16 Version: 1.1.2 7 7 Author: Park Yong 8 8 Author URI: http://parkyong.com … … 30 30 add_action( 'widgets_init', 'sewol_register_widgets' ); 31 31 add_action('plugins_loaded', 'sewol_load_textdomain'); 32 add_action( 'load-widgets.php', 'color_picker_load' ); 33 34 function color_picker_load() { 35 wp_enqueue_style( 'wp-color-picker' ); 36 wp_enqueue_script( 'wp-color-picker' ); 37 } 32 38 33 39 function sewol_load_textdomain() { … … 48 54 49 55 function form ( $instance ) { 50 $defaults = array( 'title' => __('Sewol', 'sewol-count')); 56 $defaults = array( 'title' => __('Sewol', 'sewol-count'), 57 'fontColor' => 'yellow', 58 'backGroundColor' => 'white'); 51 59 52 60 $instance = wp_parse_args( (array)$instance, $defaults ); 53 61 $title = strip_tags( $instance['title'] ); 54 62 $fontColor = strip_tags( $instance['fontColor']); 63 $backGroundColor = strip_tags( $instance['backGroundColor']); 55 64 ?> 56 65 <p> 66 <script type='text/javascript'> 67 ( function( $ ) { 68 $(document).on( 'ready widget-added widget-updated', function(event, widget) { 69 var params = { 70 change: function(e, ui) { 71 $( e.target ).val( ui.color.toString() ); 72 $( e.target ).trigger('change'); // enable widget "Save" button 73 }, 74 } 75 $('.font-color-picker').not('[id*="__i__"]').wpColorPicker(params); 76 $('.background-color-picker').not('[id*="__i__"]').wpColorPicker(params); 77 }); 78 })( jQuery ); 79 </script> 57 80 <?php _e('Title', 'pp-plugin' ) ?>: 58 <input class="widefat" name="<?php echo $this->get_field_name('title'); ?>"81 <input class="widefat" name="<?php echo $this->get_field_name('title'); ?>" 59 82 type="text" value="<?php echo esc_attr($title); ?>" /> 60 83 <br /> 61 84 <?php _e('Font Color', 'pp-plugin' ) ?>: 62 <input class="widefat "name="<?php echo $this->get_field_name('fontColor'); ?>"85 <input class="widefat font-color-picker" name="<?php echo $this->get_field_name('fontColor'); ?>" 63 86 type="text" value="<?php echo esc_attr($fontColor); ?>" /> 87 <br /> 88 <?php _e('Background Color', 'pp-plugin' ) ?>: 89 <input type="text" class="widefat background-color-picker" name="<?php echo $this->get_field_name('backGroundColor'); ?>" value="<?php echo esc_attr($backGroundColor); ?>" /> 64 90 </p> 65 91 <?php … … 70 96 $instance['title'] = strip_tags(esc_attr($new_instance['title'])); 71 97 $instance['fontColor'] = strip_tags(esc_attr($new_instance['fontColor'])); 72 98 $instance['backGroundColor'] = strip_tags(esc_attr($new_instance['backGroundColor'])); 73 99 return $instance; 74 100 } … … 81 107 $title = apply_filters('widget_title', $instance['title']); 82 108 $fontColor = apply_filters('widget_fontColor', $instance['fontColor']); 109 $backGroundColor = apply_filters('widget_backGroundColor', $instance['backGroundColor']); 83 110 84 111 if ( !empty( $title ) ) { … … 89 116 $dday = mktime(0,0,0,4,16,2014); 90 117 $xday = ceil(($now-$dday)/(60*60*24)); 91 echo "<p id='sewol' style='color:$fontColor '>" . $xday . "</p>";118 echo "<p id='sewol' style='color:$fontColor; background-color:$backGroundColor'>" . $xday . "</p>"; 92 119 echo "</aside>"; 93 120 }
Note: See TracChangeset
for help on using the changeset viewer.