-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.js
More file actions
123 lines (107 loc) · 2.91 KB
/
File.js
File metadata and controls
123 lines (107 loc) · 2.91 KB
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
123
var reset = function() {
$(".resetBtnID").click(function(){
$('input[type=text],textarea,select').each(function(){
$(this).val($(this).attr('oldValue'));
$(this).removeAttr('style');
$(this).parent().removeClass('tooltip');
if($(this).siblings('.tooltiptext').length){
$(this).siblings('.tooltiptext').hide();
}
});
for(var i in dataChanges){
dataChanges[i] = 'false';
}
$(this).attr('disabled', true);
});
$('input[type=text],textarea').each(function(){
$(this).attr('oldValue', $(this).val());
dataChanges[$(this).attr('id')] = 'false';
});
$('input[type=text]').click(function(){
if($(this).attr('style')){
$(this).parent().addClass('tooltip');
if($(this).siblings('.tooltiptext').length){
$(this).siblings('.tooltiptext').show();
}
}
});
$('select').each(function(){
$(this).attr('oldValue', $(this).val());
dataChanges[$(this).attr('name')] = 'false';
});
$('input[type=text],textarea').keyup(function(){
firstTime = false;
if($(this).val() != $(this).attr('oldValue')){
dataChanges[$(this).attr('id')] = 'true';
} else {
dataChanges[$(this).attr('id')] = 'false';
}
if($('input[type=text]').attr('style')){
$('input[type=text]').parent().addClass('tooltip');
if($('input[type=text]').siblings('.tooltiptext').length){
$('input[type=text]').siblings('.tooltiptext').show();
}
}
var changed = false;
for(var i in dataChanges){
if(dataChanges[i] == 'true'){
changed = true;
break;
}
}
if(changed){
$(".resetBtnID").attr('disabled', false);
} else {
$(".resetBtnID").attr('disabled', true);
}
});
$('input[type=text]').change(function(){
firstTime = false;
if($(this).val() != $(this).attr('oldValue')){
dataChanges[$(this).attr('id')] = 'true';
} else {
dataChanges[$(this).attr('id')] = 'false';
}
if($(this).attr('style')){
if(checkInput($(this).val())){
$(this).removeAttr('style');
$(this).parent().removeClass('tooltip');
if($(this).siblings('.tooltiptext').length){
$(this).siblings('.tooltiptext').hide();
}
}
}
var changed = false;
for(var i in dataChanges){
if(dataChanges[i] == 'true'){
changed = true;
break;
}
}
if(changed){
$(".resetBtnID").attr('disabled', false);
} else {
$(".resetBtnID").attr('disabled', true);
}
});
$('select').change(function(){
firstTime = false;
if($(this).val() != $(this).attr('oldValue')){
dataChanges[$(this).attr('name')] = 'true';
} else {
dataChanges[$(this).attr('name')] = 'false';
}
var changed = false;
for(var i in dataChanges){
if(dataChanges[i] == 'true'){
changed = true;
break;
}
}
if(changed){
$(".resetBtnID").attr('disabled', false);
} else {
$(".resetBtnID").attr('disabled', true);
}
});
}