回答編集履歴
9
修正
answer
CHANGED
@@ -47,7 +47,7 @@
|
|
47
47
|
('0' + (date.getMonth() + 1) ).slice(-2),
|
48
48
|
('0' + date.getDate()).slice(-2)].join('');
|
49
49
|
|
50
|
-
if ( isNaN(ymd) ) throw Error('Exception birthDay Format
|
50
|
+
if ( isNaN(ymd) ) throw Error('Exception birthDay Format mm/dd/yyyy');
|
51
51
|
|
52
52
|
return parseInt( ( (today - ymd) / 10000), 10);
|
53
53
|
}
|
8
var 宣言部分の修正
answer
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
},
|
42
42
|
calculateAge : function()
|
43
43
|
{
|
44
|
-
var ymd = parseInt(this.birth_day.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10)
|
44
|
+
var ymd = parseInt(this.birth_day.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10),
|
45
45
|
date = new Date(),
|
46
46
|
today = [date.getFullYear(),
|
47
47
|
('0' + (date.getMonth() + 1) ).slice(-2),
|
7
fix
answer
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
function userLogin(res) {
|
7
7
|
|
8
8
|
this.gender = res.gender || 'male';
|
9
|
-
this.birth_day = res.birthday || '
|
9
|
+
this.birth_day = res.birthday || '01/01/1970';
|
10
10
|
this.name = res.name || 'sample';
|
11
11
|
this.email = res.email || 'test@test.com';
|
12
12
|
this.location_name = res.location.name || 'test';
|
6
fix
answer
CHANGED
@@ -32,7 +32,6 @@
|
|
32
32
|
genderDOMs[2].checked = true;
|
33
33
|
break;
|
34
34
|
}
|
35
|
-
this.gender.checked = true;
|
36
35
|
doc.getElementById('address').value = this.location_name;
|
37
36
|
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
38
37
|
var schoolName = '';
|
@@ -42,7 +41,7 @@
|
|
42
41
|
},
|
43
42
|
calculateAge : function()
|
44
43
|
{
|
45
|
-
var ymd = parseInt(this.
|
44
|
+
var ymd = parseInt(this.birth_day.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10);
|
46
45
|
date = new Date(),
|
47
46
|
today = [date.getFullYear(),
|
48
47
|
('0' + (date.getMonth() + 1) ).slice(-2),
|
5
指摘事項の修正(date部分の取得方法の修正。parseIntの第二引数指定)
answer
CHANGED
@@ -5,46 +5,53 @@
|
|
5
5
|
var doc = document;
|
6
6
|
function userLogin(res) {
|
7
7
|
|
8
|
-
var genderDOM = doc.getElementsByName('gender'),
|
9
|
-
|
8
|
+
this.gender = res.gender || 'male';
|
9
|
+
this.birth_day = res.birthday || '1970/01/01';
|
10
|
+
this.name = res.name || 'sample';
|
11
|
+
this.email = res.email || 'test@test.com';
|
12
|
+
this.location_name = res.location.name || 'test';
|
13
|
+
this.education = res.education || {};
|
10
14
|
|
11
|
-
this.birth_day = res.birthday || '1970/01/01';
|
12
|
-
this.name = res.name || 'sample';
|
13
|
-
this.email = res.email || 'test@test.com';
|
14
|
-
//NOTE:ここも不明。genderDOM[0]は何?中性?
|
15
|
-
this.gender = ( gender === 'male' )? genderDOM[1] : genderDOM[2] ;
|
16
|
-
this.location_name = res.location.name || 'test';
|
17
|
-
this.education = res.education || {};
|
18
|
-
|
19
|
-
|
15
|
+
this.Controller();
|
20
16
|
}
|
21
17
|
|
22
18
|
userLogin.prototype = {
|
23
|
-
|
19
|
+
Controller : function()
|
24
|
-
|
20
|
+
{
|
25
|
-
|
21
|
+
doc.getElementById('name').value = this.name;
|
26
|
-
|
22
|
+
doc.getElementById('email').value = this.email;
|
27
|
-
|
23
|
+
doc.getElementById('age').value = this.calculateAge();
|
28
|
-
this.gender.checked = true;
|
29
|
-
doc.getElementById('address').value = this.location_name;
|
30
|
-
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
31
|
-
|
24
|
+
var genderDOMs = doc.getElementsByName('gender');
|
32
|
-
for ( var ed in this.education ) schoolName = this.education[ed].school.name;
|
33
25
|
|
34
|
-
doc.getElementById('education').value = schoolName;
|
35
|
-
},
|
36
|
-
|
26
|
+
switch ( this.gender )
|
37
|
-
|
27
|
+
{
|
38
|
-
var ymd = parseInt(this.birth_day.replace(/\u002f/g, '')),
|
39
|
-
|
28
|
+
case 'male':
|
29
|
+
genderDOMs[1].checked = true;
|
30
|
+
break;
|
31
|
+
case 'female':
|
32
|
+
genderDOMs[2].checked = true;
|
33
|
+
break;
|
34
|
+
}
|
40
|
-
|
35
|
+
this.gender.checked = true;
|
36
|
+
doc.getElementById('address').value = this.location_name;
|
41
|
-
|
37
|
+
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
38
|
+
var schoolName = '';
|
42
|
-
|
39
|
+
for ( var ed in this.education ) schoolName = this.education[ed].school.name;
|
43
40
|
|
41
|
+
doc.getElementById('education').value = schoolName;
|
42
|
+
},
|
43
|
+
calculateAge : function()
|
44
|
+
{
|
44
|
-
|
45
|
+
var ymd = parseInt(this.birthday.replace(/(\d{2}).(\d{2}).(\d{4})/, '$3$1$2'), 10);
|
46
|
+
date = new Date(),
|
47
|
+
today = [date.getFullYear(),
|
48
|
+
('0' + (date.getMonth() + 1) ).slice(-2),
|
49
|
+
('0' + date.getDate()).slice(-2)].join('');
|
45
50
|
|
51
|
+
if ( isNaN(ymd) ) throw Error('Exception birthDay Format yyyy/mm/dd');
|
52
|
+
|
46
|
-
|
53
|
+
return parseInt( ( (today - ymd) / 10000), 10);
|
47
|
-
|
54
|
+
}
|
48
55
|
};
|
49
56
|
FB.api('/me', function(res){new userLogin(res);});
|
50
57
|
```
|
4
0埋めの記述ミス修正
answer
CHANGED
@@ -38,8 +38,8 @@
|
|
38
38
|
var ymd = parseInt(this.birth_day.replace(/\u002f/g, '')),
|
39
39
|
date = new Date(),
|
40
40
|
today = [date.getFullYear(),
|
41
|
-
('0' + (date.getMonth() + 1) ),
|
41
|
+
('0' + (date.getMonth() + 1) ).slice(-2),
|
42
|
-
('0' + date.getDate())].join('');
|
42
|
+
('0' + date.getDate()).slice(-2)].join('');
|
43
43
|
|
44
44
|
if ( isNaN(ymd) ) throw Error('Exception birthDay Format yyyy/mm/dd');
|
45
45
|
|
3
comment add
answer
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
this.birth_day = res.birthday || '1970/01/01';
|
12
12
|
this.name = res.name || 'sample';
|
13
13
|
this.email = res.email || 'test@test.com';
|
14
|
+
//NOTE:ここも不明。genderDOM[0]は何?中性?
|
14
15
|
this.gender = ( gender === 'male' )? genderDOM[1] : genderDOM[2] ;
|
15
16
|
this.location_name = res.location.name || 'test';
|
16
17
|
this.education = res.education || {};
|
2
DOM入れ忘れの修正
answer
CHANGED
@@ -21,7 +21,9 @@
|
|
21
21
|
userLogin.prototype = {
|
22
22
|
Controller : function()
|
23
23
|
{
|
24
|
+
doc.getElementById('name').value = this.name;
|
25
|
+
doc.getElementById('email').value = this.email;
|
24
|
-
doc.getElementById('age').value
|
26
|
+
doc.getElementById('age').value = this.calculateAge();
|
25
27
|
this.gender.checked = true;
|
26
28
|
doc.getElementById('address').value = this.location_name;
|
27
29
|
//TODO:ちょっとここ元のソースが何がしたいのかわんかんない
|
1
スラッシュの削除バグ修正
answer
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
},
|
33
33
|
calculateAge : function()
|
34
34
|
{
|
35
|
-
var ymd = parseInt(this.birth_day.replace(
|
35
|
+
var ymd = parseInt(this.birth_day.replace(/\u002f/g, '')),
|
36
36
|
date = new Date(),
|
37
37
|
today = [date.getFullYear(),
|
38
38
|
('0' + (date.getMonth() + 1) ),
|