Passed
Push — develop ( e89f4d...9f2622 )
by Andrew
06:07 queued 12s
created

OptimizedImagesField.js ➔ initSizesVueComponent   C

Complexity

Conditions 11

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 12
rs 5.4
cc 11

How to fix   Complexity   

Complexity

Complex classes like OptimizedImagesField.js ➔ initSizesVueComponent often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/**
2
 * Image Optimize plugin for Craft CMS
3
 *
4
 * OptimizedImages Field JS
5
 *
6
 * @author    nystudio107
7
 * @copyright Copyright (c) 2017 nystudio107
8
 * @link      https://nystudio107.com
9
 * @package   ImageOptimize
10
 * @since     1.2.0
11
 */
12
13
import SizesContainer from '@/vue/SizesContainer.vue';
14
15
function humanFileSize(bytes, si = false, dp = 1) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
16
    const thresh = si ? 1000 : 1024;
17
18
    if (Math.abs(bytes) < thresh) {
19
        return bytes + ' B';
20
    }
21
22
    const units = si
23
        ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
24
        : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
25
    let u = -1;
26
    const r = 10 ** dp;
27
28
    do {
29
        bytes /= thresh;
30
        ++u;
31
    } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
32
33
34
    return bytes.toFixed(dp) + ' ' + units[u];
35
}
36
37
;(function ($, window, document, undefined) {
38
39
    var pluginName = "ImageOptimizeOptimizedImages",
40
        defaults = {};
41
42
    // Plugin constructor
43
    function Plugin(element, options) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
44
        this.element = element;
45
46
        this.options = $.extend({}, defaults, options);
47
48
        this._defaults = defaults;
49
        this._name = pluginName;
50
51
        this.init();
52
    }
53
54
    Plugin.prototype = {
55
56
        init: function (id) {
0 ignored issues
show
Unused Code introduced by
The parameter id is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
57
            var _this = this;
0 ignored issues
show
Unused Code introduced by
The variable _this seems to be never used. Consider removing it.
Loading history...
58
59
            $(function () {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
60
61
                /* -- _this.options gives us access to the $jsonVars that our FieldType passed down to us */
62
63
                const images = document.querySelectorAll("img.io-preview-image");
64
                for (const image of images) {
65
                    const url = image.src || image.href;
66
                    if (url && url.length > 0) {
67
                        const iTime = performance.getEntriesByName(url)[0];
0 ignored issues
show
Bug introduced by
The variable performance seems to be never declared. If this is a global, consider adding a /** global: performance */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
68
                        if (iTime !== undefined) {
69
                            const elem = image.parentNode.parentNode.parentNode.nextElementSibling.querySelector('.io-file-size');
70
                            if (elem) {
71
                                elem.innerHTML = humanFileSize(iTime.decodedBodySize, true);
72
                            }
73
                        }
74
                    }
75
                }
76
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
77
        }
78
    };
79
80
    // A really lightweight plugin wrapper around the constructor,
81
    // preventing against multiple instantiations
82
    $.fn[pluginName] = function (options) {
83
        return this.each(function () {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
84
            if (!$.data(this, "plugin_" + pluginName)) {
85
                $.data(this, "plugin_" + pluginName,
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
86
                    new Plugin(this, options));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 20.
Loading history...
87
            }
88
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
89
    };
90
91
})(jQuery, window, document);
92
93
function initSizesVueComponent(sizesWrapperId) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
94
    const vm = new Vue({
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Unused Code introduced by
The constant vm seems to be never used. Consider removing it.
Loading history...
Bug introduced by
The variable Vue seems to be never declared. If this is a global, consider adding a /** global: Vue */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
95
        el: '#' + sizesWrapperId,
96
        components: {
97
            'sizes-container': SizesContainer,
98
        },
99
        data: {},
100
        methods: {},
101
        mounted() {
102
        }
103
    });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
104
}
105
106
Craft.OptimizedImagesInput = Garnish.Base.extend(
0 ignored issues
show
Bug introduced by
The variable Craft seems to be never declared. If this is a global, consider adding a /** global: Craft */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable Garnish seems to be never declared. If this is a global, consider adding a /** global: Garnish */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
107
    {
108
        id: null,
109
        inputNamePrefix: null,
110
        inputIdPrefix: null,
111
112
        $container: null,
113
        $blockContainer: null,
114
        $addBlockBtnContainer: null,
115
        $addBlockBtnGroup: null,
116
        $addBlockBtnGroupBtns: null,
117
118
        blockSort: null,
119
        blockSelect: null,
120
121
        init: function (id, inputNamePrefix, sizesWrapperId) {
122
123
            initSizesVueComponent(sizesWrapperId);
124
            this.id = id;
125
            this.inputNamePrefix = inputNamePrefix;
126
            this.inputIdPrefix = Craft.formatInputId(this.inputNamePrefix);
0 ignored issues
show
Bug introduced by
The variable Craft seems to be never declared. If this is a global, consider adding a /** global: Craft */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
127
128
            this.$container = $('#' + this.id);
129
            this.$blockContainer = this.$container.children('.variant-blocks');
130
            this.$addBlockBtnContainer = this.$container.children('.buttons');
131
            this.$addBlockBtnGroup = this.$addBlockBtnContainer.children('.btngroup');
132
            this.$addBlockBtnGroupBtns = this.$addBlockBtnGroup.children('.btn');
133
134
            // Create our action button menus
135
            var _this = this;
136
            this.$blockContainer.find('> > .actions > .settings').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
137
                var $value = $(value);
138
                var menuBtn;
139
                if ($value.data('menubtn')) {
140
                    menuBtn = $value.data('menubtn');
141
                } else {
142
                    menuBtn = new Garnish.MenuBtn(value);
0 ignored issues
show
Bug introduced by
The variable Garnish seems to be never declared. If this is a global, consider adding a /** global: Garnish */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
143
                }
144
                menuBtn.menu.settings.onOptionSelect = $.proxy(function (option) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
145
                    this.onMenuOptionSelect(option, menuBtn);
146
                }, _this);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
147
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
148
149
            var $blocks = this.$blockContainer.children();
150
151
            this.blockSort = new Garnish.DragSort($blocks, {
0 ignored issues
show
Bug introduced by
The variable Garnish seems to be never declared. If this is a global, consider adding a /** global: Garnish */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
152
                handle: '> .actions > .move',
153
                axis: 'y',
154
                collapseDraggees: true,
155
                magnetStrength: 4,
156
                helperLagBase: 1.5,
157
                helperOpacity: 0.9,
158
                onSortChange: $.proxy(function () {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
159
                    this.resetVariantBlockOrder();
160
                }, this)
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
161
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
162
163
            this.addListener(this.$addBlockBtnGroupBtns, 'click', function (ev) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
164
                var type = $(ev.target).data('type');
0 ignored issues
show
Unused Code introduced by
The variable type seems to be never used. Consider removing it.
Loading history...
165
                this.addVariantBlock(null);
166
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
167
168
            this.addAspectRatioHandlers();
169
            this.reIndexVariants();
170
        },
171
172
        onMenuOptionSelect: function (option, menuBtn) {
173
            var $option = $(option);
174
            var container = menuBtn.$btn.closest('.matrixblock');
175
176
            switch ($option.data('action')) {
177
                case 'add': {
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
178
                    this.addVariantBlock(container);
179
                    break;
180
                }
181
                case 'delete': {
182
                    if (!$option.hasClass('disabled')) {
183
                        this.deleteVariantBlock(container);
184
                    }
185
                    break;
186
                }
187
            }
188
        },
189
190
        getHiddenBlockCss: function ($block) {
191
            return {
192
                opacity: 0,
193
                marginBottom: -($block.outerHeight())
194
            };
195
        },
196
197
        // Re-index all of the variant blocks
198
        reIndexVariants: function () {
199
            this.$blockContainer = this.$container.children('.variant-blocks');
200
            var $blocks = this.$blockContainer.children();
201
            $blocks.each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
202
                var variantIndex = index;
203
                var $value = $(value);
204
                var elements = $value.find('div .field, label, input, select');
205
206
                // Re-index all of the element attributes
207
                $(elements).each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
208
                    // id attributes
209
                    var str = $(value).attr('id');
210
                    if (str) {
211
                        str = str.replace(/\-([0-9]+)\-/g, "-" + variantIndex + "-");
212
                        $(value).attr('id', str);
213
                    }
214
                    // for attributes
215
                    str = $(value).attr('for');
216
                    if (str) {
217
                        str = str.replace(/\-([0-9]+)\-/g, "-" + variantIndex + "-");
218
                        $(value).attr('for', str);
219
                    }
220
                    // Name attributes
221
                    str = $(value).attr('name');
222
                    if (str) {
223
                        str = str.replace(/\[([0-9]+)\]/g, "[" + variantIndex + "]");
224
                        $(value).attr('name', str);
225
                    }
226
                });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
227
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
228
            var disabledDeleteItem = false;
229
            // If we only have one block, don't allow it to be deleted
230
            if ($blocks.length == 1) {
0 ignored issues
show
Best Practice introduced by
Comparing $blocks.length to 1 using the == operator is not safe. Consider using === instead.
Loading history...
231
                disabledDeleteItem = true;
232
            }
233
            $blocks.find('> .actions > .settings').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
234
                var $value = $(value);
235
                var menuBtn;
236
                if ($value.data('menubtn')) {
237
                    menuBtn = $value.data('menubtn');
238
                    $menuItem = $(menuBtn.menu.$menuList[1]);
0 ignored issues
show
Bug introduced by
The variable $menuItem seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.$menuItem.
Loading history...
239
                    if (disabledDeleteItem) {
240
                        $menuItem.find("> li > a").addClass('disabled').disable();
241
                    } else {
242
                        $menuItem.find("> li > a").removeClass('disabled').enable();
243
                    }
244
                }
245
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
246
247
        },
248
249
        addAspectRatioHandlers: function () {
250
            this.addListener($('.lightswitch'), 'click', function (ev) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
251
                var $target = $(ev.target);
252
                var $block = $target.closest('.matrixblock');
253
                $block.find('.io-aspect-ratio-wrapper').slideToggle();
254
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
255
            this.addListener($('.io-select-ar-box'), 'click', function (ev) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
256
                var $target = $(ev.target);
257
                var x = $(ev.target).data('x'),
258
                    y = $(ev.target).data('y'),
259
                    custom = $(ev.target).data('custom'),
260
                    field, $block;
261
                // Select the appropriate aspect ratio
262
                $block = $target.closest('.matrixblock');
263
                $block.find('.io-select-ar-box').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
264
                    $(value).removeClass('io-selected-ar-box');
265
                });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
266
                $target.addClass('io-selected-ar-box');
267
268
                // Handle setting the actual field values
269
                if (custom) {
270
                    $block.find('.io-custom-ar-wrapper').slideDown();
271
                } else {
272
                    $block.find('.io-custom-ar-wrapper').slideUp();
273
                    field = $block.find('input')[2];
274
                    $(field).val(x);
275
                    field = $block.find('input')[3];
276
                    $(field).val(y);
277
                }
278
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
279
        },
280
281
        addVariantBlock: function (container) {
282
            var _this = this;
283
            $block = $(this.$blockContainer.children()[0]).clone();
0 ignored issues
show
Bug introduced by
The variable $block seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.$block.
Loading history...
284
            // Reset to default values
285
            $block.find('.io-select-ar-box').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
286
                if (index === 0) {
287
                    $(value).addClass('io-selected-ar-box');
288
                } else {
289
                    $(value).removeClass('io-selected-ar-box');
290
                }
291
            });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
292
            $block.find('.io-custom-ar-wrapper').hide();
293
            field = $block.find('input')[0];
0 ignored issues
show
Bug introduced by
The variable field seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.field.
Loading history...
294
            $(field).val(1200);
295
            field = $block.find('input')[1];
296
            $(field).val(1);
297
            field = $block.find('input')[2];
298
            $(field).val(16);
299
            field = $block.find('input')[3];
300
            $(field).val(9);
301
            field = $block.find('select')[0];
302
            $(field).val(82);
303
            field = $block.find('select')[1];
304
            $(field).val('jpg');
305
            $block.css(this.getHiddenBlockCss($block)).velocity({
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
306
                opacity: 1,
307
                'margin-bottom': 10
308
            }, 'fast', $.proxy(function () {
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 16 spaces, but found 12.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
309
310
                // Insert the block in the right place
311
                if (container) {
312
                    $block.insertBefore(container);
313
                } else {
314
                    $block.appendTo(this.$blockContainer);
315
                }
316
                // Update the Garnish UI controls
317
                this.blockSort.addItems($block);
318
                this.addAspectRatioHandlers();
319
                $block.find('.settings').each(function (index, value) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
320
                    var $value = $(value),
321
                        menuBtn,
322
                        menu;
323
324
                    menu = _this.$container.find('.io-menu-clone > .menu').clone();
325
                    $(menu).insertAfter($value);
326
                    menuBtn = new Garnish.MenuBtn(value);
0 ignored issues
show
Bug introduced by
The variable Garnish seems to be never declared. If this is a global, consider adding a /** global: Garnish */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
327
328
                    menuBtn.menu.settings.onOptionSelect = $.proxy(function (option) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
329
                        _this.onMenuOptionSelect(option, menuBtn);
330
                    }, this);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
331
                });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
332
                this.reIndexVariants();
333
            }, this));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
334
        },
335
336
        deleteVariantBlock: function (container) {
337
            var _this = this;
338
            container.velocity(this.getHiddenBlockCss(container), 'fast', $.proxy(function () {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
339
                container.remove();
340
                _this.reIndexVariants();
341
            }, this));
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
342
        },
343
344
        resetVariantBlockOrder: function () {
345
            this.reIndexVariants();
346
        }
347
348
    });
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 0 spaces, but found 4.
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
349