- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
define([ "t5/core/dom" ], function(dom) {
return function() {
dom.scanner("select,input[type=text]", function(el) {
el.on("focus", function(e) {
var focusholder = this.findParent("form").find("input.focusholder");
if (focusholder.length)
focusholder[0].element.value = el.element.id;
el.element.select();
});
});
dom.scanner("select,input[type=text]", function(el) {
el.on("change", function(e) {
var form = this.findParent("form");
var submit = form.find("input[type=submit]");
if (submit.length)
submit[0].element.disabled = "disabled";
setTimeout(function() {form.trigger("submit");}, 1);
});
});
dom.scanner("input[type=checkbox],input[type=radio]", function(el) {
el.on("click", function(e) {
return this.findParent("form").trigger("submit");
});
});
dom.scanner("form", function(el) {
el.on("submit", function(e) {
var form=this;
setTimeout(function() {
var children = form.find("select,input[type=text],input[type=checkbox],input[type=radio]");
if (children.length)
for(var i=0;i<children.length;i++)
children[i].element.readOnly = "readOnly";
var submit = form.find("input[type=submit]");
if (submit.length)
submit[0].element.disabled = "disabled";
}, 1);
});
});
return dom;
};
});
код превращается, код превращается... в говно!