Plugin Directory

Changeset 2060094


Ignore:
Timestamp:
03/30/2019 12:17:15 PM (7 years ago)
Author:
evilex
Message:

ver 1.1.6

Location:
yummi-auto-check-parent-category-category-tree-checklist/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • yummi-auto-check-parent-category-category-tree-checklist/trunk/readme.txt

    r2017740 r2060094  
    88Requires at least: 3.3
    99Tested up to: 5.0
    10 Stable tag: 1.1.5
     10Stable tag: 1.1.6
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3434== Changelog ==
    3535
     36= 1.1.6 =
     37* Better work with Gutenberg editor
     38* Fixed conflict with "Post Expiration" plugin
     39
    3640= 1.1.5 =
    37 * Fix when Options button clicked
     41* Fixed when Options button clicked
    3842
    3943= 1.1.4 =
     
    5357
    5458= 1.0.10 =
    55 * Fix one error
     59* Fixed one error
    5660
    5761= 1.0.9 =
     
    6367
    6468= 1.0.7 =
    65 * Fix some errors
     69* Fixed some errors
    6670* Added "Synchronously allocate categories in ACF"
    6771
  • yummi-auto-check-parent-category-category-tree-checklist/trunk/yummi-category-checklist.php

    r2017740 r2060094  
    22/*
    33Plugin Name: Parent Category AutoCheck + Category Tree Checklist
    4 Version: 1.1.5
     4Version: 1.1.6
    55Description: Preserves the category hierarchy on the post editing screen + Check Parent Automatically + Auto scroll to first checked
    66Author: Alex Egorov
     
    119119
    120120    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__))?>');
    154160                    var gutenberg;
    155161                    if($('[class$="__hierarchical-terms-list"]').length) gutenberg = true;
     
    174180                        $('.categorychecklist .children, [data-taxonomy="category"] .acf-checkbox-list .children').each(function() {
    175181                            if(gutenberg){
     182                                // console.log($(this).first());
    176183                                if( $(this).children()['length'] == 1 && $(this).children()[0]['childElementCount'] != 2 )
    177184                                    $(this).find("> .li > input").addClass("disabled");//.attr('onClick','return false;');
    178185                            }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
    180189                                    $(this).find("> li > label > input").addClass("disabled").attr('onClick', 'return false;');
    181190                            }
     
    204213                        for ($i=0; $i < $depth; $i++) {
    205214                            $data .= '.parent().parent()';
    206                             echo 'var input_'.$i.' = $(this)'.$data.'.children().children();';
     215                            echo 'var input_'.$i.' = $(this)'.$data.'.children("label").children();';
    207216                        }   ?>
    208217                        // console.log('input_0:');
     
    261270                                        for ($i=0; $i < $depth; $i++) {
    262271                                            $data .= '.parent().parent()';
    263                                             echo '$(this)'.$data.'.children().children().prop("checked", true);';
     272                                            echo '$(this)'.$data.'.children("label").children().prop("checked", true);';
    264273                                        } ?>
    265274                                });
     
    275284                                $(this).addClass('is-parent');
    276285                                if($(this).find('.toggler').length){
    277                                     $('.categorychecklist .li .toggler').remove();
     286                                    $(this).find('.toggler').detach(); //$('.categorychecklist .li .toggler').remove();
    278287                                    $(this).prepend('<span class="toggler"></span>');
    279288                                }else{
     
    327336                </style>
    328337            <?php }
    329             }else{
    330             $cchl = array(
    331                 'UncheckMain' => 0
    332                ,'sync' => 1
    333                          ,'collapse' => 1
    334                          ,'collapse_acf' => 1
    335             );
    336             update_option("cchl", $cchl);
    337           }
    338338    }
    339339    static function admin_menu() {
Note: See TracChangeset for help on using the changeset viewer.