chart.js
2 months ago
chart.min.js
2 months ago
digital-files-chooser.js
2 months ago
fusewp.js
2 months ago
index.php
2 months ago
license.js
2 months ago
login-redirect.js
2 months ago
reports.js
2 months ago
reports.min.js
2 months ago
tax-rate-repeater.js
2 months ago
login-redirect.js
46 lines
| 1 | (function ($) { |
| 2 | |
| 3 | $(function () { |
| 4 | |
| 5 | var redirect_item_tmpl = wp.template('ppress-login-redirect-item'); |
| 6 | |
| 7 | $(document).on('click', '.ppress-login-redirect-add-rule button', function (e) { |
| 8 | e.preventDefault(); |
| 9 | |
| 10 | var _this = $(this), |
| 11 | rule_select_field_obj = _this.prev(), |
| 12 | selected_rule = $('option:selected', rule_select_field_obj), |
| 13 | parent_wrapper = _this.parents('.ppress-login-redirect-rules-wrap'); |
| 14 | |
| 15 | if (selected_rule.val() === "") return; |
| 16 | |
| 17 | $('.ppress-login-redirect-items-wrap', parent_wrapper).prepend( |
| 18 | redirect_item_tmpl({ |
| 19 | label: selected_rule.text(), |
| 20 | redirect_type: parent_wrapper.data('redirect-type'), |
| 21 | redirect_target: selected_rule.val() |
| 22 | }) |
| 23 | ); |
| 24 | |
| 25 | selected_rule.prop('disabled', true); |
| 26 | $('option', rule_select_field_obj).first().prop('selected', true); |
| 27 | }); |
| 28 | |
| 29 | $(document).on('click', '.ppress-login-redirect--remove-field', function (e) { |
| 30 | e.preventDefault(); |
| 31 | var wrapper = $(this).parents('.ppress-login-redirect--repeater-item'), |
| 32 | removed_redirect_target = wrapper.data('redirect-target'); |
| 33 | |
| 34 | $(this).parents('.ppress-login-redirect-rules-wrap') |
| 35 | .find('.ppress-login-redirect-select-field option[value="' + removed_redirect_target + '"]') |
| 36 | .prop('disabled', false); |
| 37 | |
| 38 | wrapper.remove(); |
| 39 | }); |
| 40 | |
| 41 | $(document).on('click', '#ppress-login-redirect-submit-btn', function (e) { |
| 42 | e.preventDefault(); |
| 43 | $('#ppress-login-redirect-form').trigger('submit'); |
| 44 | }); |
| 45 | }); |
| 46 | })(jQuery); |