Changeset 2060094
- Timestamp:
- 03/30/2019 12:17:15 PM (7 years ago)
- Location:
- yummi-auto-check-parent-category-category-tree-checklist/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
yummi-category-checklist.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yummi-auto-check-parent-category-category-tree-checklist/trunk/readme.txt
r2017740 r2060094 8 8 Requires at least: 3.3 9 9 Tested up to: 5.0 10 Stable tag: 1.1. 510 Stable tag: 1.1.6 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 34 34 == Changelog == 35 35 36 = 1.1.6 = 37 * Better work with Gutenberg editor 38 * Fixed conflict with "Post Expiration" plugin 39 36 40 = 1.1.5 = 37 * Fix when Options button clicked41 * Fixed when Options button clicked 38 42 39 43 = 1.1.4 = … … 53 57 54 58 = 1.0.10 = 55 * Fix one error59 * Fixed one error 56 60 57 61 = 1.0.9 = … … 63 67 64 68 = 1.0.7 = 65 * Fix some errors69 * Fixed some errors 66 70 * Added "Synchronously allocate categories in ACF" 67 71 -
yummi-auto-check-parent-category-category-tree-checklist/trunk/yummi-category-checklist.php
r2017740 r2060094 2 2 /* 3 3 Plugin Name: Parent Category AutoCheck + Category Tree Checklist 4 Version: 1.1. 54 Version: 1.1.6 5 5 Description: Preserves the category hierarchy on the post editing screen + Check Parent Automatically + Auto scroll to first checked 6 6 Author: Alex Egorov … … 119 119 120 120 static function script() { 121 $cchl = get_option( 'cchl', $cchl ); 122 if (isset($cchl)) { 123 $depth = ycc_array_depth(ycc_get_taxonomy_hierarchy( 'category' )); // ($taxonomy,$hide_empty,$parent) // ycc_get_taxonomy_hierarchy_multiple(array( 'category','post_tag' )); ?> 124 <script> 125 (function($){ 126 // var testAppearTmr = setInterval(function() { 127 // if ($('.components-panel__body:has(.editor-post-taxonomies-hierarchical-term-1)').length) { 128 // console.log($('.editor-post-taxonomies-hierarchical-term-1').length); 129 // clearInterval(testAppearTmr); 130 // ycclstart(); 131 // console.log("here I am!"); 132 // } 133 // }, 250); 134 135 // $("body").on('DOMSubtreeModified', '.components-panel__body', function() { 136 // console.log('changed'); 137 // }); 138 139 // if($('body').has('[class$="__hierarchical-terms-list"]')){ 140 // console.log($(this).is(':visible')); 141 // } 142 143 setTimeout( function(){ 144 ycc_load(); 145 $('button.components-icon-button:has(svg.dashicons-admin-generic)').on('click',function(){ 146 setTimeout( function(){ 147 ycc_load(); 148 },4000); 149 }); 150 },4000); 151 152 function ycc_load(){ 153 //console.log('<?=add_filter('allowed_block_types',array(__CLASS__))?>'); 121 $cchla = array( 122 'UncheckMain' => 0 123 ,'sync' => 1 124 ,'collapse' => 1 125 ,'collapse_acf' => 1 126 ); 127 $cchl = get_option('cchl',$cchla); 128 //update_option('cchl', $cchla); 129 //delete_option('cchl'); 130 131 $depth = ycc_array_depth(ycc_get_taxonomy_hierarchy( 'category' )); // ($taxonomy,$hide_empty,$parent) // ycc_get_taxonomy_hierarchy_multiple(array( 'category','post_tag' )); ?> 132 <script> 133 (function($){ 134 // var testAppearTmr = setInterval(function() { 135 // if ($('.components-panel__body:has(.editor-post-taxonomies-hierarchical-term-1)').length) { 136 // console.log($('.editor-post-taxonomies-hierarchical-term-1').length); 137 // clearInterval(testAppearTmr); 138 // ycclstart(); 139 // console.log("here I am!"); 140 // } 141 // }, 250); 142 // $("body").on('DOMSubtreeModified', '.components-panel__body', function() { 143 // console.log('changed'); 144 // }); 145 // if($('body').has('[class$="__hierarchical-terms-list"]')){ 146 // console.log($(this).is(':visible')); 147 // } 148 149 setTimeout( function(){ 150 ycc_load(); 151 $('button.components-icon-button:has(svg.dashicons-admin-generic),.components-panel h2 button.components-panel__body-toggle').on('click',function(){ //,.components-panel h2 button.components-panel__body-toggle 152 setTimeout( function(){ 153 ycc_load(); 154 },4500); 155 }); 156 },4000); 157 158 function ycc_load(){ 159 //console.log('<?//=add_filter('allowed_block_types',array(__CLASS__))?>'); 154 160 var gutenberg; 155 161 if($('[class$="__hierarchical-terms-list"]').length) gutenberg = true; … … 174 180 $('.categorychecklist .children, [data-taxonomy="category"] .acf-checkbox-list .children').each(function() { 175 181 if(gutenberg){ 182 // console.log($(this).first()); 176 183 if( $(this).children()['length'] == 1 && $(this).children()[0]['childElementCount'] != 2 ) 177 184 $(this).find("> .li > input").addClass("disabled");//.attr('onClick','return false;'); 178 185 }else{ 179 if( $(this).children()['length'] == 1 && $(this).children()[0]['childElementCount'] != 1 ) 186 // console.log($(this).first().find('ul')['length']); 187 // console.log('children length:'+$(this).children()['length']+' | childElementCount:'+$(this).children()[0]['childElementCount']); 188 if( $(this).children()['length'] == 1 && $(this).first().find('ul')['length'] != 0 ) //$(this).children()[0]['childElementCount'] != 1 180 189 $(this).find("> li > label > input").addClass("disabled").attr('onClick', 'return false;'); 181 190 } … … 204 213 for ($i=0; $i < $depth; $i++) { 205 214 $data .= '.parent().parent()'; 206 echo 'var input_'.$i.' = $(this)'.$data.'.children( ).children();';215 echo 'var input_'.$i.' = $(this)'.$data.'.children("label").children();'; 207 216 } ?> 208 217 // console.log('input_0:'); … … 261 270 for ($i=0; $i < $depth; $i++) { 262 271 $data .= '.parent().parent()'; 263 echo '$(this)'.$data.'.children( ).children().prop("checked", true);';272 echo '$(this)'.$data.'.children("label").children().prop("checked", true);'; 264 273 } ?> 265 274 }); … … 275 284 $(this).addClass('is-parent'); 276 285 if($(this).find('.toggler').length){ 277 $( '.categorychecklist .li .toggler').remove();286 $(this).find('.toggler').detach(); //$('.categorychecklist .li .toggler').remove(); 278 287 $(this).prepend('<span class="toggler"></span>'); 279 288 }else{ … … 327 336 </style> 328 337 <?php } 329 }else{330 $cchl = array(331 'UncheckMain' => 0332 ,'sync' => 1333 ,'collapse' => 1334 ,'collapse_acf' => 1335 );336 update_option("cchl", $cchl);337 }338 338 } 339 339 static function admin_menu() {
Note: See TracChangeset
for help on using the changeset viewer.