| 1 import "dart:html" as i;class q{static const s="Chrome";final m;final minimum
Version;const q(this.m,[this.minimumVersion]);}class t{const t();}class u{final
name;const u(this.name);}class v{const v();}class AB{const AB();}class BB{var C
B;var DB;BB(){DB=i.query('#example-list-fs-ul');i.window.requestFileSystem(1024*
1024,persistent:false).then(EB,onError:FB);} EB( h){CB=h;i.query('#add-button').
onClick.listen((g)=>GB());i.query('#list-button').onClick.listen((g)=>HB());i.qu
ery('#remove-button').onClick.listen((g)=>IB());} FB( h){var g='';switch (h.code
){case i.FileError.QUOTA_EXCEEDED_ERR:g='QUOTA_EXCEEDED_ERR';break;case i.FileEr
ror.NOT_FOUND_ERR:g='NOT_FOUND_ERR';break;case i.FileError.SECURITY_ERR:g='SECUR
ITY_ERR';break;case i.FileError.INVALID_MODIFICATION_ERR:g='INVALID_MODIFICATION
_ERR';break;case i.FileError.INVALID_STATE_ERR:g='INVALID_STATE_ERR';break;defau
lt:g='Unknown Error';break;}i.query("#example-list-fs-ul").text="Error: ${g}";}
GB(){CB.root.createFile('log.txt').catchError(FB);CB.root.createFile('song.mp3')
.catchError(FB);CB.root.createDirectory('mypictures').catchError(FB);DB.text='Fi
les created.';} HB(){var n=CB.root.createReader();n.readEntries().then((h){if(h.
length==0){DB.text='Filesystem is empty.';}else{DB.text='';}var j=i.document.cre
ateDocumentFragment();h.forEach((g){var o=g.isDirectory?'<img src="http://www.ht
ml5rocks.com/static/images/tutorials/icon-folder.gif">':'<img src="http://www.ht
ml5rocks.com/static/images/tutorials/icon-file.gif">';var k=new i.Element.tag("l
i");k.innerHtml="${o}<span>${l(g.name)}</span>";j.nodes.add(k);});DB.nodes.add(j
);},onError:FB);} IB(){var j=CB.root.createReader();j.readEntries().then((h){h.f
orEach((g){if(g.isDirectory){g.removeRecursively().then((JB){},onError:FB);}else
{g.remove().then((JB){},onError:FB);}});DB.text='Directory emptied.';},onError:F
B);}} main(){new BB();} l( g){return g.replaceAll("&","&").replaceAll("<","&
lt;").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'");} |