GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Resources/public/js/menu.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1.6

Size

Lines of Code 38
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
dl 0
loc 38
rs 10
cc 0
nc 2
mnd 1
bc 7
fnc 5
bpm 1.4
cpm 1.6
noi 1

2 Functions

Rating   Name   Duplication   Size   Complexity  
A $(document).pjax:end 0 11 2
A menu.js ➔ setCurrentMenuItem 0 14 3
1
(function ($, app) {
2
    'use strict';
3
4
    $.extend(app, {
5
        MENU_CURRENT_CLASS: 'active',
6
        MENU_ROOT_SELECTOR: '.navbar-nav',
7
        PJAX_MENU: 'menu-current'
8
    });
9
10
11
    $(document)
12
        .on('pjax:end', function (event, content, options) {
13
            /*if (!options.push) {
14
                return;
15
            }*/
16
            var currentItems = $(event.target).find('[data-' + app.PJAX_MENU + ']');
17
            if (currentItems) {
18
                var selectedLinks = currentItems.data(app.PJAX_MENU);
19
                options.selectedLinks = selectedLinks;
20
                setCurrentMenuItem(selectedLinks);
21
            }
22
        });
23
24
    function setCurrentMenuItem(selectedLinks) {
25
        $(app.MENU_ROOT_SELECTOR + ' li.' + app.MENU_CURRENT_CLASS).removeClass(app.MENU_CURRENT_CLASS);
26
        if (!selectedLinks || !selectedLinks.length) {
27
            return;
28
        }
29
30
        $(selectedLinks).each(function (key, currentItem) {
31
            $(app.MENU_ROOT_SELECTOR + ' li[data-name="' + currentItem + '"]')
32
                .addClass(app.MENU_CURRENT_CLASS)
33
                .parents(app.MENU_ROOT_SELECTOR + ' li').each(function () {
34
                    $(this).addClass(app.MENU_CURRENT_CLASS);
35
                });
36
        });
37
    }
38
})(jQuery, application);
0 ignored issues
show
Bug introduced by
The variable application seems to be never declared. If this is a global, consider adding a /** global: application */ 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...
39