PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | assets/js/pricing-modal.js +11 -30 2.3.0 → trunk View file →
@@ -41,11 +41,9 @@
41 41 period = null;
42 42 }
43 43
44 44 if (typeof content !== 'object') {
45 - content += ''; // Be sure content is a string.
46 - content = content.split('.');
47 - content[1] = content[1].length === 1 ? content[1] + '0' : ('' + content[1]).substring(0, 2);
45 + content = w.imagify.splitPrice(content);
48 46
49 47 output = '<span class="imagify-price-big">' + content[0] + '</span> ';
50 48 output += '<span class="imagify-price-mini">.' + content[1] + '</span>';
51 49
@@ -53,19 +51,19 @@
53 51 }
54 52
55 53 monthly = content.monthly + '';
56 54 yearly = content.yearly + '';
57 - m = '0' === monthly ? ['0', '00'] : monthly.split('.');
58 - y = '0' === yearly ? ['0', '00'] : yearly.split('.');
55 + m = w.imagify.splitPrice(monthly);
56 + y = w.imagify.splitPrice(yearly);
59 57 output = '<span class="imagify-switch-my">';
60 58 /* eslint-disable indent */
61 59 output += '<span aria-hidden="' + (period === 'monthly' ? 'false' : 'true') + '" class="imagify-monthly">';
62 60 output += '<span class="imagify-price-big">' + m[0] + '</span> ';
63 - output += '<span class="imagify-price-mini">.' + (m[1].length === 1 ? m[1] + '0' : ('' + m[1]).substring(0, 2)) + '</span>';
61 + output += '<span class="imagify-price-mini">.' + m[1] + '</span>';
64 62 output += '</span> ';
65 63 output += '<span aria-hidden="' + (period === 'yearly' ? 'false' : 'true') + '" class="imagify-yearly">';
66 64 output += '<span class="imagify-price-big">' + y[0] + '</span> ';
67 - output += '<span class="imagify-price-mini">.' + (y[1].length === 1 ? y[1] + '0' : ('' + y[1]).substring(0, 2)) + '</span>';
65 + output += '<span class="imagify-price-mini">.' + y[1] + '</span>';
68 66 output += '</span>';
69 67 /* eslint-enable indent */
70 68 output += '</span>';
71 69
@@ -123,10 +121,10 @@
123 121 mon = datas.monthly_cost, // 4.99 (monthly)
124 122 quo = datas.quota, // 1000 (MB) - 5000 images (monthly/onetime)
125 123 cos = datas.cost, // 3.49 (onetime)
126 124 label = datas.label.replace(/_.*$/, ''),
127 - name = -1 === quo ? 'Unlimited' : (quo >= 1000 ? quo / 1000 + ' GB' : quo + ' MB'),
128 - pcs = 'monthly' === type ? {monthly: mon, yearly: Math.round(ann / 12 * 100) / 100} : cos,
125 + name = w.imagify.formatQuota(quo),
126 + pcs = 'monthly' === type ? {monthly: mon, yearly: w.imagify.monthlyFromAnnual(ann)} : cos,
129 127 pcsd = pcs, // Used if discount is active.
130 128 percent, $datas_c, datas_content, applies_to = [],
131 129 offer_by = '',
132 130 additional_data = '';
@@ -142,12 +140,11 @@
142 140 && (0 < mon)
143 141 && (applies_to.includes(lab) || 'all' === applies_to[0])
144 142 ) {
145 143 percent = (100 - promo.coupon_value) / 100;
146 - pcs = 'monthly' === type ? {
147 - monthly: mon * percent,
148 - yearly: Math.round((ann * percent) / 12 * 100) / 100
149 - } : cos * percent;
144 + pcs = 'monthly' === type
145 + ? w.imagify.applyDiscount(mon, ann, promo.coupon_value)
146 + : cos * percent;
150 147 }
151 148
152 149 if (typeof classes !== 'undefined') {
153 150 $offer.addClass('imagify-' + type + '-' + lab + classes);
@@ -520,25 +517,9 @@
520 517 break;
521 518 }
522 519 },
523 520 getPromoAppliesTo: function(promo){
524 - var applies_to = [];
525 - if (promo.applies_to instanceof Array) {
526 - var plan_list = [];
527 -
528 - for (var plan_infos = 0; plan_infos < promo.applies_to.length; plan_infos++) {
529 - plan_list.push(promo.applies_to[plan_infos].plan_name);
530 - }
531 -
532 - plan_list.forEach(function (item) {
533 - if (! applies_to.includes(item)) {
534 - applies_to.push(item);
535 - }
536 - });
537 - } else {
538 - applies_to = [promo.applies_to];
539 - }
540 - return applies_to;
521 + return w.imagify.getPromoAppliesTo(promo);
541 522 }
542 523 };
543 524
544 525 /**