codemirror
4 years ago
jquery-tiptip
5 years ago
select2
5 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
4 years ago
metabox.min.js
4 years ago
multisite-updater.js
2 years ago
multisite-updater.min.js
6 years ago
welcome-modal.js
3 years ago
welcome-modal.min.js
3 years ago
wp-pages.js
3 years ago
wp-pages.min.js
3 years ago
yit-cpt-unlimited.js
6 years ago
yit-cpt-unlimited.min.js
6 years ago
yit-plugin-panel.js
1 year ago
yit-plugin-panel.min.js
1 year ago
yit-wp-pointer.js
5 years ago
yit-wp-pointer.min.js
5 years ago
yith-bh-onboarding.js
3 years ago
yith-bh-onboarding.min.js
3 years ago
yith-colorpicker.min.js
5 years ago
yith-dashboard.js
7 years ago
yith-dashboard.min.js
6 years ago
yith-date-format.js
5 years ago
yith-date-format.min.js
5 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
2 years ago
yith-enhanced-select.min.js
2 years ago
yith-fields.js
2 years ago
yith-fields.min.js
2 years ago
yith-promo.js
7 years ago
yith-promo.min.js
6 years ago
yith-system-info.js
2 years ago
yith-system-info.min.js
2 years ago
yith-ui.js
1 year ago
yith-ui.min.js
1 year ago
yith-update-plugins.js
7 years ago
yith-update-plugins.min.js
6 years ago
metabox.js
134 lines
| 1 | ( function ( $ ) { |
| 2 | |
| 3 | // TODO: check if someone is directly using it, otherwise it could be removed, since it's not used by the fw. |
| 4 | var actPageOptionContainer = $( '#_active_page_options-container' ), |
| 5 | actPageOption = actPageOptionContainer.parent().html(); |
| 6 | actPageOptionContainer.parent().remove(); |
| 7 | $( actPageOption ).insertAfter( '#yit-post-setting .handlediv' ); |
| 8 | $( actPageOption ).insertAfter( '#yit-page-setting .handlediv' ); |
| 9 | |
| 10 | actPageOptionContainer.on( 'click', function () { |
| 11 | if ( $( '#_active_page_options' ).is( ":checked" ) ) { |
| 12 | $( '#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab' ).css( { |
| 13 | 'opacity' : 1, |
| 14 | 'pointer-events': 'auto' |
| 15 | } ); |
| 16 | } else { |
| 17 | $( '#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab' ).css( { |
| 18 | 'opacity' : 0.5, |
| 19 | 'pointer-events': 'none' |
| 20 | } ); |
| 21 | } |
| 22 | } ).trigger( 'click' ); |
| 23 | |
| 24 | |
| 25 | //dependencies handler |
| 26 | $( document.body ).on( 'yith-plugin-fw-metabox-init-deps', function () { |
| 27 | $( document.body ).trigger( 'yith-plugin-fw-init-radio' ); |
| 28 | $( '.metaboxes-tab [data-dep-target]:not(.yith-plugin-fw-metabox-deps-initialized)' ).each( function () { |
| 29 | var t = $( this ); |
| 30 | |
| 31 | var field = '#' + t.data( 'dep-target' ), |
| 32 | dep = '#' + t.data( 'dep-id' ), |
| 33 | value = t.data( 'dep-value' ), |
| 34 | type = t.data( 'dep-type' ); |
| 35 | |
| 36 | |
| 37 | dependencies_handler( field, dep, value.toString(), type ); |
| 38 | |
| 39 | $( dep ).on( 'change', function () { |
| 40 | dependencies_handler( field, dep, value.toString(), type ); |
| 41 | } ).change(); |
| 42 | |
| 43 | t.addClass( 'yith-plugin-fw-metabox-deps-initialized' ); |
| 44 | } ); |
| 45 | } ).trigger( 'yith-plugin-fw-metabox-init-deps' ); |
| 46 | |
| 47 | //Handle dependencies. |
| 48 | function dependencies_handler( id, deps, values, type ) { |
| 49 | var result = true; |
| 50 | |
| 51 | if ( typeof ( deps ) == 'string' ) { |
| 52 | if ( deps.substr( 0, 6 ) === ':radio' ) { |
| 53 | deps = deps + ':checked'; |
| 54 | } |
| 55 | |
| 56 | var depsOn = $( deps ), |
| 57 | depsOnType = depsOn.attr( 'type' ), |
| 58 | val = depsOn.val(); |
| 59 | |
| 60 | switch ( depsOnType ) { |
| 61 | case 'checkbox': |
| 62 | val = depsOn.is( ':checked' ) ? 'yes' : 'no'; |
| 63 | break; |
| 64 | case 'radio': |
| 65 | val = depsOn.find( 'input[type="radio"]' ).filter( ':checked' ).val(); |
| 66 | break; |
| 67 | } |
| 68 | |
| 69 | values = values.split( ',' ); |
| 70 | |
| 71 | for ( var i = 0; i < values.length; i++ ) { |
| 72 | if ( val != values[ i ] ) { |
| 73 | result = false; |
| 74 | } else { |
| 75 | result = true; |
| 76 | break; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | var $current_field = $( id ), |
| 82 | $current_container = $( id + '-container' ).parent(); |
| 83 | |
| 84 | var types = type.split( '-' ), j; |
| 85 | for ( j in types ) { |
| 86 | var current_type = types[ j ]; |
| 87 | |
| 88 | if ( !result ) { |
| 89 | switch ( current_type ) { |
| 90 | case 'disable': |
| 91 | $current_container.addClass( 'yith-disabled' ); |
| 92 | $current_field.attr( 'disabled', true ); |
| 93 | break; |
| 94 | case 'hide': |
| 95 | case 'hideNow': |
| 96 | $current_container.hide(); |
| 97 | break; |
| 98 | case 'hideme': |
| 99 | $current_field.hide(); |
| 100 | break; |
| 101 | case 'fadeInOut': |
| 102 | case 'fadeOut': |
| 103 | $current_container.hide( 500 ); |
| 104 | break; |
| 105 | case 'fadeIn': |
| 106 | default: |
| 107 | $current_container.hide(); |
| 108 | } |
| 109 | } else { |
| 110 | switch ( current_type ) { |
| 111 | case 'disable': |
| 112 | $current_container.removeClass( 'yith-disabled' ); |
| 113 | $current_field.attr( 'disabled', false ); |
| 114 | break; |
| 115 | case 'hide': |
| 116 | case 'hideNow': |
| 117 | $current_container.show(); |
| 118 | break; |
| 119 | case 'hideme': |
| 120 | $current_field.show(); |
| 121 | break; |
| 122 | case 'fadeOut': |
| 123 | $current_container.show(); |
| 124 | break; |
| 125 | case 'fadeInOut': |
| 126 | case 'fadeIn': |
| 127 | default: |
| 128 | $current_container.show( 500 ); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | } )( jQuery ); |