| @@ -178,9 +178,10 @@ | ||
| 178 | 178 | { |
| 179 | 179 | var i, fieldDefaults, tools, table, $tools, $table; |
| 180 | 180 | var $fields = $('input#ws-plugin--s2member-custom-reg-fields'); |
| 181 | 181 | var $configuration = $('div#ws-plugin--s2member-custom-reg-field-configuration'); |
| 182 | - var fields = ($fields.val()) ? $.JSON.parse($fields.val()) : []; | |
| 182 | + //260928.0402 Use the standard JSON API provided natively or by WordPress's JSON2 compatibility dependency. | |
| 183 | + var fields = ($fields.val()) ? JSON.parse($fields.val()) : []; | |
| 183 | 184 | |
| 184 | 185 | fields = /* Force fields to an array. */ (fields instanceof Array) ? fields : []; |
| 185 | 186 | |
| 186 | 187 | fieldDefaults = {section: 'no', sectitle: '', id: '', label: '', type: 'text', deflt: '', options: '', expected: '', required: 'yes', levels: 'all', editable: 'yes', classes: '', styles: '', attrs: ''}; |
| @@ -380,9 +381,9 @@ | ||
| 380 | 381 | return field; |
| 381 | 382 | }; |
| 382 | 383 | var updateFields = /* Update hidden input value. */ function() |
| 383 | 384 | { |
| 384 | - $fields.val(((fields.length > 0) ? $.JSON.stringify(fields) : '')); | |
| 385 | + $fields.val(((fields.length > 0) ? JSON.stringify(fields) : '')); | |
| 385 | 386 | }; |
| 386 | 387 | var fieldId2Var = /* Convert ids to variables. */ function(fieldId) |
| 387 | 388 | { |
| 388 | 389 | return ( typeof fieldId === 'string') ? $.trim(fieldId).toLowerCase().replace(/[^a-z0-9]/g, '_') : ''; |
| @@ -911,8 +912,32 @@ | ||
| 911 | 912 | (thisChecked) ? $autoConfigDistros.attr('checked', 'checked') : null; |
| 912 | 913 | |
| 913 | 914 | }).trigger('change'); |
| 914 | 915 | } |
| 916 | + //260917.0108 Keep Demote-only options visibly inactive for Delete behavior, and update them immediately when the administrator changes the behavior selector. | |
| 917 | + $('select#ws-plugin--s2member-membership-eot-behavior').change(function() | |
| 918 | + { | |
| 919 | + var disabled = ($(this).val() === 'delete'); | |
| 920 | + var $demotionRows = $('tr.ws-plugin--s2member-eot-demotion-option-row'); | |
| 921 | + var $demotionInputs = $(':input', $demotionRows); | |
| 922 | + var $ccapsInput = $('#ws-plugin--s2member-eots-remove-ccaps'); | |
| 923 | + var $ccapsRows = $('label[for="ws-plugin--s2member-eots-remove-ccaps"]').closest('tr').add($ccapsInput.closest('tr')); | |
| 924 | + | |
| 925 | + $demotionInputs.add($ccapsInput).prop('disabled', disabled); | |
| 926 | + $demotionRows.add($ccapsRows).css('opacity', disabled ? '0.5' : ''); | |
| 927 | + }).trigger('change'); | |
| 928 | + | |
| 929 | + //260917.0108 Custom Maximum Runtime is meaningful only in Custom mode; preserve its saved value while making the dependency obvious in the UI. | |
| 930 | + $('select#ws-plugin--s2member-auto-eot-system-runtime-mode').change(function() | |
| 931 | + { | |
| 932 | + var disabled = ($(this).val() !== 'custom'); | |
| 933 | + var $runtimeInput = $('#ws-plugin--s2member-auto-eot-system-runtime-custom'); | |
| 934 | + var $runtimeRows = $('label[for="ws-plugin--s2member-auto-eot-system-runtime-custom"]').closest('tr').add($runtimeInput.closest('tr')); | |
| 935 | + | |
| 936 | + $runtimeInput.prop('disabled', disabled); | |
| 937 | + $runtimeRows.css('opacity', disabled ? '0.5' : ''); | |
| 938 | + }).trigger('change'); | |
| 939 | + | |
| 915 | 940 | if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)) |
| 916 | 941 | { |
| 917 | 942 | $('select#ws-plugin--s2member-auto-eot-system-enabled').change(function() |
| 918 | 943 | { |