This file is indexed.

/usr/share/games/flightgear/Phi/examples/horizon.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
// Configure require.js and tell it where to find our modules
require.config({
    baseUrl : '.', // use this base if we don't give absolute paths
    paths : {
        knockout : '/3rdparty/knockout/knockout-3.2.0',
        knockprops : '/lib/knockprops',
    },
});

require([
         // we depend on those modules
        'knockout', // lookup 'knockout' in the 'paths' attribute above, 
                    // load the script and pass the resulting object as the
                    // first parameter below
        'knockprops' // load 'knockprops' in the 'paths' attribute above etc.
], function(ko) {
    // ko is now the locally available knockout extension
    // the second arg would be knockprops but that is not needed as it registers itself with knockout.utils

    
    // this creates the websocket to FG and registers listeners for the named properites
    ko.utils.knockprops.setAliases({
        pitch: "/orientation/pitch-deg",
        roll: "/orientation/roll-deg"
    });
    

    // knockout stuff - create a ViewModel representing the data of the page
    function ViewModel() {
        var self = this;
        
        // magic function,
        // create observables for all defined properties
        ko.utils.knockprops.makeObservablesForAllProperties( self );
        // we now have observables as if we typed
        // self.pitch = ko.observable();
        // self.roll = ko.observable();
        // but our knockprops observables always reflect the value of the FG property
        // updated at frame rate through the websocket

        // build the transform-string for the css transform property
        // we want something "rotate(45deg) translate(30%)"
        // see http://knockoutjs.com/documentation/computed-pure.html
        self.groundTransform = ko.pureComputed(function() {
            return "translateY(-50%) rotate(" + (-self.roll()) + "deg) translateY(50%)" + self.groundTranslateTransform();
        });

        // this little helper just scales and clamps the y-translation
        self.groundTranslateTransform = ko.pureComputed(function() {
            var t = 20 * (self.pitch() / 30);
            if( t > 20 ) t = 20;
            if( t < -20 ) t = -20;
            return "translateY(" + (t) + "%)";
        });
        
    }

    // Create the ViewModel instance and tell knockout to process the data-bind 
    // attributes of all elements within our wrapper-div.
    ko.applyBindings(new ViewModel(), document.getElementById('wrapper'));
    
    // now, every update of a registered property in flightgear gets to our browser
    // through the websocket. Knockprops delivers each change to the associated ko.observable
    // and fires the listeners of the observable. Those listeners trigger the change of the HTML DOM
    // which results in a redraw of the browser window.
});