-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
66 lines (62 loc) · 2.2 KB
/
index.js
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
/*
* INTER-Mediator
* Copyright (c) INTER-Mediator Directive Committee (http://inter-mediator.org)
* This project started at the end of 2009 by Masayuki Nii [email protected].
*
* INTER-Mediator is supplied under MIT License.
* Please see the full license for details:
* https://github.com/INTER-Mediator/INTER-Mediator/blob/master/dist-docs/License.txt
*
* This plugin requres the following libraries, they can include with CDN services.
* The sample file "jquery_datepicker_MySQL.html" of INTER-Mediator loacated
* "INTER-Mediator/samples/Sample_webpage/" includes the loading code ot them.
*
* JQuery (https://jquery.com/)
* jQuery UI (https://api.jqueryui.com/)
*/
IMParts_Catalog.jquery_datepicker = {
instantiate: function (targetNode) {
var nodeId = targetNode.getAttribute('id');
this.ids.push(nodeId);
targetNode._im_getComponentId = (function () {
var theId = nodeId;
return function () {
return theId;
};
})();
targetNode._im_setValue = (function () {
var aNode = targetNode;
return function (str) {
aNode.value = str;
};
})();
targetNode._im_getValue = (function () {
var aNode = targetNode;
return function () {
return aNode.value;
};
})();
},
ids: [],
dateFormat: "yy-mm-dd",
finish: function () {
for (var i = 0; i < IMParts_Catalog.jquery_datepicker.ids.length; i++) {
var targetId = IMParts_Catalog.jquery_datepicker.ids[i];
var targetNode = $('#' + targetId);
if (targetNode) {
targetNode.datepicker({
dateFormat: IMParts_Catalog.jquery_datepicker.dateFormat,
onSelect: (function () {
var thisId = targetId;
var thidNode = targetNode;
return function (dateText) {
thidNode.value = dateText;
IMLibUI.valueChange(thisId);
}
})()
});
}
}
this.ids = [];
}
};