Skip to content

Commit f08d2f2

Browse files
committed
細かい文言やコードのミスを修正
1 parent ec3461e commit f08d2f2

File tree

5 files changed

+16
-34
lines changed

5 files changed

+16
-34
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ JavaScript初心者が基礎をひととおり身に付けるための資料で
77

88

99

10-
### ローカルでサーバーを立ち上げる方法
10+
### サーバーを立ち上げる方法
11+
ローカルで実行する分にはhtmlファイルを直接ブラウザで開けば大丈夫です。
12+
VM等を利用されている方は、以下の方法でサーバーを立ち上げることができます。
1113

1214
#### python
1315
python -m SimpleHTTPServer
1416

15-
ブラウザで、http://localhost:8000 にアクセス
16-
1717
ポート番号を指定したいとき
1818
例)8888
1919
python -m SimpleHTTPServer 8888

feed/feed.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434

3535
<script src="../lib/jquery-1.9.1.js"></script>
3636
<script src="../lib/underscore-1.4.4.js"></script>
37-
<script>
38-
window.$j = window.jQuery; //社内の環境にあわせる
39-
</script>
40-
<script src="feedAnswer.js"></script>
37+
<script src="feed.js"></script>
4138
</body>
4239
</html>

feed/feed.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,12 @@
1212

1313
/*
1414
* strict mode
15-
* JSの落とし穴にはまるのを防ぐため、許可された書き方の一部をエラーにする
15+
* JSの落とし穴にはまるのを防ぐため、許可された書き方の一部をエラーにします
1616
* 例外を設けたい場合は以下の様にコメントで記述できます
1717
* mixiのコーディングガイドラインでも新規コードはstrict mode必須となっています
1818
*/
1919
/*jshint browser:true, strict:true*/
2020
/*global $j:false, _:false*/
2121
"use strict";
2222

23-
/*
24-
* イイネボタン
25-
*/
26-
var LIKE_BUTTON_SELECTOR = ".likeButton";
27-
28-
$j(document).on("click", LIKE_BUTTON_SELECTOR, function() {
29-
this.disabled = true;
30-
});
31-
32-
// input
33-
var textarea = $j("textarea");
34-
var countEl = $j(".count");
35-
textarea.on("keyup", function() {
36-
var count = textarea.val().length;
37-
countEl.text(count);
38-
});
23+
window.alert("まだ動きません。このJSファイルにコードを追加してください");

feed/feedAnswer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@
1919
/*jshint browser:true, strict:true*/
2020
/*global jQuery:false, _:false*/
2121

22-
(function($j, _) {
22+
(function($, _) {
2323
"use strict";
2424

2525
/*
2626
* イイネボタン
2727
*/
2828
var LIKE_BUTTON_SELECTOR = ".likeButton";
2929

30-
$j(document).on("click", LIKE_BUTTON_SELECTOR, function() {
30+
$(document).on("click", LIKE_BUTTON_SELECTOR, function() {
3131
this.disabled = true;
3232
});
3333

3434
/*
3535
* つぶやき
3636
*/
3737
var voiceForm = {
38-
element: $j("#voiceForm"),
38+
element: $("#voiceForm"),
3939

4040
init: function() {
4141
var el = this.element;
@@ -62,7 +62,7 @@
6262

6363
// post
6464
this.button.on("click", function() {
65-
$j(window).trigger("addFeed", [
65+
$(window).trigger("addFeed", [
6666
self.nickname.val(),
6767
self.text.val()
6868
]);
@@ -73,7 +73,7 @@
7373

7474

7575
var feedList = {
76-
element: $j("#feedList"),
76+
element: $("#feedList"),
7777

7878
renderFeed: function(nickname, text) {
7979
var html = [
@@ -89,7 +89,7 @@
8989

9090
setEventListener: function() {
9191
var self = this;
92-
$j(window).on("addFeed", function(event, nickname, text) {
92+
$(window).on("addFeed", function(event, nickname, text) {
9393
self.renderFeed(nickname, text);
9494
});
9595
}

introduction.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ var array = [0, 1, 2];
4848
array[0]; // => 0
4949

5050
console.dir(array); //オブジェクトのプロパティが見れます
51-
//prototypeチェーンをたどると、Arrayクラスのプロパティも見れます
51+
//prototypeチェーンをたどると、Arrayクラスのプロパティも見られます
5252

5353
array.length; // => 3
5454
array.push; // => function push() { [native code] }
5555
// 関数も変数に代入できる(後述)
56-
array.push(3); // ()で関数呼び出し
56+
array.push(3); // ()で関数呼び出し。返り値は配列の要素数(length)なので4
5757
array; // => [0, 1, 2, 3]
5858

5959
/* 連想配列もオブジェクト */
@@ -121,8 +121,8 @@ for (var i = 0; i < array.length; i++) {
121121

122122
// for in
123123
// 連想配列の走査
124-
for (var key in color) {
125-
console.log(key + ":" + color[key]);
124+
for (var key in colors) {
125+
console.log(key + ":" + colors[key]);
126126
}
127127

128128
// while

0 commit comments

Comments
 (0)