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.
Completed
Push — master ( 4a2f15...db4227 )
by Florian
01:21
created

js/attribution.js   A

Complexity

Total Complexity 12
Complexity/F 2

Size

Lines of Code 77
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 2
dl 0
loc 77
rs 10
wmc 12
mnd 4
bc 12
fnc 6
bpm 2
cpm 2
noi 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A Attribution.init 0 21 1
A Attribution.forceUpdate 0 13 1
C Attribution.update 0 35 7
1
/*jslint
2
  regexp: true
3
  indent: 4
4
*/
5
6
/*global
7
  $, google, document, setTimeout
8
*/
9
10
var Attribution = {};
11
Attribution.m_map = null;
12
Attribution.m_div = null;
13
14
Attribution.init = function (themap) {
15
    'use strict';
16
17
    var self = this;
18
19
    this.m_map = themap;
20
21
    // Create div for showing copyrights.
22
    this.m_div = document.createElement("div");
23
    this.m_div.id = "map-copyright";
24
    this.m_div.style.fontSize = "11px";
25
    this.m_div.style.fontFamily = "Arial, sans-serif";
26
    this.m_div.style.margin = "0 2px 2px 0";
27
    this.m_div.style.whiteSpace = "nowrap";
28
    this.m_div.style.background = "#FFFFFF";
29
    this.m_map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(this.m_div);
30
31
    google.maps.event.addListener(this.m_map, "maptypeid_changed", function () {
32
        self.update();
33
    });
34
};
35
36
37
Attribution.update = function () {
38
    'use strict';
39
40
    var m = this.m_map.getMapTypeId(),
41
        g = true,
42
        c = "";
43
44
    if (m === "OSM" || m === "OSM/DE") {
45
        g = false;
46
        c = "Map data (C) by <a href=\"http://www.openstreetmap.org/\">OpenStreetMap.org</a> and its contributors; <a href=\"http://opendatacommons.org/licenses/odbl/\">Open Database License</a>";
47
    } else if (m === "OCM") {
48
        g = false;
49
        c = "Map data (C) by <a href=\"http://www.openstreetmap.org/\">OpenStreetMap.org</a> and its contributors; <a href=\"http://opendatacommons.org/licenses/odbl/\">Open Database License</a>, tiles (C) by <a href=\"http://opencyclemap.org\">OpenCycleMap.org</a>";
50
    } else if (m === "OUTD") {
51
        g = false;
52
        c = "Map data (C) by <a href=\"http://www.openstreetmap.org/\">OpenStreetMap.org</a> and its contributors; <a href=\"http://opendatacommons.org/licenses/odbl/\">Open Database License</a>, tiles (C) by <a href=\"http://www.thunderforest.com/outdoors/\">Thunderforest</a>";
53
    } else if (m === "TOPO") {
54
        g = false;
55
        c = "Map data (C) by <a href=\"http://www.openstreetmap.org/\">OpenStreetMap.org</a> and its contributors; <a href=\"http://opendatacommons.org/licenses/odbl/\">Open Database License</a>, height data by SRTM, tiles (C) by <a href=\"http://www.opentopomap.org/\">OpenTopoMap</a>";
56
    }
57
58
    this.m_div.innerHTML = c;
59
60
    if (g) {
61
        $(".gmnoprint a, .gmnoprint span, .gm-style-cc").css("display", "block");
62
        $("a[href*='maps.google.com/maps']").show();
63
        this.m_map.setOptions({streetViewControl: true});
64
    } else {
65
        // hide logo for non-g-maps
66
        $("a[href*='maps.google.com/maps']").hide();
67
        // hide term-of-use for non-g-maps
68
        $(".gmnoprint a, .gmnoprint span, .gm-style-cc").css("display", "none");
69
        this.m_map.setOptions({streetViewControl: false});
70
    }
71
};
72
73
74
Attribution.forceUpdate = function () {
75
    'use strict';
76
77
    var self = this;
78
79
    this.update();
80
    google.maps.event.addListenerOnce(this.m_map, 'idle', function () {
81
        self.update();
82
    });
83
    setTimeout(function () {
84
        self.update();
85
    }, 1000);
86
};
87