|
2 | 2 | * Copyright © 2015 Magento. All rights reserved.
|
3 | 3 | * See COPYING.txt for license details.
|
4 | 4 | */
|
5 |
| -Number.prototype.formatMoney = function (c, d, t) { //this function helps format price |
6 |
| - var n = this, |
7 |
| - c = isNaN(c = Math.abs(c)) ? 2 : c, |
8 |
| - d = d == undefined ? "." : d, |
9 |
| - t = t == undefined ? "," : t, |
10 |
| - s = n < 0 ? "-" : "", |
11 |
| - i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", |
12 |
| - j = (j = i.length) > 3 ? j % 3 : 0; |
13 |
| - return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); |
14 |
| -}; |
15 |
| - |
16 |
| -Array.prototype.intersection = function (a) { |
17 |
| - return this.filter(function (i) { |
18 |
| - return a.indexOf(i) >= 0; |
19 |
| - }); |
20 |
| -}; |
21 | 5 |
|
22 |
| -define(["jquery", "jquery/ui"], function ($) { |
| 6 | +define(['jquery', 'underscore', 'jquery/ui'], function ($, _) { |
| 7 | + 'use strict'; |
| 8 | + |
| 9 | + /** |
| 10 | + * Parse params |
| 11 | + * @param {String} query |
| 12 | + * @returns {{}} |
| 13 | + */ |
23 | 14 | $.parseParams = function (query) {
|
24 | 15 | var re = /([^&=]+)=?([^&]*)/g,
|
25 | 16 | decodeRE = /\+/g, // Regex for replacing addition symbol with a space
|
@@ -564,7 +555,7 @@ define(["jquery", "jquery/ui"], function ($) {
|
564 | 555 | return;
|
565 | 556 | }
|
566 | 557 |
|
567 |
| - if (products.intersection($widget.optionsMap[id][option].products).length <= 0) { |
| 558 | + if (_.intersection(products, $widget.optionsMap[id][option].products).length <= 0) { |
568 | 559 | $this.attr('disabled', true).addClass('disabled');
|
569 | 560 | }
|
570 | 561 | });
|
@@ -597,7 +588,7 @@ define(["jquery", "jquery/ui"], function ($) {
|
597 | 588 | if (products.length == 0) {
|
598 | 589 | products = $widget.optionsMap[id][option].products;
|
599 | 590 | } else {
|
600 |
| - products = products.intersection($widget.optionsMap[id][option].products); |
| 591 | + products = _.intersection(products, $widget.optionsMap[id][option].products); |
601 | 592 | }
|
602 | 593 | });
|
603 | 594 |
|
|
0 commit comments