/usr/share/games/flightgear/Phi/3rdparty/knockout-jqueryui/dialog.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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | /*global define*/
/*jslint browser:true*/
define(
[
'jquery',
'knockout',
'./bindingHandler',
'./utils',
'jquery-ui/dialog'
],
function ($, ko, BindingHandler, utils) {
'use strict';
var Dialog = function () {
/// <summary>Constructor.</summary>
BindingHandler.call(this, 'dialog');
if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 8) {
this.options = ['autoOpen', 'buttons', 'closeOnEscape', 'closeText',
'dialogClass', 'disabled', 'draggable', 'height', 'maxHeight',
'maxWidth', 'minHeight', 'minWidth', 'modal', 'position', 'resizable',
'show', 'stack', 'title', 'width', 'zIndex'];
this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
} else if (utils.uiVersion.major === 1 && utils.uiVersion.minor === 9) {
this.options = ['autoOpen', 'buttons', 'closeOnEscape', 'closeText',
'dialogClass', 'draggable', 'height', 'hide', 'maxHeight', 'maxWidth',
'minHeight', 'minWidth', 'modal', 'position', 'resizable', 'show',
'stack', 'title', 'width', 'zIndex'];
this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
} else {
this.options = ['appendTo', 'autoOpen', 'buttons', 'closeOnEscape',
'closeText', 'dialogClass', 'draggable', 'height', 'hide',
'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'modal', 'position',
'resizable', 'show', 'title', 'width'];
this.events = ['beforeClose', 'create', 'open', 'focus', 'dragStart',
'drag', 'dragStop', 'resizeStart', 'resize', 'resizeStop', 'close'];
}
};
Dialog.prototype = utils.createObject(BindingHandler.prototype);
Dialog.prototype.constructor = Dialog;
Dialog.prototype.init = function (element, valueAccessor) {
/// <summary>Creates a hidden div before the element. This helps in disposing
/// the binding if the element is moved from its original location.
/// Keeps the isOpen binding property in sync with the dialog's state.
// </summary>
/// <param name='element' type='DOMNode'></param>
/// <param name='valueAccessor' type='Function'></param>
/// <returns type='Object'></returns>
var marker, result, value;
/// sets up the correct disposal
marker = document.createElement('DIV');
marker.style.display = 'none';
element.parentNode.insertBefore(marker, element);
ko.utils.domNodeDisposal.addDisposeCallback(marker, function () {
ko.removeNode(element);
});
/// invokes the prototype's init() method
result = BindingHandler.prototype.init.apply(this, arguments);
/// sets up handling of the isOpen option
value = valueAccessor();
if (value.isOpen) {
ko.computed({
read: function () {
if (ko.utils.unwrapObservable(value.isOpen)) {
$(element)[this.widgetName]('open');
} else {
$(element)[this.widgetName]('close');
}
},
disposeWhenNodeIsRemoved: element,
owner: this
});
}
if (ko.isWriteableObservable(value.isOpen)) {
this.on(element, 'open', function () {
value.isOpen(true);
});
this.on(element, 'close', function () {
value.isOpen(false);
});
}
// make the width option two-way
if (ko.isWriteableObservable(value.width)) {
/*jslint unparam:true*/
this.on(element, 'resizestop', function (ev, ui) {
value.width(Math.round(ui.size.width));
});
/*jslint unparam:false*/
}
// make the height option two-way
if (ko.isWriteableObservable(value.height)) {
/*jslint unparam:true*/
this.on(element, 'resizestop', function (ev, ui) {
value.height(Math.round(ui.size.height));
});
/*jslint unparam:false*/
}
return result;
};
utils.register(Dialog);
return Dialog;
}
);
|