Changeset 1055112
- Timestamp:
- 12/27/2014 05:30:24 PM (11 years ago)
- Location:
- css-file-selector/tags/1.0.2
- Files:
-
- 3 edited
-
cssfileselector.php (modified) (4 diffs)
-
inc/js/cssfileselector.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
css-file-selector/tags/1.0.2/cssfileselector.php
r1055109 r1055112 4 4 Plugin URI: http://www.chrgiga.com/css-file-selector 5 5 Description: Add CSS files and/or CSS custom rules to any single page or post 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: Christian Gil 8 8 Author URI: http://www.chrgiga.com … … 94 94 echo '<div class="row"><label>Select CSS files</label><br />'.gil_get_css_file(explode(',', $cssfiles)).' <button type="button" class="add-select-css button button-primary button-large">Add other file</button><hr /></div>'; 95 95 echo '<div class="row"><label for="css-file-selector-rules">Write your custom CSS rules</label><br /><textarea id="css-file-selector-rules" name="gil_css_file_selector_rules">'.esc_attr($cssrules).'</textarea></div>'; 96 } 97 98 function gil_css_file_selector_admin_scripts() 99 { 96 100 wp_enqueue_style('cssfileselector.css', plugins_url('inc/css/cssfileselector.css', __FILE__)); 97 101 wp_enqueue_script('cssfileselector.js', plugins_url('inc/js/cssfileselector.js', __FILE__), array(), '1.0.0', true); … … 146 150 function gil_css_file_selector_insert_css_rules() 147 151 { 148 global $post;149 150 if (is_single() || is_page()) {152 global $post; 153 154 if (is_single() || is_page()) { 151 155 $cssrules = get_post_meta($post->ID, 'gil_css_file_selector_rules'); 152 156 if ($cssrules[0] != '') { ?> … … 176 180 /* Save the selected css files and the custom css rules */ 177 181 add_action('save_post', 'gil_css_file_selector_save_postdata'); 182 /* Enqueue styles ans function in editor page/post */ 183 add_action('admin_enqueue_scripts', 'gil_css_file_selector_admin_scripts'); 178 184 /* Put the css files selected */ 179 185 add_action('wp_enqueue_scripts', 'gil_css_file_selector_insert_css_file'); -
css-file-selector/tags/1.0.2/inc/js/cssfileselector.js
r1053787 r1055112 8 8 if (last_select.val() == '') { 9 9 //If no option selected, we can't add other select element 10 $('.add-select ').prop('disabled', 'true').removeClass('button-primary').addClass('button-default');10 $('.add-select-css').attr('disabled', 'true').removeClass('button-primary').addClass('button-default'); 11 11 } 12 12 last_select.change(function() 13 13 { 14 14 if ($(this).val() != '') { 15 $('.add-select ').removeProp('disabled').removeClass('button-default').addClass('button-primary');15 $('.add-select-css').removeAttr('disabled').removeClass('button-default').addClass('button-primary'); 16 16 } 17 17 }); 18 18 } 19 19 20 $('body').on('change', '[name="gil_css_file_selector_file[]"]', function() 21 { 22 if ($(this).val() == '' && $('[name="gil_css_file_selector_file[]"]').length > 1) { 23 $(this).remove(); 20 if (typeof jQuery.fn.jquery === 'function') { 21 $('body').on('change', '[name="gil_css_file_selector_file[]"]', function() 22 { 23 if ($(this).val() == '' && $('[name="gil_css_file_selector_file[]"]').length > 1) { 24 $(this).remove(); 25 } 26 24 27 refresh_state(); 25 } 26 }); 28 }); 29 } else { 30 $('[name="gil_css_file_selector_file[]"]').live('change', function() 31 { 32 if ($(this).val() == '' && $('[name="gil_css_file_selector_file[]"]').length > 1) { 33 $(this).remove(); 34 } 27 35 28 $('.add-select').click(function(e) { 36 refresh_state(); 37 }); 38 } 39 40 $('.add-select-css').click(function(e) { 29 41 e.preventDefault(); 30 42 if (!e.target.disabled) { 31 43 var clone = last_select.clone(); 32 clone.find('option').first(). prop('selected', 'true');44 clone.find('option').first().attr('selected', 'true'); 33 45 last_select.after(clone); 34 46 refresh_state(); -
css-file-selector/tags/1.0.2/readme.txt
r1055109 r1055112 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.1 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 31 31 == Changelog == 32 32 33 = 1.0.2 = 34 * Modified the central file to better manage call functions and styles plugin 35 * Modified javascript functions to better support older versions of jQuery 36 33 37 = 1.0.1 = 34 38 * Fixed bug that emptied the options of select field when the button `Preview Changes` was pressed … … 39 43 == Upgrade Notice == 40 44 45 = 1.0.2 = 46 * Modified the central file to better manage call functions and styles plugin 47 * Modified javascript functions to better support older versions of jQuery 48 41 49 = 1.0.1 = 42 50 Fixed bug that emptied the options of select field when the button `Preview Changes` was pressed
Note: See TracChangeset
for help on using the changeset viewer.