/usr/share/games/flightgear/Phi/lib/jquery.fganimate.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 98 99 100 | (function($) {
function makeTranslate(a) {
return makeTransform("translate", a);
}
function makeRotate(a) {
return makeTransform("rotate", a);
}
function makeTransform( type, a ) {
var t = type.concat("(");
if( a != null ) {
a.forEach( function(ele) {
t = t.concat(ele).concat(" ");
});
}
return t.concat(") ");
}
function evaluate( context,exp ) {
if( typeof(exp) == 'function' )
return exp.call(context);
return exp;
}
$.fn.fgAnimateSVG = function(props) {
if (props) {
if (props.type == "transform" && props.transforms) {
// remember predefined transforms
if( typeof(this.originalTransform) === 'undefined' ) {
this.originalTransform = this.attr("transform");
if( typeof(this.originalTransform) === 'undefined' ) {
this.originalTransform = "";
}
}
var a = "";
props.transforms.forEach(function(transform) {
switch (transform.type) {
case "rotate":
a = a.concat(makeRotate([
evaluate(transform.props.context,transform.props.a),
evaluate(transform.props.context,transform.props.x),
evaluate(transform.props.context,transform.props.y) ]));
break;
case "translate":
a = a.concat(makeTranslate([
evaluate(transform.props.context,transform.props.x),
evaluate(transform.props.context,transform.props.y) ]));
break;
}
});
if( this.originalTransform != "" ) {
a = a.concat(' ').concat(this.originalTransform);
}
this.attr("transform", a );
} else if( props.type == "text" ) {
var tspans = this.children("tspan");
if( 0 == tspans.length ) {
this.text(props.text);
} else {
tspans.text(props.text);
}
}
}
return this;
};
$.fn.fgLoadInstruments = function( dataTag ) {
var reply = [];
this.each(function() {
var instrumentDefinitionFile = $(this).data(dataTag);
$.ajax({
type: "GET",
url: instrumentDefinitionFile,
context: this,
async: false,
success: function (data,status,xhr) {
var i = new FGFS.Instrument(data);
reply.push(i);
$(this).append(i.svg);
// set inkscape pagecolor as div background-color
// somewhat awkward get the namespaced sodipodi:namedview element
var pagecolor = $(i.svg.getElementsByTagNameNS('http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd', 'namedview')).attr("pagecolor");
if( pagecolor != null )
$(this).css("background-color", pagecolor );
},
error: function(xhr,status,msg) {
alert(status + " while reading '" + instrumentDefinitionFile + "': " + msg.toString() );
},
});
});
return reply;
}
}(jQuery));
|