Passed
Push — master ( 53f161...b6d7ca )
by
unknown
43s
created

public_html/js/TACAPI.js   A

Size

Lines of Code 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 1
rs 10
noi 6
1
var TACAPI = {};
2
3
TACAPI.showTAC = function(anchor) {
4
    
5
    var stateInfo = {pageInfo: 'tac', pageTitle: 'Talent Cloud: Terms and Conditions'};
6
    document.title = stateInfo.pageTitle;
7
8
    TalentCloudAPI.hideAllContent();
0 ignored issues
show
Bug introduced by
The variable TalentCloudAPI seems to be never declared. If this is a global, consider adding a /** global: TalentCloudAPI */ 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...
9
    
10
    var tacSection = document.getElementById('tacSection');
11
    tacSection.classList.remove('hidden');
12
13
    var locale = TalentCloudAPI.getLanguageFromCookie();
0 ignored issues
show
Unused Code introduced by
The variable locale seems to be never used. Consider removing it.
Loading history...
14
15
    // New Subpage Hero Scripts
16
17
    Utilities.getHeroElements();
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ 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...
18
19
    var tacHeroTitle = document.getElementById("tacHeroTitle");
20
    tacHeroTitle.classList.remove("hidden");
21
    tacHeroTitle.setAttribute("aria-hidden", "false");
22
23
    // Google Analytics
24
25
    ga('set', 'page', '/tac');
26
    ga('send', 'pageview');
27
28
    // alert(anchor);
29
30
    if (anchor == null) {
0 ignored issues
show
Best Practice introduced by
Comparing anchor to null using the == operator is not safe. Consider using === instead.
Loading history...
Coding Style introduced by
It is recommended to use === to compare with null.

Generally, it is recommended to use strict comparison whenever possible and not to rely on the weaker type-juggling comparison operator.

Read more about comparison operations.

Loading history...
31
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ 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...
32
        window.scrollTo(0, 0);
33
    }
34
    else if (anchor === "tacSection1") {
35
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC/tacSection1');
36
        setTimeout(function() {
37
            document.getElementById("tacSection1").scrollIntoView(true);
38
        }, 800);
39
    }
40
    else if (anchor === "tacSection2") {
41
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC/tacSection2');
42
        setTimeout(function() {
43
            document.getElementById("tacSection2").scrollIntoView(true);
44
        }, 800);
45
    }
46
    else if (anchor === "tacSection3") {
47
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC/tacSection3');
48
        setTimeout(function() {
49
            document.getElementById("tacSection3").scrollIntoView(true);
50
        }, 800);
51
    }
52
    else if (anchor === "tacSection4") {
53
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC/tacSection4');
54
        setTimeout(function() {
55
            document.getElementById("tacSection4").scrollIntoView(true);
56
        }, 800);
57
    }
58
    else if (anchor === "tacSection5") {
59
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC/tacSection5');
60
        setTimeout(function() {
61
            document.getElementById("tacSection5").scrollIntoView(true);
62
        }, 800);
63
    }
64
    else if (anchor === "tacSection6") {
65
        history.pushState(stateInfo, stateInfo.pageInfo, '#TAC/tacSection6');
66
        setTimeout(function() {
67
            document.getElementById("tacSection1").scrollIntoView(true);
68
        }, 800);
69
    }
70
71
};