Passed
Push — develop ( 7418b4...add4d6 )
by Andrew
05:15
created

OptimizedImagesField.js ➔ Plugin   A

Complexity

Conditions 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 10
rs 10
cc 2
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
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...
14
    const thresh = si ? 1000 : 1024;
15
16
    if (Math.abs(bytes) < thresh) {
17
        return bytes + ' B';
18
    }
19
20
    const units = si
21
        ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
22
        : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
23
    let u = -1;
24
    const r = 10**dp;
25
26
    do {
27
        bytes /= thresh;
28
        ++u;
29
    } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
30
31
32
    return bytes.toFixed(dp) + ' ' + units[u];
33
}
34
35
;(function ( $, window, document, undefined ) {
36
37
    var pluginName = "ImageOptimizeOptimizedImages",
38
        defaults = {
39
        };
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 4 spaces, found 8
Loading history...
40
41
    // Plugin constructor
42
    function Plugin( element, options ) {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on a new line
Loading history...
43
        this.element = element;
44
45
        this.options = $.extend( {}, defaults, options) ;
0 ignored issues
show
Coding Style introduced by
Space after opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Space after closing parenthesis of function call prohibited
Loading history...
46
47
        this._defaults = defaults;
48
        this._name = pluginName;
49
50
        this.init();
51
    }
52
53
    Plugin.prototype = {
54
55
        init: function(id) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
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...
56
            var _this = this;
0 ignored issues
show
Unused Code introduced by
The variable _this seems to be never used. Consider removing it.
Loading history...
57
58
            $(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...
59
60
/* -- _this.options gives us access to the $jsonVars that our FieldType passed down to us */
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 16 spaces, found 0
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 0.
Loading history...
61
62
                const images = document.querySelectorAll("img.io-prevew-image");
63
                for (const image of images) {
64
                    const url = image.src || image.href;
65
                    if (url && url.length > 0) {
66
                        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...
67
                        if (iTime !== undefined) {
68
                            const elem = image.parentNode.parentNode.parentNode.nextElementSibling.querySelector('.io-file-size');
69
                            if (elem) {
70
                                elem.innerHTML = humanFileSize(iTime.decodedBodySize, true);
71
                            }
72
                        }
73
                    }
74
                }
75
            });
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...
76
        }
77
    };
78
79
    // A really lightweight plugin wrapper around the constructor,
80
    // preventing against multiple instantiations
81
    $.fn[pluginName] = function ( options ) {
82
        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...
83
            if (!$.data(this, "plugin_" + pluginName)) {
84
                $.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...
85
                new Plugin( this, options ));
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces before closing parenthesis; 1 found
Loading history...
Coding Style introduced by
Space after opening parenthesis of function call prohibited
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...
86
            }
87
        });
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...
88
    };
89
90
})( jQuery, window, document );
0 ignored issues
show
Coding Style introduced by
Space after opening parenthesis of function call prohibited
Loading history...
Coding Style introduced by
Expected 0 spaces before closing parenthesis; 1 found
Loading history...
91
92
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...
93
    {
94
        id: null,
95
        inputNamePrefix: null,
96
        inputIdPrefix: null,
97
98
        $container: null,
99
        $blockContainer: null,
100
        $addBlockBtnContainer: null,
101
        $addBlockBtnGroup: null,
102
        $addBlockBtnGroupBtns: null,
103
104
        blockSort: null,
105
        blockSelect: null,
106
107
        init: function(id, inputNamePrefix, sizesWrapperId) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
Unused Code introduced by
The parameter sizesWrapperId 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...
108
109
            this.id = id;
110
            this.inputNamePrefix = inputNamePrefix;
111
            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...
112
113
            this.$container = $('#' + this.id);
114
            this.$blockContainer = this.$container.children('.variant-blocks');
115
            this.$addBlockBtnContainer = this.$container.children('.buttons');
116
            this.$addBlockBtnGroup = this.$addBlockBtnContainer.children('.btngroup');
117
            this.$addBlockBtnGroupBtns = this.$addBlockBtnGroup.children('.btn');
118
119
            // Create our action button menus
120
            var _this = this;
121
            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...
122
                var $value = $(value);
123
                var menuBtn;
124
                if ($value.data('menubtn')) {
125
                    menuBtn = $value.data('menubtn');
126
                } else {
127
                    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...
128
                }
129
                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...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
130
                    this.onMenuOptionSelect(option, menuBtn);
131
                }, _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...
132
            });
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...
133
134
            var $blocks = this.$blockContainer.children();
135
136
            this.blockSort = new Garnish.DragSort($blocks, {
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...
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...
137
                handle: '> .actions > .move',
138
                axis: 'y',
139
                collapseDraggees: true,
140
                magnetStrength: 4,
141
                helperLagBase: 1.5,
142
                helperOpacity: 0.9,
143
                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...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
144
                    this.resetVariantBlockOrder();
145
                }, 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...
146
            });
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
148
            this.addListener(this.$addBlockBtnGroupBtns, 'click', function(ev) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
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...
149
                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...
150
                this.addVariantBlock(null);
151
            });
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...
152
153
            this.addAspectRatioHandlers();
154
            this.reIndexVariants();
155
        },
156
157
        onMenuOptionSelect: function(option, menuBtn) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
158
            var $option = $(option);
159
            var container = menuBtn.$btn.closest('.matrixblock');
160
161
            switch ($option.data('action')) {
162
                case 'add': {
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
163
                    this.addVariantBlock(container);
164
                    break;
165
                }
166
                case 'delete': {
167
                    if (!$option.hasClass('disabled')) {
168
                        this.deleteVariantBlock(container);
169
                    }
170
                    break;
171
                }
172
            }
173
        },
174
175
        getHiddenBlockCss: function($block) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
176
            return {
177
                opacity: 0,
178
                marginBottom: -($block.outerHeight())
179
            };
180
        },
181
182
        // Re-index all of the variant blocks
183
        reIndexVariants: function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
184
            this.$blockContainer = this.$container.children('.variant-blocks');
185
            var $blocks = this.$blockContainer.children();
186
            $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...
187
                var variantIndex = index;
188
                var $value = $(value);
189
                var elements = $value.find('div .field, label, input, select');
190
191
                // Re-index all of the element attributes
192
                $(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...
193
                    // id attributes
194
                    var str = $(value).attr('id');
195
                    if (str) {
196
                        str = str.replace(/\-([0-9]+)\-/g, "-" + variantIndex +"-");
197
                        $(value).attr('id', str);
198
                    }
199
                    // for attributes
200
                    str = $(value).attr('for');
201
                    if (str) {
202
                        str = str.replace(/\-([0-9]+)\-/g, "-" + variantIndex +"-");
203
                        $(value).attr('for', str);
204
                    }
205
                    // Name attributes
206
                    str = $(value).attr('name');
207
                    if (str) {
208
                        str = str.replace(/\[([0-9]+)\]/g, "[" + variantIndex +"]");
209
                        $(value).attr('name', str);
210
                    }
211
                });
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...
212
            });
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...
213
            var disabledDeleteItem = false;
214
            // If we only have one block, don't allow it to be deleted
215
            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...
216
                disabledDeleteItem = true;
217
            }
218
            $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...
219
                var $value = $(value);
220
                var menuBtn;
221
                if ($value.data('menubtn')) {
222
                    menuBtn = $value.data('menubtn');
223
                    $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...
224
                    if (disabledDeleteItem) {
225
                        $menuItem.find("> li > a").addClass('disabled').disable();
226
                    } else {
227
                        $menuItem.find("> li > a").removeClass('disabled').enable();
228
                    }
229
                }
230
            });
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...
231
232
        },
233
234
        addAspectRatioHandlers: function () {
235
            this.addListener($('.lightswitch'), 'click', function(ev) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
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...
236
                var $target = $(ev.target);
237
                var $block = $target.closest('.matrixblock');
238
                $block.find('.io-aspect-ratio-wrapper').slideToggle();
239
            });
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...
240
            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...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
241
                var $target = $(ev.target);
242
                var x = $(ev.target).data('x'),
243
                    y = $(ev.target).data('y'),
244
                    custom = $(ev.target).data('custom'),
245
                    field, $block;
246
                // Select the appropriate aspect ratio
247
                $block = $target.closest('.matrixblock');
248
                $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...
249
                    $(value).removeClass('io-selected-ar-box');
250
                });
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...
251
                $target.addClass('io-selected-ar-box');
252
253
                // Handle setting the actual field values
254
                if (custom) {
255
                    $block.find('.io-custom-ar-wrapper').slideDown();
256
                } else {
257
                    $block.find('.io-custom-ar-wrapper').slideUp();
258
                    field = $block.find('input')[2];
259
                    $(field).val(x);
260
                    field = $block.find('input')[3];
261
                    $(field).val(y);
262
                }
263
            });
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...
264
        },
265
266
        addVariantBlock: function(container) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
267
            var _this = this;
268
            $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...
269
            // Reset to default values
270
            $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...
271
                if (index === 0) {
272
                    $(value).addClass('io-selected-ar-box');
273
                } else {
274
                    $(value).removeClass('io-selected-ar-box');
275
                }
276
            });
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...
277
            $block.find('.io-custom-ar-wrapper').hide();
278
            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...
279
            $(field).val(1200);
280
            field = $block.find('input')[1];
281
            $(field).val(1);
282
            field = $block.find('input')[2];
283
            $(field).val(16);
284
            field = $block.find('input')[3];
285
            $(field).val(9);
286
            field = $block.find('select')[0];
287
            $(field).val(82);
288
            field = $block.find('select')[1];
289
            $(field).val('jpg');
290
            $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...
291
                opacity: 1,
292
                'margin-bottom': 10
293
            }, '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...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
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 12.
Loading history...
294
295
                // Insert the block in the right place
296
                if (container) {
297
                    $block.insertBefore(container);
298
                } else {
299
                    $block.appendTo(this.$blockContainer);
300
                }
301
                // Update the Garnish UI controls
302
                this.blockSort.addItems($block);
303
                this.addAspectRatioHandlers();
304
                $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...
305
                    var $value = $(value),
306
                        menuBtn,
307
                        menu;
308
309
                    menu = _this.$container.find('.io-menu-clone > .menu').clone();
310
                    $(menu).insertAfter($value);
311
                    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...
312
313
                    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...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
314
                        _this.onMenuOptionSelect(option, menuBtn);
315
                    }, 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...
316
                });
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...
317
                this.reIndexVariants();
318
            }, 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...
319
        },
320
321
        deleteVariantBlock: function(container) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
322
            var _this = this;
323
            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...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
324
                container.remove();
325
                _this.reIndexVariants();
326
            }, 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...
327
        },
328
329
        resetVariantBlockOrder: function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
330
            this.reIndexVariants();
331
        }
332
333
    });
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 0 spaces, but found 4.
Loading history...
334