Changeset 2105451
- Timestamp:
- 06/13/2019 10:20:30 AM (7 years ago)
- Location:
- yummi-auto-check-parent-category-category-tree-checklist/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
yummi-category-checklist.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yummi-auto-check-parent-category-category-tree-checklist/trunk/readme.txt
r2060340 r2105451 8 8 Requires at least: 3.3 9 9 Tested up to: 5.0 10 Stable tag: 1.1. 710 Stable tag: 1.1.8 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 36 = 1.1.8 = 37 * New checking for Gutenberg 38 * Fix some bugs 35 39 36 40 = 1.1.7 = -
yummi-auto-check-parent-category-category-tree-checklist/trunk/yummi-category-checklist.php
r2060340 r2105451 2 2 /* 3 3 Plugin Name: Parent Category AutoCheck + Category Tree Checklist 4 Version: 1.1. 74 Version: 1.1.8 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 … … 120 120 static function script() { 121 121 $cchla = array( 122 'UncheckMain' => 0122 'UncheckMain' => 0 123 123 ,'sync' => 1 124 124 ,'collapse' => 1 … … 132 132 <script> 133 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(){ 134 135 function cat_check(){ 136 // console.log(wp.data.select('core/editor')); //core/button //core/editor 137 var reloader = setInterval(function(){ 138 var gutenberg; 139 if( $('[class$="__hierarchical-terms-list"]').length ) { 140 gutenberg = true; 141 var classes = '[class$="__hierarchical-terms-list"]'; 142 }else{ 143 var classes = '.categorychecklist, .cat-checklist'; 144 } 145 // gutenberg ? console.log('gutenberg editor') : console.log('old editor'); 146 147 if( $(classes).length ){ 148 $(classes).each(function(index, value){ 149 if( gutenberg ){ 150 var loader = setInterval(function(){ 151 if( value.innerHTML !== "" ){ 152 ycc_load(gutenberg); 153 // console.log(index + ' Categories loaded!'); 154 clearInterval(loader); 155 } 156 },500); 157 }else 158 ycc_load(gutenberg); 159 }); 160 clearInterval(reloader); 161 } 162 },500); 163 } 164 cat_check(); // check on page load 165 var sys_buttons_loader = setInterval(function(){ // check on click toggles 166 if( $('button.components-icon-button:has(svg.dashicons-admin-generic), .components-panel h2 button.components-panel__body-toggle, button.edit-post-sidebar__panel-tab, .components-panel h2 button').length ){ 167 $('button.components-icon-button:has(svg.dashicons-admin-generic), .components-panel h2 button.components-panel__body-toggle, button.edit-post-sidebar__panel-tab, .components-panel h2 button').on('click',function(){ // check on system buttons clicks 168 cat_check(); 169 // console.log('system buttons clicks'); 170 }); 171 clearInterval(sys_buttons_loader); 172 } 173 }, 2000); 174 175 // var reload_check = false; var publish_button_click = false; 176 // jQuery(document).ready(function($) { 177 // add_publish_button_click = setInterval(function() { 178 // $publish_button = jQuery('.edit-post-header__settings .editor-post-publish-button'); 179 // if ($publish_button && !publish_button_click) { 180 // publish_button_click = true; 181 // $publish_button.on('click', function() { 182 // var reloader = setInterval(function() { 183 // if (reload_check) {return;} else {reload_check = true;} 184 // postsaving = wp.data.select('core/editor').isSavingPost(); 185 // autosaving = wp.data.select('core/editor').isAutosavingPost(); 186 // success = wp.data.select('core/editor').didPostSaveRequestSucceed(); 187 // console.log('Saving: '+postsaving+' - Autosaving: '+autosaving+' - Success: '+success); 188 // if (postsaving || autosaving || !success) {classic_reload_check = false; return;} 189 // clearInterval(reloader); 190 // 191 // value = document.getElementById('metabox_input_id').value; 192 // if (value == 'trigger_value') { 193 // if (confirm('Page reload required. Refresh the page now?')) { 194 // window.location.href = window.location.href+'&refreshed=1'; 195 // } 196 // } 197 // }, 1000); 198 // }); 199 // } 200 // }, 500); 201 // }); 202 203 function ycc_load(gutenberg){ 159 204 //console.log('<?//=add_filter('allowed_block_types',array(__CLASS__))?>'); 160 var gutenberg; 161 if($('[class$="__hierarchical-terms-list"]').length) gutenberg = true; 162 // gutenberg ? console.log('gutenberg editor') : console.log('old editor'); 205 163 206 $('[class$="__hierarchical-terms-list"]').addClass('categorychecklist'); 164 207 $('[class$="__hierarchical-terms-subchoices"]').addClass('is-parent children'); … … 177 220 178 221 /* отключаем от чека заглавные которые имеют детей */ 222 179 223 <?php if( $cchl['UncheckMain'] == 0 ){ ?> 180 224 $('.categorychecklist .children, [data-taxonomy="category"] .acf-checkbox-list .children').each(function() {
Note: See TracChangeset
for help on using the changeset viewer.