Giter VIP home page Giter VIP logo

array-test's Introduction


array-test's People

Contributors

makoto-ogata avatar ms2sato avatar

Watchers

 avatar  avatar

array-test's Issues

「次のページ」的実装の練習

新しい課題です。
Twitterの「もっと読む」を作ります。

  • tweets.json をajaxしてtweets.htmlに表示する。
    • これまでやったことと殆ど同じですね!
  • 全てのtweetの下に「もっと読む」リンクをつけます。
    • もっと読むを押すと、tweets.jsonをajaxして、一番下のtweetに追加します。
    • 本来はtweets.jsonの内容がサーバ側で変化する(ページネーション)はずですが、今はサーバー実装をしないので、同じ文章が何回も出る形で大丈夫です。

tweets.jsonは下記のようなものです。5件くらいは配列に入れたほうがそれっぽいでしょう。

[
  {
     name: "ms2sato",
     body: "こんにちは"
  },
  {
    name: "makoto-ogata",
    body: "本日は晴天なり"
  }
]

ajax読み込み中は「もっと読む」を押させないようにする

よくある実装ですが、非同期で通信している際にボタンを二度押し、三度押しされると誤動作してしまうアプリを作る時、ボタンが通信中に押せないようにブロックされる仕組みを導入します。

仕様

  • 通信中:もっと読むボタンは属性disabledになります(見た目がグレーっぽく変わるはず)
  • 通信中:「もっと読む」のテキストが「通信中...」に変わります
  • 通信後:もっと読むボタンの状態が通信前と同様に戻ります。

確認のヒント

通信速度が速すぎてテストしづらいかもしれません。ブレークポイントを使って確認するような形で大丈夫ですよ。

【セキュリティ】ユーザーが入力しているテキストを扱う場合には注意が必要です!

tweets.jsonの内容を画面に出していると思いますが、名前、本文ともにユーザーが自由に入力できる想定ですね(Twitterのようなアプリを想定しています)。

実は今のコードには「クロスサイトスクリプティング」という攻撃に対して脆弱性があります。さて、クロスサイトスクリプティングはどんな攻撃で、どのように守ると良いのでしょうか。

時間のあるときに調べておいてください。

【ウィザード練習】HTMLの画面作成

ゴールイメージとしては下記のようなところを考えています(アニメーションなどは今回はやりません、パッパッとページが切り替わるものでOKです)

http://www.jquery-steps.com/Examples

まずは HTMLに複数ページのタグを最初から用意して、一番最初のページだけが表示されている状態まで作りましょう(最初のページは表示されているが、その他のページが非表示の状態)。

仕様がわかりにくい場合には相談しましょう。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.