際際滷

際際滷Share a Scribd company logo
File API in Firefox3.6
  with HTML5 D&D

       tnantoka
? tnantoka
?            SE

? JavaScript
? blog.bornneet.com
W3C File API
File API


? <input type="?le" /> JavaScript
? HTML5#Drag and Drop
?
    html5.bornneet.com/?le/multi/
? dataURI
    html5.bornneet.com/?le/datauri/
Web UI
☆
File




<textarea>
$(function() {
 .....

      <textarea>
html
1    <!DOCTYPE html>
2    <html lang="ja">
3    <head>
4      <meta charset="UTF-8" />
5      <title>Textarea D&D</title>
6      <link rel="stylesheet" href="style.css" />
7      <script src=/slideshow/file-api-in-firefox36/2750248/"script.js"></script>
8    </head>
9    <body>
10   <p>
11     <textarea id="dropbox"></textarea>
12   </p>
13   </body>
14   </html>
css
1   @charset "UTF-8";

2   p {
3     text-align: center;
4   }
5   textarea {
6   
   width: 500px;
7   
   height: 300px;
8   }

    /* dragover             */
9 .over {
10   border: 3px solid orange;
11 }
dragover
1   var db = document.getElementById('dropbox');

2   db.addEventListener('dragover', function(e){

      //
3     e.preventDefault();

      //
4     db.className = 'over';

5   }, true);
dragleave
1   db.addEventListener('dragleave', function(e){

      //
2     db.className = '';

3   }, true);
drop
1   db.addEventListener('drop', function(e) {

     // e.stopPropagation();
2     e.preventDefault();

     //
3     var file = e.dataTransfer.files[0];
4     var reader = new FileReader();
5     reader.onloadend = function() {
6        db.value = reader.result;
7     };
8     reader.readAsText(file);
9   }, true);
html5.bornneet.com/?le/textarea/
Mozilla
Jetpacking
tnantoka.net/jetpack/dropta/
?   ON/OFF
    -          ^^

?
    - getEventListener

?
    - Web Workers

?   about:jetpack#Develop Bespin
    -
File API in Firefox3.6
?
? W3C FileAPI in Firefox 3.6
  http://hacks.mozilla.org/2009/12/w3c-
  ?leapi-in-?refox-3-6/

More Related Content

What's hot (9)

JS programowanie obiektowe
JS  programowanie obiektoweJS  programowanie obiektowe
JS programowanie obiektowe
Piotr Czajkowski
?
Javascript per applicazioni complesse - Lo Stretto digitale
Javascript per applicazioni complesse - Lo Stretto digitaleJavascript per applicazioni complesse - Lo Stretto digitale
Javascript per applicazioni complesse - Lo Stretto digitale
Giuseppe Pizzimenti
?
Ebookl membuat login php7+mysqli
Ebookl membuat login php7+mysqliEbookl membuat login php7+mysqli
Ebookl membuat login php7+mysqli
SMK - Statens Museum for Kunst
?
Pertemuan 8 - Report Tabel
Pertemuan 8 - Report TabelPertemuan 8 - Report Tabel
Pertemuan 8 - Report Tabel
Adi Triyatmoko
?
Java Script - Object-Oriented Programming
Java Script - Object-Oriented ProgrammingJava Script - Object-Oriented Programming
Java Script - Object-Oriented Programming
intive
?
Максим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru Group
Максим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru GroupМаксим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru Group
Максим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru Group
Mail.ru Group
?
Func
FuncFunc
Func
Hvqr
?
Javascript per applicazioni complesse - Lo Stretto digitale
Javascript per applicazioni complesse - Lo Stretto digitaleJavascript per applicazioni complesse - Lo Stretto digitale
Javascript per applicazioni complesse - Lo Stretto digitale
Giuseppe Pizzimenti
?
Pertemuan 8 - Report Tabel
Pertemuan 8 - Report TabelPertemuan 8 - Report Tabel
Pertemuan 8 - Report Tabel
Adi Triyatmoko
?
Java Script - Object-Oriented Programming
Java Script - Object-Oriented ProgrammingJava Script - Object-Oriented Programming
Java Script - Object-Oriented Programming
intive
?
Максим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru Group
Максим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru GroupМаксим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru Group
Максим cdump Андреев, WPAD, Security Meetup 9 апреля, Mail.Ru Group
Mail.ru Group
?

Viewers also liked (9)

干温厩温皆界姻庄沿岳の強かし圭
干温厩温皆界姻庄沿岳の強かし圭干温厩温皆界姻庄沿岳の強かし圭
干温厩温皆界姻庄沿岳の強かし圭
Tatsuya Tobioka
?
及0指ワススタ!! #wasbookをiもう
及0指ワススタ!! #wasbookをiもう及0指ワススタ!! #wasbookをiもう
及0指ワススタ!! #wasbookをiもう
Tatsuya Tobioka
?
Kin Long Company Profile
Kin Long Company ProfileKin Long Company Profile
Kin Long Company Profile
xtpf5240
?
RubyMotionを1Lg 乾ってみた咫
RubyMotionを1Lg 乾ってみた咫RubyMotionを1Lg 乾ってみた咫
RubyMotionを1Lg 乾ってみた咫
Tatsuya Tobioka
?
Node.js D Hello, world! の1i枠へ。
Node.js D Hello, world! の1i枠へ。Node.js D Hello, world! の1i枠へ。
Node.js D Hello, world! の1i枠へ。
Tatsuya Tobioka
?
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging Challenges
Aaron Irizarry
?
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
Seth Familian
?
3 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 20173 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 2017
Drift
?
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
Leslie Samuel
?
干温厩温皆界姻庄沿岳の強かし圭
干温厩温皆界姻庄沿岳の強かし圭干温厩温皆界姻庄沿岳の強かし圭
干温厩温皆界姻庄沿岳の強かし圭
Tatsuya Tobioka
?
及0指ワススタ!! #wasbookをiもう
及0指ワススタ!! #wasbookをiもう及0指ワススタ!! #wasbookをiもう
及0指ワススタ!! #wasbookをiもう
Tatsuya Tobioka
?
Kin Long Company Profile
Kin Long Company ProfileKin Long Company Profile
Kin Long Company Profile
xtpf5240
?
RubyMotionを1Lg 乾ってみた咫
RubyMotionを1Lg 乾ってみた咫RubyMotionを1Lg 乾ってみた咫
RubyMotionを1Lg 乾ってみた咫
Tatsuya Tobioka
?
Node.js D Hello, world! の1i枠へ。
Node.js D Hello, world! の1i枠へ。Node.js D Hello, world! の1i枠へ。
Node.js D Hello, world! の1i枠へ。
Tatsuya Tobioka
?
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging Challenges
Aaron Irizarry
?
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
Seth Familian
?
3 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 20173 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 2017
Drift
?
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
Leslie Samuel
?

File API in Firefox3.6

  • 1. File API in Firefox3.6 with HTML5 D&D tnantoka
  • 2. ? tnantoka ? SE ? JavaScript ? blog.bornneet.com
  • 4. File API ? <input type="?le" /> JavaScript ? HTML5#Drag and Drop
  • 5. ? html5.bornneet.com/?le/multi/ ? dataURI html5.bornneet.com/?le/datauri/
  • 7.
  • 9. $(function() { ..... <textarea>
  • 10. html 1 <!DOCTYPE html> 2 <html lang="ja"> 3 <head> 4 <meta charset="UTF-8" /> 5 <title>Textarea D&D</title> 6 <link rel="stylesheet" href="style.css" /> 7 <script src=/slideshow/file-api-in-firefox36/2750248/"script.js"></script> 8 </head> 9 <body> 10 <p> 11 <textarea id="dropbox"></textarea> 12 </p> 13 </body> 14 </html>
  • 11. css 1 @charset "UTF-8"; 2 p { 3 text-align: center; 4 } 5 textarea { 6 width: 500px; 7 height: 300px; 8 } /* dragover */ 9 .over { 10 border: 3px solid orange; 11 }
  • 12. dragover 1 var db = document.getElementById('dropbox'); 2 db.addEventListener('dragover', function(e){ // 3 e.preventDefault(); // 4 db.className = 'over'; 5 }, true);
  • 13. dragleave 1 db.addEventListener('dragleave', function(e){ // 2 db.className = ''; 3 }, true);
  • 14. drop 1 db.addEventListener('drop', function(e) { // e.stopPropagation(); 2 e.preventDefault(); // 3 var file = e.dataTransfer.files[0]; 4 var reader = new FileReader(); 5 reader.onloadend = function() { 6 db.value = reader.result; 7 }; 8 reader.readAsText(file); 9 }, true);
  • 18. ? ON/OFF - ^^ ? - getEventListener ? - Web Workers ? about:jetpack#Develop Bespin -
  • 20. ? ? W3C FileAPI in Firefox 3.6 http://hacks.mozilla.org/2009/12/w3c- ?leapi-in-?refox-3-6/