回答編集履歴
9
修正
test
CHANGED
@@ -96,7 +96,7 @@
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
if ( isNaN(ymd) ) throw Error('Exception birthDay Format
|
99
|
+
if ( isNaN(ymd) ) throw Error('Exception birthDay Format mm/dd/yyyy');
|
100
100
|
|
101
101
|
|
102
102
|
|
8
var 宣言部分の修正
test
CHANGED
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
{
|
86
86
|
|
87
|
-
var ymd = parseInt(this.birth_day.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10)
|
87
|
+
var ymd = parseInt(this.birth_day.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10),
|
88
88
|
|
89
89
|
date = new Date(),
|
90
90
|
|
7
fix
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
this.gender = res.gender || 'male';
|
16
16
|
|
17
|
-
this.birth_day = res.birthday || '1
|
17
|
+
this.birth_day = res.birthday || '01/01/1970';
|
18
18
|
|
19
19
|
this.name = res.name || 'sample';
|
20
20
|
|
6
fix
test
CHANGED
@@ -66,8 +66,6 @@
|
|
66
66
|
|
67
67
|
}
|
68
68
|
|
69
|
-
this.gender.checked = true;
|
70
|
-
|
71
69
|
doc.getElementById('address').value = this.location_name;
|
72
70
|
|
73
71
|
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
@@ -86,7 +84,7 @@
|
|
86
84
|
|
87
85
|
{
|
88
86
|
|
89
|
-
var ymd = parseInt(this.birthday.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10);
|
87
|
+
var ymd = parseInt(this.birth_day.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10);
|
90
88
|
|
91
89
|
date = new Date(),
|
92
90
|
|
5
指摘事項の修正(date部分の取得方法の修正。parseIntの第二引数指定)
test
CHANGED
@@ -12,29 +12,21 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
|
15
|
+
this.gender = res.gender || 'male';
|
16
16
|
|
17
|
+
this.birth_day = res.birthday || '1970/01/01';
|
18
|
+
|
17
|
-
|
19
|
+
this.name = res.name || 'sample';
|
20
|
+
|
21
|
+
this.email = res.email || 'test@test.com';
|
22
|
+
|
23
|
+
this.location_name = res.location.name || 'test';
|
24
|
+
|
25
|
+
this.education = res.education || {};
|
18
26
|
|
19
27
|
|
20
28
|
|
21
|
-
this.birth_day = res.birthday || '1970/01/01';
|
22
|
-
|
23
|
-
this.name = res.name || 'sample';
|
24
|
-
|
25
|
-
this.email = res.email || 'test@test.com';
|
26
|
-
|
27
|
-
//NOTE:ここも不明。genderDOM[0]は何?中性?
|
28
|
-
|
29
|
-
this.gender = ( gender === 'male' )? genderDOM[1] : genderDOM[2] ;
|
30
|
-
|
31
|
-
this.location_name = res.location.name || 'test';
|
32
|
-
|
33
|
-
this.education = res.education || {};
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
this.Controller();
|
38
30
|
|
39
31
|
}
|
40
32
|
|
@@ -42,55 +34,77 @@
|
|
42
34
|
|
43
35
|
userLogin.prototype = {
|
44
36
|
|
45
|
-
|
37
|
+
Controller : function()
|
46
38
|
|
47
|
-
|
39
|
+
{
|
48
40
|
|
49
|
-
|
41
|
+
doc.getElementById('name').value = this.name;
|
50
42
|
|
51
|
-
|
43
|
+
doc.getElementById('email').value = this.email;
|
52
44
|
|
53
|
-
|
45
|
+
doc.getElementById('age').value = this.calculateAge();
|
54
46
|
|
55
|
-
this.gender.checked = true;
|
56
|
-
|
57
|
-
doc.getElementById('address').value = this.location_name;
|
58
|
-
|
59
|
-
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
60
|
-
|
61
|
-
|
47
|
+
var genderDOMs = doc.getElementsByName('gender');
|
62
|
-
|
63
|
-
for ( var ed in this.education ) schoolName = this.education[ed].school.name;
|
64
48
|
|
65
49
|
|
66
50
|
|
67
|
-
|
51
|
+
switch ( this.gender )
|
68
52
|
|
69
|
-
|
53
|
+
{
|
70
54
|
|
71
|
-
|
55
|
+
case 'male':
|
72
56
|
|
73
|
-
|
57
|
+
genderDOMs[1].checked = true;
|
74
58
|
|
75
|
-
|
59
|
+
break;
|
76
60
|
|
77
|
-
|
61
|
+
case 'female':
|
78
62
|
|
79
|
-
|
63
|
+
genderDOMs[2].checked = true;
|
80
64
|
|
81
|
-
|
65
|
+
break;
|
82
66
|
|
67
|
+
}
|
68
|
+
|
69
|
+
this.gender.checked = true;
|
70
|
+
|
83
|
-
|
71
|
+
doc.getElementById('address').value = this.location_name;
|
72
|
+
|
73
|
+
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
74
|
+
|
75
|
+
var schoolName = '';
|
76
|
+
|
77
|
+
for ( var ed in this.education ) schoolName = this.education[ed].school.name;
|
84
78
|
|
85
79
|
|
86
80
|
|
81
|
+
doc.getElementById('education').value = schoolName;
|
82
|
+
|
83
|
+
},
|
84
|
+
|
85
|
+
calculateAge : function()
|
86
|
+
|
87
|
+
{
|
88
|
+
|
87
|
-
|
89
|
+
var ymd = parseInt(this.birthday.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10);
|
90
|
+
|
91
|
+
date = new Date(),
|
92
|
+
|
93
|
+
today = [date.getFullYear(),
|
94
|
+
|
95
|
+
('0' + (date.getMonth() + 1) ).slice(-2),
|
96
|
+
|
97
|
+
('0' + date.getDate()).slice(-2)].join('');
|
88
98
|
|
89
99
|
|
90
100
|
|
91
|
-
|
101
|
+
if ( isNaN(ymd) ) throw Error('Exception birthDay Format yyyy/mm/dd');
|
92
102
|
|
103
|
+
|
104
|
+
|
105
|
+
return parseInt( ( (today - ymd) / 10000), 10);
|
106
|
+
|
93
|
-
|
107
|
+
}
|
94
108
|
|
95
109
|
};
|
96
110
|
|
4
0埋めの記述ミス修正
test
CHANGED
@@ -78,9 +78,9 @@
|
|
78
78
|
|
79
79
|
today = [date.getFullYear(),
|
80
80
|
|
81
|
-
('0' + (date.getMonth() + 1) ),
|
81
|
+
('0' + (date.getMonth() + 1) ).slice(-2),
|
82
82
|
|
83
|
-
('0' + date.getDate())].join('');
|
83
|
+
('0' + date.getDate()).slice(-2)].join('');
|
84
84
|
|
85
85
|
|
86
86
|
|
3
comment add
test
CHANGED
@@ -23,6 +23,8 @@
|
|
23
23
|
this.name = res.name || 'sample';
|
24
24
|
|
25
25
|
this.email = res.email || 'test@test.com';
|
26
|
+
|
27
|
+
//NOTE:ここも不明。genderDOM[0]は何?中性?
|
26
28
|
|
27
29
|
this.gender = ( gender === 'male' )? genderDOM[1] : genderDOM[2] ;
|
28
30
|
|
2
DOM入れ忘れの修正
test
CHANGED
@@ -44,7 +44,11 @@
|
|
44
44
|
|
45
45
|
{
|
46
46
|
|
47
|
+
doc.getElementById('name').value = this.name;
|
48
|
+
|
49
|
+
doc.getElementById('email').value = this.email;
|
50
|
+
|
47
|
-
doc.getElementById('age').value = this.calculateAge();
|
51
|
+
doc.getElementById('age').value = this.calculateAge();
|
48
52
|
|
49
53
|
this.gender.checked = true;
|
50
54
|
|
1
スラッシュの削除バグ修正
test
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
{
|
68
68
|
|
69
|
-
var ymd = parseInt(this.birth_day.replace(
|
69
|
+
var ymd = parseInt(this.birth_day.replace(/\u002f/g, '')),
|
70
70
|
|
71
71
|
date = new Date(),
|
72
72
|
|