~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to status/status.js

  • Committer: Keith Hughitt
  • Date: 2012-06-04 17:27:01 UTC
  • Revision ID: keith.hughitt@nasa.gov-20120604172701-eo2sj3ylxh4bik4l
Added support for reconnecting to MySQL if the connection fails when querying the db to determine which files are new

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
$(function() {
 
2
    var locateStorageEnabled, jsonEnabled;
 
3
 
 
4
    // Check for localStorage and native JSON support
 
5
    locateStorageEnabled = ('localStorage' in window) && 
 
6
                            window['localStorage'] !== null;
 
7
 
 
8
    jsonEnabled = typeof (JSON) !== "undefined";
 
9
 
 
10
    // Initialize localStorage
 
11
    if (locateStorageEnabled && jsonEnabled) {
 
12
        var instruments = localStorage.dataMonitorOpenGroups;
 
13
 
 
14
        if (!instruments) {
 
15
            localStorage.dataMonitorOpenGroups = "[]";
 
16
        } else {
 
17
            $.each(JSON.parse(instruments), function (i, inst) {
 
18
                $(".datasource." + inst).show();
 
19
            });
 
20
        }
 
21
    }
 
22
 
 
23
    // Instrument click-handler
 
24
    $(".instrument").click(function (e) {
 
25
        // Don't activate for source link clicks
 
26
        if (e.target.nodeName === "A") {
 
27
            return;
 
28
        }
 
29
        
 
30
        var inst = $($(this).find("td")[0]).text();
 
31
        $(".datasource." + inst).toggle();
 
32
 
 
33
        if (locateStorageEnabled && jsonEnabled) {
 
34
            var instruments, index;
 
35
 
 
36
            instruments = JSON.parse(localStorage.dataMonitorOpenGroups);
 
37
 
 
38
            // Add or remove instrument from list of opened groups
 
39
            index = $.inArray(inst, instruments);
 
40
            if (index == -1) {
 
41
                instruments.push(inst);
 
42
            } else {
 
43
                instruments.splice(index, 1);
 
44
            }
 
45
            localStorage.dataMonitorOpenGroups = JSON.stringify(instruments);
 
46
        }
 
47
    }).find("td:first").each(function (i, item) {
 
48
        var inst = $(this);
 
49
        
 
50
        //if ($.inArray(inst.text(), ["AIA", "HMI"]) !== -1) {
 
51
        //    inst.text(inst.text() + " (LMSAL/SAO)");
 
52
        //}
 
53
    });
 
54
 
 
55
    
 
56
    // Info popup
 
57
    $("#info").hover(function (e) {
 
58
        $("#legend").show();
 
59
    }, function (e) {
 
60
        $("#legend").hide();
 
61
    });
 
62
    
 
63
});
 
 
b'\\ No newline at end of file'