PluginProbe
Tiered Pricing Table for WooCommerce / 2.0
Tiered Pricing Table for WooCommerce v2.0
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / assets / admin / settings.js

settings.js in Tiered Pricing Table for WooCommerce 2.0, at assets/admin/settings.js

73 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2 var TieredPricingSettings = function () {
3 this.init = function () {
4 this.prefix = 'tier_pricing_table_';
5 this.$displayType = $('[name=' + this.prefix + 'display_type]');
6 this.$displayAtCatalog = $('[name=' + this.prefix + 'tiered_price_at_catalog]');
7 this.$showDiscountColumn = $('[name=' + this.prefix + 'show_discount_column]');
8
9 this.$displayType.on('change', (function () {
10
11 if (this.$displayType.val() === 'tooltip') {
12 this.hideRow(this.getRow('position_hook'));
13 this.hideRow(this.getRow('table_title'));
14 this.showRow(this.getRow('tooltip_color'));
15 this.showRow(this.getRow('tooltip_size'));
16 this.showRow(this.getRow('tooltip_border'));
17 } else {
18 this.showRow(this.getRow('position_hook'));
19 this.showRow(this.getRow('table_title'));
20 this.hideRow(this.getRow('tooltip_size'));
21 this.hideRow(this.getRow('tooltip_color'));
22 this.hideRow(this.getRow('tooltip_border'));
23 }
24
25 }).bind(this));
26
27 this.getRow('tiered_price_at_catalog_type').on('change', (function (e) {
28 if($(e.target).val() === 'lowest'){
29 this.showRow(this.getRow('lowest_prefix'));
30 }else{
31 this.hideRow(this.getRow('lowest_prefix'));
32 }
33 }).bind(this));
34
35 this.$displayAtCatalog.on('change', (function () {
36 if (this.$displayAtCatalog.attr('checked')) {
37 this.showRow(this.getRow('tiered_price_at_catalog_type'));
38 } else {
39 this.hideRow(this.getRow('tiered_price_at_catalog_type'));
40 }
41 }).bind(this));
42
43 this.$showDiscountColumn.on('change', (function () {
44 if (this.$showDiscountColumn.attr('checked')) {
45 this.showRow(this.getRow('head_discount_text'));
46 } else {
47 this.hideRow(this.getRow('head_discount_text'));
48 }
49 }).bind(this));
50
51 this.$displayType.trigger('change');
52 this.$displayAtCatalog.trigger('change');
53 this.$showDiscountColumn.trigger('change');
54 this.getRow('tiered_price_at_catalog_type').trigger('change');
55 };
56
57 this.showRow = function (el) {
58 el.closest('tr').show(100);
59 };
60
61 this.hideRow = function (el) {
62 el.closest('tr').hide(100);
63 };
64
65 this.getRow = function (settingsName) {
66 return $('[name=' + this.prefix + settingsName + ']');
67 }
68 };
69
70 var tieredPricingSettings = new TieredPricingSettings();
71
72 tieredPricingSettings.init();
73 });