codemirror
9 years ago
javascript-md5
7 years ago
how-to.js
8 years ago
how-to.min.js
6 years ago
jquery.colorbox.js
8 years ago
jquery.colorbox.min.js
6 years ago
metabox.js
5 years ago
metabox.min.js
5 years ago
multisite-updater.js
6 years ago
multisite-updater.min.js
6 years ago
wp-pages.js
6 years ago
wp-pages.min.js
6 years ago
yit-cpt-unlimited.js
6 years ago
yit-cpt-unlimited.min.js
6 years ago
yit-plugin-panel.js
5 years ago
yit-plugin-panel.min.js
5 years ago
yit-wp-pointer.js
5 years ago
yit-wp-pointer.min.js
5 years ago
yith-colorpicker.min.js
5 years ago
yith-dashboard.js
7 years ago
yith-dashboard.min.js
6 years ago
yith-enhanced-select-wc-2.6.js
5 years ago
yith-enhanced-select-wc-2.6.min.js
5 years ago
yith-enhanced-select.js
5 years ago
yith-enhanced-select.min.js
5 years ago
yith-fields.js
5 years ago
yith-fields.min.js
5 years ago
yith-gutenberg.js
5 years ago
yith-gutenberg.min.js
5 years ago
yith-promo.js
7 years ago
yith-promo.min.js
6 years ago
yith-system-info.js
5 years ago
yith-system-info.min.js
5 years ago
yith-update-plugins.js
7 years ago
yith-update-plugins.min.js
6 years ago
metabox.js
179 lines
| 1 | /** |
| 2 | * This file belongs to the YIT Framework. |
| 3 | * |
| 4 | * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) |
| 5 | * that is bundled with this package in the file LICENSE.txt. |
| 6 | * It is also available through the world-wide-web at this URL: |
| 7 | * http://www.gnu.org/licenses/gpl-3.0.txt |
| 8 | */ |
| 9 | ( function ( $ ) { |
| 10 | |
| 11 | $( '.metaboxes-tab' ).each( function () { |
| 12 | $( '.tabs-panel', this ).hide(); |
| 13 | |
| 14 | var active_tab = wpCookies.get( 'active_metabox_tab' ); |
| 15 | if ( active_tab == null ) { |
| 16 | active_tab = $( 'ul.metaboxes-tabs li:first-child a', this ).attr( 'href' ); |
| 17 | } else { |
| 18 | active_tab = '#' + active_tab; |
| 19 | } |
| 20 | |
| 21 | $( active_tab ).show(); |
| 22 | |
| 23 | $( '.metaboxes-tabs a', this ).click( function ( e ) { |
| 24 | if ( $( this ).parent().hasClass( 'tabs' ) ) { |
| 25 | e.preventDefault(); |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | var t = $( this ).attr( 'href' ); |
| 30 | $( this ).parent().addClass( 'tabs' ).siblings( 'li' ).removeClass( 'tabs' ); |
| 31 | $( this ).closest( '.metaboxes-tab' ).find( '.tabs-panel' ).hide(); |
| 32 | $( t ).show(); |
| 33 | |
| 34 | return false; |
| 35 | } ); |
| 36 | } ); |
| 37 | |
| 38 | var act_page_option = $( '#_active_page_options-container' ).parent().html(); |
| 39 | $( '#_active_page_options-container' ).parent().remove(); |
| 40 | $( act_page_option ).insertAfter( '#yit-post-setting .handlediv' ); |
| 41 | $( act_page_option ).insertAfter( '#yit-page-setting .handlediv' ); |
| 42 | |
| 43 | |
| 44 | $( '#_active_page_options-container' ).on( 'click', function () { |
| 45 | if ( $( '#_active_page_options' ).is( ":checked" ) ) { |
| 46 | $( '#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab' ).css( { |
| 47 | 'opacity' : 1, |
| 48 | 'pointer-events': 'auto' |
| 49 | } ); |
| 50 | } else { |
| 51 | $( '#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab' ).css( { |
| 52 | 'opacity' : 0.5, |
| 53 | 'pointer-events': 'none' |
| 54 | } ); |
| 55 | } |
| 56 | } ).click(); |
| 57 | |
| 58 | |
| 59 | //dependencies handler |
| 60 | $( document.body ).on( 'yith-plugin-fw-metabox-init-deps', function () { |
| 61 | $( document.body ).trigger( 'yith-plugin-fw-init-radio' ); |
| 62 | $( '.metaboxes-tab [data-dep-target]:not(.yith-plugin-fw-metabox-deps-initialized)' ).each( function () { |
| 63 | var t = $( this ); |
| 64 | |
| 65 | var field = '#' + t.data( 'dep-target' ), |
| 66 | dep = '#' + t.data( 'dep-id' ), |
| 67 | value = t.data( 'dep-value' ), |
| 68 | type = t.data( 'dep-type' ); |
| 69 | |
| 70 | |
| 71 | dependencies_handler( field, dep, value.toString(), type ); |
| 72 | |
| 73 | $( dep ).on( 'change', function () { |
| 74 | dependencies_handler( field, dep, value.toString(), type ); |
| 75 | } ).change(); |
| 76 | |
| 77 | t.addClass( 'yith-plugin-fw-metabox-deps-initialized' ); |
| 78 | } ); |
| 79 | } ).trigger( 'yith-plugin-fw-metabox-init-deps' ); |
| 80 | |
| 81 | //Handle dependencies. |
| 82 | function dependencies_handler( id, deps, values, type ) { |
| 83 | var result = true; |
| 84 | |
| 85 | |
| 86 | //Single dependency |
| 87 | if ( typeof ( deps ) == 'string' ) { |
| 88 | if ( deps.substr( 0, 6 ) == ':radio' ) { |
| 89 | deps = deps + ':checked'; |
| 90 | } |
| 91 | |
| 92 | var val = $( deps ).val(); |
| 93 | |
| 94 | if ( $( deps ).attr( 'type' ) == 'checkbox' ) { |
| 95 | var thisCheck = $( deps ); |
| 96 | if ( thisCheck.is( ':checked' ) ) { |
| 97 | val = 'yes'; |
| 98 | } else { |
| 99 | val = 'no'; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | values = values.split( ',' ); |
| 104 | |
| 105 | for ( var i = 0; i < values.length; i++ ) { |
| 106 | if ( val != values[ i ] ) { |
| 107 | result = false; |
| 108 | } else { |
| 109 | result = true; |
| 110 | break; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | var $current_field = $( id ), |
| 116 | $current_container = $( id + '-container' ).parent(); |
| 117 | |
| 118 | var types = type.split( '-' ), j; |
| 119 | for ( j in types ) { |
| 120 | var current_type = types[ j ]; |
| 121 | |
| 122 | if ( !result ) { |
| 123 | switch ( current_type ) { |
| 124 | case 'disable': |
| 125 | $current_container.addClass( 'yith-disabled' ); |
| 126 | $current_field.attr( 'disabled', true ); |
| 127 | break; |
| 128 | case 'hideNow': |
| 129 | $current_container.hide(); |
| 130 | break; |
| 131 | case 'hideme': |
| 132 | $current_field.hide(); |
| 133 | break; |
| 134 | case 'fadeInOut': |
| 135 | case 'fadeOut': |
| 136 | $current_container.hide( 500 ); |
| 137 | break; |
| 138 | case 'fadeIn': |
| 139 | $current_container.hide(); |
| 140 | break; |
| 141 | default: |
| 142 | if( ! $current_container.hasClass('fade-in')){ |
| 143 | $current_container.hide(); |
| 144 | $current_container.css({'opacity':'0'}); |
| 145 | }else{ |
| 146 | $current_container.fadeTo("slow" , 0, function(){ |
| 147 | $(this).hide().removeClass('fade-in'); |
| 148 | }); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | } else { |
| 153 | switch ( current_type ) { |
| 154 | case 'disable': |
| 155 | $current_container.removeClass( 'yith-disabled' ); |
| 156 | $current_field.attr( 'disabled', false ); |
| 157 | break; |
| 158 | case 'hideNow': |
| 159 | $current_container.show(); |
| 160 | break; |
| 161 | case 'hideme': |
| 162 | $current_field.show(); |
| 163 | break; |
| 164 | case 'fadeInOut': |
| 165 | case 'fadeIn': |
| 166 | $current_container.show( 500 ); |
| 167 | break; |
| 168 | case 'fadeOut': |
| 169 | $current_container.show(); |
| 170 | break; |
| 171 | default: |
| 172 | $current_container.show(); |
| 173 | $current_container.fadeTo("slow" , 1).addClass('fade-in'); |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | } )( jQuery ); |