blob: ca8f1a4c69e4830c7c6b88acc6eff452143b2947 (
plain)
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
|
/*global Pixelated */
/*global _ */
define([],
function () {
'use strict';
function withEnableDisableOnEvent(ev) {
return function () {
this.disableElement = function () {
this.$node.attr('disabled', 'disabled');
};
this.enableElement = function () {
this.$node.removeAttr('disabled');
};
this.toggleEnabled = function (ev, enable) {
if (enable) {
this.enableElement();
} else {
this.disableElement();
}
};
this.after('initialize', function () {
this.on(document, ev, this.toggleEnabled);
});
};
}
return withEnableDisableOnEvent;
}
);
|