Changeset 3216886
- Timestamp:
- 01/04/2025 02:08:40 PM (15 months ago)
- Location:
- advanced-notifications/trunk
- Files:
-
- 4 edited
-
plugins/easy-interface-settings/assets/js/eis-settings-fields.js (modified) (1 diff)
-
plugins/easy-interface-settings/easy-interface-settings.php (modified) (1 diff)
-
plugins/easy-interface-settings/includes/eis-admin-functions.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-notifications/trunk/plugins/easy-interface-settings/assets/js/eis-settings-fields.js
r3214908 r3216886 1 1 jQuery(document).ready( function($) { 2 // HIDE CHILD FIELDS3 function eis_hide_children_ of_hidden_parent(element) {2 // HIDE CHILDREN FIELDS 3 function eis_hide_children_field(element) { 4 4 element = typeof element !== 'undefined' ? element : false; 5 5 if (element) { 6 let parent_option_name = $(element). closest('[data-option-name]').data('option-name');6 let parent_option_name = $(element).attr('data-option-name'); 7 7 if (typeof parent_option_name != 'undefined') { 8 8 let parent_value = $(element).val(); 9 let children = $('[data-parent-option="'+parent_option_name+'"]'); 10 children.each(function(index,child) { 11 let child_option_name = $(child).closest('[data-option-name]').data('option-name'); 12 if ($(child).hasClass('hidden')) { 13 let children_2 = $('[data-parent-option="'+child_option_name+'"]').addClass('eis-children-hidden'); 14 } else { 15 let children_2 = $('[data-parent-option="'+child_option_name+'"]').removeClass('eis-children-hidden'); 16 } 9 let children_option = $('[data-parent-option="'+parent_option_name+'"]'); 10 children_option.each(function(index,child) { 11 $(child).addClass('hidden'); 17 12 }); 18 13 } 19 } else {20 $('[data-parent-option]').each(function(index,element) {21 var parent_attr = $(element).find('select').attr("name");22 if (typeof parent_attr != 'undefined') {23 $('[data-parent-option]').each(function(index,ele) {24 var parent_option = $(this).data('parent-option');25 var parent = $('select[name$="['+parent_option+']"]').closest('.form-field');26 var is_parent = parent_attr.includes('['+parent_option+']');27 if (is_parent) {28 $(this).addClass('eis-children-hidden');29 } else if ($(parent).hasClass('hidden') != true) {30 $(this).removeClass('eis-children-hidden');31 }32 });33 }34 });35 14 } 36 15 } 37 function eis_hide_unselected_child_field(element) { 16 // HIDE CHILD FIELDS 17 function eis_hide_child_field(element) { 38 18 element = typeof element !== 'undefined' ? element : false; 19 if (!$(element).is('input, select')) { 20 element = $(element).find('input, select')[0]; 21 } 39 22 if (element) { 40 let parent_option_name = $(element).closest('[data-option-name]'). data('option-name');23 let parent_option_name = $(element).closest('[data-option-name]').attr('data-option-name'); 41 24 if (typeof parent_option_name != 'undefined') { 42 25 let parent_value = $(element).val(); 43 let children = $('[data-parent-option="'+parent_option_name+'"]'); 44 children.each(function(index,child) { 45 let child_value = $(child).data('parent-value'); 46 if (typeof child_value != 'undefined') { 47 if (jQuery.inArray(parent_value, child_value.split(',')) !== -1) { 26 let children_option = $('[data-parent-option="'+parent_option_name+'"]'); 27 children_option.each(function(index,child) { 28 let child_parent_show_value = $(child).attr('data-parent-value'); 29 let child_parent_hide_value = $(child).attr('data-hide-value'); 30 if (typeof child_parent_show_value != 'undefined') { 31 if (jQuery.inArray(parent_value, child_parent_show_value.split(',')) !== -1) { 48 32 $(child).removeClass('hidden'); 33 eis_hide_child_field(child); 49 34 } else { 50 35 $(child).addClass('hidden'); 36 eis_hide_children_field(child); 37 } 38 } else if (typeof child_parent_hide_value != 'undefined') { 39 if (jQuery.inArray(parent_value, child_parent_hide_value.split(',')) !== -1) { 40 $(child).addClass('hidden'); 41 eis_hide_children_field(child); 42 } else { 43 $(child).removeClass('hidden'); 44 eis_hide_child_field(child); 51 45 } 52 46 } 53 47 }); 54 48 } 55 } else {56 $('[data-parent-option]').each(function(index,element) {57 let parent_option = $(element).data('parent-option');58 let parent_value = $(element).data('parent-value');59 if (typeof parent_value != 'undefined') {60 let parent = $('select[name$="['+parent_option+']"]').val();61 if (jQuery.inArray(parent, parent_value.split(',')) !== -1) {62 $(element).removeClass('hidden');63 } else {64 $(element).addClass('hidden');65 }66 }67 });68 49 } 69 eis_hide_children_of_hidden_parent(element);70 50 } 71 // eis_hide_unselected_child_field();72 function eis_hide_selected_child_field(element) {73 element = typeof element !== 'undefined' ? element : false;74 if (element) {75 let parent_option_name = $(element).closest('[data-option-name]').data('option-name');76 if (typeof parent_option_name != 'undefined') {77 let parent_value = $(element).val();78 let children = $('[data-parent-option="'+parent_option_name+'"]');79 children.each(function(index,child) {80 let child_value = $(child).data('hide-value');81 if (typeof child_value != 'undefined') {82 if (jQuery.inArray(parent_value, child_value.split(',')) !== -1) {83 $(child).addClass('hidden');84 } else {85 $(child).removeClass('hidden');86 }87 }88 });89 }90 } else {91 $('[data-parent-option]').each(function(index,element) {92 let parent_option = $(element).data('parent-option');93 let hide_value = $(element).data('hide-value');94 if (typeof hide_value != 'undefined') {95 let parent = $('select[name$="['+parent_option+']"]').val();96 if (jQuery.inArray(parent, hide_value.split(',')) !== -1) {97 $(element).addClass('hidden');98 } else {99 $(element).removeClass('hidden');100 }101 }102 });103 }104 eis_hide_children_of_hidden_parent(element);105 }106 // eis_hide_selected_child_field();107 51 $(document).on("input", ".eis-interface-settings input, .eis-interface-settings select", function(e){ 108 52 e.stopPropagation(); 109 eis_hide_unselected_child_field(this); 110 eis_hide_selected_child_field(this); 53 eis_hide_child_field(this); 111 54 }); 112 113 55 $(document).on("click", "input[name*=_display_eis_checkbox]", function(e) { 114 56 if ($(this).is(":checked")) { -
advanced-notifications/trunk/plugins/easy-interface-settings/easy-interface-settings.php
r3214908 r3216886 2 2 /* 3 3 * 4 * Easy Interface Settings V 1.0. 84 * Easy Interface Settings V 1.0.9 5 5 * ------------------------------------------------ 6 6 * Copyright Linker - https://linker.co.il -
advanced-notifications/trunk/plugins/easy-interface-settings/includes/eis-admin-functions.php
r3214908 r3216886 695 695 $return = false; 696 696 $current_input_register_info = get_register_eis_interfaces_options($current_interface_id, $current_input_id); 697 $current_input_parent_name = (isset($current_input_register_info['parent_name'])) ? $current_input_register_info['parent_name'] : null; 698 $current_input_show_on_value = (isset($current_input_register_info['show_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['show_on_value'])) : null; 699 $current_input_hide_on_value = (isset($current_input_register_info['hide_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['hide_on_value'])) : null; 700 if ($current_input_parent_name != null && $current_input_show_on_value != null) { 701 $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name); 702 $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id); 703 $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val); 704 if ($current_input_parent_name_val != null && !in_array($current_input_parent_name_val, $current_input_show_on_value)) { 697 $current_input_parent_name = (isset($current_input_register_info['parent_name'])) ? $current_input_register_info['parent_name'] : false; 698 if ($current_input_parent_name) { 699 if (is_eis_option_hidden($current_interface_id, $current_input_parent_name)) { 705 700 $return = true; 706 } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') { 707 $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null; 708 if (!in_array($current_input_parent_name_first_select, $current_input_show_on_value)) { 709 $return = true; 710 } 711 } 712 } elseif ($current_input_parent_name != null && $current_input_hide_on_value != null) { 713 $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name); 714 $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id); 715 $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val); 716 if ($current_input_parent_name_val != null && in_array($current_input_parent_name_val, $current_input_hide_on_value)) { 717 $return = true; 718 } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') { 719 $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null; 720 if (in_array($current_input_parent_name_first_select, $current_input_hide_on_value)) { 721 $return = true; 701 } else { 702 $current_input_show_on_value = (isset($current_input_register_info['show_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['show_on_value'])) : false; 703 $current_input_hide_on_value = (isset($current_input_register_info['hide_on_value'])) ? array_map('trim',explode(",",$current_input_register_info['hide_on_value'])) : false; 704 if ($current_input_show_on_value) { 705 $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name); 706 $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id); 707 $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val); 708 if ($current_input_parent_name_val && !in_array($current_input_parent_name_val, $current_input_show_on_value)) { 709 $return = true; 710 } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') { 711 $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null; 712 if (!in_array($current_input_parent_name_first_select, $current_input_show_on_value)) { 713 $return = true; 714 } 715 } 716 } elseif ($current_input_hide_on_value) { 717 $current_input_parent_name_info = get_register_eis_interfaces_options($current_interface_id, $current_input_parent_name); 718 $current_input_parent_name_val = eis_get_option($current_interface_id, $current_input_parent_name, $post_id); 719 $current_input_parent_name_val = str_replace(' ', '_', $current_input_parent_name_val); 720 if ($current_input_parent_name_val != null && in_array($current_input_parent_name_val, $current_input_hide_on_value)) { 721 $return = true; 722 } elseif ($current_input_parent_name_val == null && isset($current_input_parent_name_info['input_type']) && $current_input_parent_name_info['input_type'] == 'select') { 723 $current_input_parent_name_first_select = (!empty($current_input_parent_name_info['input_select_options']) && function_exists('array_key_first')) ? array_key_first($current_input_parent_name_info['input_select_options']) : null; 724 if (in_array($current_input_parent_name_first_select, $current_input_hide_on_value)) { 725 $return = true; 726 } 727 } 722 728 } 723 729 } -
advanced-notifications/trunk/readme.txt
r3214908 r3216886 3 3 Tags: notice, notifications, alerts, popup, messages 4 4 Requires at least: 5.6.2 5 Tested up to: 6. 5.06 Stable tag: 1.2. 75 Tested up to: 6.7.1 6 Stable tag: 1.2.8 7 7 License: GPLv2 or later 8 8 … … 76 76 77 77 == Changelog == 78 79 = 1.2.8 = 80 * Update: eis plugin 78 81 79 82 = 1.2.7 =
Note: See TracChangeset
for help on using the changeset viewer.