/usr/share/games/flightgear/Phi/topics/Aircraft/Checklists.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 | define([
'jquery', 'knockout', 'props', 'text!./Checklists.html', 'jquery-ui/accordion',
], function(jquery, ko, SGPropertyNode, htmlString) {
function ViewModel(params) {
var self = this;
self.checklists = ko.observableArray([]);
self.selectedChecklist = ko.observable('').extend({
observedProperty : '/sim/gui/dialogs/checklist/selected-checklist'
});
self.selectedChecklistSubscription = self.selectedChecklist.subscribe(function(newValue) {
self.openChecklist(newValue);
});
self.openChecklist = function(title) {
jquery("#checklists h4").each(function(idx) {
if ($(this).text() == title) {
jquery("#checklists").accordion("option", "active", idx);
}
});
}
jquery.get('/json/sim/checklists?d=3', null, function(data) {
var assembleChecklists = function(data) {
var checklists = [];
var root = new SGPropertyNode(data);
root.getChildren("checklist").forEach(function(checklistNode) {
var checklist = {
title : checklistNode.getValue('title', 'unnamed'),
abnormal : checklistNode.getValue('type', '') == 'abnormal',
items : []
};
checklists.push(checklist);
checklistNode.getChildren("item").forEach(function(itemNode) {
checklist.items.push({
name : itemNode.getValue('name', 'unnamed'),
value : itemNode.getValue('value', ''),
});
});
});
return checklists;
}
self.checklists(assembleChecklists(data));
jquery("#checklists").accordion({
collapsible : true,
heightStyle : "content",
active : false,
});
jquery("#checklists li").hover(function() {
$(this).addClass("ui-state-highlight").addClass("ui-corner-all");
}, function() {
$(this).removeClass("ui-state-highlight").removeClass("ui-corner-all");
});
self.openChecklist( self.selectedChecklist() );
});
}
ViewModel.prototype.dispose = function() {
var self = this;
self.selectedChecklistSubscription.dispose();
self.selectedChecklist.dispose();
}
// Return component definition
return {
viewModel : ViewModel,
template : htmlString
};
});
|