+import "dart:html" as i;class q{static const s="Chrome";final m;final minimumVersion;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 CB;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.query('#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.FileError.NOT_FOUND_ERR:g='NOT_FOUND_ERR';break;case i.FileError.SECURITY_ERR:g='SECURITY_ERR';break;case i.FileError.INVALID_MODIFICATION_ERR:g='INVALID_MODIFICATION_ERR';break;case i.FileError.INVALID_STATE_ERR:g='INVALID_STATE_ERR';break;default: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='Files 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.createDocumentFragment();h.forEach((g){var o=g.isDirectory?'<img src="http://www.html5rocks.com/static/images/tutorials/icon-folder.gif">':'<img src="http://www.html5rocks.com/static/images/tutorials/icon-file.gif">';var k=new i.Element.tag("li");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.forEach((g){if(g.isDirectory){g.removeRecursively().then((JB){},onError:FB);}else{g.remove().then((JB){},onError:FB);}});DB.text='Directory emptied.';},onError:FB);}} main(){new BB();} l( g){return g.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'");}
|