/usr/share/games/flightgear/Phi/lib/props2.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 | /**
* Wraps json properties into something like SGPropertyNodes
*/
(function(factory) {
if (typeof define === "function" && define.amd)// AMD. Register as an anonymous module.
define([
], factory); else // Browser globals
factory();
}(function() {
var SGPropertyNode = function(json) {
this.json = json;
};
SGPropertyNode.prototype.getValue = function(child,deflt) {
if( typeof(child) === 'undefined' )
return this.json.value;
var c = this.getNode(child);
if( c ) return c.getValue();
else return deflt;
}
SGPropertyNode.prototype.getName = function() {
return this.json.name;
}
SGPropertyNode.prototype.getPath = function() {
return this.json.path;
}
SGPropertyNode.prototype.getIndex = function() {
return this.json.index;
}
SGPropertyNode.prototype.getChildren = function(name) {
var reply = [];
this.json.children.forEach(function(child) {
if (name && child.name == name)
reply.push(new SGPropertyNode(child));
});
return reply;
}
SGPropertyNode.prototype.getNode = function(name, index) {
if (!index)
index = 0;
for (var i = 0; i < this.json.children.length; i++) {
var child = this.json.children[i];
if (child.name == name && child.index == index)
return new SGPropertyNode(child);
}
}
return SGPropertyNode;
}));
|