This file is indexed.

/usr/share/games/flightgear/Phi/topics/Environment/DateTime.js is in flightgear-phi 2016.4.2+dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
define([
        'jquery', 'knockout', 'text!./DateTime.html', 'fgcommand', 'kojqui/datepicker', 'kojqui/spinner', 'clockpicker'
], function(jquery, ko, htmlString, fgcommand) {
    function ViewModel(params) {
        var self = this;

        self.timesOfToday = [
                'Clock Time', 'Dawn', 'Morning', 'Noon', 'Afternoon', 'Dusk', 'Evening', 'Night',
        ];

        self.setTimeOfToday = function(type) {
            var offsetTypes = {
                "Clock Time" : "real",
                "Dawn" : "dawn",
                "Morning" : "morning",
                "Noon" : "noon",
                "Afternoon" : "afternoon",
                "Dusk" : "dusk",
                "Evening" : "evening",
                "Night" : "night",
            }
            offsetType = offsetTypes[type] || null;
            if (!offsetType) {
                console.log("unknown time offset type ", type);
                return;
            }
            fgcommand.timeofday(offsetType);
        }

        self.gmtProp = ko.observable().extend({
            fgprop : 'gmt'
        });
        //TODO: bind this to gmtProp?
//      self.clockpickerInput.val(d.getUTCHours() + ':' + d.getUTCMinutes());

        self.warp = ko.observable().extend({
            fgprop : 'timeWarp'
        });

        self.simTimeUTC = ko.pureComputed(function() {
            // make a Date object holding the UTC time
            var d = new Date(self.gmtProp() + "Z");
            return d.getTime();
        });
        
        self.timeAsString = ko.pureComputed(function() {
            var d = new Date();
            d.setTime( self.simTimeUTC() );
           return d.toUTCString() 
        });
        
        self.simTimeAsLocalTime = ko.pureComputed(function() {
            // jqui datepicker displays local (browser) time, so fake it by adding timezoneOffset
            var d = new Date();
            d.setTime( self.simTimeUTC() + 60000 * d.getTimezoneOffset() );
            return d;
        });

        self.onDateSelect = function(dateText, inst) {
            var utc = new Date(self.simTimeUTC());
            utc.setFullYear(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
            self.setWarpFor( utc.getTime() );
        }
        
        self.setWarpFor = function( newDateTime ) {
            var warp = (newDateTime - self.simTimeUTC())/1000;
            console.log("warp=", warp, self.warp());
            ko.utils.knockprops.write( "timeWarp", self.warp() + warp );
        }

        // clockpicker: see http://weareoutman.github.io/clockpicker/
        self.clockpicker = jquery('.clockpicker').clockpicker({
            placement : 'top',
            align : 'left',
            autoclose : true,
            afterDone : function() {
                var utc = new Date();
                utc.setTime( self.simTimeUTC() );
                var hm = self.clockpickerInput.val().toString().split(":");
                utc.setUTCHours(hm[0]);
                utc.setUTCMinutes(hm[1]);
                self.setWarpFor( utc.getTime() );
            },
        });

        self.clockpickerInput = jquery('.clockpicker input');
    }

    ViewModel.prototype.dispose = function() {
    }

    // Return component definition
    return {
        viewModel : ViewModel,
        template : htmlString
    };
});