1 | define(function(require) { |
||
2 | 'use strict'; |
||
3 | |||
4 | var FrontendCustomFiltersTogglePlugin; |
||
5 | var _ = require('underscore'); |
||
6 | var FullScreenFiltersAction = require('orofrontend/js/app/datafilter/actions/fullscreen-filters-action'); |
||
7 | var FrontendFiltersTogglePlugin = require('orofrontend/js/app/datafilter/plugins/frontend-filters-plugin'); |
||
8 | var viewportManager = require('oroui/js/viewport-manager'); |
||
9 | |||
10 | FrontendCustomFiltersTogglePlugin = FrontendFiltersTogglePlugin.extend({ |
||
11 | /** |
||
12 | * @inheritDoc |
||
13 | */ |
||
14 | constructor: function FrontendCustomFiltersTogglePlugin() { |
||
15 | FrontendCustomFiltersTogglePlugin.__super__.constructor.apply(this, arguments); |
||
16 | }, |
||
17 | |||
18 | /** |
||
19 | * @inheritDoc |
||
20 | */ |
||
21 | initialize: function(main, options) { |
||
0 ignored issues
–
show
|
|||
22 | if (this.changeBehavior()) { |
||
23 | this.filtersActions = { |
||
24 | 'mobile-landscape': FullScreenFiltersAction |
||
25 | }; |
||
26 | } |
||
27 | |||
28 | FrontendFiltersTogglePlugin.__super__.initialize.apply(this, arguments); |
||
29 | }, |
||
30 | |||
31 | /** |
||
32 | * @inheritDoc |
||
33 | */ |
||
34 | enable: function() { |
||
35 | if (this.changeBehavior()) { |
||
36 | switch (viewportManager.getViewport().type) { |
||
37 | case 'desktop': |
||
38 | case 'tablet': |
||
39 | case 'tablet-small': |
||
40 | this.disable(); |
||
41 | break; |
||
42 | default: |
||
43 | FrontendFiltersTogglePlugin.__super__.enable.call(this); |
||
44 | break; |
||
45 | } |
||
46 | } else { |
||
47 | FrontendFiltersTogglePlugin.__super__.enable.call(this); |
||
48 | } |
||
49 | }, |
||
50 | |||
51 | changeBehavior: function() { |
||
52 | return !_.isUndefined(this.main.$el.parent().attr('data-server-render')); |
||
53 | } |
||
54 | }); |
||
55 | return FrontendCustomFiltersTogglePlugin; |
||
56 | }); |
||
57 |
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.