[{"data":1,"prerenderedAt":7144},["ShallowReactive",2],{"article_list_html5_":3},[4,3662,3794,5366],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"publishDate":11,"categories":12,"tags":14,"image":18,"excerpt":10,"body":19,"_type":3653,"_id":3654,"_source":3655,"_file":3656,"_stem":3657,"_extension":3658,"author":3659},"/ckeefer/2013-3/ajax-upload","2013-3",false,"","Ajax Upload Part I: Framed (and jQuery Deferred)","Inevitably, people want their files on the Internet. If your project is about cute cats, someone will task you with allowing users to upload photos of their cats, videos of their cats, long rambling audio clips in which they attempt to convince their cat to stop attacking the microphone, etcetera. If your project is about the nature and proclivities of mold, someone, somewhere will want to share detailed photographic evidence of their mold problem. The need to upload files is a given.","2013-03-20",[13],"developer-blog",[15,16,17],"js","jquery","html5","/ckeefer/2013-3/img/upframe.jpg",{"type":20,"children":21,"toc":3646},"root",[22,41,64,69,74,81,86,91,305,310,713,718,724,729,743,868,882,888,893,1173,1186,1359,1364,1755,1760,2082,2087,2093,2098,2104,2109,3640],{"type":23,"tag":24,"props":25,"children":26},"element","p",{},[27,30,39],{"type":28,"value":29},"text","Inevitably, people want their files on the Internet. If your project is about cute cats, someone will task you with allowing users to upload photos of their cats, videos of their cats, long rambling audio clips in which they attempt to convince their cat to stop attacking the microphone, etcetera. If your project is about the nature and proclivities of mold, ",{"type":23,"tag":31,"props":32,"children":36},"a",{"href":33,"rel":34},"http://beta.photobucket.com/img/mold+spores/",[35],"nofollow",[37],{"type":28,"value":38},"someone, somewhere",{"type":28,"value":40}," will want to share detailed photographic evidence of their mold problem. The need to upload files is a given.",{"type":23,"tag":24,"props":42,"children":43},{},[44,46,53,55,62],{"type":28,"value":45},"Despite that, uploading files has long been one of the roughest aspects of interaction with the web – requiring form submission, and the requisite UI-lockup and page reload, or else some form of plugin intervention (such as Flash). ",{"type":23,"tag":31,"props":47,"children":50},{"href":48,"rel":49},"http://www.w3.org/TR/XMLHttpRequest2/",[35],[51],{"type":28,"value":52},"This is changing",{"type":28,"value":54}," – with the new XMLHttpRequest level 2 spec, coupled with the ",{"type":23,"tag":31,"props":56,"children":59},{"href":57,"rel":58},"http://www.w3.org/TR/FileAPI/",[35],[60],{"type":28,"value":61},"File API",{"type":28,"value":63},", all supporting browsers will be able to cleanly and neatly retrieve a file from the user's local file system and upload it to the web – no page reloads, beautifully asynchronous. We will be focusing on just how to take advantage of these new developments in part II.",{"type":23,"tag":24,"props":65,"children":66},{},[67],{"type":28,"value":68},"For now, though, let's say you have to support an older browser (\u003C= IE9, for instance). You don't want to have to employ Flash – its a security risk (a topic for another post), and not supported by all mobile browsers or devices; but you want to avoid the deleterious standard behaviour of a form submission. Or maybe there's some other need for a form submission that works like an ajax request (I'll get into that later).",{"type":23,"tag":24,"props":70,"children":71},{},[72],{"type":28,"value":73},"Aha, I say – its time for a little iframe trick, then.",{"type":23,"tag":75,"props":76,"children":78},"h2",{"id":77},"the-trick",[79],{"type":28,"value":80},"The Trick",{"type":23,"tag":24,"props":82,"children":83},{},[84],{"type":28,"value":85},"Situation: We need to submit a form transparently (to the user), and get the result (so that we know when our file has finished uploading, for instance). We don't want to lock up the UI or reload the page. So, instead of submitting our form within the page, we will submit it within an iframe.",{"type":23,"tag":24,"props":87,"children":88},{},[89],{"type":28,"value":90},"Say you have a form like this:",{"type":23,"tag":92,"props":93,"children":97},"pre",{"className":94,"code":95,"language":96,"meta":8,"style":8},"language-html shiki shiki-themes github-light github-dark","\u003Cform id=\"uploadForm\" action=\"/upload/url\" enctype=\"multipart/form-data\" method=\"POST\">\n    \u003Cinput type=\"file\" name=\"uploadLocalImage\" accept=\"image/*\" />\n    \u003Cinput type=\"submit\" value=\"Submit\" />\n\u003C/form>\n","html",[98],{"type":23,"tag":99,"props":100,"children":101},"code",{"__ignoreMap":8},[102,184,245,288],{"type":23,"tag":103,"props":104,"children":107},"span",{"class":105,"line":106},"line",1,[108,114,120,126,131,137,142,146,151,156,160,165,170,174,179],{"type":23,"tag":103,"props":109,"children":111},{"style":110},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[112],{"type":28,"value":113},"\u003C",{"type":23,"tag":103,"props":115,"children":117},{"style":116},"--shiki-default:#22863A;--shiki-dark:#85E89D",[118],{"type":28,"value":119},"form",{"type":23,"tag":103,"props":121,"children":123},{"style":122},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[124],{"type":28,"value":125}," id",{"type":23,"tag":103,"props":127,"children":128},{"style":110},[129],{"type":28,"value":130},"=",{"type":23,"tag":103,"props":132,"children":134},{"style":133},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[135],{"type":28,"value":136},"\"uploadForm\"",{"type":23,"tag":103,"props":138,"children":139},{"style":122},[140],{"type":28,"value":141}," action",{"type":23,"tag":103,"props":143,"children":144},{"style":110},[145],{"type":28,"value":130},{"type":23,"tag":103,"props":147,"children":148},{"style":133},[149],{"type":28,"value":150},"\"/upload/url\"",{"type":23,"tag":103,"props":152,"children":153},{"style":122},[154],{"type":28,"value":155}," enctype",{"type":23,"tag":103,"props":157,"children":158},{"style":110},[159],{"type":28,"value":130},{"type":23,"tag":103,"props":161,"children":162},{"style":133},[163],{"type":28,"value":164},"\"multipart/form-data\"",{"type":23,"tag":103,"props":166,"children":167},{"style":122},[168],{"type":28,"value":169}," method",{"type":23,"tag":103,"props":171,"children":172},{"style":110},[173],{"type":28,"value":130},{"type":23,"tag":103,"props":175,"children":176},{"style":133},[177],{"type":28,"value":178},"\"POST\"",{"type":23,"tag":103,"props":180,"children":181},{"style":110},[182],{"type":28,"value":183},">\n",{"type":23,"tag":103,"props":185,"children":187},{"class":105,"line":186},2,[188,193,198,203,207,212,217,221,226,231,235,240],{"type":23,"tag":103,"props":189,"children":190},{"style":110},[191],{"type":28,"value":192},"    \u003C",{"type":23,"tag":103,"props":194,"children":195},{"style":116},[196],{"type":28,"value":197},"input",{"type":23,"tag":103,"props":199,"children":200},{"style":122},[201],{"type":28,"value":202}," type",{"type":23,"tag":103,"props":204,"children":205},{"style":110},[206],{"type":28,"value":130},{"type":23,"tag":103,"props":208,"children":209},{"style":133},[210],{"type":28,"value":211},"\"file\"",{"type":23,"tag":103,"props":213,"children":214},{"style":122},[215],{"type":28,"value":216}," name",{"type":23,"tag":103,"props":218,"children":219},{"style":110},[220],{"type":28,"value":130},{"type":23,"tag":103,"props":222,"children":223},{"style":133},[224],{"type":28,"value":225},"\"uploadLocalImage\"",{"type":23,"tag":103,"props":227,"children":228},{"style":122},[229],{"type":28,"value":230}," accept",{"type":23,"tag":103,"props":232,"children":233},{"style":110},[234],{"type":28,"value":130},{"type":23,"tag":103,"props":236,"children":237},{"style":133},[238],{"type":28,"value":239},"\"image/*\"",{"type":23,"tag":103,"props":241,"children":242},{"style":110},[243],{"type":28,"value":244}," />\n",{"type":23,"tag":103,"props":246,"children":248},{"class":105,"line":247},3,[249,253,257,261,265,270,275,279,284],{"type":23,"tag":103,"props":250,"children":251},{"style":110},[252],{"type":28,"value":192},{"type":23,"tag":103,"props":254,"children":255},{"style":116},[256],{"type":28,"value":197},{"type":23,"tag":103,"props":258,"children":259},{"style":122},[260],{"type":28,"value":202},{"type":23,"tag":103,"props":262,"children":263},{"style":110},[264],{"type":28,"value":130},{"type":23,"tag":103,"props":266,"children":267},{"style":133},[268],{"type":28,"value":269},"\"submit\"",{"type":23,"tag":103,"props":271,"children":272},{"style":122},[273],{"type":28,"value":274}," value",{"type":23,"tag":103,"props":276,"children":277},{"style":110},[278],{"type":28,"value":130},{"type":23,"tag":103,"props":280,"children":281},{"style":133},[282],{"type":28,"value":283},"\"Submit\"",{"type":23,"tag":103,"props":285,"children":286},{"style":110},[287],{"type":28,"value":244},{"type":23,"tag":103,"props":289,"children":291},{"class":105,"line":290},4,[292,297,301],{"type":23,"tag":103,"props":293,"children":294},{"style":110},[295],{"type":28,"value":296},"\u003C/",{"type":23,"tag":103,"props":298,"children":299},{"style":116},[300],{"type":28,"value":119},{"type":23,"tag":103,"props":302,"children":303},{"style":110},[304],{"type":28,"value":183},{"type":23,"tag":24,"props":306,"children":307},{},[308],{"type":28,"value":309},"The user selects the file they want to upload, and clicks submit. We want to upload the file, and expect a json response telling us something (new location of the file, number of MB left for uploading files, etc.)",{"type":23,"tag":92,"props":311,"children":315},{"className":312,"code":313,"language":314,"meta":8,"style":8},"language-javascript shiki shiki-themes github-light github-dark","$('#uploadForm').on('submit', function(event){\n// Check to see if target is defined before we cancel the default event - this allows us to use the html5 checkValidity function on a form if we so desire, or perform any other checks.\nif ($(this).attr('target') === undefined)\n{\n    event.preventDefault();\n    this.checkValidity(); // See \u003Ca href=\"http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form- checkvalidity\">checkValidity\u003C/a>; for more details. This probably isn't necessary on a file upload, but might be desirable for other form submissions.\n$.transparentSubmit({\n    dataType:'json',\n    form:this\n}).done(function(response){\n// Woo, completed successfully! Do something with the response.\n    console.log(response);\n}).fail(function(e){\n// Aww, our call failed. :( Do something with the failure message.\n    console.log(e);\n});\n}\n});\n","javascript",[316],{"type":23,"tag":99,"props":317,"children":318},{"__ignoreMap":8},[319,382,391,456,464,483,512,531,550,564,599,608,627,661,670,687,696,705],{"type":23,"tag":103,"props":320,"children":321},{"class":105,"line":106},[322,327,332,337,342,347,351,356,361,367,371,377],{"type":23,"tag":103,"props":323,"children":324},{"style":122},[325],{"type":28,"value":326},"$",{"type":23,"tag":103,"props":328,"children":329},{"style":110},[330],{"type":28,"value":331},"(",{"type":23,"tag":103,"props":333,"children":334},{"style":133},[335],{"type":28,"value":336},"'#uploadForm'",{"type":23,"tag":103,"props":338,"children":339},{"style":110},[340],{"type":28,"value":341},").",{"type":23,"tag":103,"props":343,"children":344},{"style":122},[345],{"type":28,"value":346},"on",{"type":23,"tag":103,"props":348,"children":349},{"style":110},[350],{"type":28,"value":331},{"type":23,"tag":103,"props":352,"children":353},{"style":133},[354],{"type":28,"value":355},"'submit'",{"type":23,"tag":103,"props":357,"children":358},{"style":110},[359],{"type":28,"value":360},", ",{"type":23,"tag":103,"props":362,"children":364},{"style":363},"--shiki-default:#D73A49;--shiki-dark:#F97583",[365],{"type":28,"value":366},"function",{"type":23,"tag":103,"props":368,"children":369},{"style":110},[370],{"type":28,"value":331},{"type":23,"tag":103,"props":372,"children":374},{"style":373},"--shiki-default:#E36209;--shiki-dark:#FFAB70",[375],{"type":28,"value":376},"event",{"type":23,"tag":103,"props":378,"children":379},{"style":110},[380],{"type":28,"value":381},"){\n",{"type":23,"tag":103,"props":383,"children":384},{"class":105,"line":186},[385],{"type":23,"tag":103,"props":386,"children":388},{"style":387},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[389],{"type":28,"value":390},"// Check to see if target is defined before we cancel the default event - this allows us to use the html5 checkValidity function on a form if we so desire, or perform any other checks.\n",{"type":23,"tag":103,"props":392,"children":393},{"class":105,"line":247},[394,399,404,408,412,418,422,427,431,436,441,446,451],{"type":23,"tag":103,"props":395,"children":396},{"style":363},[397],{"type":28,"value":398},"if",{"type":23,"tag":103,"props":400,"children":401},{"style":110},[402],{"type":28,"value":403}," (",{"type":23,"tag":103,"props":405,"children":406},{"style":122},[407],{"type":28,"value":326},{"type":23,"tag":103,"props":409,"children":410},{"style":110},[411],{"type":28,"value":331},{"type":23,"tag":103,"props":413,"children":415},{"style":414},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[416],{"type":28,"value":417},"this",{"type":23,"tag":103,"props":419,"children":420},{"style":110},[421],{"type":28,"value":341},{"type":23,"tag":103,"props":423,"children":424},{"style":122},[425],{"type":28,"value":426},"attr",{"type":23,"tag":103,"props":428,"children":429},{"style":110},[430],{"type":28,"value":331},{"type":23,"tag":103,"props":432,"children":433},{"style":133},[434],{"type":28,"value":435},"'target'",{"type":23,"tag":103,"props":437,"children":438},{"style":110},[439],{"type":28,"value":440},") ",{"type":23,"tag":103,"props":442,"children":443},{"style":363},[444],{"type":28,"value":445},"===",{"type":23,"tag":103,"props":447,"children":448},{"style":414},[449],{"type":28,"value":450}," undefined",{"type":23,"tag":103,"props":452,"children":453},{"style":110},[454],{"type":28,"value":455},")\n",{"type":23,"tag":103,"props":457,"children":458},{"class":105,"line":290},[459],{"type":23,"tag":103,"props":460,"children":461},{"style":110},[462],{"type":28,"value":463},"{\n",{"type":23,"tag":103,"props":465,"children":467},{"class":105,"line":466},5,[468,473,478],{"type":23,"tag":103,"props":469,"children":470},{"style":110},[471],{"type":28,"value":472},"    event.",{"type":23,"tag":103,"props":474,"children":475},{"style":122},[476],{"type":28,"value":477},"preventDefault",{"type":23,"tag":103,"props":479,"children":480},{"style":110},[481],{"type":28,"value":482},"();\n",{"type":23,"tag":103,"props":484,"children":486},{"class":105,"line":485},6,[487,492,497,502,507],{"type":23,"tag":103,"props":488,"children":489},{"style":414},[490],{"type":28,"value":491},"    this",{"type":23,"tag":103,"props":493,"children":494},{"style":110},[495],{"type":28,"value":496},".",{"type":23,"tag":103,"props":498,"children":499},{"style":122},[500],{"type":28,"value":501},"checkValidity",{"type":23,"tag":103,"props":503,"children":504},{"style":110},[505],{"type":28,"value":506},"(); ",{"type":23,"tag":103,"props":508,"children":509},{"style":387},[510],{"type":28,"value":511},"// See \u003Ca href=\"http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form- checkvalidity\">checkValidity\u003C/a>; for more details. This probably isn't necessary on a file upload, but might be desirable for other form submissions.\n",{"type":23,"tag":103,"props":513,"children":515},{"class":105,"line":514},7,[516,521,526],{"type":23,"tag":103,"props":517,"children":518},{"style":110},[519],{"type":28,"value":520},"$.",{"type":23,"tag":103,"props":522,"children":523},{"style":122},[524],{"type":28,"value":525},"transparentSubmit",{"type":23,"tag":103,"props":527,"children":528},{"style":110},[529],{"type":28,"value":530},"({\n",{"type":23,"tag":103,"props":532,"children":534},{"class":105,"line":533},8,[535,540,545],{"type":23,"tag":103,"props":536,"children":537},{"style":110},[538],{"type":28,"value":539},"    dataType:",{"type":23,"tag":103,"props":541,"children":542},{"style":133},[543],{"type":28,"value":544},"'json'",{"type":23,"tag":103,"props":546,"children":547},{"style":110},[548],{"type":28,"value":549},",\n",{"type":23,"tag":103,"props":551,"children":553},{"class":105,"line":552},9,[554,559],{"type":23,"tag":103,"props":555,"children":556},{"style":110},[557],{"type":28,"value":558},"    form:",{"type":23,"tag":103,"props":560,"children":561},{"style":414},[562],{"type":28,"value":563},"this\n",{"type":23,"tag":103,"props":565,"children":567},{"class":105,"line":566},10,[568,573,578,582,586,590,595],{"type":23,"tag":103,"props":569,"children":570},{"style":110},[571],{"type":28,"value":572},"}).",{"type":23,"tag":103,"props":574,"children":575},{"style":122},[576],{"type":28,"value":577},"done",{"type":23,"tag":103,"props":579,"children":580},{"style":110},[581],{"type":28,"value":331},{"type":23,"tag":103,"props":583,"children":584},{"style":363},[585],{"type":28,"value":366},{"type":23,"tag":103,"props":587,"children":588},{"style":110},[589],{"type":28,"value":331},{"type":23,"tag":103,"props":591,"children":592},{"style":373},[593],{"type":28,"value":594},"response",{"type":23,"tag":103,"props":596,"children":597},{"style":110},[598],{"type":28,"value":381},{"type":23,"tag":103,"props":600,"children":602},{"class":105,"line":601},11,[603],{"type":23,"tag":103,"props":604,"children":605},{"style":387},[606],{"type":28,"value":607},"// Woo, completed successfully! Do something with the response.\n",{"type":23,"tag":103,"props":609,"children":611},{"class":105,"line":610},12,[612,617,622],{"type":23,"tag":103,"props":613,"children":614},{"style":110},[615],{"type":28,"value":616},"    console.",{"type":23,"tag":103,"props":618,"children":619},{"style":122},[620],{"type":28,"value":621},"log",{"type":23,"tag":103,"props":623,"children":624},{"style":110},[625],{"type":28,"value":626},"(response);\n",{"type":23,"tag":103,"props":628,"children":630},{"class":105,"line":629},13,[631,635,640,644,648,652,657],{"type":23,"tag":103,"props":632,"children":633},{"style":110},[634],{"type":28,"value":572},{"type":23,"tag":103,"props":636,"children":637},{"style":122},[638],{"type":28,"value":639},"fail",{"type":23,"tag":103,"props":641,"children":642},{"style":110},[643],{"type":28,"value":331},{"type":23,"tag":103,"props":645,"children":646},{"style":363},[647],{"type":28,"value":366},{"type":23,"tag":103,"props":649,"children":650},{"style":110},[651],{"type":28,"value":331},{"type":23,"tag":103,"props":653,"children":654},{"style":373},[655],{"type":28,"value":656},"e",{"type":23,"tag":103,"props":658,"children":659},{"style":110},[660],{"type":28,"value":381},{"type":23,"tag":103,"props":662,"children":664},{"class":105,"line":663},14,[665],{"type":23,"tag":103,"props":666,"children":667},{"style":387},[668],{"type":28,"value":669},"// Aww, our call failed. :( Do something with the failure message.\n",{"type":23,"tag":103,"props":671,"children":673},{"class":105,"line":672},15,[674,678,682],{"type":23,"tag":103,"props":675,"children":676},{"style":110},[677],{"type":28,"value":616},{"type":23,"tag":103,"props":679,"children":680},{"style":122},[681],{"type":28,"value":621},{"type":23,"tag":103,"props":683,"children":684},{"style":110},[685],{"type":28,"value":686},"(e);\n",{"type":23,"tag":103,"props":688,"children":690},{"class":105,"line":689},16,[691],{"type":23,"tag":103,"props":692,"children":693},{"style":110},[694],{"type":28,"value":695},"});\n",{"type":23,"tag":103,"props":697,"children":699},{"class":105,"line":698},17,[700],{"type":23,"tag":103,"props":701,"children":702},{"style":110},[703],{"type":28,"value":704},"}\n",{"type":23,"tag":103,"props":706,"children":708},{"class":105,"line":707},18,[709],{"type":23,"tag":103,"props":710,"children":711},{"style":110},[712],{"type":28,"value":695},{"type":23,"tag":24,"props":714,"children":715},{},[716],{"type":28,"value":717},"Looks pretty simple, right? It's missing something, though - what's this $.transparentSubmit thing? It might look familiar if you're used to $.ajax - we're using the same nice, neat callback style via $.Deferred.",{"type":23,"tag":75,"props":719,"children":721},{"id":720},"aside-deferred",[722],{"type":28,"value":723},"Aside: $.Deferred",{"type":23,"tag":24,"props":725,"children":726},{},[727],{"type":28,"value":728},"jQuery offers us a very powerful tool for perfoming asynchronous calls, following the Promise pattern, in the form of $.Deferred. jQuery's ajax implements deferred as a way of offering us chainable callbacks (in the form of .done on success, .fail on failure, .always no matter the result, as well as waiting on multiple sucessful calls with .when, and chaining calls together with .then).",{"type":23,"tag":24,"props":730,"children":731},{},[732,734,741],{"type":28,"value":733},"This is all kinds of good, and could fill a post on its own (see ",{"type":23,"tag":31,"props":735,"children":738},{"href":736,"rel":737},"http://www.html5rocks.com/en/tutorials/async/deferred/",[35],[739],{"type":28,"value":740},"this post",{"type":28,"value":742}," for example). For now, suffice to say that since we want our transparent form submission to work like an ajax call, it makes perfect sense for it to look and operate like one, too. It opens up neat possibilities - say we need the results of our form submission and a seperate ajax call before we proceed:",{"type":23,"tag":92,"props":744,"children":746},{"className":312,"code":745,"language":314,"meta":8,"style":8},"$.when($('#myForm').transparentSubmit({}), $.ajax({url:'/ajax/page'}))\n.done(function(res1, res2){\n// Do something with the responses from both of our asynch calls\n});\n\n",[747],{"type":23,"tag":99,"props":748,"children":749},{"__ignoreMap":8},[750,812,853,861],{"type":23,"tag":103,"props":751,"children":752},{"class":105,"line":106},[753,757,762,766,770,774,779,783,787,792,797,802,807],{"type":23,"tag":103,"props":754,"children":755},{"style":110},[756],{"type":28,"value":520},{"type":23,"tag":103,"props":758,"children":759},{"style":122},[760],{"type":28,"value":761},"when",{"type":23,"tag":103,"props":763,"children":764},{"style":110},[765],{"type":28,"value":331},{"type":23,"tag":103,"props":767,"children":768},{"style":122},[769],{"type":28,"value":326},{"type":23,"tag":103,"props":771,"children":772},{"style":110},[773],{"type":28,"value":331},{"type":23,"tag":103,"props":775,"children":776},{"style":133},[777],{"type":28,"value":778},"'#myForm'",{"type":23,"tag":103,"props":780,"children":781},{"style":110},[782],{"type":28,"value":341},{"type":23,"tag":103,"props":784,"children":785},{"style":122},[786],{"type":28,"value":525},{"type":23,"tag":103,"props":788,"children":789},{"style":110},[790],{"type":28,"value":791},"({}), $.",{"type":23,"tag":103,"props":793,"children":794},{"style":122},[795],{"type":28,"value":796},"ajax",{"type":23,"tag":103,"props":798,"children":799},{"style":110},[800],{"type":28,"value":801},"({url:",{"type":23,"tag":103,"props":803,"children":804},{"style":133},[805],{"type":28,"value":806},"'/ajax/page'",{"type":23,"tag":103,"props":808,"children":809},{"style":110},[810],{"type":28,"value":811},"}))\n",{"type":23,"tag":103,"props":813,"children":814},{"class":105,"line":186},[815,819,823,827,831,835,840,844,849],{"type":23,"tag":103,"props":816,"children":817},{"style":110},[818],{"type":28,"value":496},{"type":23,"tag":103,"props":820,"children":821},{"style":122},[822],{"type":28,"value":577},{"type":23,"tag":103,"props":824,"children":825},{"style":110},[826],{"type":28,"value":331},{"type":23,"tag":103,"props":828,"children":829},{"style":363},[830],{"type":28,"value":366},{"type":23,"tag":103,"props":832,"children":833},{"style":110},[834],{"type":28,"value":331},{"type":23,"tag":103,"props":836,"children":837},{"style":373},[838],{"type":28,"value":839},"res1",{"type":23,"tag":103,"props":841,"children":842},{"style":110},[843],{"type":28,"value":360},{"type":23,"tag":103,"props":845,"children":846},{"style":373},[847],{"type":28,"value":848},"res2",{"type":23,"tag":103,"props":850,"children":851},{"style":110},[852],{"type":28,"value":381},{"type":23,"tag":103,"props":854,"children":855},{"class":105,"line":247},[856],{"type":23,"tag":103,"props":857,"children":858},{"style":387},[859],{"type":28,"value":860},"// Do something with the responses from both of our asynch calls\n",{"type":23,"tag":103,"props":862,"children":863},{"class":105,"line":290},[864],{"type":23,"tag":103,"props":865,"children":866},{"style":110},[867],{"type":28,"value":695},{"type":23,"tag":24,"props":869,"children":870},{},[871,873,880],{"type":28,"value":872},"See the ",{"type":23,"tag":31,"props":874,"children":877},{"href":875,"rel":876},"http://api.jquery.com/category/deferred-object/",[35],[878],{"type":28,"value":879},"jQuery docs",{"type":28,"value":881}," for more details.",{"type":23,"tag":75,"props":883,"children":885},{"id":884},"breakdown",[886],{"type":28,"value":887},"Breakdown",{"type":23,"tag":24,"props":889,"children":890},{},[891],{"type":28,"value":892},"So just how does this transparentSubmit thing work, then? Let's go through it a few pieces at a time.",{"type":23,"tag":92,"props":894,"children":896},{"className":312,"code":895,"language":314,"meta":8,"style":8},"var defer = $.Deferred(),\noptions = $.extend({\n    dataType:'json'\n}, (options || {})),\nname = 'target-'+Math.random().toString(36).substring(7),\nhiframe = $(''),\nform = $(options.form),\ncleanup = function(){\n    hiframe.remove();\n    delete frames[name];\n};\n",[897],{"type":23,"tag":99,"props":898,"children":899},{"__ignoreMap":8},[900,932,957,969,987,1061,1091,1112,1135,1152,1165],{"type":23,"tag":103,"props":901,"children":902},{"class":105,"line":106},[903,908,913,917,922,927],{"type":23,"tag":103,"props":904,"children":905},{"style":363},[906],{"type":28,"value":907},"var",{"type":23,"tag":103,"props":909,"children":910},{"style":110},[911],{"type":28,"value":912}," defer ",{"type":23,"tag":103,"props":914,"children":915},{"style":363},[916],{"type":28,"value":130},{"type":23,"tag":103,"props":918,"children":919},{"style":110},[920],{"type":28,"value":921}," $.",{"type":23,"tag":103,"props":923,"children":924},{"style":122},[925],{"type":28,"value":926},"Deferred",{"type":23,"tag":103,"props":928,"children":929},{"style":110},[930],{"type":28,"value":931},"(),\n",{"type":23,"tag":103,"props":933,"children":934},{"class":105,"line":186},[935,940,944,948,953],{"type":23,"tag":103,"props":936,"children":937},{"style":110},[938],{"type":28,"value":939},"options ",{"type":23,"tag":103,"props":941,"children":942},{"style":363},[943],{"type":28,"value":130},{"type":23,"tag":103,"props":945,"children":946},{"style":110},[947],{"type":28,"value":921},{"type":23,"tag":103,"props":949,"children":950},{"style":122},[951],{"type":28,"value":952},"extend",{"type":23,"tag":103,"props":954,"children":955},{"style":110},[956],{"type":28,"value":530},{"type":23,"tag":103,"props":958,"children":959},{"class":105,"line":247},[960,964],{"type":23,"tag":103,"props":961,"children":962},{"style":110},[963],{"type":28,"value":539},{"type":23,"tag":103,"props":965,"children":966},{"style":133},[967],{"type":28,"value":968},"'json'\n",{"type":23,"tag":103,"props":970,"children":971},{"class":105,"line":290},[972,977,982],{"type":23,"tag":103,"props":973,"children":974},{"style":110},[975],{"type":28,"value":976},"}, (options ",{"type":23,"tag":103,"props":978,"children":979},{"style":363},[980],{"type":28,"value":981},"||",{"type":23,"tag":103,"props":983,"children":984},{"style":110},[985],{"type":28,"value":986}," {})),\n",{"type":23,"tag":103,"props":988,"children":989},{"class":105,"line":466},[990,995,999,1004,1009,1014,1019,1024,1029,1033,1038,1042,1047,1051,1056],{"type":23,"tag":103,"props":991,"children":992},{"style":110},[993],{"type":28,"value":994},"name ",{"type":23,"tag":103,"props":996,"children":997},{"style":363},[998],{"type":28,"value":130},{"type":23,"tag":103,"props":1000,"children":1001},{"style":133},[1002],{"type":28,"value":1003}," 'target-'",{"type":23,"tag":103,"props":1005,"children":1006},{"style":363},[1007],{"type":28,"value":1008},"+",{"type":23,"tag":103,"props":1010,"children":1011},{"style":110},[1012],{"type":28,"value":1013},"Math.",{"type":23,"tag":103,"props":1015,"children":1016},{"style":122},[1017],{"type":28,"value":1018},"random",{"type":23,"tag":103,"props":1020,"children":1021},{"style":110},[1022],{"type":28,"value":1023},"().",{"type":23,"tag":103,"props":1025,"children":1026},{"style":122},[1027],{"type":28,"value":1028},"toString",{"type":23,"tag":103,"props":1030,"children":1031},{"style":110},[1032],{"type":28,"value":331},{"type":23,"tag":103,"props":1034,"children":1035},{"style":414},[1036],{"type":28,"value":1037},"36",{"type":23,"tag":103,"props":1039,"children":1040},{"style":110},[1041],{"type":28,"value":341},{"type":23,"tag":103,"props":1043,"children":1044},{"style":122},[1045],{"type":28,"value":1046},"substring",{"type":23,"tag":103,"props":1048,"children":1049},{"style":110},[1050],{"type":28,"value":331},{"type":23,"tag":103,"props":1052,"children":1053},{"style":414},[1054],{"type":28,"value":1055},"7",{"type":23,"tag":103,"props":1057,"children":1058},{"style":110},[1059],{"type":28,"value":1060},"),\n",{"type":23,"tag":103,"props":1062,"children":1063},{"class":105,"line":485},[1064,1069,1073,1078,1082,1087],{"type":23,"tag":103,"props":1065,"children":1066},{"style":110},[1067],{"type":28,"value":1068},"hiframe ",{"type":23,"tag":103,"props":1070,"children":1071},{"style":363},[1072],{"type":28,"value":130},{"type":23,"tag":103,"props":1074,"children":1075},{"style":122},[1076],{"type":28,"value":1077}," $",{"type":23,"tag":103,"props":1079,"children":1080},{"style":110},[1081],{"type":28,"value":331},{"type":23,"tag":103,"props":1083,"children":1084},{"style":133},[1085],{"type":28,"value":1086},"''",{"type":23,"tag":103,"props":1088,"children":1089},{"style":110},[1090],{"type":28,"value":1060},{"type":23,"tag":103,"props":1092,"children":1093},{"class":105,"line":514},[1094,1099,1103,1107],{"type":23,"tag":103,"props":1095,"children":1096},{"style":110},[1097],{"type":28,"value":1098},"form ",{"type":23,"tag":103,"props":1100,"children":1101},{"style":363},[1102],{"type":28,"value":130},{"type":23,"tag":103,"props":1104,"children":1105},{"style":122},[1106],{"type":28,"value":1077},{"type":23,"tag":103,"props":1108,"children":1109},{"style":110},[1110],{"type":28,"value":1111},"(options.form),\n",{"type":23,"tag":103,"props":1113,"children":1114},{"class":105,"line":533},[1115,1120,1125,1130],{"type":23,"tag":103,"props":1116,"children":1117},{"style":122},[1118],{"type":28,"value":1119},"cleanup",{"type":23,"tag":103,"props":1121,"children":1122},{"style":363},[1123],{"type":28,"value":1124}," =",{"type":23,"tag":103,"props":1126,"children":1127},{"style":363},[1128],{"type":28,"value":1129}," function",{"type":23,"tag":103,"props":1131,"children":1132},{"style":110},[1133],{"type":28,"value":1134},"(){\n",{"type":23,"tag":103,"props":1136,"children":1137},{"class":105,"line":552},[1138,1143,1148],{"type":23,"tag":103,"props":1139,"children":1140},{"style":110},[1141],{"type":28,"value":1142},"    hiframe.",{"type":23,"tag":103,"props":1144,"children":1145},{"style":122},[1146],{"type":28,"value":1147},"remove",{"type":23,"tag":103,"props":1149,"children":1150},{"style":110},[1151],{"type":28,"value":482},{"type":23,"tag":103,"props":1153,"children":1154},{"class":105,"line":566},[1155,1160],{"type":23,"tag":103,"props":1156,"children":1157},{"style":363},[1158],{"type":28,"value":1159},"    delete",{"type":23,"tag":103,"props":1161,"children":1162},{"style":110},[1163],{"type":28,"value":1164}," frames[name];\n",{"type":23,"tag":103,"props":1166,"children":1167},{"class":105,"line":601},[1168],{"type":23,"tag":103,"props":1169,"children":1170},{"style":110},[1171],{"type":28,"value":1172},"};\n",{"type":23,"tag":24,"props":1174,"children":1175},{},[1176,1178,1184],{"type":28,"value":1177},"At the top we declare our deferred object, get options (which are passed to our plugin function, or else is made an empty object), set a name for the frame, create said iframe, get the form and declare an inline function to do some house-keeping. ",{"type":23,"tag":1179,"props":1180,"children":1181},"strong",{},[1182],{"type":28,"value":1183},"Note",{"type":28,"value":1185},": name is assigned a value from Math.random converted to a string using base 36 (0-9a-z) to generate a 5 letter random string we append to 'target-'. This isn't strictly necessary - originally, using the same name for more than one frame would cause us problems, but this is resolved by the call in cleanup to delete the named frame. I've left it in as a neat little trick that someone might be interested in!",{"type":23,"tag":92,"props":1187,"children":1189},{"className":312,"code":1188,"language":314,"meta":8,"style":8},"if (!form.length || form[0].tagName !== 'FORM')\n{\ndefer.reject(\"No form element specified to submit.\");\nreturn defer.promise();\n}\n\nform.attr('target', name).append(hiframe);\n",[1190],{"type":23,"tag":99,"props":1191,"children":1192},{"__ignoreMap":8},[1193,1253,1260,1287,1309,1316,1325],{"type":23,"tag":103,"props":1194,"children":1195},{"class":105,"line":106},[1196,1200,1204,1209,1214,1219,1224,1229,1234,1239,1244,1249],{"type":23,"tag":103,"props":1197,"children":1198},{"style":363},[1199],{"type":28,"value":398},{"type":23,"tag":103,"props":1201,"children":1202},{"style":110},[1203],{"type":28,"value":403},{"type":23,"tag":103,"props":1205,"children":1206},{"style":363},[1207],{"type":28,"value":1208},"!",{"type":23,"tag":103,"props":1210,"children":1211},{"style":110},[1212],{"type":28,"value":1213},"form.",{"type":23,"tag":103,"props":1215,"children":1216},{"style":414},[1217],{"type":28,"value":1218},"length",{"type":23,"tag":103,"props":1220,"children":1221},{"style":363},[1222],{"type":28,"value":1223}," ||",{"type":23,"tag":103,"props":1225,"children":1226},{"style":110},[1227],{"type":28,"value":1228}," form[",{"type":23,"tag":103,"props":1230,"children":1231},{"style":414},[1232],{"type":28,"value":1233},"0",{"type":23,"tag":103,"props":1235,"children":1236},{"style":110},[1237],{"type":28,"value":1238},"].tagName ",{"type":23,"tag":103,"props":1240,"children":1241},{"style":363},[1242],{"type":28,"value":1243},"!==",{"type":23,"tag":103,"props":1245,"children":1246},{"style":133},[1247],{"type":28,"value":1248}," 'FORM'",{"type":23,"tag":103,"props":1250,"children":1251},{"style":110},[1252],{"type":28,"value":455},{"type":23,"tag":103,"props":1254,"children":1255},{"class":105,"line":186},[1256],{"type":23,"tag":103,"props":1257,"children":1258},{"style":110},[1259],{"type":28,"value":463},{"type":23,"tag":103,"props":1261,"children":1262},{"class":105,"line":247},[1263,1268,1273,1277,1282],{"type":23,"tag":103,"props":1264,"children":1265},{"style":110},[1266],{"type":28,"value":1267},"defer.",{"type":23,"tag":103,"props":1269,"children":1270},{"style":122},[1271],{"type":28,"value":1272},"reject",{"type":23,"tag":103,"props":1274,"children":1275},{"style":110},[1276],{"type":28,"value":331},{"type":23,"tag":103,"props":1278,"children":1279},{"style":133},[1280],{"type":28,"value":1281},"\"No form element specified to submit.\"",{"type":23,"tag":103,"props":1283,"children":1284},{"style":110},[1285],{"type":28,"value":1286},");\n",{"type":23,"tag":103,"props":1288,"children":1289},{"class":105,"line":290},[1290,1295,1300,1305],{"type":23,"tag":103,"props":1291,"children":1292},{"style":363},[1293],{"type":28,"value":1294},"return",{"type":23,"tag":103,"props":1296,"children":1297},{"style":110},[1298],{"type":28,"value":1299}," defer.",{"type":23,"tag":103,"props":1301,"children":1302},{"style":122},[1303],{"type":28,"value":1304},"promise",{"type":23,"tag":103,"props":1306,"children":1307},{"style":110},[1308],{"type":28,"value":482},{"type":23,"tag":103,"props":1310,"children":1311},{"class":105,"line":466},[1312],{"type":23,"tag":103,"props":1313,"children":1314},{"style":110},[1315],{"type":28,"value":704},{"type":23,"tag":103,"props":1317,"children":1318},{"class":105,"line":485},[1319],{"type":23,"tag":103,"props":1320,"children":1322},{"emptyLinePlaceholder":1321},true,[1323],{"type":28,"value":1324},"\n",{"type":23,"tag":103,"props":1326,"children":1327},{"class":105,"line":514},[1328,1332,1336,1340,1344,1349,1354],{"type":23,"tag":103,"props":1329,"children":1330},{"style":110},[1331],{"type":28,"value":1213},{"type":23,"tag":103,"props":1333,"children":1334},{"style":122},[1335],{"type":28,"value":426},{"type":23,"tag":103,"props":1337,"children":1338},{"style":110},[1339],{"type":28,"value":331},{"type":23,"tag":103,"props":1341,"children":1342},{"style":133},[1343],{"type":28,"value":435},{"type":23,"tag":103,"props":1345,"children":1346},{"style":110},[1347],{"type":28,"value":1348},", name).",{"type":23,"tag":103,"props":1350,"children":1351},{"style":122},[1352],{"type":28,"value":1353},"append",{"type":23,"tag":103,"props":1355,"children":1356},{"style":110},[1357],{"type":28,"value":1358},"(hiframe);\n",{"type":23,"tag":24,"props":1360,"children":1361},{},[1362],{"type":28,"value":1363},"We make sure that form is in the DOM and is a form, or else call reject on our deferred object (triggering any .fail attached to our promise). Then, we set the target attribute on the form to point at our iframe, and append the iframe to the form.",{"type":23,"tag":92,"props":1365,"children":1367},{"className":312,"code":1366,"language":314,"meta":8,"style":8},"hiframe.on('load', function(){\nvar res;\n\nform.removeAttr('target');\n\ntry{\nif (options.dataType.indexOf('json') != -1)\n{\n    res = frames[name].document.getElementsByTagName(\"pre\")[0].innerHTML;\n}\nelse\n{\n    res = frames[name].document.getElementsByTagName('body')[0].innerHTML;\n}\n}catch(e){\n    // Failed to receive anything in the body of the frame\n    cleanup();\n    defer.reject(\"Failed to receive response in form target \"+name+\": \"+e.message);\n    return;\n}\ncleanup();\n",[1368],{"type":23,"tag":99,"props":1369,"children":1370},{"__ignoreMap":8},[1371,1404,1416,1423,1447,1454,1466,1514,1521,1566,1573,1581,1588,1628,1635,1653,1661,1673,1721,1735,1743],{"type":23,"tag":103,"props":1372,"children":1373},{"class":105,"line":106},[1374,1379,1383,1387,1392,1396,1400],{"type":23,"tag":103,"props":1375,"children":1376},{"style":110},[1377],{"type":28,"value":1378},"hiframe.",{"type":23,"tag":103,"props":1380,"children":1381},{"style":122},[1382],{"type":28,"value":346},{"type":23,"tag":103,"props":1384,"children":1385},{"style":110},[1386],{"type":28,"value":331},{"type":23,"tag":103,"props":1388,"children":1389},{"style":133},[1390],{"type":28,"value":1391},"'load'",{"type":23,"tag":103,"props":1393,"children":1394},{"style":110},[1395],{"type":28,"value":360},{"type":23,"tag":103,"props":1397,"children":1398},{"style":363},[1399],{"type":28,"value":366},{"type":23,"tag":103,"props":1401,"children":1402},{"style":110},[1403],{"type":28,"value":1134},{"type":23,"tag":103,"props":1405,"children":1406},{"class":105,"line":186},[1407,1411],{"type":23,"tag":103,"props":1408,"children":1409},{"style":363},[1410],{"type":28,"value":907},{"type":23,"tag":103,"props":1412,"children":1413},{"style":110},[1414],{"type":28,"value":1415}," res;\n",{"type":23,"tag":103,"props":1417,"children":1418},{"class":105,"line":247},[1419],{"type":23,"tag":103,"props":1420,"children":1421},{"emptyLinePlaceholder":1321},[1422],{"type":28,"value":1324},{"type":23,"tag":103,"props":1424,"children":1425},{"class":105,"line":290},[1426,1430,1435,1439,1443],{"type":23,"tag":103,"props":1427,"children":1428},{"style":110},[1429],{"type":28,"value":1213},{"type":23,"tag":103,"props":1431,"children":1432},{"style":122},[1433],{"type":28,"value":1434},"removeAttr",{"type":23,"tag":103,"props":1436,"children":1437},{"style":110},[1438],{"type":28,"value":331},{"type":23,"tag":103,"props":1440,"children":1441},{"style":133},[1442],{"type":28,"value":435},{"type":23,"tag":103,"props":1444,"children":1445},{"style":110},[1446],{"type":28,"value":1286},{"type":23,"tag":103,"props":1448,"children":1449},{"class":105,"line":466},[1450],{"type":23,"tag":103,"props":1451,"children":1452},{"emptyLinePlaceholder":1321},[1453],{"type":28,"value":1324},{"type":23,"tag":103,"props":1455,"children":1456},{"class":105,"line":485},[1457,1462],{"type":23,"tag":103,"props":1458,"children":1459},{"style":363},[1460],{"type":28,"value":1461},"try",{"type":23,"tag":103,"props":1463,"children":1464},{"style":110},[1465],{"type":28,"value":463},{"type":23,"tag":103,"props":1467,"children":1468},{"class":105,"line":514},[1469,1473,1478,1483,1487,1491,1495,1500,1505,1510],{"type":23,"tag":103,"props":1470,"children":1471},{"style":363},[1472],{"type":28,"value":398},{"type":23,"tag":103,"props":1474,"children":1475},{"style":110},[1476],{"type":28,"value":1477}," (options.dataType.",{"type":23,"tag":103,"props":1479,"children":1480},{"style":122},[1481],{"type":28,"value":1482},"indexOf",{"type":23,"tag":103,"props":1484,"children":1485},{"style":110},[1486],{"type":28,"value":331},{"type":23,"tag":103,"props":1488,"children":1489},{"style":133},[1490],{"type":28,"value":544},{"type":23,"tag":103,"props":1492,"children":1493},{"style":110},[1494],{"type":28,"value":440},{"type":23,"tag":103,"props":1496,"children":1497},{"style":363},[1498],{"type":28,"value":1499},"!=",{"type":23,"tag":103,"props":1501,"children":1502},{"style":363},[1503],{"type":28,"value":1504}," -",{"type":23,"tag":103,"props":1506,"children":1507},{"style":414},[1508],{"type":28,"value":1509},"1",{"type":23,"tag":103,"props":1511,"children":1512},{"style":110},[1513],{"type":28,"value":455},{"type":23,"tag":103,"props":1515,"children":1516},{"class":105,"line":533},[1517],{"type":23,"tag":103,"props":1518,"children":1519},{"style":110},[1520],{"type":28,"value":463},{"type":23,"tag":103,"props":1522,"children":1523},{"class":105,"line":552},[1524,1529,1533,1538,1543,1547,1552,1557,1561],{"type":23,"tag":103,"props":1525,"children":1526},{"style":110},[1527],{"type":28,"value":1528},"    res ",{"type":23,"tag":103,"props":1530,"children":1531},{"style":363},[1532],{"type":28,"value":130},{"type":23,"tag":103,"props":1534,"children":1535},{"style":110},[1536],{"type":28,"value":1537}," frames[name].document.",{"type":23,"tag":103,"props":1539,"children":1540},{"style":122},[1541],{"type":28,"value":1542},"getElementsByTagName",{"type":23,"tag":103,"props":1544,"children":1545},{"style":110},[1546],{"type":28,"value":331},{"type":23,"tag":103,"props":1548,"children":1549},{"style":133},[1550],{"type":28,"value":1551},"\"pre\"",{"type":23,"tag":103,"props":1553,"children":1554},{"style":110},[1555],{"type":28,"value":1556},")[",{"type":23,"tag":103,"props":1558,"children":1559},{"style":414},[1560],{"type":28,"value":1233},{"type":23,"tag":103,"props":1562,"children":1563},{"style":110},[1564],{"type":28,"value":1565},"].innerHTML;\n",{"type":23,"tag":103,"props":1567,"children":1568},{"class":105,"line":566},[1569],{"type":23,"tag":103,"props":1570,"children":1571},{"style":110},[1572],{"type":28,"value":704},{"type":23,"tag":103,"props":1574,"children":1575},{"class":105,"line":601},[1576],{"type":23,"tag":103,"props":1577,"children":1578},{"style":363},[1579],{"type":28,"value":1580},"else\n",{"type":23,"tag":103,"props":1582,"children":1583},{"class":105,"line":610},[1584],{"type":23,"tag":103,"props":1585,"children":1586},{"style":110},[1587],{"type":28,"value":463},{"type":23,"tag":103,"props":1589,"children":1590},{"class":105,"line":629},[1591,1595,1599,1603,1607,1611,1616,1620,1624],{"type":23,"tag":103,"props":1592,"children":1593},{"style":110},[1594],{"type":28,"value":1528},{"type":23,"tag":103,"props":1596,"children":1597},{"style":363},[1598],{"type":28,"value":130},{"type":23,"tag":103,"props":1600,"children":1601},{"style":110},[1602],{"type":28,"value":1537},{"type":23,"tag":103,"props":1604,"children":1605},{"style":122},[1606],{"type":28,"value":1542},{"type":23,"tag":103,"props":1608,"children":1609},{"style":110},[1610],{"type":28,"value":331},{"type":23,"tag":103,"props":1612,"children":1613},{"style":133},[1614],{"type":28,"value":1615},"'body'",{"type":23,"tag":103,"props":1617,"children":1618},{"style":110},[1619],{"type":28,"value":1556},{"type":23,"tag":103,"props":1621,"children":1622},{"style":414},[1623],{"type":28,"value":1233},{"type":23,"tag":103,"props":1625,"children":1626},{"style":110},[1627],{"type":28,"value":1565},{"type":23,"tag":103,"props":1629,"children":1630},{"class":105,"line":663},[1631],{"type":23,"tag":103,"props":1632,"children":1633},{"style":110},[1634],{"type":28,"value":704},{"type":23,"tag":103,"props":1636,"children":1637},{"class":105,"line":672},[1638,1643,1648],{"type":23,"tag":103,"props":1639,"children":1640},{"style":110},[1641],{"type":28,"value":1642},"}",{"type":23,"tag":103,"props":1644,"children":1645},{"style":363},[1646],{"type":28,"value":1647},"catch",{"type":23,"tag":103,"props":1649,"children":1650},{"style":110},[1651],{"type":28,"value":1652},"(e){\n",{"type":23,"tag":103,"props":1654,"children":1655},{"class":105,"line":689},[1656],{"type":23,"tag":103,"props":1657,"children":1658},{"style":387},[1659],{"type":28,"value":1660},"    // Failed to receive anything in the body of the frame\n",{"type":23,"tag":103,"props":1662,"children":1663},{"class":105,"line":698},[1664,1669],{"type":23,"tag":103,"props":1665,"children":1666},{"style":122},[1667],{"type":28,"value":1668},"    cleanup",{"type":23,"tag":103,"props":1670,"children":1671},{"style":110},[1672],{"type":28,"value":482},{"type":23,"tag":103,"props":1674,"children":1675},{"class":105,"line":707},[1676,1681,1685,1689,1694,1698,1703,1707,1712,1716],{"type":23,"tag":103,"props":1677,"children":1678},{"style":110},[1679],{"type":28,"value":1680},"    defer.",{"type":23,"tag":103,"props":1682,"children":1683},{"style":122},[1684],{"type":28,"value":1272},{"type":23,"tag":103,"props":1686,"children":1687},{"style":110},[1688],{"type":28,"value":331},{"type":23,"tag":103,"props":1690,"children":1691},{"style":133},[1692],{"type":28,"value":1693},"\"Failed to receive response in form target \"",{"type":23,"tag":103,"props":1695,"children":1696},{"style":363},[1697],{"type":28,"value":1008},{"type":23,"tag":103,"props":1699,"children":1700},{"style":110},[1701],{"type":28,"value":1702},"name",{"type":23,"tag":103,"props":1704,"children":1705},{"style":363},[1706],{"type":28,"value":1008},{"type":23,"tag":103,"props":1708,"children":1709},{"style":133},[1710],{"type":28,"value":1711},"\": \"",{"type":23,"tag":103,"props":1713,"children":1714},{"style":363},[1715],{"type":28,"value":1008},{"type":23,"tag":103,"props":1717,"children":1718},{"style":110},[1719],{"type":28,"value":1720},"e.message);\n",{"type":23,"tag":103,"props":1722,"children":1724},{"class":105,"line":1723},19,[1725,1730],{"type":23,"tag":103,"props":1726,"children":1727},{"style":363},[1728],{"type":28,"value":1729},"    return",{"type":23,"tag":103,"props":1731,"children":1732},{"style":110},[1733],{"type":28,"value":1734},";\n",{"type":23,"tag":103,"props":1736,"children":1738},{"class":105,"line":1737},20,[1739],{"type":23,"tag":103,"props":1740,"children":1741},{"style":110},[1742],{"type":28,"value":704},{"type":23,"tag":103,"props":1744,"children":1746},{"class":105,"line":1745},21,[1747,1751],{"type":23,"tag":103,"props":1748,"children":1749},{"style":122},[1750],{"type":28,"value":1119},{"type":23,"tag":103,"props":1752,"children":1753},{"style":110},[1754],{"type":28,"value":482},{"type":23,"tag":24,"props":1756,"children":1757},{},[1758],{"type":28,"value":1759},"Now, we add a listener to the 'load' event for the iframe. When that event is triggered, after the upload is finished, or the form has been successfully submitted, we remove the target from the form (so its ready to be checked previous to submission again), and try and get the content returned from the server we submitted to that will have been loaded into the iframe, based on the dataType we set as an option when calling $.transparentSubmit.",{"type":23,"tag":92,"props":1761,"children":1763},{"className":312,"code":1762,"language":314,"meta":8,"style":8},"if (options.dataType.indexOf('json') != -1)\n{\ntry{\n    res = $.parseJSON(res);\n}catch(e){\n    defer.reject(\"Failed to parse response into JSON: \"+e.message);\n    return;\n}\n}\nelse if (options.dataType.indexOf('html') != -1)\n{\nres = $.parseHTML(res);\n}\ndefer.resolve(res);\n});\n\nform.submit();\n\nreturn defer.promise();\n",[1764],{"type":23,"tag":99,"props":1765,"children":1766},{"__ignoreMap":8},[1767,1810,1817,1828,1853,1868,1896,1907,1914,1921,1971,1978,2003,2010,2026,2033,2040,2056,2063],{"type":23,"tag":103,"props":1768,"children":1769},{"class":105,"line":106},[1770,1774,1778,1782,1786,1790,1794,1798,1802,1806],{"type":23,"tag":103,"props":1771,"children":1772},{"style":363},[1773],{"type":28,"value":398},{"type":23,"tag":103,"props":1775,"children":1776},{"style":110},[1777],{"type":28,"value":1477},{"type":23,"tag":103,"props":1779,"children":1780},{"style":122},[1781],{"type":28,"value":1482},{"type":23,"tag":103,"props":1783,"children":1784},{"style":110},[1785],{"type":28,"value":331},{"type":23,"tag":103,"props":1787,"children":1788},{"style":133},[1789],{"type":28,"value":544},{"type":23,"tag":103,"props":1791,"children":1792},{"style":110},[1793],{"type":28,"value":440},{"type":23,"tag":103,"props":1795,"children":1796},{"style":363},[1797],{"type":28,"value":1499},{"type":23,"tag":103,"props":1799,"children":1800},{"style":363},[1801],{"type":28,"value":1504},{"type":23,"tag":103,"props":1803,"children":1804},{"style":414},[1805],{"type":28,"value":1509},{"type":23,"tag":103,"props":1807,"children":1808},{"style":110},[1809],{"type":28,"value":455},{"type":23,"tag":103,"props":1811,"children":1812},{"class":105,"line":186},[1813],{"type":23,"tag":103,"props":1814,"children":1815},{"style":110},[1816],{"type":28,"value":463},{"type":23,"tag":103,"props":1818,"children":1819},{"class":105,"line":247},[1820,1824],{"type":23,"tag":103,"props":1821,"children":1822},{"style":363},[1823],{"type":28,"value":1461},{"type":23,"tag":103,"props":1825,"children":1826},{"style":110},[1827],{"type":28,"value":463},{"type":23,"tag":103,"props":1829,"children":1830},{"class":105,"line":290},[1831,1835,1839,1843,1848],{"type":23,"tag":103,"props":1832,"children":1833},{"style":110},[1834],{"type":28,"value":1528},{"type":23,"tag":103,"props":1836,"children":1837},{"style":363},[1838],{"type":28,"value":130},{"type":23,"tag":103,"props":1840,"children":1841},{"style":110},[1842],{"type":28,"value":921},{"type":23,"tag":103,"props":1844,"children":1845},{"style":122},[1846],{"type":28,"value":1847},"parseJSON",{"type":23,"tag":103,"props":1849,"children":1850},{"style":110},[1851],{"type":28,"value":1852},"(res);\n",{"type":23,"tag":103,"props":1854,"children":1855},{"class":105,"line":466},[1856,1860,1864],{"type":23,"tag":103,"props":1857,"children":1858},{"style":110},[1859],{"type":28,"value":1642},{"type":23,"tag":103,"props":1861,"children":1862},{"style":363},[1863],{"type":28,"value":1647},{"type":23,"tag":103,"props":1865,"children":1866},{"style":110},[1867],{"type":28,"value":1652},{"type":23,"tag":103,"props":1869,"children":1870},{"class":105,"line":485},[1871,1875,1879,1883,1888,1892],{"type":23,"tag":103,"props":1872,"children":1873},{"style":110},[1874],{"type":28,"value":1680},{"type":23,"tag":103,"props":1876,"children":1877},{"style":122},[1878],{"type":28,"value":1272},{"type":23,"tag":103,"props":1880,"children":1881},{"style":110},[1882],{"type":28,"value":331},{"type":23,"tag":103,"props":1884,"children":1885},{"style":133},[1886],{"type":28,"value":1887},"\"Failed to parse response into JSON: \"",{"type":23,"tag":103,"props":1889,"children":1890},{"style":363},[1891],{"type":28,"value":1008},{"type":23,"tag":103,"props":1893,"children":1894},{"style":110},[1895],{"type":28,"value":1720},{"type":23,"tag":103,"props":1897,"children":1898},{"class":105,"line":514},[1899,1903],{"type":23,"tag":103,"props":1900,"children":1901},{"style":363},[1902],{"type":28,"value":1729},{"type":23,"tag":103,"props":1904,"children":1905},{"style":110},[1906],{"type":28,"value":1734},{"type":23,"tag":103,"props":1908,"children":1909},{"class":105,"line":533},[1910],{"type":23,"tag":103,"props":1911,"children":1912},{"style":110},[1913],{"type":28,"value":704},{"type":23,"tag":103,"props":1915,"children":1916},{"class":105,"line":552},[1917],{"type":23,"tag":103,"props":1918,"children":1919},{"style":110},[1920],{"type":28,"value":704},{"type":23,"tag":103,"props":1922,"children":1923},{"class":105,"line":566},[1924,1929,1934,1938,1942,1946,1951,1955,1959,1963,1967],{"type":23,"tag":103,"props":1925,"children":1926},{"style":363},[1927],{"type":28,"value":1928},"else",{"type":23,"tag":103,"props":1930,"children":1931},{"style":363},[1932],{"type":28,"value":1933}," if",{"type":23,"tag":103,"props":1935,"children":1936},{"style":110},[1937],{"type":28,"value":1477},{"type":23,"tag":103,"props":1939,"children":1940},{"style":122},[1941],{"type":28,"value":1482},{"type":23,"tag":103,"props":1943,"children":1944},{"style":110},[1945],{"type":28,"value":331},{"type":23,"tag":103,"props":1947,"children":1948},{"style":133},[1949],{"type":28,"value":1950},"'html'",{"type":23,"tag":103,"props":1952,"children":1953},{"style":110},[1954],{"type":28,"value":440},{"type":23,"tag":103,"props":1956,"children":1957},{"style":363},[1958],{"type":28,"value":1499},{"type":23,"tag":103,"props":1960,"children":1961},{"style":363},[1962],{"type":28,"value":1504},{"type":23,"tag":103,"props":1964,"children":1965},{"style":414},[1966],{"type":28,"value":1509},{"type":23,"tag":103,"props":1968,"children":1969},{"style":110},[1970],{"type":28,"value":455},{"type":23,"tag":103,"props":1972,"children":1973},{"class":105,"line":601},[1974],{"type":23,"tag":103,"props":1975,"children":1976},{"style":110},[1977],{"type":28,"value":463},{"type":23,"tag":103,"props":1979,"children":1980},{"class":105,"line":610},[1981,1986,1990,1994,1999],{"type":23,"tag":103,"props":1982,"children":1983},{"style":110},[1984],{"type":28,"value":1985},"res ",{"type":23,"tag":103,"props":1987,"children":1988},{"style":363},[1989],{"type":28,"value":130},{"type":23,"tag":103,"props":1991,"children":1992},{"style":110},[1993],{"type":28,"value":921},{"type":23,"tag":103,"props":1995,"children":1996},{"style":122},[1997],{"type":28,"value":1998},"parseHTML",{"type":23,"tag":103,"props":2000,"children":2001},{"style":110},[2002],{"type":28,"value":1852},{"type":23,"tag":103,"props":2004,"children":2005},{"class":105,"line":629},[2006],{"type":23,"tag":103,"props":2007,"children":2008},{"style":110},[2009],{"type":28,"value":704},{"type":23,"tag":103,"props":2011,"children":2012},{"class":105,"line":663},[2013,2017,2022],{"type":23,"tag":103,"props":2014,"children":2015},{"style":110},[2016],{"type":28,"value":1267},{"type":23,"tag":103,"props":2018,"children":2019},{"style":122},[2020],{"type":28,"value":2021},"resolve",{"type":23,"tag":103,"props":2023,"children":2024},{"style":110},[2025],{"type":28,"value":1852},{"type":23,"tag":103,"props":2027,"children":2028},{"class":105,"line":672},[2029],{"type":23,"tag":103,"props":2030,"children":2031},{"style":110},[2032],{"type":28,"value":695},{"type":23,"tag":103,"props":2034,"children":2035},{"class":105,"line":689},[2036],{"type":23,"tag":103,"props":2037,"children":2038},{"emptyLinePlaceholder":1321},[2039],{"type":28,"value":1324},{"type":23,"tag":103,"props":2041,"children":2042},{"class":105,"line":698},[2043,2047,2052],{"type":23,"tag":103,"props":2044,"children":2045},{"style":110},[2046],{"type":28,"value":1213},{"type":23,"tag":103,"props":2048,"children":2049},{"style":122},[2050],{"type":28,"value":2051},"submit",{"type":23,"tag":103,"props":2053,"children":2054},{"style":110},[2055],{"type":28,"value":482},{"type":23,"tag":103,"props":2057,"children":2058},{"class":105,"line":707},[2059],{"type":23,"tag":103,"props":2060,"children":2061},{"emptyLinePlaceholder":1321},[2062],{"type":28,"value":1324},{"type":23,"tag":103,"props":2064,"children":2065},{"class":105,"line":1723},[2066,2070,2074,2078],{"type":23,"tag":103,"props":2067,"children":2068},{"style":363},[2069],{"type":28,"value":1294},{"type":23,"tag":103,"props":2071,"children":2072},{"style":110},[2073],{"type":28,"value":1299},{"type":23,"tag":103,"props":2075,"children":2076},{"style":122},[2077],{"type":28,"value":1304},{"type":23,"tag":103,"props":2079,"children":2080},{"style":110},[2081],{"type":28,"value":482},{"type":23,"tag":24,"props":2083,"children":2084},{},[2085],{"type":28,"value":2086},"If we want to return json or html, then we try and parse it as such. Either way, we can now resolve our promise and return the response. Outside of the load event, after its declared, we make our call to submit the form, which will now target the iframe and submit seamlessly. Finally, we return our deferred promise.",{"type":23,"tag":75,"props":2088,"children":2090},{"id":2089},"aside-other-uses",[2091],{"type":28,"value":2092},"Aside: Other Uses",{"type":23,"tag":24,"props":2094,"children":2095},{},[2096],{"type":28,"value":2097},"As mentioned previously, all of this is going away as far as file uploading is concerned as soon as all major browsers (and all the legacy browsers we have to support as web developers) gain support for XMLHttpRequest level 2 and the File API. This technique is useful for more than just file uploading, however. In a project I worked on recently, we wanted to submit billing details to a payment gateway without needing to pass said details through our server, and with the gateway only accepting form submission. This technique was the perfect way to submit said details directly to them, without the negative user experience that would normally come with a form submission.",{"type":23,"tag":75,"props":2099,"children":2101},{"id":2100},"the-gist",[2102],{"type":28,"value":2103},"The Gist",{"type":23,"tag":24,"props":2105,"children":2106},{},[2107],{"type":28,"value":2108},"This is a neat technique which I suspect I will still be getting some use out of even after all the major browsers support ajax file uploading. Therefore, I wrote a little jquery plugin (the aforementioned $.transparentSubmit). Feel free to use it, add to it, deride it mercilessly, etc.",{"type":23,"tag":92,"props":2110,"children":2112},{"className":312,"code":2111,"language":314,"meta":8,"style":8},"/**\n * jQuery plugin for transparent submission of a form using an $.ajax-like interface.\n * Usage Examples:\n * $.transparentSubmit({dataType:'json', form:$('#myForm')})\n * $('#myForm').transparentSubmit({dataType:'html'})\n * Supports Deferred (.done, .fail, .when, etc.)\n */\n(function($){\n    $.transparentSubmit = function(options){\n        var defer = $.Deferred(), // Deferred object whose promise we will hook into when adding .done, etc to calls\n            options = $.extend({\n                dataType:'json'\n            }, (options || {})), // coerce options into being an object, extend defaults\n            name = 'target-'+Math.random().toString(36).substring(7), // assign a psuedo-random name to the frame\n            hiframe = $('\u003Ciframe id=\"'+name+'\" name=\"'+name+'\" src=\"about:blank\" ' +\n                'style=\"width:0;height:0;border:0px solid #fff;\">\u003C/iframe>'), // create invisible iframe - NOT display:none\n            form = $(options.form), // get form, make sure its a jquery object\n            cleanup = function(){\n                hiframe.remove();\n                delete frames[name];\n            }; // clean iframe away when we're finished with it\n        if (!form.length || form[0].tagName !== 'FORM'){ // if we don't have a form to submit, reject (call .fail)\n            defer.reject(\"No form element specified to submit.\");\n            return defer.promise();\n        }\n\n        form.attr('target', name).append(hiframe); // set target of form to iframe, and append iframe to the form\n\n        // On load event, grab and parse the contents of the iframe\n        hiframe.on('load', function(){\n            var res;\n\n            form.removeAttr('target');\n\n            try{\n                if (options.dataType.indexOf('json') != -1)\n                { // browsers will wrap a json return with \u003Cpre>\u003C/pre>\n                    res = frames[name].document.getElementsByTagName(\"pre\")[0].innerHTML;\n                }\n                else\n                {\n                    res = frames[name].document.getElementsByTagName('body')[0].innerHTML;\n                }\n            }catch(e){\n                // Failed to receive anything in the body of the frame\n                cleanup();\n                defer.reject(\"Failed to receive response in form target \"+name+\": \"+e.message);\n                return;\n            }\n\n            cleanup();\n\n            if (options.dataType.indexOf('json') != -1)\n            {\n                try{\n                    res = $.parseJSON(res);\n                }catch(e){\n                    defer.reject(\"Failed to parse response into JSON: \"+e.message);\n                    return;\n                }\n            }\n            else if (options.dataType.indexOf('html') != -1)\n            {\n                res = $.parseHTML(res);\n            }\n\n            defer.resolve(res); // Finished (call .done)\n        });\n\n        form.submit();\n\n        return defer.promise();\n    }\n\n/*\n* This allows us the option to call $('#myForm').transparentSubmit - as you can see, its just a slightly different form \n* to the plugin, which calls our transparentSubmit function as defined above.\n*/\n    $.fn.transparentSubmit = function(options){\n        options.form = this;\n        return $.transparentSubmit(options);\n    };\n})(jQuery);\n",[2113],{"type":23,"tag":99,"props":2114,"children":2115},{"__ignoreMap":8},[2116,2124,2132,2140,2148,2156,2164,2172,2195,2228,2262,2286,2298,2320,2390,2454,2471,2497,2517,2533,2545,2558,2617,2642,2663,2672,2680,2719,2727,2736,2769,2782,2790,2815,2823,2836,2881,2895,2936,2945,2954,2963,3003,3011,3028,3037,3050,3095,3108,3117,3125,3137,3145,3190,3199,3212,3236,3253,3282,3295,3303,3311,3360,3368,3393,3401,3409,3431,3440,3448,3464,3472,3493,3502,3510,3519,3528,3537,3546,3579,3601,3622,3631],{"type":23,"tag":103,"props":2117,"children":2118},{"class":105,"line":106},[2119],{"type":23,"tag":103,"props":2120,"children":2121},{"style":387},[2122],{"type":28,"value":2123},"/**\n",{"type":23,"tag":103,"props":2125,"children":2126},{"class":105,"line":186},[2127],{"type":23,"tag":103,"props":2128,"children":2129},{"style":387},[2130],{"type":28,"value":2131}," * jQuery plugin for transparent submission of a form using an $.ajax-like interface.\n",{"type":23,"tag":103,"props":2133,"children":2134},{"class":105,"line":247},[2135],{"type":23,"tag":103,"props":2136,"children":2137},{"style":387},[2138],{"type":28,"value":2139}," * Usage Examples:\n",{"type":23,"tag":103,"props":2141,"children":2142},{"class":105,"line":290},[2143],{"type":23,"tag":103,"props":2144,"children":2145},{"style":387},[2146],{"type":28,"value":2147}," * $.transparentSubmit({dataType:'json', form:$('#myForm')})\n",{"type":23,"tag":103,"props":2149,"children":2150},{"class":105,"line":466},[2151],{"type":23,"tag":103,"props":2152,"children":2153},{"style":387},[2154],{"type":28,"value":2155}," * $('#myForm').transparentSubmit({dataType:'html'})\n",{"type":23,"tag":103,"props":2157,"children":2158},{"class":105,"line":485},[2159],{"type":23,"tag":103,"props":2160,"children":2161},{"style":387},[2162],{"type":28,"value":2163}," * Supports Deferred (.done, .fail, .when, etc.)\n",{"type":23,"tag":103,"props":2165,"children":2166},{"class":105,"line":514},[2167],{"type":23,"tag":103,"props":2168,"children":2169},{"style":387},[2170],{"type":28,"value":2171}," */\n",{"type":23,"tag":103,"props":2173,"children":2174},{"class":105,"line":533},[2175,2179,2183,2187,2191],{"type":23,"tag":103,"props":2176,"children":2177},{"style":110},[2178],{"type":28,"value":331},{"type":23,"tag":103,"props":2180,"children":2181},{"style":363},[2182],{"type":28,"value":366},{"type":23,"tag":103,"props":2184,"children":2185},{"style":110},[2186],{"type":28,"value":331},{"type":23,"tag":103,"props":2188,"children":2189},{"style":373},[2190],{"type":28,"value":326},{"type":23,"tag":103,"props":2192,"children":2193},{"style":110},[2194],{"type":28,"value":381},{"type":23,"tag":103,"props":2196,"children":2197},{"class":105,"line":552},[2198,2203,2207,2211,2215,2219,2224],{"type":23,"tag":103,"props":2199,"children":2200},{"style":110},[2201],{"type":28,"value":2202},"    $.",{"type":23,"tag":103,"props":2204,"children":2205},{"style":122},[2206],{"type":28,"value":525},{"type":23,"tag":103,"props":2208,"children":2209},{"style":363},[2210],{"type":28,"value":1124},{"type":23,"tag":103,"props":2212,"children":2213},{"style":363},[2214],{"type":28,"value":1129},{"type":23,"tag":103,"props":2216,"children":2217},{"style":110},[2218],{"type":28,"value":331},{"type":23,"tag":103,"props":2220,"children":2221},{"style":373},[2222],{"type":28,"value":2223},"options",{"type":23,"tag":103,"props":2225,"children":2226},{"style":110},[2227],{"type":28,"value":381},{"type":23,"tag":103,"props":2229,"children":2230},{"class":105,"line":566},[2231,2236,2240,2244,2248,2252,2257],{"type":23,"tag":103,"props":2232,"children":2233},{"style":363},[2234],{"type":28,"value":2235},"        var",{"type":23,"tag":103,"props":2237,"children":2238},{"style":110},[2239],{"type":28,"value":912},{"type":23,"tag":103,"props":2241,"children":2242},{"style":363},[2243],{"type":28,"value":130},{"type":23,"tag":103,"props":2245,"children":2246},{"style":110},[2247],{"type":28,"value":921},{"type":23,"tag":103,"props":2249,"children":2250},{"style":122},[2251],{"type":28,"value":926},{"type":23,"tag":103,"props":2253,"children":2254},{"style":110},[2255],{"type":28,"value":2256},"(), ",{"type":23,"tag":103,"props":2258,"children":2259},{"style":387},[2260],{"type":28,"value":2261},"// Deferred object whose promise we will hook into when adding .done, etc to calls\n",{"type":23,"tag":103,"props":2263,"children":2264},{"class":105,"line":601},[2265,2270,2274,2278,2282],{"type":23,"tag":103,"props":2266,"children":2267},{"style":110},[2268],{"type":28,"value":2269},"            options ",{"type":23,"tag":103,"props":2271,"children":2272},{"style":363},[2273],{"type":28,"value":130},{"type":23,"tag":103,"props":2275,"children":2276},{"style":110},[2277],{"type":28,"value":921},{"type":23,"tag":103,"props":2279,"children":2280},{"style":122},[2281],{"type":28,"value":952},{"type":23,"tag":103,"props":2283,"children":2284},{"style":110},[2285],{"type":28,"value":530},{"type":23,"tag":103,"props":2287,"children":2288},{"class":105,"line":610},[2289,2294],{"type":23,"tag":103,"props":2290,"children":2291},{"style":110},[2292],{"type":28,"value":2293},"                dataType:",{"type":23,"tag":103,"props":2295,"children":2296},{"style":133},[2297],{"type":28,"value":968},{"type":23,"tag":103,"props":2299,"children":2300},{"class":105,"line":629},[2301,2306,2310,2315],{"type":23,"tag":103,"props":2302,"children":2303},{"style":110},[2304],{"type":28,"value":2305},"            }, (options ",{"type":23,"tag":103,"props":2307,"children":2308},{"style":363},[2309],{"type":28,"value":981},{"type":23,"tag":103,"props":2311,"children":2312},{"style":110},[2313],{"type":28,"value":2314}," {})), ",{"type":23,"tag":103,"props":2316,"children":2317},{"style":387},[2318],{"type":28,"value":2319},"// coerce options into being an object, extend defaults\n",{"type":23,"tag":103,"props":2321,"children":2322},{"class":105,"line":663},[2323,2328,2332,2336,2340,2344,2348,2352,2356,2360,2364,2368,2372,2376,2380,2385],{"type":23,"tag":103,"props":2324,"children":2325},{"style":110},[2326],{"type":28,"value":2327},"            name ",{"type":23,"tag":103,"props":2329,"children":2330},{"style":363},[2331],{"type":28,"value":130},{"type":23,"tag":103,"props":2333,"children":2334},{"style":133},[2335],{"type":28,"value":1003},{"type":23,"tag":103,"props":2337,"children":2338},{"style":363},[2339],{"type":28,"value":1008},{"type":23,"tag":103,"props":2341,"children":2342},{"style":110},[2343],{"type":28,"value":1013},{"type":23,"tag":103,"props":2345,"children":2346},{"style":122},[2347],{"type":28,"value":1018},{"type":23,"tag":103,"props":2349,"children":2350},{"style":110},[2351],{"type":28,"value":1023},{"type":23,"tag":103,"props":2353,"children":2354},{"style":122},[2355],{"type":28,"value":1028},{"type":23,"tag":103,"props":2357,"children":2358},{"style":110},[2359],{"type":28,"value":331},{"type":23,"tag":103,"props":2361,"children":2362},{"style":414},[2363],{"type":28,"value":1037},{"type":23,"tag":103,"props":2365,"children":2366},{"style":110},[2367],{"type":28,"value":341},{"type":23,"tag":103,"props":2369,"children":2370},{"style":122},[2371],{"type":28,"value":1046},{"type":23,"tag":103,"props":2373,"children":2374},{"style":110},[2375],{"type":28,"value":331},{"type":23,"tag":103,"props":2377,"children":2378},{"style":414},[2379],{"type":28,"value":1055},{"type":23,"tag":103,"props":2381,"children":2382},{"style":110},[2383],{"type":28,"value":2384},"), ",{"type":23,"tag":103,"props":2386,"children":2387},{"style":387},[2388],{"type":28,"value":2389},"// assign a psuedo-random name to the frame\n",{"type":23,"tag":103,"props":2391,"children":2392},{"class":105,"line":672},[2393,2398,2402,2406,2410,2415,2419,2423,2427,2432,2436,2440,2444,2449],{"type":23,"tag":103,"props":2394,"children":2395},{"style":110},[2396],{"type":28,"value":2397},"            hiframe ",{"type":23,"tag":103,"props":2399,"children":2400},{"style":363},[2401],{"type":28,"value":130},{"type":23,"tag":103,"props":2403,"children":2404},{"style":122},[2405],{"type":28,"value":1077},{"type":23,"tag":103,"props":2407,"children":2408},{"style":110},[2409],{"type":28,"value":331},{"type":23,"tag":103,"props":2411,"children":2412},{"style":133},[2413],{"type":28,"value":2414},"'\u003Ciframe id=\"'",{"type":23,"tag":103,"props":2416,"children":2417},{"style":363},[2418],{"type":28,"value":1008},{"type":23,"tag":103,"props":2420,"children":2421},{"style":110},[2422],{"type":28,"value":1702},{"type":23,"tag":103,"props":2424,"children":2425},{"style":363},[2426],{"type":28,"value":1008},{"type":23,"tag":103,"props":2428,"children":2429},{"style":133},[2430],{"type":28,"value":2431},"'\" name=\"'",{"type":23,"tag":103,"props":2433,"children":2434},{"style":363},[2435],{"type":28,"value":1008},{"type":23,"tag":103,"props":2437,"children":2438},{"style":110},[2439],{"type":28,"value":1702},{"type":23,"tag":103,"props":2441,"children":2442},{"style":363},[2443],{"type":28,"value":1008},{"type":23,"tag":103,"props":2445,"children":2446},{"style":133},[2447],{"type":28,"value":2448},"'\" src=\"about:blank\" '",{"type":23,"tag":103,"props":2450,"children":2451},{"style":363},[2452],{"type":28,"value":2453}," +\n",{"type":23,"tag":103,"props":2455,"children":2456},{"class":105,"line":689},[2457,2462,2466],{"type":23,"tag":103,"props":2458,"children":2459},{"style":133},[2460],{"type":28,"value":2461},"                'style=\"width:0;height:0;border:0px solid #fff;\">\u003C/iframe>'",{"type":23,"tag":103,"props":2463,"children":2464},{"style":110},[2465],{"type":28,"value":2384},{"type":23,"tag":103,"props":2467,"children":2468},{"style":387},[2469],{"type":28,"value":2470},"// create invisible iframe - NOT display:none\n",{"type":23,"tag":103,"props":2472,"children":2473},{"class":105,"line":698},[2474,2479,2483,2487,2492],{"type":23,"tag":103,"props":2475,"children":2476},{"style":110},[2477],{"type":28,"value":2478},"            form ",{"type":23,"tag":103,"props":2480,"children":2481},{"style":363},[2482],{"type":28,"value":130},{"type":23,"tag":103,"props":2484,"children":2485},{"style":122},[2486],{"type":28,"value":1077},{"type":23,"tag":103,"props":2488,"children":2489},{"style":110},[2490],{"type":28,"value":2491},"(options.form), ",{"type":23,"tag":103,"props":2493,"children":2494},{"style":387},[2495],{"type":28,"value":2496},"// get form, make sure its a jquery object\n",{"type":23,"tag":103,"props":2498,"children":2499},{"class":105,"line":707},[2500,2505,2509,2513],{"type":23,"tag":103,"props":2501,"children":2502},{"style":122},[2503],{"type":28,"value":2504},"            cleanup",{"type":23,"tag":103,"props":2506,"children":2507},{"style":363},[2508],{"type":28,"value":1124},{"type":23,"tag":103,"props":2510,"children":2511},{"style":363},[2512],{"type":28,"value":1129},{"type":23,"tag":103,"props":2514,"children":2515},{"style":110},[2516],{"type":28,"value":1134},{"type":23,"tag":103,"props":2518,"children":2519},{"class":105,"line":1723},[2520,2525,2529],{"type":23,"tag":103,"props":2521,"children":2522},{"style":110},[2523],{"type":28,"value":2524},"                hiframe.",{"type":23,"tag":103,"props":2526,"children":2527},{"style":122},[2528],{"type":28,"value":1147},{"type":23,"tag":103,"props":2530,"children":2531},{"style":110},[2532],{"type":28,"value":482},{"type":23,"tag":103,"props":2534,"children":2535},{"class":105,"line":1737},[2536,2541],{"type":23,"tag":103,"props":2537,"children":2538},{"style":363},[2539],{"type":28,"value":2540},"                delete",{"type":23,"tag":103,"props":2542,"children":2543},{"style":110},[2544],{"type":28,"value":1164},{"type":23,"tag":103,"props":2546,"children":2547},{"class":105,"line":1745},[2548,2553],{"type":23,"tag":103,"props":2549,"children":2550},{"style":110},[2551],{"type":28,"value":2552},"            }; ",{"type":23,"tag":103,"props":2554,"children":2555},{"style":387},[2556],{"type":28,"value":2557},"// clean iframe away when we're finished with it\n",{"type":23,"tag":103,"props":2559,"children":2561},{"class":105,"line":2560},22,[2562,2567,2571,2575,2579,2583,2587,2591,2595,2599,2603,2607,2612],{"type":23,"tag":103,"props":2563,"children":2564},{"style":363},[2565],{"type":28,"value":2566},"        if",{"type":23,"tag":103,"props":2568,"children":2569},{"style":110},[2570],{"type":28,"value":403},{"type":23,"tag":103,"props":2572,"children":2573},{"style":363},[2574],{"type":28,"value":1208},{"type":23,"tag":103,"props":2576,"children":2577},{"style":110},[2578],{"type":28,"value":1213},{"type":23,"tag":103,"props":2580,"children":2581},{"style":414},[2582],{"type":28,"value":1218},{"type":23,"tag":103,"props":2584,"children":2585},{"style":363},[2586],{"type":28,"value":1223},{"type":23,"tag":103,"props":2588,"children":2589},{"style":110},[2590],{"type":28,"value":1228},{"type":23,"tag":103,"props":2592,"children":2593},{"style":414},[2594],{"type":28,"value":1233},{"type":23,"tag":103,"props":2596,"children":2597},{"style":110},[2598],{"type":28,"value":1238},{"type":23,"tag":103,"props":2600,"children":2601},{"style":363},[2602],{"type":28,"value":1243},{"type":23,"tag":103,"props":2604,"children":2605},{"style":133},[2606],{"type":28,"value":1248},{"type":23,"tag":103,"props":2608,"children":2609},{"style":110},[2610],{"type":28,"value":2611},"){ ",{"type":23,"tag":103,"props":2613,"children":2614},{"style":387},[2615],{"type":28,"value":2616},"// if we don't have a form to submit, reject (call .fail)\n",{"type":23,"tag":103,"props":2618,"children":2620},{"class":105,"line":2619},23,[2621,2626,2630,2634,2638],{"type":23,"tag":103,"props":2622,"children":2623},{"style":110},[2624],{"type":28,"value":2625},"            defer.",{"type":23,"tag":103,"props":2627,"children":2628},{"style":122},[2629],{"type":28,"value":1272},{"type":23,"tag":103,"props":2631,"children":2632},{"style":110},[2633],{"type":28,"value":331},{"type":23,"tag":103,"props":2635,"children":2636},{"style":133},[2637],{"type":28,"value":1281},{"type":23,"tag":103,"props":2639,"children":2640},{"style":110},[2641],{"type":28,"value":1286},{"type":23,"tag":103,"props":2643,"children":2645},{"class":105,"line":2644},24,[2646,2651,2655,2659],{"type":23,"tag":103,"props":2647,"children":2648},{"style":363},[2649],{"type":28,"value":2650},"            return",{"type":23,"tag":103,"props":2652,"children":2653},{"style":110},[2654],{"type":28,"value":1299},{"type":23,"tag":103,"props":2656,"children":2657},{"style":122},[2658],{"type":28,"value":1304},{"type":23,"tag":103,"props":2660,"children":2661},{"style":110},[2662],{"type":28,"value":482},{"type":23,"tag":103,"props":2664,"children":2666},{"class":105,"line":2665},25,[2667],{"type":23,"tag":103,"props":2668,"children":2669},{"style":110},[2670],{"type":28,"value":2671},"        }\n",{"type":23,"tag":103,"props":2673,"children":2675},{"class":105,"line":2674},26,[2676],{"type":23,"tag":103,"props":2677,"children":2678},{"emptyLinePlaceholder":1321},[2679],{"type":28,"value":1324},{"type":23,"tag":103,"props":2681,"children":2683},{"class":105,"line":2682},27,[2684,2689,2693,2697,2701,2705,2709,2714],{"type":23,"tag":103,"props":2685,"children":2686},{"style":110},[2687],{"type":28,"value":2688},"        form.",{"type":23,"tag":103,"props":2690,"children":2691},{"style":122},[2692],{"type":28,"value":426},{"type":23,"tag":103,"props":2694,"children":2695},{"style":110},[2696],{"type":28,"value":331},{"type":23,"tag":103,"props":2698,"children":2699},{"style":133},[2700],{"type":28,"value":435},{"type":23,"tag":103,"props":2702,"children":2703},{"style":110},[2704],{"type":28,"value":1348},{"type":23,"tag":103,"props":2706,"children":2707},{"style":122},[2708],{"type":28,"value":1353},{"type":23,"tag":103,"props":2710,"children":2711},{"style":110},[2712],{"type":28,"value":2713},"(hiframe); ",{"type":23,"tag":103,"props":2715,"children":2716},{"style":387},[2717],{"type":28,"value":2718},"// set target of form to iframe, and append iframe to the form\n",{"type":23,"tag":103,"props":2720,"children":2722},{"class":105,"line":2721},28,[2723],{"type":23,"tag":103,"props":2724,"children":2725},{"emptyLinePlaceholder":1321},[2726],{"type":28,"value":1324},{"type":23,"tag":103,"props":2728,"children":2730},{"class":105,"line":2729},29,[2731],{"type":23,"tag":103,"props":2732,"children":2733},{"style":387},[2734],{"type":28,"value":2735},"        // On load event, grab and parse the contents of the iframe\n",{"type":23,"tag":103,"props":2737,"children":2739},{"class":105,"line":2738},30,[2740,2745,2749,2753,2757,2761,2765],{"type":23,"tag":103,"props":2741,"children":2742},{"style":110},[2743],{"type":28,"value":2744},"        hiframe.",{"type":23,"tag":103,"props":2746,"children":2747},{"style":122},[2748],{"type":28,"value":346},{"type":23,"tag":103,"props":2750,"children":2751},{"style":110},[2752],{"type":28,"value":331},{"type":23,"tag":103,"props":2754,"children":2755},{"style":133},[2756],{"type":28,"value":1391},{"type":23,"tag":103,"props":2758,"children":2759},{"style":110},[2760],{"type":28,"value":360},{"type":23,"tag":103,"props":2762,"children":2763},{"style":363},[2764],{"type":28,"value":366},{"type":23,"tag":103,"props":2766,"children":2767},{"style":110},[2768],{"type":28,"value":1134},{"type":23,"tag":103,"props":2770,"children":2772},{"class":105,"line":2771},31,[2773,2778],{"type":23,"tag":103,"props":2774,"children":2775},{"style":363},[2776],{"type":28,"value":2777},"            var",{"type":23,"tag":103,"props":2779,"children":2780},{"style":110},[2781],{"type":28,"value":1415},{"type":23,"tag":103,"props":2783,"children":2785},{"class":105,"line":2784},32,[2786],{"type":23,"tag":103,"props":2787,"children":2788},{"emptyLinePlaceholder":1321},[2789],{"type":28,"value":1324},{"type":23,"tag":103,"props":2791,"children":2793},{"class":105,"line":2792},33,[2794,2799,2803,2807,2811],{"type":23,"tag":103,"props":2795,"children":2796},{"style":110},[2797],{"type":28,"value":2798},"            form.",{"type":23,"tag":103,"props":2800,"children":2801},{"style":122},[2802],{"type":28,"value":1434},{"type":23,"tag":103,"props":2804,"children":2805},{"style":110},[2806],{"type":28,"value":331},{"type":23,"tag":103,"props":2808,"children":2809},{"style":133},[2810],{"type":28,"value":435},{"type":23,"tag":103,"props":2812,"children":2813},{"style":110},[2814],{"type":28,"value":1286},{"type":23,"tag":103,"props":2816,"children":2818},{"class":105,"line":2817},34,[2819],{"type":23,"tag":103,"props":2820,"children":2821},{"emptyLinePlaceholder":1321},[2822],{"type":28,"value":1324},{"type":23,"tag":103,"props":2824,"children":2826},{"class":105,"line":2825},35,[2827,2832],{"type":23,"tag":103,"props":2828,"children":2829},{"style":363},[2830],{"type":28,"value":2831},"            try",{"type":23,"tag":103,"props":2833,"children":2834},{"style":110},[2835],{"type":28,"value":463},{"type":23,"tag":103,"props":2837,"children":2839},{"class":105,"line":2838},36,[2840,2845,2849,2853,2857,2861,2865,2869,2873,2877],{"type":23,"tag":103,"props":2841,"children":2842},{"style":363},[2843],{"type":28,"value":2844},"                if",{"type":23,"tag":103,"props":2846,"children":2847},{"style":110},[2848],{"type":28,"value":1477},{"type":23,"tag":103,"props":2850,"children":2851},{"style":122},[2852],{"type":28,"value":1482},{"type":23,"tag":103,"props":2854,"children":2855},{"style":110},[2856],{"type":28,"value":331},{"type":23,"tag":103,"props":2858,"children":2859},{"style":133},[2860],{"type":28,"value":544},{"type":23,"tag":103,"props":2862,"children":2863},{"style":110},[2864],{"type":28,"value":440},{"type":23,"tag":103,"props":2866,"children":2867},{"style":363},[2868],{"type":28,"value":1499},{"type":23,"tag":103,"props":2870,"children":2871},{"style":363},[2872],{"type":28,"value":1504},{"type":23,"tag":103,"props":2874,"children":2875},{"style":414},[2876],{"type":28,"value":1509},{"type":23,"tag":103,"props":2878,"children":2879},{"style":110},[2880],{"type":28,"value":455},{"type":23,"tag":103,"props":2882,"children":2884},{"class":105,"line":2883},37,[2885,2890],{"type":23,"tag":103,"props":2886,"children":2887},{"style":110},[2888],{"type":28,"value":2889},"                { ",{"type":23,"tag":103,"props":2891,"children":2892},{"style":387},[2893],{"type":28,"value":2894},"// browsers will wrap a json return with \u003Cpre>\u003C/pre>\n",{"type":23,"tag":103,"props":2896,"children":2898},{"class":105,"line":2897},38,[2899,2904,2908,2912,2916,2920,2924,2928,2932],{"type":23,"tag":103,"props":2900,"children":2901},{"style":110},[2902],{"type":28,"value":2903},"                    res ",{"type":23,"tag":103,"props":2905,"children":2906},{"style":363},[2907],{"type":28,"value":130},{"type":23,"tag":103,"props":2909,"children":2910},{"style":110},[2911],{"type":28,"value":1537},{"type":23,"tag":103,"props":2913,"children":2914},{"style":122},[2915],{"type":28,"value":1542},{"type":23,"tag":103,"props":2917,"children":2918},{"style":110},[2919],{"type":28,"value":331},{"type":23,"tag":103,"props":2921,"children":2922},{"style":133},[2923],{"type":28,"value":1551},{"type":23,"tag":103,"props":2925,"children":2926},{"style":110},[2927],{"type":28,"value":1556},{"type":23,"tag":103,"props":2929,"children":2930},{"style":414},[2931],{"type":28,"value":1233},{"type":23,"tag":103,"props":2933,"children":2934},{"style":110},[2935],{"type":28,"value":1565},{"type":23,"tag":103,"props":2937,"children":2939},{"class":105,"line":2938},39,[2940],{"type":23,"tag":103,"props":2941,"children":2942},{"style":110},[2943],{"type":28,"value":2944},"                }\n",{"type":23,"tag":103,"props":2946,"children":2948},{"class":105,"line":2947},40,[2949],{"type":23,"tag":103,"props":2950,"children":2951},{"style":363},[2952],{"type":28,"value":2953},"                else\n",{"type":23,"tag":103,"props":2955,"children":2957},{"class":105,"line":2956},41,[2958],{"type":23,"tag":103,"props":2959,"children":2960},{"style":110},[2961],{"type":28,"value":2962},"                {\n",{"type":23,"tag":103,"props":2964,"children":2966},{"class":105,"line":2965},42,[2967,2971,2975,2979,2983,2987,2991,2995,2999],{"type":23,"tag":103,"props":2968,"children":2969},{"style":110},[2970],{"type":28,"value":2903},{"type":23,"tag":103,"props":2972,"children":2973},{"style":363},[2974],{"type":28,"value":130},{"type":23,"tag":103,"props":2976,"children":2977},{"style":110},[2978],{"type":28,"value":1537},{"type":23,"tag":103,"props":2980,"children":2981},{"style":122},[2982],{"type":28,"value":1542},{"type":23,"tag":103,"props":2984,"children":2985},{"style":110},[2986],{"type":28,"value":331},{"type":23,"tag":103,"props":2988,"children":2989},{"style":133},[2990],{"type":28,"value":1615},{"type":23,"tag":103,"props":2992,"children":2993},{"style":110},[2994],{"type":28,"value":1556},{"type":23,"tag":103,"props":2996,"children":2997},{"style":414},[2998],{"type":28,"value":1233},{"type":23,"tag":103,"props":3000,"children":3001},{"style":110},[3002],{"type":28,"value":1565},{"type":23,"tag":103,"props":3004,"children":3006},{"class":105,"line":3005},43,[3007],{"type":23,"tag":103,"props":3008,"children":3009},{"style":110},[3010],{"type":28,"value":2944},{"type":23,"tag":103,"props":3012,"children":3014},{"class":105,"line":3013},44,[3015,3020,3024],{"type":23,"tag":103,"props":3016,"children":3017},{"style":110},[3018],{"type":28,"value":3019},"            }",{"type":23,"tag":103,"props":3021,"children":3022},{"style":363},[3023],{"type":28,"value":1647},{"type":23,"tag":103,"props":3025,"children":3026},{"style":110},[3027],{"type":28,"value":1652},{"type":23,"tag":103,"props":3029,"children":3031},{"class":105,"line":3030},45,[3032],{"type":23,"tag":103,"props":3033,"children":3034},{"style":387},[3035],{"type":28,"value":3036},"                // Failed to receive anything in the body of the frame\n",{"type":23,"tag":103,"props":3038,"children":3040},{"class":105,"line":3039},46,[3041,3046],{"type":23,"tag":103,"props":3042,"children":3043},{"style":122},[3044],{"type":28,"value":3045},"                cleanup",{"type":23,"tag":103,"props":3047,"children":3048},{"style":110},[3049],{"type":28,"value":482},{"type":23,"tag":103,"props":3051,"children":3053},{"class":105,"line":3052},47,[3054,3059,3063,3067,3071,3075,3079,3083,3087,3091],{"type":23,"tag":103,"props":3055,"children":3056},{"style":110},[3057],{"type":28,"value":3058},"                defer.",{"type":23,"tag":103,"props":3060,"children":3061},{"style":122},[3062],{"type":28,"value":1272},{"type":23,"tag":103,"props":3064,"children":3065},{"style":110},[3066],{"type":28,"value":331},{"type":23,"tag":103,"props":3068,"children":3069},{"style":133},[3070],{"type":28,"value":1693},{"type":23,"tag":103,"props":3072,"children":3073},{"style":363},[3074],{"type":28,"value":1008},{"type":23,"tag":103,"props":3076,"children":3077},{"style":110},[3078],{"type":28,"value":1702},{"type":23,"tag":103,"props":3080,"children":3081},{"style":363},[3082],{"type":28,"value":1008},{"type":23,"tag":103,"props":3084,"children":3085},{"style":133},[3086],{"type":28,"value":1711},{"type":23,"tag":103,"props":3088,"children":3089},{"style":363},[3090],{"type":28,"value":1008},{"type":23,"tag":103,"props":3092,"children":3093},{"style":110},[3094],{"type":28,"value":1720},{"type":23,"tag":103,"props":3096,"children":3098},{"class":105,"line":3097},48,[3099,3104],{"type":23,"tag":103,"props":3100,"children":3101},{"style":363},[3102],{"type":28,"value":3103},"                return",{"type":23,"tag":103,"props":3105,"children":3106},{"style":110},[3107],{"type":28,"value":1734},{"type":23,"tag":103,"props":3109,"children":3111},{"class":105,"line":3110},49,[3112],{"type":23,"tag":103,"props":3113,"children":3114},{"style":110},[3115],{"type":28,"value":3116},"            }\n",{"type":23,"tag":103,"props":3118,"children":3120},{"class":105,"line":3119},50,[3121],{"type":23,"tag":103,"props":3122,"children":3123},{"emptyLinePlaceholder":1321},[3124],{"type":28,"value":1324},{"type":23,"tag":103,"props":3126,"children":3128},{"class":105,"line":3127},51,[3129,3133],{"type":23,"tag":103,"props":3130,"children":3131},{"style":122},[3132],{"type":28,"value":2504},{"type":23,"tag":103,"props":3134,"children":3135},{"style":110},[3136],{"type":28,"value":482},{"type":23,"tag":103,"props":3138,"children":3140},{"class":105,"line":3139},52,[3141],{"type":23,"tag":103,"props":3142,"children":3143},{"emptyLinePlaceholder":1321},[3144],{"type":28,"value":1324},{"type":23,"tag":103,"props":3146,"children":3148},{"class":105,"line":3147},53,[3149,3154,3158,3162,3166,3170,3174,3178,3182,3186],{"type":23,"tag":103,"props":3150,"children":3151},{"style":363},[3152],{"type":28,"value":3153},"            if",{"type":23,"tag":103,"props":3155,"children":3156},{"style":110},[3157],{"type":28,"value":1477},{"type":23,"tag":103,"props":3159,"children":3160},{"style":122},[3161],{"type":28,"value":1482},{"type":23,"tag":103,"props":3163,"children":3164},{"style":110},[3165],{"type":28,"value":331},{"type":23,"tag":103,"props":3167,"children":3168},{"style":133},[3169],{"type":28,"value":544},{"type":23,"tag":103,"props":3171,"children":3172},{"style":110},[3173],{"type":28,"value":440},{"type":23,"tag":103,"props":3175,"children":3176},{"style":363},[3177],{"type":28,"value":1499},{"type":23,"tag":103,"props":3179,"children":3180},{"style":363},[3181],{"type":28,"value":1504},{"type":23,"tag":103,"props":3183,"children":3184},{"style":414},[3185],{"type":28,"value":1509},{"type":23,"tag":103,"props":3187,"children":3188},{"style":110},[3189],{"type":28,"value":455},{"type":23,"tag":103,"props":3191,"children":3193},{"class":105,"line":3192},54,[3194],{"type":23,"tag":103,"props":3195,"children":3196},{"style":110},[3197],{"type":28,"value":3198},"            {\n",{"type":23,"tag":103,"props":3200,"children":3202},{"class":105,"line":3201},55,[3203,3208],{"type":23,"tag":103,"props":3204,"children":3205},{"style":363},[3206],{"type":28,"value":3207},"                try",{"type":23,"tag":103,"props":3209,"children":3210},{"style":110},[3211],{"type":28,"value":463},{"type":23,"tag":103,"props":3213,"children":3215},{"class":105,"line":3214},56,[3216,3220,3224,3228,3232],{"type":23,"tag":103,"props":3217,"children":3218},{"style":110},[3219],{"type":28,"value":2903},{"type":23,"tag":103,"props":3221,"children":3222},{"style":363},[3223],{"type":28,"value":130},{"type":23,"tag":103,"props":3225,"children":3226},{"style":110},[3227],{"type":28,"value":921},{"type":23,"tag":103,"props":3229,"children":3230},{"style":122},[3231],{"type":28,"value":1847},{"type":23,"tag":103,"props":3233,"children":3234},{"style":110},[3235],{"type":28,"value":1852},{"type":23,"tag":103,"props":3237,"children":3239},{"class":105,"line":3238},57,[3240,3245,3249],{"type":23,"tag":103,"props":3241,"children":3242},{"style":110},[3243],{"type":28,"value":3244},"                }",{"type":23,"tag":103,"props":3246,"children":3247},{"style":363},[3248],{"type":28,"value":1647},{"type":23,"tag":103,"props":3250,"children":3251},{"style":110},[3252],{"type":28,"value":1652},{"type":23,"tag":103,"props":3254,"children":3256},{"class":105,"line":3255},58,[3257,3262,3266,3270,3274,3278],{"type":23,"tag":103,"props":3258,"children":3259},{"style":110},[3260],{"type":28,"value":3261},"                    defer.",{"type":23,"tag":103,"props":3263,"children":3264},{"style":122},[3265],{"type":28,"value":1272},{"type":23,"tag":103,"props":3267,"children":3268},{"style":110},[3269],{"type":28,"value":331},{"type":23,"tag":103,"props":3271,"children":3272},{"style":133},[3273],{"type":28,"value":1887},{"type":23,"tag":103,"props":3275,"children":3276},{"style":363},[3277],{"type":28,"value":1008},{"type":23,"tag":103,"props":3279,"children":3280},{"style":110},[3281],{"type":28,"value":1720},{"type":23,"tag":103,"props":3283,"children":3285},{"class":105,"line":3284},59,[3286,3291],{"type":23,"tag":103,"props":3287,"children":3288},{"style":363},[3289],{"type":28,"value":3290},"                    return",{"type":23,"tag":103,"props":3292,"children":3293},{"style":110},[3294],{"type":28,"value":1734},{"type":23,"tag":103,"props":3296,"children":3298},{"class":105,"line":3297},60,[3299],{"type":23,"tag":103,"props":3300,"children":3301},{"style":110},[3302],{"type":28,"value":2944},{"type":23,"tag":103,"props":3304,"children":3306},{"class":105,"line":3305},61,[3307],{"type":23,"tag":103,"props":3308,"children":3309},{"style":110},[3310],{"type":28,"value":3116},{"type":23,"tag":103,"props":3312,"children":3314},{"class":105,"line":3313},62,[3315,3320,3324,3328,3332,3336,3340,3344,3348,3352,3356],{"type":23,"tag":103,"props":3316,"children":3317},{"style":363},[3318],{"type":28,"value":3319},"            else",{"type":23,"tag":103,"props":3321,"children":3322},{"style":363},[3323],{"type":28,"value":1933},{"type":23,"tag":103,"props":3325,"children":3326},{"style":110},[3327],{"type":28,"value":1477},{"type":23,"tag":103,"props":3329,"children":3330},{"style":122},[3331],{"type":28,"value":1482},{"type":23,"tag":103,"props":3333,"children":3334},{"style":110},[3335],{"type":28,"value":331},{"type":23,"tag":103,"props":3337,"children":3338},{"style":133},[3339],{"type":28,"value":1950},{"type":23,"tag":103,"props":3341,"children":3342},{"style":110},[3343],{"type":28,"value":440},{"type":23,"tag":103,"props":3345,"children":3346},{"style":363},[3347],{"type":28,"value":1499},{"type":23,"tag":103,"props":3349,"children":3350},{"style":363},[3351],{"type":28,"value":1504},{"type":23,"tag":103,"props":3353,"children":3354},{"style":414},[3355],{"type":28,"value":1509},{"type":23,"tag":103,"props":3357,"children":3358},{"style":110},[3359],{"type":28,"value":455},{"type":23,"tag":103,"props":3361,"children":3363},{"class":105,"line":3362},63,[3364],{"type":23,"tag":103,"props":3365,"children":3366},{"style":110},[3367],{"type":28,"value":3198},{"type":23,"tag":103,"props":3369,"children":3371},{"class":105,"line":3370},64,[3372,3377,3381,3385,3389],{"type":23,"tag":103,"props":3373,"children":3374},{"style":110},[3375],{"type":28,"value":3376},"                res ",{"type":23,"tag":103,"props":3378,"children":3379},{"style":363},[3380],{"type":28,"value":130},{"type":23,"tag":103,"props":3382,"children":3383},{"style":110},[3384],{"type":28,"value":921},{"type":23,"tag":103,"props":3386,"children":3387},{"style":122},[3388],{"type":28,"value":1998},{"type":23,"tag":103,"props":3390,"children":3391},{"style":110},[3392],{"type":28,"value":1852},{"type":23,"tag":103,"props":3394,"children":3396},{"class":105,"line":3395},65,[3397],{"type":23,"tag":103,"props":3398,"children":3399},{"style":110},[3400],{"type":28,"value":3116},{"type":23,"tag":103,"props":3402,"children":3404},{"class":105,"line":3403},66,[3405],{"type":23,"tag":103,"props":3406,"children":3407},{"emptyLinePlaceholder":1321},[3408],{"type":28,"value":1324},{"type":23,"tag":103,"props":3410,"children":3412},{"class":105,"line":3411},67,[3413,3417,3421,3426],{"type":23,"tag":103,"props":3414,"children":3415},{"style":110},[3416],{"type":28,"value":2625},{"type":23,"tag":103,"props":3418,"children":3419},{"style":122},[3420],{"type":28,"value":2021},{"type":23,"tag":103,"props":3422,"children":3423},{"style":110},[3424],{"type":28,"value":3425},"(res); ",{"type":23,"tag":103,"props":3427,"children":3428},{"style":387},[3429],{"type":28,"value":3430},"// Finished (call .done)\n",{"type":23,"tag":103,"props":3432,"children":3434},{"class":105,"line":3433},68,[3435],{"type":23,"tag":103,"props":3436,"children":3437},{"style":110},[3438],{"type":28,"value":3439},"        });\n",{"type":23,"tag":103,"props":3441,"children":3443},{"class":105,"line":3442},69,[3444],{"type":23,"tag":103,"props":3445,"children":3446},{"emptyLinePlaceholder":1321},[3447],{"type":28,"value":1324},{"type":23,"tag":103,"props":3449,"children":3451},{"class":105,"line":3450},70,[3452,3456,3460],{"type":23,"tag":103,"props":3453,"children":3454},{"style":110},[3455],{"type":28,"value":2688},{"type":23,"tag":103,"props":3457,"children":3458},{"style":122},[3459],{"type":28,"value":2051},{"type":23,"tag":103,"props":3461,"children":3462},{"style":110},[3463],{"type":28,"value":482},{"type":23,"tag":103,"props":3465,"children":3467},{"class":105,"line":3466},71,[3468],{"type":23,"tag":103,"props":3469,"children":3470},{"emptyLinePlaceholder":1321},[3471],{"type":28,"value":1324},{"type":23,"tag":103,"props":3473,"children":3475},{"class":105,"line":3474},72,[3476,3481,3485,3489],{"type":23,"tag":103,"props":3477,"children":3478},{"style":363},[3479],{"type":28,"value":3480},"        return",{"type":23,"tag":103,"props":3482,"children":3483},{"style":110},[3484],{"type":28,"value":1299},{"type":23,"tag":103,"props":3486,"children":3487},{"style":122},[3488],{"type":28,"value":1304},{"type":23,"tag":103,"props":3490,"children":3491},{"style":110},[3492],{"type":28,"value":482},{"type":23,"tag":103,"props":3494,"children":3496},{"class":105,"line":3495},73,[3497],{"type":23,"tag":103,"props":3498,"children":3499},{"style":110},[3500],{"type":28,"value":3501},"    }\n",{"type":23,"tag":103,"props":3503,"children":3505},{"class":105,"line":3504},74,[3506],{"type":23,"tag":103,"props":3507,"children":3508},{"emptyLinePlaceholder":1321},[3509],{"type":28,"value":1324},{"type":23,"tag":103,"props":3511,"children":3513},{"class":105,"line":3512},75,[3514],{"type":23,"tag":103,"props":3515,"children":3516},{"style":387},[3517],{"type":28,"value":3518},"/*\n",{"type":23,"tag":103,"props":3520,"children":3522},{"class":105,"line":3521},76,[3523],{"type":23,"tag":103,"props":3524,"children":3525},{"style":387},[3526],{"type":28,"value":3527},"* This allows us the option to call $('#myForm').transparentSubmit - as you can see, its just a slightly different form \n",{"type":23,"tag":103,"props":3529,"children":3531},{"class":105,"line":3530},77,[3532],{"type":23,"tag":103,"props":3533,"children":3534},{"style":387},[3535],{"type":28,"value":3536},"* to the plugin, which calls our transparentSubmit function as defined above.\n",{"type":23,"tag":103,"props":3538,"children":3540},{"class":105,"line":3539},78,[3541],{"type":23,"tag":103,"props":3542,"children":3543},{"style":387},[3544],{"type":28,"value":3545},"*/\n",{"type":23,"tag":103,"props":3547,"children":3549},{"class":105,"line":3548},79,[3550,3555,3559,3563,3567,3571,3575],{"type":23,"tag":103,"props":3551,"children":3552},{"style":110},[3553],{"type":28,"value":3554},"    $.fn.",{"type":23,"tag":103,"props":3556,"children":3557},{"style":122},[3558],{"type":28,"value":525},{"type":23,"tag":103,"props":3560,"children":3561},{"style":363},[3562],{"type":28,"value":1124},{"type":23,"tag":103,"props":3564,"children":3565},{"style":363},[3566],{"type":28,"value":1129},{"type":23,"tag":103,"props":3568,"children":3569},{"style":110},[3570],{"type":28,"value":331},{"type":23,"tag":103,"props":3572,"children":3573},{"style":373},[3574],{"type":28,"value":2223},{"type":23,"tag":103,"props":3576,"children":3577},{"style":110},[3578],{"type":28,"value":381},{"type":23,"tag":103,"props":3580,"children":3582},{"class":105,"line":3581},80,[3583,3588,3592,3597],{"type":23,"tag":103,"props":3584,"children":3585},{"style":110},[3586],{"type":28,"value":3587},"        options.form ",{"type":23,"tag":103,"props":3589,"children":3590},{"style":363},[3591],{"type":28,"value":130},{"type":23,"tag":103,"props":3593,"children":3594},{"style":414},[3595],{"type":28,"value":3596}," this",{"type":23,"tag":103,"props":3598,"children":3599},{"style":110},[3600],{"type":28,"value":1734},{"type":23,"tag":103,"props":3602,"children":3604},{"class":105,"line":3603},81,[3605,3609,3613,3617],{"type":23,"tag":103,"props":3606,"children":3607},{"style":363},[3608],{"type":28,"value":3480},{"type":23,"tag":103,"props":3610,"children":3611},{"style":110},[3612],{"type":28,"value":921},{"type":23,"tag":103,"props":3614,"children":3615},{"style":122},[3616],{"type":28,"value":525},{"type":23,"tag":103,"props":3618,"children":3619},{"style":110},[3620],{"type":28,"value":3621},"(options);\n",{"type":23,"tag":103,"props":3623,"children":3625},{"class":105,"line":3624},82,[3626],{"type":23,"tag":103,"props":3627,"children":3628},{"style":110},[3629],{"type":28,"value":3630},"    };\n",{"type":23,"tag":103,"props":3632,"children":3634},{"class":105,"line":3633},83,[3635],{"type":23,"tag":103,"props":3636,"children":3637},{"style":110},[3638],{"type":28,"value":3639},"})(jQuery);\n",{"type":23,"tag":3641,"props":3642,"children":3643},"style",{},[3644],{"type":28,"value":3645},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":8,"searchDepth":247,"depth":247,"links":3647},[3648,3649,3650,3651,3652],{"id":77,"depth":186,"text":80},{"id":720,"depth":186,"text":723},{"id":884,"depth":186,"text":887},{"id":2089,"depth":186,"text":2092},{"id":2100,"depth":186,"text":2103},"markdown","content:ckeefer:2013-3:ajax-upload.md","content","ckeefer/2013-3/ajax-upload.md","ckeefer/2013-3/ajax-upload","md",{"user":3660,"name":3661},"ckeefer","Christopher Keefer",{"_path":3663,"_dir":3664,"_draft":7,"_partial":7,"_locale":8,"title":3665,"description":3666,"publishDate":3667,"tags":3668,"excerpt":3666,"body":3672,"_type":3653,"_id":3788,"_source":3655,"_file":3789,"_stem":3790,"_extension":3658,"author":3791},"/rbrubaker/2012-06/coffee-backbone-3","2012-06","Fun with CoffeeScript and Backbone.js : Part 3","In this post I’ll discuss my thoughts on CoffeeScript and Backbone.js.","2012-06-08",[3669,3670,17,3671],"backbone-js","coffeescript","series",{"type":20,"children":3673,"toc":3786},[3674,3696,3717,3728,3750,3767,3776,3781],{"type":23,"tag":24,"props":3675,"children":3676},{},[3677,3679,3686,3688,3695],{"type":28,"value":3678},"In this post I’ll discuss my thoughts on ",{"type":23,"tag":31,"props":3680,"children":3683},{"href":3681,"rel":3682},"http://coffeescript.org/",[35],[3684],{"type":28,"value":3685},"CoffeeScript",{"type":28,"value":3687}," and ",{"type":23,"tag":31,"props":3689,"children":3692},{"href":3690,"rel":3691},"http://backbonejs.org/",[35],[3693],{"type":28,"value":3694},"Backbone.js",{"type":28,"value":496},{"type":23,"tag":24,"props":3697,"children":3698},{},[3699,3701,3708,3710,3716],{"type":28,"value":3700},"The project is a simplified morse code simulator that animates morse code being sent over a telegraph line. The complete source is available ",{"type":23,"tag":31,"props":3702,"children":3705},{"href":3703,"rel":3704},"https://github.com/rmb177/MorseCode",[35],[3706],{"type":28,"value":3707},"here",{"type":28,"value":3709}," and the running code can be seen ",{"type":23,"tag":31,"props":3711,"children":3714},{"href":3712,"rel":3713},"http://www.ryan-brubaker.com/code/MorseCode",[35],[3715],{"type":28,"value":3707},{"type":28,"value":496},{"type":23,"tag":24,"props":3718,"children":3719},{},[3720,3721,3727],{"type":28,"value":872},{"type":23,"tag":31,"props":3722,"children":3724},{"href":3723},"/search/fun/coffeescript/user:rmb",[3725],{"type":28,"value":3726},"rest of this series",{"type":28,"value":496},{"type":23,"tag":24,"props":3729,"children":3730},{},[3731,3733,3740,3742,3748],{"type":28,"value":3732},"JavaScript has slowly become my favorite programming language as I've done more web development. As you learn its ",{"type":23,"tag":31,"props":3734,"children":3737},{"href":3735,"rel":3736},"http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&qid=1339122559&sr=8-1",[35],[3738],{"type":28,"value":3739},"Good Parts",{"type":28,"value":3741},", you start to realize how powerful of a language it is. I'll never forget the ",{"type":23,"tag":3743,"props":3744,"children":3745},"em",{},[3746],{"type":28,"value":3747},"Aha",{"type":28,"value":3749},"! moment I had when I wrote my first closure.",{"type":23,"tag":24,"props":3751,"children":3752},{},[3753,3765],{"type":23,"tag":31,"props":3754,"children":3757},{"href":3755,"rel":3756},"https://artandlogic.com/wp-content/uploads/2012/06/coffeescript-logo1.png",[35],[3758],{"type":23,"tag":3759,"props":3760,"children":3764},"img",{"alt":3761,"src":3762,"title":3763},"Coffeescript logo","assets/images/coffeescript-logo1.png","CoffeeScript-logo",[],{"type":28,"value":3766},"CoffeeScript takes a great language and makes it even better. It hides the bad parts of JavaScript and adds the expressiveness of Ruby and Python. The addition of classes shields the developer from JavaScript's prototypal inheritance and is much easier to understand for developers used to class-based inheritance. Admittedly, this was a small demo, but tracking runtime errors in the JavaScript code back to the CoffeeScript code was trivial. I definitely plan to use CoffeeScript as much as possible in future projects.",{"type":23,"tag":24,"props":3768,"children":3769},{},[3770],{"type":23,"tag":3759,"props":3771,"children":3775},{"alt":3772,"src":3773,"title":3774},"Backbone js","assets/images/backbone.png","backbone",[],{"type":23,"tag":24,"props":3777,"children":3778},{},[3779],{"type":28,"value":3780},"This demo only scratched the surface of Backbone.js. Views can be initialized with templates, making complex models easier to render. Backbone.js also provides functionality to automatically synch your objects to/from a server, provides support for collections and also provides routing functionality to ensure the back button works in single-page applications. I'm very interested in learning more about Backbone.js and using it to reduce the amount of front-end code I need to write.",{"type":23,"tag":24,"props":3782,"children":3783},{},[3784],{"type":28,"value":3785},"In general, I think the combination of CoffeeScript and Backbone.js results in a much cleaner application. View code is segregated from the model code and developers are forced into keeping things more modular. This style would also make unit testing easier. I'm anxious to continue experimenting with both of these technologies to see how they boost my productivity and allow me to develop larger web-apps in a more controlled manner.",{"title":8,"searchDepth":247,"depth":247,"links":3787},[],"content:rbrubaker:2012-06:coffee-backbone-3.md","rbrubaker/2012-06/coffee-backbone-3.md","rbrubaker/2012-06/coffee-backbone-3",{"user":3792,"name":3793},"rbrubaker","Ryan Brubaker",{"_path":3795,"_dir":3664,"_draft":7,"_partial":7,"_locale":8,"title":3796,"description":3797,"publishDate":3798,"tags":3799,"excerpt":3797,"body":3800,"_type":3653,"_id":5362,"_source":3655,"_file":5363,"_stem":5364,"_extension":3658,"author":5365},"/rbrubaker/2012-06/coffee-backbone-2","Fun with CoffeeScript and Backbone.js : Part 2","In this post I’ll discuss the code that handles updating the UI.","2012-06-07",[3669,3670,17,3671],{"type":20,"children":3801,"toc":5360},[3802,3806,3815,3831,3842,4013,4034,4045,4591,4610,4621,5345,5356],{"type":23,"tag":24,"props":3803,"children":3804},{},[3805],{"type":28,"value":3797},{"type":23,"tag":24,"props":3807,"children":3808},{},[3809,3810,3814],{"type":28,"value":872},{"type":23,"tag":31,"props":3811,"children":3812},{"href":3723},[3813],{"type":28,"value":3726},{"type":28,"value":496},{"type":23,"tag":24,"props":3816,"children":3817},{},[3818,3819,3824,3825,3830],{"type":28,"value":3700},{"type":23,"tag":31,"props":3820,"children":3822},{"href":3703,"rel":3821},[35],[3823],{"type":28,"value":3707},{"type":28,"value":3709},{"type":23,"tag":31,"props":3826,"children":3828},{"href":3712,"rel":3827},[35],[3829],{"type":28,"value":3707},{"type":28,"value":496},{"type":23,"tag":24,"props":3832,"children":3833},{},[3834],{"type":23,"tag":1179,"props":3835,"children":3836},{},[3837],{"type":23,"tag":3743,"props":3838,"children":3839},{},[3840],{"type":28,"value":3841},"Communication Line View",{"type":23,"tag":92,"props":3843,"children":3847},{"className":3844,"code":3845,"language":3846,"meta":8,"style":8},"language-coffee shiki shiki-themes github-light github-dark","class DecoderView extends Backbone.View\n   initialize: ->\n      @model.bind('parsedCharacter', @render)\n\n   render: (token) =>\n      messageBox = $('#messageBox')\n      messageBox.val(messageBox.val() + token)\n","coffee",[3848],{"type":23,"tag":99,"props":3849,"children":3850},{"__ignoreMap":8},[3851,3874,3892,3919,3926,3948,3977],{"type":23,"tag":103,"props":3852,"children":3853},{"class":105,"line":106},[3854,3859,3864,3869],{"type":23,"tag":103,"props":3855,"children":3856},{"style":363},[3857],{"type":28,"value":3858},"class",{"type":23,"tag":103,"props":3860,"children":3861},{"style":122},[3862],{"type":28,"value":3863}," DecoderView",{"type":23,"tag":103,"props":3865,"children":3866},{"style":363},[3867],{"type":28,"value":3868}," extends",{"type":23,"tag":103,"props":3870,"children":3871},{"style":122},[3872],{"type":28,"value":3873}," Backbone.View\n",{"type":23,"tag":103,"props":3875,"children":3876},{"class":105,"line":186},[3877,3882,3887],{"type":23,"tag":103,"props":3878,"children":3879},{"style":122},[3880],{"type":28,"value":3881},"   initialize",{"type":23,"tag":103,"props":3883,"children":3884},{"style":363},[3885],{"type":28,"value":3886},":",{"type":23,"tag":103,"props":3888,"children":3889},{"style":363},[3890],{"type":28,"value":3891}," ->\n",{"type":23,"tag":103,"props":3893,"children":3894},{"class":105,"line":247},[3895,3900,3905,3909,3914],{"type":23,"tag":103,"props":3896,"children":3897},{"style":110},[3898],{"type":28,"value":3899},"      @model.",{"type":23,"tag":103,"props":3901,"children":3902},{"style":122},[3903],{"type":28,"value":3904},"bind",{"type":23,"tag":103,"props":3906,"children":3907},{"style":110},[3908],{"type":28,"value":331},{"type":23,"tag":103,"props":3910,"children":3911},{"style":133},[3912],{"type":28,"value":3913},"'parsedCharacter'",{"type":23,"tag":103,"props":3915,"children":3916},{"style":110},[3917],{"type":28,"value":3918},", @render)\n",{"type":23,"tag":103,"props":3920,"children":3921},{"class":105,"line":290},[3922],{"type":23,"tag":103,"props":3923,"children":3924},{"emptyLinePlaceholder":1321},[3925],{"type":28,"value":1324},{"type":23,"tag":103,"props":3927,"children":3928},{"class":105,"line":466},[3929,3934,3938,3943],{"type":23,"tag":103,"props":3930,"children":3931},{"style":122},[3932],{"type":28,"value":3933},"   render",{"type":23,"tag":103,"props":3935,"children":3936},{"style":363},[3937],{"type":28,"value":3886},{"type":23,"tag":103,"props":3939,"children":3940},{"style":110},[3941],{"type":28,"value":3942}," (token) ",{"type":23,"tag":103,"props":3944,"children":3945},{"style":363},[3946],{"type":28,"value":3947},"=>\n",{"type":23,"tag":103,"props":3949,"children":3950},{"class":105,"line":485},[3951,3956,3960,3964,3968,3973],{"type":23,"tag":103,"props":3952,"children":3953},{"style":373},[3954],{"type":28,"value":3955},"      messageBox",{"type":23,"tag":103,"props":3957,"children":3958},{"style":363},[3959],{"type":28,"value":1124},{"type":23,"tag":103,"props":3961,"children":3962},{"style":122},[3963],{"type":28,"value":1077},{"type":23,"tag":103,"props":3965,"children":3966},{"style":110},[3967],{"type":28,"value":331},{"type":23,"tag":103,"props":3969,"children":3970},{"style":133},[3971],{"type":28,"value":3972},"'#messageBox'",{"type":23,"tag":103,"props":3974,"children":3975},{"style":110},[3976],{"type":28,"value":455},{"type":23,"tag":103,"props":3978,"children":3979},{"class":105,"line":514},[3980,3985,3990,3995,3999,4004,4008],{"type":23,"tag":103,"props":3981,"children":3982},{"style":110},[3983],{"type":28,"value":3984},"      messageBox.",{"type":23,"tag":103,"props":3986,"children":3987},{"style":122},[3988],{"type":28,"value":3989},"val",{"type":23,"tag":103,"props":3991,"children":3992},{"style":110},[3993],{"type":28,"value":3994},"(messageBox.",{"type":23,"tag":103,"props":3996,"children":3997},{"style":122},[3998],{"type":28,"value":3989},{"type":23,"tag":103,"props":4000,"children":4001},{"style":110},[4002],{"type":28,"value":4003},"() ",{"type":23,"tag":103,"props":4005,"children":4006},{"style":363},[4007],{"type":28,"value":1008},{"type":23,"tag":103,"props":4009,"children":4010},{"style":110},[4011],{"type":28,"value":4012}," token)\n",{"type":23,"tag":24,"props":4014,"children":4015},{},[4016,4018,4025,4027,4032],{"type":28,"value":4017},"The CommunicationLineView class is a Backbone.js view class that handles the animation of signals sent across the communication line. In ",{"type":23,"tag":31,"props":4019,"children":4022},{"href":4020,"rel":4021},"http://blog.artlogic.com/2012/06/06/fun-with-coffeescript-and-backbone-js-part-1/",[35],[4023],{"type":28,"value":4024},"Part 1",{"type":28,"value":4026},", I mentioned that the model representing the communication line fires a ",{"type":23,"tag":3743,"props":4028,"children":4029},{},[4030],{"type":28,"value":4031},"hasNewData",{"type":28,"value":4033}," event each time the tokens progress one step through the line. As you can see above, this view is bound to that event and rerenders itself every time it receives the event. The render method iterates over the current tokens and draws the appropriate token shape for each line position.",{"type":23,"tag":24,"props":4035,"children":4036},{},[4037],{"type":23,"tag":3743,"props":4038,"children":4039},{},[4040],{"type":23,"tag":1179,"props":4041,"children":4042},{},[4043],{"type":28,"value":4044},"Decoder Model",{"type":23,"tag":92,"props":4046,"children":4048},{"className":3844,"code":4047,"language":3846,"meta":8,"style":8},"class MorseDecoder extends Backbone.Model\n\n   initializeKey: =>\n      \"\"\"\n      Omitting code that initializes the morse code key \n      dictionary.\n      \"\"\"\n\n   initialize: =>\n      @inputTokens = []\n      @numEmptyTokensInARow = 0\n      @initializeKey()\n\n   processToken: (token) =>\n      if token == ''\n         @parseTokens() if \n          ++@numEmptyTokensInARow >= 10\n      else if token == kWordStopToken\n         @parseTokens() if @inputTokens.length > 0\n         @trigger('parsedCharacter', ' ')\n      else\n         @inputTokens.push(token)\n         @numEmptyTokensInARow = 0\n\n   parseTokens: =>\n      if @inputTokens.length > 0\n         token = @key[@inputTokens.join('')]\n         @trigger('parsedCharacter', token) if \n          token != undefined\n      @numEmptyTokensInARow = 0\n      @inputTokens.length = 0\n",[4049],{"type":23,"tag":99,"props":4050,"children":4051},{"__ignoreMap":8},[4052,4073,4080,4097,4105,4113,4121,4128,4135,4150,4167,4184,4202,4209,4229,4252,4278,4301,4326,4359,4392,4400,4418,4434,4441,4457,4476,4511,4543,4560,4575],{"type":23,"tag":103,"props":4053,"children":4054},{"class":105,"line":106},[4055,4059,4064,4068],{"type":23,"tag":103,"props":4056,"children":4057},{"style":363},[4058],{"type":28,"value":3858},{"type":23,"tag":103,"props":4060,"children":4061},{"style":122},[4062],{"type":28,"value":4063}," MorseDecoder",{"type":23,"tag":103,"props":4065,"children":4066},{"style":363},[4067],{"type":28,"value":3868},{"type":23,"tag":103,"props":4069,"children":4070},{"style":122},[4071],{"type":28,"value":4072}," Backbone.Model\n",{"type":23,"tag":103,"props":4074,"children":4075},{"class":105,"line":186},[4076],{"type":23,"tag":103,"props":4077,"children":4078},{"emptyLinePlaceholder":1321},[4079],{"type":28,"value":1324},{"type":23,"tag":103,"props":4081,"children":4082},{"class":105,"line":247},[4083,4088,4092],{"type":23,"tag":103,"props":4084,"children":4085},{"style":122},[4086],{"type":28,"value":4087},"   initializeKey",{"type":23,"tag":103,"props":4089,"children":4090},{"style":363},[4091],{"type":28,"value":3886},{"type":23,"tag":103,"props":4093,"children":4094},{"style":363},[4095],{"type":28,"value":4096}," =>\n",{"type":23,"tag":103,"props":4098,"children":4099},{"class":105,"line":290},[4100],{"type":23,"tag":103,"props":4101,"children":4102},{"style":133},[4103],{"type":28,"value":4104},"      \"\"\"\n",{"type":23,"tag":103,"props":4106,"children":4107},{"class":105,"line":466},[4108],{"type":23,"tag":103,"props":4109,"children":4110},{"style":133},[4111],{"type":28,"value":4112},"      Omitting code that initializes the morse code key \n",{"type":23,"tag":103,"props":4114,"children":4115},{"class":105,"line":485},[4116],{"type":23,"tag":103,"props":4117,"children":4118},{"style":133},[4119],{"type":28,"value":4120},"      dictionary.\n",{"type":23,"tag":103,"props":4122,"children":4123},{"class":105,"line":514},[4124],{"type":23,"tag":103,"props":4125,"children":4126},{"style":133},[4127],{"type":28,"value":4104},{"type":23,"tag":103,"props":4129,"children":4130},{"class":105,"line":533},[4131],{"type":23,"tag":103,"props":4132,"children":4133},{"emptyLinePlaceholder":1321},[4134],{"type":28,"value":1324},{"type":23,"tag":103,"props":4136,"children":4137},{"class":105,"line":552},[4138,4142,4146],{"type":23,"tag":103,"props":4139,"children":4140},{"style":122},[4141],{"type":28,"value":3881},{"type":23,"tag":103,"props":4143,"children":4144},{"style":363},[4145],{"type":28,"value":3886},{"type":23,"tag":103,"props":4147,"children":4148},{"style":363},[4149],{"type":28,"value":4096},{"type":23,"tag":103,"props":4151,"children":4152},{"class":105,"line":566},[4153,4158,4162],{"type":23,"tag":103,"props":4154,"children":4155},{"style":110},[4156],{"type":28,"value":4157},"      @inputTokens ",{"type":23,"tag":103,"props":4159,"children":4160},{"style":363},[4161],{"type":28,"value":130},{"type":23,"tag":103,"props":4163,"children":4164},{"style":110},[4165],{"type":28,"value":4166}," []\n",{"type":23,"tag":103,"props":4168,"children":4169},{"class":105,"line":601},[4170,4175,4179],{"type":23,"tag":103,"props":4171,"children":4172},{"style":110},[4173],{"type":28,"value":4174},"      @numEmptyTokensInARow ",{"type":23,"tag":103,"props":4176,"children":4177},{"style":363},[4178],{"type":28,"value":130},{"type":23,"tag":103,"props":4180,"children":4181},{"style":414},[4182],{"type":28,"value":4183}," 0\n",{"type":23,"tag":103,"props":4185,"children":4186},{"class":105,"line":610},[4187,4192,4197],{"type":23,"tag":103,"props":4188,"children":4189},{"style":110},[4190],{"type":28,"value":4191},"      @",{"type":23,"tag":103,"props":4193,"children":4194},{"style":122},[4195],{"type":28,"value":4196},"initializeKey",{"type":23,"tag":103,"props":4198,"children":4199},{"style":110},[4200],{"type":28,"value":4201},"()\n",{"type":23,"tag":103,"props":4203,"children":4204},{"class":105,"line":629},[4205],{"type":23,"tag":103,"props":4206,"children":4207},{"emptyLinePlaceholder":1321},[4208],{"type":28,"value":1324},{"type":23,"tag":103,"props":4210,"children":4211},{"class":105,"line":663},[4212,4217,4221,4225],{"type":23,"tag":103,"props":4213,"children":4214},{"style":122},[4215],{"type":28,"value":4216},"   processToken",{"type":23,"tag":103,"props":4218,"children":4219},{"style":363},[4220],{"type":28,"value":3886},{"type":23,"tag":103,"props":4222,"children":4223},{"style":110},[4224],{"type":28,"value":3942},{"type":23,"tag":103,"props":4226,"children":4227},{"style":363},[4228],{"type":28,"value":3947},{"type":23,"tag":103,"props":4230,"children":4231},{"class":105,"line":672},[4232,4237,4242,4247],{"type":23,"tag":103,"props":4233,"children":4234},{"style":363},[4235],{"type":28,"value":4236},"      if",{"type":23,"tag":103,"props":4238,"children":4239},{"style":110},[4240],{"type":28,"value":4241}," token ",{"type":23,"tag":103,"props":4243,"children":4244},{"style":363},[4245],{"type":28,"value":4246},"==",{"type":23,"tag":103,"props":4248,"children":4249},{"style":133},[4250],{"type":28,"value":4251}," ''\n",{"type":23,"tag":103,"props":4253,"children":4254},{"class":105,"line":689},[4255,4260,4265,4269,4273],{"type":23,"tag":103,"props":4256,"children":4257},{"style":110},[4258],{"type":28,"value":4259},"         @",{"type":23,"tag":103,"props":4261,"children":4262},{"style":122},[4263],{"type":28,"value":4264},"parseTokens",{"type":23,"tag":103,"props":4266,"children":4267},{"style":110},[4268],{"type":28,"value":4003},{"type":23,"tag":103,"props":4270,"children":4271},{"style":363},[4272],{"type":28,"value":398},{"type":23,"tag":103,"props":4274,"children":4275},{"style":110},[4276],{"type":28,"value":4277}," \n",{"type":23,"tag":103,"props":4279,"children":4280},{"class":105,"line":698},[4281,4286,4291,4296],{"type":23,"tag":103,"props":4282,"children":4283},{"style":363},[4284],{"type":28,"value":4285},"          ++",{"type":23,"tag":103,"props":4287,"children":4288},{"style":110},[4289],{"type":28,"value":4290},"@numEmptyTokensInARow ",{"type":23,"tag":103,"props":4292,"children":4293},{"style":363},[4294],{"type":28,"value":4295},">=",{"type":23,"tag":103,"props":4297,"children":4298},{"style":414},[4299],{"type":28,"value":4300}," 10\n",{"type":23,"tag":103,"props":4302,"children":4303},{"class":105,"line":707},[4304,4309,4313,4317,4321],{"type":23,"tag":103,"props":4305,"children":4306},{"style":363},[4307],{"type":28,"value":4308},"      else",{"type":23,"tag":103,"props":4310,"children":4311},{"style":363},[4312],{"type":28,"value":1933},{"type":23,"tag":103,"props":4314,"children":4315},{"style":110},[4316],{"type":28,"value":4241},{"type":23,"tag":103,"props":4318,"children":4319},{"style":363},[4320],{"type":28,"value":4246},{"type":23,"tag":103,"props":4322,"children":4323},{"style":110},[4324],{"type":28,"value":4325}," kWordStopToken\n",{"type":23,"tag":103,"props":4327,"children":4328},{"class":105,"line":1723},[4329,4333,4337,4341,4345,4350,4355],{"type":23,"tag":103,"props":4330,"children":4331},{"style":110},[4332],{"type":28,"value":4259},{"type":23,"tag":103,"props":4334,"children":4335},{"style":122},[4336],{"type":28,"value":4264},{"type":23,"tag":103,"props":4338,"children":4339},{"style":110},[4340],{"type":28,"value":4003},{"type":23,"tag":103,"props":4342,"children":4343},{"style":363},[4344],{"type":28,"value":398},{"type":23,"tag":103,"props":4346,"children":4347},{"style":110},[4348],{"type":28,"value":4349}," @inputTokens.length ",{"type":23,"tag":103,"props":4351,"children":4352},{"style":363},[4353],{"type":28,"value":4354},">",{"type":23,"tag":103,"props":4356,"children":4357},{"style":414},[4358],{"type":28,"value":4183},{"type":23,"tag":103,"props":4360,"children":4361},{"class":105,"line":1737},[4362,4366,4371,4375,4379,4383,4388],{"type":23,"tag":103,"props":4363,"children":4364},{"style":110},[4365],{"type":28,"value":4259},{"type":23,"tag":103,"props":4367,"children":4368},{"style":122},[4369],{"type":28,"value":4370},"trigger",{"type":23,"tag":103,"props":4372,"children":4373},{"style":110},[4374],{"type":28,"value":331},{"type":23,"tag":103,"props":4376,"children":4377},{"style":133},[4378],{"type":28,"value":3913},{"type":23,"tag":103,"props":4380,"children":4381},{"style":110},[4382],{"type":28,"value":360},{"type":23,"tag":103,"props":4384,"children":4385},{"style":133},[4386],{"type":28,"value":4387},"' '",{"type":23,"tag":103,"props":4389,"children":4390},{"style":110},[4391],{"type":28,"value":455},{"type":23,"tag":103,"props":4393,"children":4394},{"class":105,"line":1745},[4395],{"type":23,"tag":103,"props":4396,"children":4397},{"style":363},[4398],{"type":28,"value":4399},"      else\n",{"type":23,"tag":103,"props":4401,"children":4402},{"class":105,"line":2560},[4403,4408,4413],{"type":23,"tag":103,"props":4404,"children":4405},{"style":110},[4406],{"type":28,"value":4407},"         @inputTokens.",{"type":23,"tag":103,"props":4409,"children":4410},{"style":414},[4411],{"type":28,"value":4412},"push",{"type":23,"tag":103,"props":4414,"children":4415},{"style":110},[4416],{"type":28,"value":4417},"(token)\n",{"type":23,"tag":103,"props":4419,"children":4420},{"class":105,"line":2619},[4421,4426,4430],{"type":23,"tag":103,"props":4422,"children":4423},{"style":110},[4424],{"type":28,"value":4425},"         @numEmptyTokensInARow ",{"type":23,"tag":103,"props":4427,"children":4428},{"style":363},[4429],{"type":28,"value":130},{"type":23,"tag":103,"props":4431,"children":4432},{"style":414},[4433],{"type":28,"value":4183},{"type":23,"tag":103,"props":4435,"children":4436},{"class":105,"line":2644},[4437],{"type":23,"tag":103,"props":4438,"children":4439},{"emptyLinePlaceholder":1321},[4440],{"type":28,"value":1324},{"type":23,"tag":103,"props":4442,"children":4443},{"class":105,"line":2665},[4444,4449,4453],{"type":23,"tag":103,"props":4445,"children":4446},{"style":122},[4447],{"type":28,"value":4448},"   parseTokens",{"type":23,"tag":103,"props":4450,"children":4451},{"style":363},[4452],{"type":28,"value":3886},{"type":23,"tag":103,"props":4454,"children":4455},{"style":363},[4456],{"type":28,"value":4096},{"type":23,"tag":103,"props":4458,"children":4459},{"class":105,"line":2674},[4460,4464,4468,4472],{"type":23,"tag":103,"props":4461,"children":4462},{"style":363},[4463],{"type":28,"value":4236},{"type":23,"tag":103,"props":4465,"children":4466},{"style":110},[4467],{"type":28,"value":4349},{"type":23,"tag":103,"props":4469,"children":4470},{"style":363},[4471],{"type":28,"value":4354},{"type":23,"tag":103,"props":4473,"children":4474},{"style":414},[4475],{"type":28,"value":4183},{"type":23,"tag":103,"props":4477,"children":4478},{"class":105,"line":2682},[4479,4484,4488,4493,4498,4502,4506],{"type":23,"tag":103,"props":4480,"children":4481},{"style":373},[4482],{"type":28,"value":4483},"         token",{"type":23,"tag":103,"props":4485,"children":4486},{"style":363},[4487],{"type":28,"value":1124},{"type":23,"tag":103,"props":4489,"children":4490},{"style":110},[4491],{"type":28,"value":4492}," @key[@inputTokens.",{"type":23,"tag":103,"props":4494,"children":4495},{"style":414},[4496],{"type":28,"value":4497},"join",{"type":23,"tag":103,"props":4499,"children":4500},{"style":110},[4501],{"type":28,"value":331},{"type":23,"tag":103,"props":4503,"children":4504},{"style":133},[4505],{"type":28,"value":1086},{"type":23,"tag":103,"props":4507,"children":4508},{"style":110},[4509],{"type":28,"value":4510},")]\n",{"type":23,"tag":103,"props":4512,"children":4513},{"class":105,"line":2721},[4514,4518,4522,4526,4530,4535,4539],{"type":23,"tag":103,"props":4515,"children":4516},{"style":110},[4517],{"type":28,"value":4259},{"type":23,"tag":103,"props":4519,"children":4520},{"style":122},[4521],{"type":28,"value":4370},{"type":23,"tag":103,"props":4523,"children":4524},{"style":110},[4525],{"type":28,"value":331},{"type":23,"tag":103,"props":4527,"children":4528},{"style":133},[4529],{"type":28,"value":3913},{"type":23,"tag":103,"props":4531,"children":4532},{"style":110},[4533],{"type":28,"value":4534},", token) ",{"type":23,"tag":103,"props":4536,"children":4537},{"style":363},[4538],{"type":28,"value":398},{"type":23,"tag":103,"props":4540,"children":4541},{"style":110},[4542],{"type":28,"value":4277},{"type":23,"tag":103,"props":4544,"children":4545},{"class":105,"line":2729},[4546,4551,4555],{"type":23,"tag":103,"props":4547,"children":4548},{"style":110},[4549],{"type":28,"value":4550},"          token ",{"type":23,"tag":103,"props":4552,"children":4553},{"style":363},[4554],{"type":28,"value":1499},{"type":23,"tag":103,"props":4556,"children":4557},{"style":414},[4558],{"type":28,"value":4559}," undefined\n",{"type":23,"tag":103,"props":4561,"children":4562},{"class":105,"line":2738},[4563,4567,4571],{"type":23,"tag":103,"props":4564,"children":4565},{"style":110},[4566],{"type":28,"value":4174},{"type":23,"tag":103,"props":4568,"children":4569},{"style":363},[4570],{"type":28,"value":130},{"type":23,"tag":103,"props":4572,"children":4573},{"style":414},[4574],{"type":28,"value":4183},{"type":23,"tag":103,"props":4576,"children":4577},{"class":105,"line":2771},[4578,4583,4587],{"type":23,"tag":103,"props":4579,"children":4580},{"style":110},[4581],{"type":28,"value":4582},"      @inputTokens.length ",{"type":23,"tag":103,"props":4584,"children":4585},{"style":363},[4586],{"type":28,"value":130},{"type":23,"tag":103,"props":4588,"children":4589},{"style":414},[4590],{"type":28,"value":4183},{"type":23,"tag":24,"props":4592,"children":4593},{},[4594,4596,4601,4603,4608],{"type":28,"value":4595},"The Decoder model is responsible for determining what characters the user has sent across the line. The ",{"type":23,"tag":3743,"props":4597,"children":4598},{},[4599],{"type":28,"value":4600},"processToken",{"type":28,"value":4602}," function is called each time the tokens on the communication line progress one step through the line. The decoder processes the current tokens sent by the user anytime it sees 10 or more empty tokens in a row or receives a word-break token. If the decoder parses a known morse code sequence it fires a ",{"type":23,"tag":3743,"props":4604,"children":4605},{},[4606],{"type":28,"value":4607},"parsedCharacter",{"type":28,"value":4609}," event letting the message field know it needs to rerender itself.",{"type":23,"tag":24,"props":4611,"children":4612},{},[4613],{"type":23,"tag":3743,"props":4614,"children":4615},{},[4616],{"type":23,"tag":1179,"props":4617,"children":4618},{},[4619],{"type":28,"value":4620},"Decoder View",{"type":23,"tag":92,"props":4622,"children":4624},{"className":3844,"code":4623,"language":3846,"meta":8,"style":8},"class CommunicationLineView extends Backbone.View\n   initialize: ->\n      @model.bind('hasNewData', @render)\n\n   render: (tokens) =>\n      context = document.getElementById(\n       \"communicationLineCanvas\").getContext('2d')\n\n      context.clearRect(0, 0, context.canvas.width, 29)\n      tokenNum = 0\n      for token in tokens\n         do (token) ->\n            if kDotToken == token\n               context.beginPath()\n               context.moveTo((50 * tokenNum) + 15, 15)\n\n               context.arc((50 * tokenNum) + 15, 15, 10, \n                0, Math.PI*2, false)\n\n               context.closePath()\n               context.fill()\n               context.stroke()\n            else if kDashToken == token\n               context.fillRect((50 * tokenNum) + 15, \n                15, 25, 10)\n            else if kWordStopToken == token\n               context.fillRect((50 * tokenNum) + 30, \n                5, 10, 20)\n            tokenNum += 1\n",[4625],{"type":23,"tag":99,"props":4626,"children":4627},{"__ignoreMap":8},[4628,4648,4663,4687,4694,4714,4745,4775,4782,4825,4841,4863,4880,4901,4918,4972,4979,5037,5086,5093,5109,5125,5141,5165,5205,5234,5258,5298,5327],{"type":23,"tag":103,"props":4629,"children":4630},{"class":105,"line":106},[4631,4635,4640,4644],{"type":23,"tag":103,"props":4632,"children":4633},{"style":363},[4634],{"type":28,"value":3858},{"type":23,"tag":103,"props":4636,"children":4637},{"style":122},[4638],{"type":28,"value":4639}," CommunicationLineView",{"type":23,"tag":103,"props":4641,"children":4642},{"style":363},[4643],{"type":28,"value":3868},{"type":23,"tag":103,"props":4645,"children":4646},{"style":122},[4647],{"type":28,"value":3873},{"type":23,"tag":103,"props":4649,"children":4650},{"class":105,"line":186},[4651,4655,4659],{"type":23,"tag":103,"props":4652,"children":4653},{"style":122},[4654],{"type":28,"value":3881},{"type":23,"tag":103,"props":4656,"children":4657},{"style":363},[4658],{"type":28,"value":3886},{"type":23,"tag":103,"props":4660,"children":4661},{"style":363},[4662],{"type":28,"value":3891},{"type":23,"tag":103,"props":4664,"children":4665},{"class":105,"line":247},[4666,4670,4674,4678,4683],{"type":23,"tag":103,"props":4667,"children":4668},{"style":110},[4669],{"type":28,"value":3899},{"type":23,"tag":103,"props":4671,"children":4672},{"style":122},[4673],{"type":28,"value":3904},{"type":23,"tag":103,"props":4675,"children":4676},{"style":110},[4677],{"type":28,"value":331},{"type":23,"tag":103,"props":4679,"children":4680},{"style":133},[4681],{"type":28,"value":4682},"'hasNewData'",{"type":23,"tag":103,"props":4684,"children":4685},{"style":110},[4686],{"type":28,"value":3918},{"type":23,"tag":103,"props":4688,"children":4689},{"class":105,"line":290},[4690],{"type":23,"tag":103,"props":4691,"children":4692},{"emptyLinePlaceholder":1321},[4693],{"type":28,"value":1324},{"type":23,"tag":103,"props":4695,"children":4696},{"class":105,"line":466},[4697,4701,4705,4710],{"type":23,"tag":103,"props":4698,"children":4699},{"style":122},[4700],{"type":28,"value":3933},{"type":23,"tag":103,"props":4702,"children":4703},{"style":363},[4704],{"type":28,"value":3886},{"type":23,"tag":103,"props":4706,"children":4707},{"style":110},[4708],{"type":28,"value":4709}," (tokens) ",{"type":23,"tag":103,"props":4711,"children":4712},{"style":363},[4713],{"type":28,"value":3947},{"type":23,"tag":103,"props":4715,"children":4716},{"class":105,"line":485},[4717,4722,4726,4731,4735,4740],{"type":23,"tag":103,"props":4718,"children":4719},{"style":373},[4720],{"type":28,"value":4721},"      context",{"type":23,"tag":103,"props":4723,"children":4724},{"style":363},[4725],{"type":28,"value":1124},{"type":23,"tag":103,"props":4727,"children":4728},{"style":414},[4729],{"type":28,"value":4730}," document",{"type":23,"tag":103,"props":4732,"children":4733},{"style":110},[4734],{"type":28,"value":496},{"type":23,"tag":103,"props":4736,"children":4737},{"style":414},[4738],{"type":28,"value":4739},"getElementById",{"type":23,"tag":103,"props":4741,"children":4742},{"style":110},[4743],{"type":28,"value":4744},"(\n",{"type":23,"tag":103,"props":4746,"children":4747},{"class":105,"line":514},[4748,4753,4757,4762,4766,4771],{"type":23,"tag":103,"props":4749,"children":4750},{"style":133},[4751],{"type":28,"value":4752},"       \"communicationLineCanvas\"",{"type":23,"tag":103,"props":4754,"children":4755},{"style":110},[4756],{"type":28,"value":341},{"type":23,"tag":103,"props":4758,"children":4759},{"style":414},[4760],{"type":28,"value":4761},"getContext",{"type":23,"tag":103,"props":4763,"children":4764},{"style":110},[4765],{"type":28,"value":331},{"type":23,"tag":103,"props":4767,"children":4768},{"style":133},[4769],{"type":28,"value":4770},"'2d'",{"type":23,"tag":103,"props":4772,"children":4773},{"style":110},[4774],{"type":28,"value":455},{"type":23,"tag":103,"props":4776,"children":4777},{"class":105,"line":533},[4778],{"type":23,"tag":103,"props":4779,"children":4780},{"emptyLinePlaceholder":1321},[4781],{"type":28,"value":1324},{"type":23,"tag":103,"props":4783,"children":4784},{"class":105,"line":552},[4785,4790,4795,4799,4803,4807,4811,4816,4821],{"type":23,"tag":103,"props":4786,"children":4787},{"style":110},[4788],{"type":28,"value":4789},"      context.",{"type":23,"tag":103,"props":4791,"children":4792},{"style":122},[4793],{"type":28,"value":4794},"clearRect",{"type":23,"tag":103,"props":4796,"children":4797},{"style":110},[4798],{"type":28,"value":331},{"type":23,"tag":103,"props":4800,"children":4801},{"style":414},[4802],{"type":28,"value":1233},{"type":23,"tag":103,"props":4804,"children":4805},{"style":110},[4806],{"type":28,"value":360},{"type":23,"tag":103,"props":4808,"children":4809},{"style":414},[4810],{"type":28,"value":1233},{"type":23,"tag":103,"props":4812,"children":4813},{"style":110},[4814],{"type":28,"value":4815},", context.canvas.width, ",{"type":23,"tag":103,"props":4817,"children":4818},{"style":414},[4819],{"type":28,"value":4820},"29",{"type":23,"tag":103,"props":4822,"children":4823},{"style":110},[4824],{"type":28,"value":455},{"type":23,"tag":103,"props":4826,"children":4827},{"class":105,"line":566},[4828,4833,4837],{"type":23,"tag":103,"props":4829,"children":4830},{"style":373},[4831],{"type":28,"value":4832},"      tokenNum",{"type":23,"tag":103,"props":4834,"children":4835},{"style":363},[4836],{"type":28,"value":1124},{"type":23,"tag":103,"props":4838,"children":4839},{"style":414},[4840],{"type":28,"value":4183},{"type":23,"tag":103,"props":4842,"children":4843},{"class":105,"line":601},[4844,4849,4853,4858],{"type":23,"tag":103,"props":4845,"children":4846},{"style":363},[4847],{"type":28,"value":4848},"      for",{"type":23,"tag":103,"props":4850,"children":4851},{"style":110},[4852],{"type":28,"value":4241},{"type":23,"tag":103,"props":4854,"children":4855},{"style":363},[4856],{"type":28,"value":4857},"in",{"type":23,"tag":103,"props":4859,"children":4860},{"style":110},[4861],{"type":28,"value":4862}," tokens\n",{"type":23,"tag":103,"props":4864,"children":4865},{"class":105,"line":610},[4866,4871,4875],{"type":23,"tag":103,"props":4867,"children":4868},{"style":363},[4869],{"type":28,"value":4870},"         do",{"type":23,"tag":103,"props":4872,"children":4873},{"style":110},[4874],{"type":28,"value":3942},{"type":23,"tag":103,"props":4876,"children":4877},{"style":363},[4878],{"type":28,"value":4879},"->\n",{"type":23,"tag":103,"props":4881,"children":4882},{"class":105,"line":629},[4883,4887,4892,4896],{"type":23,"tag":103,"props":4884,"children":4885},{"style":363},[4886],{"type":28,"value":3153},{"type":23,"tag":103,"props":4888,"children":4889},{"style":110},[4890],{"type":28,"value":4891}," kDotToken ",{"type":23,"tag":103,"props":4893,"children":4894},{"style":363},[4895],{"type":28,"value":4246},{"type":23,"tag":103,"props":4897,"children":4898},{"style":110},[4899],{"type":28,"value":4900}," token\n",{"type":23,"tag":103,"props":4902,"children":4903},{"class":105,"line":663},[4904,4909,4914],{"type":23,"tag":103,"props":4905,"children":4906},{"style":110},[4907],{"type":28,"value":4908},"               context.",{"type":23,"tag":103,"props":4910,"children":4911},{"style":122},[4912],{"type":28,"value":4913},"beginPath",{"type":23,"tag":103,"props":4915,"children":4916},{"style":110},[4917],{"type":28,"value":4201},{"type":23,"tag":103,"props":4919,"children":4920},{"class":105,"line":672},[4921,4925,4930,4935,4940,4945,4950,4954,4959,4963,4968],{"type":23,"tag":103,"props":4922,"children":4923},{"style":110},[4924],{"type":28,"value":4908},{"type":23,"tag":103,"props":4926,"children":4927},{"style":414},[4928],{"type":28,"value":4929},"moveTo",{"type":23,"tag":103,"props":4931,"children":4932},{"style":110},[4933],{"type":28,"value":4934},"((",{"type":23,"tag":103,"props":4936,"children":4937},{"style":414},[4938],{"type":28,"value":4939},"50",{"type":23,"tag":103,"props":4941,"children":4942},{"style":363},[4943],{"type":28,"value":4944}," *",{"type":23,"tag":103,"props":4946,"children":4947},{"style":110},[4948],{"type":28,"value":4949}," tokenNum) ",{"type":23,"tag":103,"props":4951,"children":4952},{"style":363},[4953],{"type":28,"value":1008},{"type":23,"tag":103,"props":4955,"children":4956},{"style":414},[4957],{"type":28,"value":4958}," 15",{"type":23,"tag":103,"props":4960,"children":4961},{"style":110},[4962],{"type":28,"value":360},{"type":23,"tag":103,"props":4964,"children":4965},{"style":414},[4966],{"type":28,"value":4967},"15",{"type":23,"tag":103,"props":4969,"children":4970},{"style":110},[4971],{"type":28,"value":455},{"type":23,"tag":103,"props":4973,"children":4974},{"class":105,"line":689},[4975],{"type":23,"tag":103,"props":4976,"children":4977},{"emptyLinePlaceholder":1321},[4978],{"type":28,"value":1324},{"type":23,"tag":103,"props":4980,"children":4981},{"class":105,"line":698},[4982,4986,4991,4995,4999,5003,5007,5011,5015,5019,5023,5027,5032],{"type":23,"tag":103,"props":4983,"children":4984},{"style":110},[4985],{"type":28,"value":4908},{"type":23,"tag":103,"props":4987,"children":4988},{"style":122},[4989],{"type":28,"value":4990},"arc",{"type":23,"tag":103,"props":4992,"children":4993},{"style":110},[4994],{"type":28,"value":4934},{"type":23,"tag":103,"props":4996,"children":4997},{"style":414},[4998],{"type":28,"value":4939},{"type":23,"tag":103,"props":5000,"children":5001},{"style":363},[5002],{"type":28,"value":4944},{"type":23,"tag":103,"props":5004,"children":5005},{"style":110},[5006],{"type":28,"value":4949},{"type":23,"tag":103,"props":5008,"children":5009},{"style":363},[5010],{"type":28,"value":1008},{"type":23,"tag":103,"props":5012,"children":5013},{"style":414},[5014],{"type":28,"value":4958},{"type":23,"tag":103,"props":5016,"children":5017},{"style":110},[5018],{"type":28,"value":360},{"type":23,"tag":103,"props":5020,"children":5021},{"style":414},[5022],{"type":28,"value":4967},{"type":23,"tag":103,"props":5024,"children":5025},{"style":110},[5026],{"type":28,"value":360},{"type":23,"tag":103,"props":5028,"children":5029},{"style":414},[5030],{"type":28,"value":5031},"10",{"type":23,"tag":103,"props":5033,"children":5034},{"style":110},[5035],{"type":28,"value":5036},", \n",{"type":23,"tag":103,"props":5038,"children":5039},{"class":105,"line":707},[5040,5045,5049,5054,5058,5063,5068,5073,5077,5082],{"type":23,"tag":103,"props":5041,"children":5042},{"style":414},[5043],{"type":28,"value":5044},"                0",{"type":23,"tag":103,"props":5046,"children":5047},{"style":110},[5048],{"type":28,"value":360},{"type":23,"tag":103,"props":5050,"children":5051},{"style":414},[5052],{"type":28,"value":5053},"Math",{"type":23,"tag":103,"props":5055,"children":5056},{"style":110},[5057],{"type":28,"value":496},{"type":23,"tag":103,"props":5059,"children":5060},{"style":414},[5061],{"type":28,"value":5062},"PI",{"type":23,"tag":103,"props":5064,"children":5065},{"style":363},[5066],{"type":28,"value":5067},"*",{"type":23,"tag":103,"props":5069,"children":5070},{"style":414},[5071],{"type":28,"value":5072},"2",{"type":23,"tag":103,"props":5074,"children":5075},{"style":110},[5076],{"type":28,"value":360},{"type":23,"tag":103,"props":5078,"children":5079},{"style":414},[5080],{"type":28,"value":5081},"false",{"type":23,"tag":103,"props":5083,"children":5084},{"style":110},[5085],{"type":28,"value":455},{"type":23,"tag":103,"props":5087,"children":5088},{"class":105,"line":1723},[5089],{"type":23,"tag":103,"props":5090,"children":5091},{"emptyLinePlaceholder":1321},[5092],{"type":28,"value":1324},{"type":23,"tag":103,"props":5094,"children":5095},{"class":105,"line":1737},[5096,5100,5105],{"type":23,"tag":103,"props":5097,"children":5098},{"style":110},[5099],{"type":28,"value":4908},{"type":23,"tag":103,"props":5101,"children":5102},{"style":122},[5103],{"type":28,"value":5104},"closePath",{"type":23,"tag":103,"props":5106,"children":5107},{"style":110},[5108],{"type":28,"value":4201},{"type":23,"tag":103,"props":5110,"children":5111},{"class":105,"line":1745},[5112,5116,5121],{"type":23,"tag":103,"props":5113,"children":5114},{"style":110},[5115],{"type":28,"value":4908},{"type":23,"tag":103,"props":5117,"children":5118},{"style":122},[5119],{"type":28,"value":5120},"fill",{"type":23,"tag":103,"props":5122,"children":5123},{"style":110},[5124],{"type":28,"value":4201},{"type":23,"tag":103,"props":5126,"children":5127},{"class":105,"line":2560},[5128,5132,5137],{"type":23,"tag":103,"props":5129,"children":5130},{"style":110},[5131],{"type":28,"value":4908},{"type":23,"tag":103,"props":5133,"children":5134},{"style":122},[5135],{"type":28,"value":5136},"stroke",{"type":23,"tag":103,"props":5138,"children":5139},{"style":110},[5140],{"type":28,"value":4201},{"type":23,"tag":103,"props":5142,"children":5143},{"class":105,"line":2619},[5144,5148,5152,5157,5161],{"type":23,"tag":103,"props":5145,"children":5146},{"style":363},[5147],{"type":28,"value":3319},{"type":23,"tag":103,"props":5149,"children":5150},{"style":363},[5151],{"type":28,"value":1933},{"type":23,"tag":103,"props":5153,"children":5154},{"style":110},[5155],{"type":28,"value":5156}," kDashToken ",{"type":23,"tag":103,"props":5158,"children":5159},{"style":363},[5160],{"type":28,"value":4246},{"type":23,"tag":103,"props":5162,"children":5163},{"style":110},[5164],{"type":28,"value":4900},{"type":23,"tag":103,"props":5166,"children":5167},{"class":105,"line":2644},[5168,5172,5177,5181,5185,5189,5193,5197,5201],{"type":23,"tag":103,"props":5169,"children":5170},{"style":110},[5171],{"type":28,"value":4908},{"type":23,"tag":103,"props":5173,"children":5174},{"style":122},[5175],{"type":28,"value":5176},"fillRect",{"type":23,"tag":103,"props":5178,"children":5179},{"style":110},[5180],{"type":28,"value":4934},{"type":23,"tag":103,"props":5182,"children":5183},{"style":414},[5184],{"type":28,"value":4939},{"type":23,"tag":103,"props":5186,"children":5187},{"style":363},[5188],{"type":28,"value":4944},{"type":23,"tag":103,"props":5190,"children":5191},{"style":110},[5192],{"type":28,"value":4949},{"type":23,"tag":103,"props":5194,"children":5195},{"style":363},[5196],{"type":28,"value":1008},{"type":23,"tag":103,"props":5198,"children":5199},{"style":414},[5200],{"type":28,"value":4958},{"type":23,"tag":103,"props":5202,"children":5203},{"style":110},[5204],{"type":28,"value":5036},{"type":23,"tag":103,"props":5206,"children":5207},{"class":105,"line":2665},[5208,5213,5217,5222,5226,5230],{"type":23,"tag":103,"props":5209,"children":5210},{"style":414},[5211],{"type":28,"value":5212},"                15",{"type":23,"tag":103,"props":5214,"children":5215},{"style":110},[5216],{"type":28,"value":360},{"type":23,"tag":103,"props":5218,"children":5219},{"style":414},[5220],{"type":28,"value":5221},"25",{"type":23,"tag":103,"props":5223,"children":5224},{"style":110},[5225],{"type":28,"value":360},{"type":23,"tag":103,"props":5227,"children":5228},{"style":414},[5229],{"type":28,"value":5031},{"type":23,"tag":103,"props":5231,"children":5232},{"style":110},[5233],{"type":28,"value":455},{"type":23,"tag":103,"props":5235,"children":5236},{"class":105,"line":2674},[5237,5241,5245,5250,5254],{"type":23,"tag":103,"props":5238,"children":5239},{"style":363},[5240],{"type":28,"value":3319},{"type":23,"tag":103,"props":5242,"children":5243},{"style":363},[5244],{"type":28,"value":1933},{"type":23,"tag":103,"props":5246,"children":5247},{"style":110},[5248],{"type":28,"value":5249}," kWordStopToken ",{"type":23,"tag":103,"props":5251,"children":5252},{"style":363},[5253],{"type":28,"value":4246},{"type":23,"tag":103,"props":5255,"children":5256},{"style":110},[5257],{"type":28,"value":4900},{"type":23,"tag":103,"props":5259,"children":5260},{"class":105,"line":2682},[5261,5265,5269,5273,5277,5281,5285,5289,5294],{"type":23,"tag":103,"props":5262,"children":5263},{"style":110},[5264],{"type":28,"value":4908},{"type":23,"tag":103,"props":5266,"children":5267},{"style":122},[5268],{"type":28,"value":5176},{"type":23,"tag":103,"props":5270,"children":5271},{"style":110},[5272],{"type":28,"value":4934},{"type":23,"tag":103,"props":5274,"children":5275},{"style":414},[5276],{"type":28,"value":4939},{"type":23,"tag":103,"props":5278,"children":5279},{"style":363},[5280],{"type":28,"value":4944},{"type":23,"tag":103,"props":5282,"children":5283},{"style":110},[5284],{"type":28,"value":4949},{"type":23,"tag":103,"props":5286,"children":5287},{"style":363},[5288],{"type":28,"value":1008},{"type":23,"tag":103,"props":5290,"children":5291},{"style":414},[5292],{"type":28,"value":5293}," 30",{"type":23,"tag":103,"props":5295,"children":5296},{"style":110},[5297],{"type":28,"value":5036},{"type":23,"tag":103,"props":5299,"children":5300},{"class":105,"line":2721},[5301,5306,5310,5314,5318,5323],{"type":23,"tag":103,"props":5302,"children":5303},{"style":414},[5304],{"type":28,"value":5305},"                5",{"type":23,"tag":103,"props":5307,"children":5308},{"style":110},[5309],{"type":28,"value":360},{"type":23,"tag":103,"props":5311,"children":5312},{"style":414},[5313],{"type":28,"value":5031},{"type":23,"tag":103,"props":5315,"children":5316},{"style":110},[5317],{"type":28,"value":360},{"type":23,"tag":103,"props":5319,"children":5320},{"style":414},[5321],{"type":28,"value":5322},"20",{"type":23,"tag":103,"props":5324,"children":5325},{"style":110},[5326],{"type":28,"value":455},{"type":23,"tag":103,"props":5328,"children":5329},{"class":105,"line":2729},[5330,5335,5340],{"type":23,"tag":103,"props":5331,"children":5332},{"style":373},[5333],{"type":28,"value":5334},"            tokenNum",{"type":23,"tag":103,"props":5336,"children":5337},{"style":363},[5338],{"type":28,"value":5339}," +=",{"type":23,"tag":103,"props":5341,"children":5342},{"style":414},[5343],{"type":28,"value":5344}," 1\n",{"type":23,"tag":24,"props":5346,"children":5347},{},[5348,5350,5354],{"type":28,"value":5349},"The Decoder view is a Backbone.js view class that represents a simple text box to display the characters the user has sent across the line. Anytime the Decoder model emits a ",{"type":23,"tag":3743,"props":5351,"children":5352},{},[5353],{"type":28,"value":4607},{"type":28,"value":5355}," event, the Decoder view appends the parsed character to the end of its text box.",{"type":23,"tag":3641,"props":5357,"children":5358},{},[5359],{"type":28,"value":3645},{"title":8,"searchDepth":247,"depth":247,"links":5361},[],"content:rbrubaker:2012-06:coffee-backbone-2.md","rbrubaker/2012-06/coffee-backbone-2.md","rbrubaker/2012-06/coffee-backbone-2",{"user":3792,"name":3793},{"_path":5367,"_dir":3664,"_draft":7,"_partial":7,"_locale":8,"title":5368,"description":5369,"publishDate":5370,"tags":5371,"excerpt":5369,"body":5372,"_type":3653,"_id":7140,"_source":3655,"_file":7141,"_stem":7142,"_extension":3658,"author":7143},"/rbrubaker/2012-06/coffe-backbone-1","Fun with CoffeeScript and Backbone.js : Part 1","CoffeeScript has been all the rage lately and I've been wanting to hop on board the bandwagon. I've also seen Backbone.js mentioned quite a bit and was even more intrigued after listening to this .NET Rocks podcast. I decided to convert some plain JavaScript code I had in a side project to use both CoffeeScript and Backbone.js and see how things went.","2012-06-06",[3669,3670,17,3671],{"type":20,"children":5373,"toc":7138},[5374,5401,5410,5428,5433,5444,5821,5832,5843,6088,6099,6104,6672,6677,6688,7124,7129,7134],{"type":23,"tag":24,"props":5375,"children":5376},{},[5377,5382,5384,5390,5392,5399],{"type":23,"tag":31,"props":5378,"children":5380},{"href":3681,"rel":5379},[35],[5381],{"type":28,"value":3685},{"type":28,"value":5383}," has been all the rage lately and I've been wanting to hop on board the bandwagon. I've also seen ",{"type":23,"tag":31,"props":5385,"children":5388},{"href":5386,"rel":5387},"http://backbonejs.org",[35],[5389],{"type":28,"value":3694},{"type":28,"value":5391}," mentioned quite a bit and was even more intrigued after listening to this ",{"type":23,"tag":31,"props":5393,"children":5396},{"href":5394,"rel":5395},"http://www.dotnetrocks.com/default.aspx?showNum=743",[35],[5397],{"type":28,"value":5398},".NET Rocks podcast",{"type":28,"value":5400},". I decided to convert some plain JavaScript code I had in a side project to use both CoffeeScript and Backbone.js and see how things went.",{"type":23,"tag":24,"props":5402,"children":5403},{},[5404,5405,5409],{"type":28,"value":872},{"type":23,"tag":31,"props":5406,"children":5407},{"href":3723},[5408],{"type":28,"value":3726},{"type":28,"value":496},{"type":23,"tag":24,"props":5411,"children":5412},{},[5413,5415,5420,5422,5427],{"type":28,"value":5414},"The project is a simplified morse code simulator that animates morse code being sent over a telegraph line. The complete source is available ",{"type":23,"tag":31,"props":5416,"children":5418},{"href":3703,"rel":5417},[35],[5419],{"type":28,"value":3707},{"type":28,"value":5421}," and the running code can be seen ",{"type":23,"tag":31,"props":5423,"children":5425},{"href":3712,"rel":5424},[35],[5426],{"type":28,"value":3707},{"type":28,"value":496},{"type":23,"tag":24,"props":5429,"children":5430},{},[5431],{"type":28,"value":5432},"In this post I'll discuss the code that handles the user input.",{"type":23,"tag":24,"props":5434,"children":5435},{},[5436],{"type":23,"tag":3743,"props":5437,"children":5438},{},[5439],{"type":23,"tag":1179,"props":5440,"children":5441},{},[5442],{"type":28,"value":5443},"Initialization",{"type":23,"tag":92,"props":5445,"children":5447},{"className":3844,"code":5446,"language":3846,"meta":8,"style":8},"init = ->\n   decoder = new MorseDecoder\n\n   communicationLine = new CommunicationLine(\n    'decoder': decoder)\n\n   straightKey = new StraightKeyInput(\n    'el': $('#straight-key-div'), \n    'model': communicationLine)\n\n   communicationLineView = new CommunicationLineView(\n    'el': $('#communication-line-div'), \n    'model': communicationLine)\n\n   decoderView = new DecoderView(\n    'el': $('messageBoxDiv'), \n    'model': decoder)\n\n   drawSignalLine()\n\n$(document).ready init\n",[5448],{"type":23,"tag":99,"props":5449,"children":5450},{"__ignoreMap":8},[5451,5467,5489,5496,5521,5538,5545,5570,5600,5617,5624,5648,5676,5691,5698,5722,5750,5765,5772,5784,5791],{"type":23,"tag":103,"props":5452,"children":5453},{"class":105,"line":106},[5454,5459,5463],{"type":23,"tag":103,"props":5455,"children":5456},{"style":122},[5457],{"type":28,"value":5458},"init",{"type":23,"tag":103,"props":5460,"children":5461},{"style":363},[5462],{"type":28,"value":1124},{"type":23,"tag":103,"props":5464,"children":5465},{"style":363},[5466],{"type":28,"value":3891},{"type":23,"tag":103,"props":5468,"children":5469},{"class":105,"line":186},[5470,5475,5479,5484],{"type":23,"tag":103,"props":5471,"children":5472},{"style":373},[5473],{"type":28,"value":5474},"   decoder",{"type":23,"tag":103,"props":5476,"children":5477},{"style":363},[5478],{"type":28,"value":1124},{"type":23,"tag":103,"props":5480,"children":5481},{"style":363},[5482],{"type":28,"value":5483}," new",{"type":23,"tag":103,"props":5485,"children":5486},{"style":122},[5487],{"type":28,"value":5488}," MorseDecoder\n",{"type":23,"tag":103,"props":5490,"children":5491},{"class":105,"line":247},[5492],{"type":23,"tag":103,"props":5493,"children":5494},{"emptyLinePlaceholder":1321},[5495],{"type":28,"value":1324},{"type":23,"tag":103,"props":5497,"children":5498},{"class":105,"line":290},[5499,5504,5508,5512,5517],{"type":23,"tag":103,"props":5500,"children":5501},{"style":373},[5502],{"type":28,"value":5503},"   communicationLine",{"type":23,"tag":103,"props":5505,"children":5506},{"style":363},[5507],{"type":28,"value":1124},{"type":23,"tag":103,"props":5509,"children":5510},{"style":363},[5511],{"type":28,"value":5483},{"type":23,"tag":103,"props":5513,"children":5514},{"style":122},[5515],{"type":28,"value":5516}," CommunicationLine",{"type":23,"tag":103,"props":5518,"children":5519},{"style":110},[5520],{"type":28,"value":4744},{"type":23,"tag":103,"props":5522,"children":5523},{"class":105,"line":466},[5524,5529,5533],{"type":23,"tag":103,"props":5525,"children":5526},{"style":133},[5527],{"type":28,"value":5528},"    'decoder'",{"type":23,"tag":103,"props":5530,"children":5531},{"style":363},[5532],{"type":28,"value":3886},{"type":23,"tag":103,"props":5534,"children":5535},{"style":110},[5536],{"type":28,"value":5537}," decoder)\n",{"type":23,"tag":103,"props":5539,"children":5540},{"class":105,"line":485},[5541],{"type":23,"tag":103,"props":5542,"children":5543},{"emptyLinePlaceholder":1321},[5544],{"type":28,"value":1324},{"type":23,"tag":103,"props":5546,"children":5547},{"class":105,"line":514},[5548,5553,5557,5561,5566],{"type":23,"tag":103,"props":5549,"children":5550},{"style":373},[5551],{"type":28,"value":5552},"   straightKey",{"type":23,"tag":103,"props":5554,"children":5555},{"style":363},[5556],{"type":28,"value":1124},{"type":23,"tag":103,"props":5558,"children":5559},{"style":363},[5560],{"type":28,"value":5483},{"type":23,"tag":103,"props":5562,"children":5563},{"style":122},[5564],{"type":28,"value":5565}," StraightKeyInput",{"type":23,"tag":103,"props":5567,"children":5568},{"style":110},[5569],{"type":28,"value":4744},{"type":23,"tag":103,"props":5571,"children":5572},{"class":105,"line":533},[5573,5578,5582,5586,5590,5595],{"type":23,"tag":103,"props":5574,"children":5575},{"style":133},[5576],{"type":28,"value":5577},"    'el'",{"type":23,"tag":103,"props":5579,"children":5580},{"style":363},[5581],{"type":28,"value":3886},{"type":23,"tag":103,"props":5583,"children":5584},{"style":122},[5585],{"type":28,"value":1077},{"type":23,"tag":103,"props":5587,"children":5588},{"style":110},[5589],{"type":28,"value":331},{"type":23,"tag":103,"props":5591,"children":5592},{"style":133},[5593],{"type":28,"value":5594},"'#straight-key-div'",{"type":23,"tag":103,"props":5596,"children":5597},{"style":110},[5598],{"type":28,"value":5599},"), \n",{"type":23,"tag":103,"props":5601,"children":5602},{"class":105,"line":552},[5603,5608,5612],{"type":23,"tag":103,"props":5604,"children":5605},{"style":133},[5606],{"type":28,"value":5607},"    'model'",{"type":23,"tag":103,"props":5609,"children":5610},{"style":363},[5611],{"type":28,"value":3886},{"type":23,"tag":103,"props":5613,"children":5614},{"style":110},[5615],{"type":28,"value":5616}," communicationLine)\n",{"type":23,"tag":103,"props":5618,"children":5619},{"class":105,"line":566},[5620],{"type":23,"tag":103,"props":5621,"children":5622},{"emptyLinePlaceholder":1321},[5623],{"type":28,"value":1324},{"type":23,"tag":103,"props":5625,"children":5626},{"class":105,"line":601},[5627,5632,5636,5640,5644],{"type":23,"tag":103,"props":5628,"children":5629},{"style":373},[5630],{"type":28,"value":5631},"   communicationLineView",{"type":23,"tag":103,"props":5633,"children":5634},{"style":363},[5635],{"type":28,"value":1124},{"type":23,"tag":103,"props":5637,"children":5638},{"style":363},[5639],{"type":28,"value":5483},{"type":23,"tag":103,"props":5641,"children":5642},{"style":122},[5643],{"type":28,"value":4639},{"type":23,"tag":103,"props":5645,"children":5646},{"style":110},[5647],{"type":28,"value":4744},{"type":23,"tag":103,"props":5649,"children":5650},{"class":105,"line":610},[5651,5655,5659,5663,5667,5672],{"type":23,"tag":103,"props":5652,"children":5653},{"style":133},[5654],{"type":28,"value":5577},{"type":23,"tag":103,"props":5656,"children":5657},{"style":363},[5658],{"type":28,"value":3886},{"type":23,"tag":103,"props":5660,"children":5661},{"style":122},[5662],{"type":28,"value":1077},{"type":23,"tag":103,"props":5664,"children":5665},{"style":110},[5666],{"type":28,"value":331},{"type":23,"tag":103,"props":5668,"children":5669},{"style":133},[5670],{"type":28,"value":5671},"'#communication-line-div'",{"type":23,"tag":103,"props":5673,"children":5674},{"style":110},[5675],{"type":28,"value":5599},{"type":23,"tag":103,"props":5677,"children":5678},{"class":105,"line":629},[5679,5683,5687],{"type":23,"tag":103,"props":5680,"children":5681},{"style":133},[5682],{"type":28,"value":5607},{"type":23,"tag":103,"props":5684,"children":5685},{"style":363},[5686],{"type":28,"value":3886},{"type":23,"tag":103,"props":5688,"children":5689},{"style":110},[5690],{"type":28,"value":5616},{"type":23,"tag":103,"props":5692,"children":5693},{"class":105,"line":663},[5694],{"type":23,"tag":103,"props":5695,"children":5696},{"emptyLinePlaceholder":1321},[5697],{"type":28,"value":1324},{"type":23,"tag":103,"props":5699,"children":5700},{"class":105,"line":672},[5701,5706,5710,5714,5718],{"type":23,"tag":103,"props":5702,"children":5703},{"style":373},[5704],{"type":28,"value":5705},"   decoderView",{"type":23,"tag":103,"props":5707,"children":5708},{"style":363},[5709],{"type":28,"value":1124},{"type":23,"tag":103,"props":5711,"children":5712},{"style":363},[5713],{"type":28,"value":5483},{"type":23,"tag":103,"props":5715,"children":5716},{"style":122},[5717],{"type":28,"value":3863},{"type":23,"tag":103,"props":5719,"children":5720},{"style":110},[5721],{"type":28,"value":4744},{"type":23,"tag":103,"props":5723,"children":5724},{"class":105,"line":689},[5725,5729,5733,5737,5741,5746],{"type":23,"tag":103,"props":5726,"children":5727},{"style":133},[5728],{"type":28,"value":5577},{"type":23,"tag":103,"props":5730,"children":5731},{"style":363},[5732],{"type":28,"value":3886},{"type":23,"tag":103,"props":5734,"children":5735},{"style":122},[5736],{"type":28,"value":1077},{"type":23,"tag":103,"props":5738,"children":5739},{"style":110},[5740],{"type":28,"value":331},{"type":23,"tag":103,"props":5742,"children":5743},{"style":133},[5744],{"type":28,"value":5745},"'messageBoxDiv'",{"type":23,"tag":103,"props":5747,"children":5748},{"style":110},[5749],{"type":28,"value":5599},{"type":23,"tag":103,"props":5751,"children":5752},{"class":105,"line":698},[5753,5757,5761],{"type":23,"tag":103,"props":5754,"children":5755},{"style":133},[5756],{"type":28,"value":5607},{"type":23,"tag":103,"props":5758,"children":5759},{"style":363},[5760],{"type":28,"value":3886},{"type":23,"tag":103,"props":5762,"children":5763},{"style":110},[5764],{"type":28,"value":5537},{"type":23,"tag":103,"props":5766,"children":5767},{"class":105,"line":707},[5768],{"type":23,"tag":103,"props":5769,"children":5770},{"emptyLinePlaceholder":1321},[5771],{"type":28,"value":1324},{"type":23,"tag":103,"props":5773,"children":5774},{"class":105,"line":1723},[5775,5780],{"type":23,"tag":103,"props":5776,"children":5777},{"style":122},[5778],{"type":28,"value":5779},"   drawSignalLine",{"type":23,"tag":103,"props":5781,"children":5782},{"style":110},[5783],{"type":28,"value":4201},{"type":23,"tag":103,"props":5785,"children":5786},{"class":105,"line":1737},[5787],{"type":23,"tag":103,"props":5788,"children":5789},{"emptyLinePlaceholder":1321},[5790],{"type":28,"value":1324},{"type":23,"tag":103,"props":5792,"children":5793},{"class":105,"line":1745},[5794,5798,5802,5807,5811,5816],{"type":23,"tag":103,"props":5795,"children":5796},{"style":122},[5797],{"type":28,"value":326},{"type":23,"tag":103,"props":5799,"children":5800},{"style":110},[5801],{"type":28,"value":331},{"type":23,"tag":103,"props":5803,"children":5804},{"style":414},[5805],{"type":28,"value":5806},"document",{"type":23,"tag":103,"props":5808,"children":5809},{"style":110},[5810],{"type":28,"value":341},{"type":23,"tag":103,"props":5812,"children":5813},{"style":122},[5814],{"type":28,"value":5815},"ready",{"type":23,"tag":103,"props":5817,"children":5818},{"style":110},[5819],{"type":28,"value":5820}," init\n",{"type":23,"tag":24,"props":5822,"children":5823},{},[5824,5826,5830],{"type":28,"value":5825},"The ",{"type":23,"tag":3743,"props":5827,"children":5828},{},[5829],{"type":28,"value":5458},{"type":28,"value":5831}," function sets up all of the Backbone.js model/view classes. Note that each Backbone view is initialized with both its corresponding HTML element and corresponding model object.",{"type":23,"tag":24,"props":5833,"children":5834},{},[5835,5837,5841],{"type":28,"value":5836},"The ",{"type":23,"tag":3743,"props":5838,"children":5839},{},[5840],{"type":28,"value":5458},{"type":28,"value":5842}," function also draws the \"communication line\" in a canvas element.",{"type":23,"tag":92,"props":5844,"children":5846},{"className":3844,"code":5845,"language":3846,"meta":8,"style":8},"drawSignalLine = ->\n   context = document.getElementById(\n    \"communicationLineCanvas\").getContext('2d')\n\n   context.clearRect(0, 0, \n    context.canvas.width, context.canvas.height)\n\n   context.moveTo(0, 30)\n   context.lineTo(500, 30)\n   context.strokeStyle = \"#000\"\n   context.closePath()\n   context.stroke()\n",[5847],{"type":23,"tag":99,"props":5848,"children":5849},{"__ignoreMap":8},[5850,5866,5894,5922,5929,5961,5969,5976,6008,6041,6058,6073],{"type":23,"tag":103,"props":5851,"children":5852},{"class":105,"line":106},[5853,5858,5862],{"type":23,"tag":103,"props":5854,"children":5855},{"style":122},[5856],{"type":28,"value":5857},"drawSignalLine",{"type":23,"tag":103,"props":5859,"children":5860},{"style":363},[5861],{"type":28,"value":1124},{"type":23,"tag":103,"props":5863,"children":5864},{"style":363},[5865],{"type":28,"value":3891},{"type":23,"tag":103,"props":5867,"children":5868},{"class":105,"line":186},[5869,5874,5878,5882,5886,5890],{"type":23,"tag":103,"props":5870,"children":5871},{"style":373},[5872],{"type":28,"value":5873},"   context",{"type":23,"tag":103,"props":5875,"children":5876},{"style":363},[5877],{"type":28,"value":1124},{"type":23,"tag":103,"props":5879,"children":5880},{"style":414},[5881],{"type":28,"value":4730},{"type":23,"tag":103,"props":5883,"children":5884},{"style":110},[5885],{"type":28,"value":496},{"type":23,"tag":103,"props":5887,"children":5888},{"style":414},[5889],{"type":28,"value":4739},{"type":23,"tag":103,"props":5891,"children":5892},{"style":110},[5893],{"type":28,"value":4744},{"type":23,"tag":103,"props":5895,"children":5896},{"class":105,"line":247},[5897,5902,5906,5910,5914,5918],{"type":23,"tag":103,"props":5898,"children":5899},{"style":133},[5900],{"type":28,"value":5901},"    \"communicationLineCanvas\"",{"type":23,"tag":103,"props":5903,"children":5904},{"style":110},[5905],{"type":28,"value":341},{"type":23,"tag":103,"props":5907,"children":5908},{"style":414},[5909],{"type":28,"value":4761},{"type":23,"tag":103,"props":5911,"children":5912},{"style":110},[5913],{"type":28,"value":331},{"type":23,"tag":103,"props":5915,"children":5916},{"style":133},[5917],{"type":28,"value":4770},{"type":23,"tag":103,"props":5919,"children":5920},{"style":110},[5921],{"type":28,"value":455},{"type":23,"tag":103,"props":5923,"children":5924},{"class":105,"line":290},[5925],{"type":23,"tag":103,"props":5926,"children":5927},{"emptyLinePlaceholder":1321},[5928],{"type":28,"value":1324},{"type":23,"tag":103,"props":5930,"children":5931},{"class":105,"line":466},[5932,5937,5941,5945,5949,5953,5957],{"type":23,"tag":103,"props":5933,"children":5934},{"style":110},[5935],{"type":28,"value":5936},"   context.",{"type":23,"tag":103,"props":5938,"children":5939},{"style":122},[5940],{"type":28,"value":4794},{"type":23,"tag":103,"props":5942,"children":5943},{"style":110},[5944],{"type":28,"value":331},{"type":23,"tag":103,"props":5946,"children":5947},{"style":414},[5948],{"type":28,"value":1233},{"type":23,"tag":103,"props":5950,"children":5951},{"style":110},[5952],{"type":28,"value":360},{"type":23,"tag":103,"props":5954,"children":5955},{"style":414},[5956],{"type":28,"value":1233},{"type":23,"tag":103,"props":5958,"children":5959},{"style":110},[5960],{"type":28,"value":5036},{"type":23,"tag":103,"props":5962,"children":5963},{"class":105,"line":485},[5964],{"type":23,"tag":103,"props":5965,"children":5966},{"style":110},[5967],{"type":28,"value":5968},"    context.canvas.width, context.canvas.height)\n",{"type":23,"tag":103,"props":5970,"children":5971},{"class":105,"line":514},[5972],{"type":23,"tag":103,"props":5973,"children":5974},{"emptyLinePlaceholder":1321},[5975],{"type":28,"value":1324},{"type":23,"tag":103,"props":5977,"children":5978},{"class":105,"line":533},[5979,5983,5987,5991,5995,5999,6004],{"type":23,"tag":103,"props":5980,"children":5981},{"style":110},[5982],{"type":28,"value":5936},{"type":23,"tag":103,"props":5984,"children":5985},{"style":414},[5986],{"type":28,"value":4929},{"type":23,"tag":103,"props":5988,"children":5989},{"style":110},[5990],{"type":28,"value":331},{"type":23,"tag":103,"props":5992,"children":5993},{"style":414},[5994],{"type":28,"value":1233},{"type":23,"tag":103,"props":5996,"children":5997},{"style":110},[5998],{"type":28,"value":360},{"type":23,"tag":103,"props":6000,"children":6001},{"style":414},[6002],{"type":28,"value":6003},"30",{"type":23,"tag":103,"props":6005,"children":6006},{"style":110},[6007],{"type":28,"value":455},{"type":23,"tag":103,"props":6009,"children":6010},{"class":105,"line":552},[6011,6015,6020,6024,6029,6033,6037],{"type":23,"tag":103,"props":6012,"children":6013},{"style":110},[6014],{"type":28,"value":5936},{"type":23,"tag":103,"props":6016,"children":6017},{"style":122},[6018],{"type":28,"value":6019},"lineTo",{"type":23,"tag":103,"props":6021,"children":6022},{"style":110},[6023],{"type":28,"value":331},{"type":23,"tag":103,"props":6025,"children":6026},{"style":414},[6027],{"type":28,"value":6028},"500",{"type":23,"tag":103,"props":6030,"children":6031},{"style":110},[6032],{"type":28,"value":360},{"type":23,"tag":103,"props":6034,"children":6035},{"style":414},[6036],{"type":28,"value":6003},{"type":23,"tag":103,"props":6038,"children":6039},{"style":110},[6040],{"type":28,"value":455},{"type":23,"tag":103,"props":6042,"children":6043},{"class":105,"line":566},[6044,6049,6053],{"type":23,"tag":103,"props":6045,"children":6046},{"style":110},[6047],{"type":28,"value":6048},"   context.strokeStyle ",{"type":23,"tag":103,"props":6050,"children":6051},{"style":363},[6052],{"type":28,"value":130},{"type":23,"tag":103,"props":6054,"children":6055},{"style":133},[6056],{"type":28,"value":6057}," \"#000\"\n",{"type":23,"tag":103,"props":6059,"children":6060},{"class":105,"line":601},[6061,6065,6069],{"type":23,"tag":103,"props":6062,"children":6063},{"style":110},[6064],{"type":28,"value":5936},{"type":23,"tag":103,"props":6066,"children":6067},{"style":122},[6068],{"type":28,"value":5104},{"type":23,"tag":103,"props":6070,"children":6071},{"style":110},[6072],{"type":28,"value":4201},{"type":23,"tag":103,"props":6074,"children":6075},{"class":105,"line":610},[6076,6080,6084],{"type":23,"tag":103,"props":6077,"children":6078},{"style":110},[6079],{"type":28,"value":5936},{"type":23,"tag":103,"props":6081,"children":6082},{"style":122},[6083],{"type":28,"value":5136},{"type":23,"tag":103,"props":6085,"children":6086},{"style":110},[6087],{"type":28,"value":4201},{"type":23,"tag":24,"props":6089,"children":6090},{},[6091],{"type":23,"tag":3743,"props":6092,"children":6093},{},[6094],{"type":23,"tag":1179,"props":6095,"children":6096},{},[6097],{"type":28,"value":6098},"Input View",{"type":23,"tag":24,"props":6100,"children":6101},{},[6102],{"type":28,"value":6103},"The application processes user input using the StraighKeyInput class, a Backbone view class associated with an input button:",{"type":23,"tag":92,"props":6105,"children":6107},{"className":312,"code":6106,"language":314,"meta":8,"style":8},"class StraightKeyInput extends Backbone.View\n\n   initialize: ->\n      @dashTimer = null\n      @dashFlag = false\n      @wordStopTimer = null\n      @wordStopFlag = false\n\n   events:\n      'mousedown #straight-key': 'startTimers',\n      'mouseup #straight-key': 'sendUserInput'\n\n   startTimers: =>\n      @dashTimer = setTimeout(@dashTimerExpired, 250)\n      @wordStopTimer = setTimeout(\n       @wordStopTimerExpired, 1000)\n\n   dashTimerExpired: =>\n      @dashFlag = true\n\n   wordStopTimerExpired: =>\n      @wordStopFlag = true\n\n   sendUserInput: =>\n      if @wordStopFlag\n         @model.addToken(kWordStopToken)\n      else if @dashFlag\n         @model.addToken(kDashToken)\n      else\n         @model.addToken(kDotToken)\n\n      clearTimeout(@dashTimer)\n      clearTimeout(@wordStopTimer)\n      @dashFlag = false\n      @wordStopFlag = false\n",[6108],{"type":23,"tag":99,"props":6109,"children":6110},{"__ignoreMap":8},[6111,6140,6147,6163,6184,6205,6225,6245,6252,6265,6286,6303,6310,6326,6360,6383,6400,6407,6423,6443,6450,6466,6485,6492,6508,6525,6543,6563,6579,6586,6602,6609,6622,6634,6653],{"type":23,"tag":103,"props":6112,"children":6113},{"class":105,"line":106},[6114,6118,6122,6126,6131,6135],{"type":23,"tag":103,"props":6115,"children":6116},{"style":363},[6117],{"type":28,"value":3858},{"type":23,"tag":103,"props":6119,"children":6120},{"style":122},[6121],{"type":28,"value":5565},{"type":23,"tag":103,"props":6123,"children":6124},{"style":363},[6125],{"type":28,"value":3868},{"type":23,"tag":103,"props":6127,"children":6128},{"style":122},[6129],{"type":28,"value":6130}," Backbone",{"type":23,"tag":103,"props":6132,"children":6133},{"style":110},[6134],{"type":28,"value":496},{"type":23,"tag":103,"props":6136,"children":6137},{"style":122},[6138],{"type":28,"value":6139},"View\n",{"type":23,"tag":103,"props":6141,"children":6142},{"class":105,"line":186},[6143],{"type":23,"tag":103,"props":6144,"children":6145},{"emptyLinePlaceholder":1321},[6146],{"type":28,"value":1324},{"type":23,"tag":103,"props":6148,"children":6149},{"class":105,"line":247},[6150,6154,6159],{"type":23,"tag":103,"props":6151,"children":6152},{"style":122},[6153],{"type":28,"value":3881},{"type":23,"tag":103,"props":6155,"children":6156},{"style":110},[6157],{"type":28,"value":6158},": ",{"type":23,"tag":103,"props":6160,"children":6161},{"style":363},[6162],{"type":28,"value":4879},{"type":23,"tag":103,"props":6164,"children":6165},{"class":105,"line":290},[6166,6170,6175,6179],{"type":23,"tag":103,"props":6167,"children":6168},{"style":110},[6169],{"type":28,"value":4191},{"type":23,"tag":103,"props":6171,"children":6172},{"style":122},[6173],{"type":28,"value":6174},"dashTimer",{"type":23,"tag":103,"props":6176,"children":6177},{"style":363},[6178],{"type":28,"value":1124},{"type":23,"tag":103,"props":6180,"children":6181},{"style":414},[6182],{"type":28,"value":6183}," null\n",{"type":23,"tag":103,"props":6185,"children":6186},{"class":105,"line":466},[6187,6191,6196,6200],{"type":23,"tag":103,"props":6188,"children":6189},{"style":110},[6190],{"type":28,"value":4191},{"type":23,"tag":103,"props":6192,"children":6193},{"style":122},[6194],{"type":28,"value":6195},"dashFlag",{"type":23,"tag":103,"props":6197,"children":6198},{"style":363},[6199],{"type":28,"value":1124},{"type":23,"tag":103,"props":6201,"children":6202},{"style":414},[6203],{"type":28,"value":6204}," false\n",{"type":23,"tag":103,"props":6206,"children":6207},{"class":105,"line":485},[6208,6212,6217,6221],{"type":23,"tag":103,"props":6209,"children":6210},{"style":110},[6211],{"type":28,"value":4191},{"type":23,"tag":103,"props":6213,"children":6214},{"style":122},[6215],{"type":28,"value":6216},"wordStopTimer",{"type":23,"tag":103,"props":6218,"children":6219},{"style":363},[6220],{"type":28,"value":1124},{"type":23,"tag":103,"props":6222,"children":6223},{"style":414},[6224],{"type":28,"value":6183},{"type":23,"tag":103,"props":6226,"children":6227},{"class":105,"line":514},[6228,6232,6237,6241],{"type":23,"tag":103,"props":6229,"children":6230},{"style":110},[6231],{"type":28,"value":4191},{"type":23,"tag":103,"props":6233,"children":6234},{"style":122},[6235],{"type":28,"value":6236},"wordStopFlag",{"type":23,"tag":103,"props":6238,"children":6239},{"style":363},[6240],{"type":28,"value":1124},{"type":23,"tag":103,"props":6242,"children":6243},{"style":414},[6244],{"type":28,"value":6204},{"type":23,"tag":103,"props":6246,"children":6247},{"class":105,"line":533},[6248],{"type":23,"tag":103,"props":6249,"children":6250},{"emptyLinePlaceholder":1321},[6251],{"type":28,"value":1324},{"type":23,"tag":103,"props":6253,"children":6254},{"class":105,"line":552},[6255,6260],{"type":23,"tag":103,"props":6256,"children":6257},{"style":122},[6258],{"type":28,"value":6259},"   events",{"type":23,"tag":103,"props":6261,"children":6262},{"style":110},[6263],{"type":28,"value":6264},":\n",{"type":23,"tag":103,"props":6266,"children":6267},{"class":105,"line":566},[6268,6273,6277,6282],{"type":23,"tag":103,"props":6269,"children":6270},{"style":133},[6271],{"type":28,"value":6272},"      'mousedown #straight-key'",{"type":23,"tag":103,"props":6274,"children":6275},{"style":110},[6276],{"type":28,"value":6158},{"type":23,"tag":103,"props":6278,"children":6279},{"style":133},[6280],{"type":28,"value":6281},"'startTimers'",{"type":23,"tag":103,"props":6283,"children":6284},{"style":110},[6285],{"type":28,"value":549},{"type":23,"tag":103,"props":6287,"children":6288},{"class":105,"line":601},[6289,6294,6298],{"type":23,"tag":103,"props":6290,"children":6291},{"style":133},[6292],{"type":28,"value":6293},"      'mouseup #straight-key'",{"type":23,"tag":103,"props":6295,"children":6296},{"style":110},[6297],{"type":28,"value":6158},{"type":23,"tag":103,"props":6299,"children":6300},{"style":133},[6301],{"type":28,"value":6302},"'sendUserInput'\n",{"type":23,"tag":103,"props":6304,"children":6305},{"class":105,"line":610},[6306],{"type":23,"tag":103,"props":6307,"children":6308},{"emptyLinePlaceholder":1321},[6309],{"type":28,"value":1324},{"type":23,"tag":103,"props":6311,"children":6312},{"class":105,"line":629},[6313,6318,6322],{"type":23,"tag":103,"props":6314,"children":6315},{"style":122},[6316],{"type":28,"value":6317},"   startTimers",{"type":23,"tag":103,"props":6319,"children":6320},{"style":110},[6321],{"type":28,"value":6158},{"type":23,"tag":103,"props":6323,"children":6324},{"style":363},[6325],{"type":28,"value":3947},{"type":23,"tag":103,"props":6327,"children":6328},{"class":105,"line":663},[6329,6333,6337,6341,6346,6351,6356],{"type":23,"tag":103,"props":6330,"children":6331},{"style":110},[6332],{"type":28,"value":4191},{"type":23,"tag":103,"props":6334,"children":6335},{"style":122},[6336],{"type":28,"value":6174},{"type":23,"tag":103,"props":6338,"children":6339},{"style":363},[6340],{"type":28,"value":1124},{"type":23,"tag":103,"props":6342,"children":6343},{"style":122},[6344],{"type":28,"value":6345}," setTimeout",{"type":23,"tag":103,"props":6347,"children":6348},{"style":110},[6349],{"type":28,"value":6350},"(@dashTimerExpired, ",{"type":23,"tag":103,"props":6352,"children":6353},{"style":414},[6354],{"type":28,"value":6355},"250",{"type":23,"tag":103,"props":6357,"children":6358},{"style":110},[6359],{"type":28,"value":455},{"type":23,"tag":103,"props":6361,"children":6362},{"class":105,"line":672},[6363,6367,6371,6375,6379],{"type":23,"tag":103,"props":6364,"children":6365},{"style":110},[6366],{"type":28,"value":4191},{"type":23,"tag":103,"props":6368,"children":6369},{"style":122},[6370],{"type":28,"value":6216},{"type":23,"tag":103,"props":6372,"children":6373},{"style":363},[6374],{"type":28,"value":1124},{"type":23,"tag":103,"props":6376,"children":6377},{"style":122},[6378],{"type":28,"value":6345},{"type":23,"tag":103,"props":6380,"children":6381},{"style":110},[6382],{"type":28,"value":4744},{"type":23,"tag":103,"props":6384,"children":6385},{"class":105,"line":689},[6386,6391,6396],{"type":23,"tag":103,"props":6387,"children":6388},{"style":110},[6389],{"type":28,"value":6390},"       @wordStopTimerExpired, ",{"type":23,"tag":103,"props":6392,"children":6393},{"style":414},[6394],{"type":28,"value":6395},"1000",{"type":23,"tag":103,"props":6397,"children":6398},{"style":110},[6399],{"type":28,"value":455},{"type":23,"tag":103,"props":6401,"children":6402},{"class":105,"line":698},[6403],{"type":23,"tag":103,"props":6404,"children":6405},{"emptyLinePlaceholder":1321},[6406],{"type":28,"value":1324},{"type":23,"tag":103,"props":6408,"children":6409},{"class":105,"line":707},[6410,6415,6419],{"type":23,"tag":103,"props":6411,"children":6412},{"style":122},[6413],{"type":28,"value":6414},"   dashTimerExpired",{"type":23,"tag":103,"props":6416,"children":6417},{"style":110},[6418],{"type":28,"value":6158},{"type":23,"tag":103,"props":6420,"children":6421},{"style":363},[6422],{"type":28,"value":3947},{"type":23,"tag":103,"props":6424,"children":6425},{"class":105,"line":1723},[6426,6430,6434,6438],{"type":23,"tag":103,"props":6427,"children":6428},{"style":110},[6429],{"type":28,"value":4191},{"type":23,"tag":103,"props":6431,"children":6432},{"style":122},[6433],{"type":28,"value":6195},{"type":23,"tag":103,"props":6435,"children":6436},{"style":363},[6437],{"type":28,"value":1124},{"type":23,"tag":103,"props":6439,"children":6440},{"style":414},[6441],{"type":28,"value":6442}," true\n",{"type":23,"tag":103,"props":6444,"children":6445},{"class":105,"line":1737},[6446],{"type":23,"tag":103,"props":6447,"children":6448},{"emptyLinePlaceholder":1321},[6449],{"type":28,"value":1324},{"type":23,"tag":103,"props":6451,"children":6452},{"class":105,"line":1745},[6453,6458,6462],{"type":23,"tag":103,"props":6454,"children":6455},{"style":122},[6456],{"type":28,"value":6457},"   wordStopTimerExpired",{"type":23,"tag":103,"props":6459,"children":6460},{"style":110},[6461],{"type":28,"value":6158},{"type":23,"tag":103,"props":6463,"children":6464},{"style":363},[6465],{"type":28,"value":3947},{"type":23,"tag":103,"props":6467,"children":6468},{"class":105,"line":2560},[6469,6473,6477,6481],{"type":23,"tag":103,"props":6470,"children":6471},{"style":110},[6472],{"type":28,"value":4191},{"type":23,"tag":103,"props":6474,"children":6475},{"style":122},[6476],{"type":28,"value":6236},{"type":23,"tag":103,"props":6478,"children":6479},{"style":363},[6480],{"type":28,"value":1124},{"type":23,"tag":103,"props":6482,"children":6483},{"style":414},[6484],{"type":28,"value":6442},{"type":23,"tag":103,"props":6486,"children":6487},{"class":105,"line":2619},[6488],{"type":23,"tag":103,"props":6489,"children":6490},{"emptyLinePlaceholder":1321},[6491],{"type":28,"value":1324},{"type":23,"tag":103,"props":6493,"children":6494},{"class":105,"line":2644},[6495,6500,6504],{"type":23,"tag":103,"props":6496,"children":6497},{"style":122},[6498],{"type":28,"value":6499},"   sendUserInput",{"type":23,"tag":103,"props":6501,"children":6502},{"style":110},[6503],{"type":28,"value":6158},{"type":23,"tag":103,"props":6505,"children":6506},{"style":363},[6507],{"type":28,"value":3947},{"type":23,"tag":103,"props":6509,"children":6510},{"class":105,"line":2665},[6511,6515,6520],{"type":23,"tag":103,"props":6512,"children":6513},{"style":122},[6514],{"type":28,"value":4236},{"type":23,"tag":103,"props":6516,"children":6517},{"style":110},[6518],{"type":28,"value":6519}," @",{"type":23,"tag":103,"props":6521,"children":6522},{"style":122},[6523],{"type":28,"value":6524},"wordStopFlag\n",{"type":23,"tag":103,"props":6526,"children":6527},{"class":105,"line":2674},[6528,6533,6538],{"type":23,"tag":103,"props":6529,"children":6530},{"style":110},[6531],{"type":28,"value":6532},"         @model.",{"type":23,"tag":103,"props":6534,"children":6535},{"style":122},[6536],{"type":28,"value":6537},"addToken",{"type":23,"tag":103,"props":6539,"children":6540},{"style":110},[6541],{"type":28,"value":6542},"(kWordStopToken)\n",{"type":23,"tag":103,"props":6544,"children":6545},{"class":105,"line":2682},[6546,6550,6554,6558],{"type":23,"tag":103,"props":6547,"children":6548},{"style":122},[6549],{"type":28,"value":4308},{"type":23,"tag":103,"props":6551,"children":6552},{"style":122},[6553],{"type":28,"value":1933},{"type":23,"tag":103,"props":6555,"children":6556},{"style":110},[6557],{"type":28,"value":6519},{"type":23,"tag":103,"props":6559,"children":6560},{"style":122},[6561],{"type":28,"value":6562},"dashFlag\n",{"type":23,"tag":103,"props":6564,"children":6565},{"class":105,"line":2721},[6566,6570,6574],{"type":23,"tag":103,"props":6567,"children":6568},{"style":110},[6569],{"type":28,"value":6532},{"type":23,"tag":103,"props":6571,"children":6572},{"style":122},[6573],{"type":28,"value":6537},{"type":23,"tag":103,"props":6575,"children":6576},{"style":110},[6577],{"type":28,"value":6578},"(kDashToken)\n",{"type":23,"tag":103,"props":6580,"children":6581},{"class":105,"line":2729},[6582],{"type":23,"tag":103,"props":6583,"children":6584},{"style":122},[6585],{"type":28,"value":4399},{"type":23,"tag":103,"props":6587,"children":6588},{"class":105,"line":2738},[6589,6593,6597],{"type":23,"tag":103,"props":6590,"children":6591},{"style":110},[6592],{"type":28,"value":6532},{"type":23,"tag":103,"props":6594,"children":6595},{"style":122},[6596],{"type":28,"value":6537},{"type":23,"tag":103,"props":6598,"children":6599},{"style":110},[6600],{"type":28,"value":6601},"(kDotToken)\n",{"type":23,"tag":103,"props":6603,"children":6604},{"class":105,"line":2771},[6605],{"type":23,"tag":103,"props":6606,"children":6607},{"emptyLinePlaceholder":1321},[6608],{"type":28,"value":1324},{"type":23,"tag":103,"props":6610,"children":6611},{"class":105,"line":2784},[6612,6617],{"type":23,"tag":103,"props":6613,"children":6614},{"style":122},[6615],{"type":28,"value":6616},"      clearTimeout",{"type":23,"tag":103,"props":6618,"children":6619},{"style":110},[6620],{"type":28,"value":6621},"(@dashTimer)\n",{"type":23,"tag":103,"props":6623,"children":6624},{"class":105,"line":2792},[6625,6629],{"type":23,"tag":103,"props":6626,"children":6627},{"style":122},[6628],{"type":28,"value":6616},{"type":23,"tag":103,"props":6630,"children":6631},{"style":110},[6632],{"type":28,"value":6633},"(@wordStopTimer)\n",{"type":23,"tag":103,"props":6635,"children":6636},{"class":105,"line":2817},[6637,6641,6645,6649],{"type":23,"tag":103,"props":6638,"children":6639},{"style":110},[6640],{"type":28,"value":4191},{"type":23,"tag":103,"props":6642,"children":6643},{"style":122},[6644],{"type":28,"value":6195},{"type":23,"tag":103,"props":6646,"children":6647},{"style":363},[6648],{"type":28,"value":1124},{"type":23,"tag":103,"props":6650,"children":6651},{"style":414},[6652],{"type":28,"value":6204},{"type":23,"tag":103,"props":6654,"children":6655},{"class":105,"line":2825},[6656,6660,6664,6668],{"type":23,"tag":103,"props":6657,"children":6658},{"style":110},[6659],{"type":28,"value":4191},{"type":23,"tag":103,"props":6661,"children":6662},{"style":122},[6663],{"type":28,"value":6236},{"type":23,"tag":103,"props":6665,"children":6666},{"style":363},[6667],{"type":28,"value":1124},{"type":23,"tag":103,"props":6669,"children":6670},{"style":414},[6671],{"type":28,"value":6204},{"type":23,"tag":24,"props":6673,"children":6674},{},[6675],{"type":28,"value":6676},"The class uses two timers to determine which \"token\" a user intends to send across the line. Using Backbone's declarative style for event binding, I bind the mousedown event to a function that starts both timers. The mouseup event is bound to a function that pushes the appropriate token to the model based on how long the user held down the input button.",{"type":23,"tag":24,"props":6678,"children":6679},{},[6680],{"type":23,"tag":3743,"props":6681,"children":6682},{},[6683],{"type":23,"tag":1179,"props":6684,"children":6685},{},[6686],{"type":28,"value":6687},"Input Model",{"type":23,"tag":92,"props":6689,"children":6691},{"className":3844,"code":6690,"language":3846,"meta":8,"style":8},"class CommunicationLine extends Backbone.Model\n   initialize: (options) =>\n      @inputQueue = []\n\n      @communicationLine = \n       ['', '', '', '', '', '', '', '', '', '']\n\n      @decoder = options.decoder\n      setInterval(@moveDataOneStep, 100)\n\n   addToken: (token) =>\n      @inputQueue.push(token)\n\n   moveDataOneStep: =>\n      @decoder.processToken(@communicationLine.pop())\n      nextToken = @inputQueue.shift()\n\n      @communicationLine.unshift(\n       if undefined == nextToken then '' else nextToken)\n\n      @trigger('hasNewData', @communicationLine)\n",[6692],{"type":23,"tag":99,"props":6693,"children":6694},{"__ignoreMap":8},[6695,6714,6734,6750,6757,6773,6862,6869,6886,6908,6915,6935,6951,6958,6974,7001,7027,7034,7051,7093,7100],{"type":23,"tag":103,"props":6696,"children":6697},{"class":105,"line":106},[6698,6702,6706,6710],{"type":23,"tag":103,"props":6699,"children":6700},{"style":363},[6701],{"type":28,"value":3858},{"type":23,"tag":103,"props":6703,"children":6704},{"style":122},[6705],{"type":28,"value":5516},{"type":23,"tag":103,"props":6707,"children":6708},{"style":363},[6709],{"type":28,"value":3868},{"type":23,"tag":103,"props":6711,"children":6712},{"style":122},[6713],{"type":28,"value":4072},{"type":23,"tag":103,"props":6715,"children":6716},{"class":105,"line":186},[6717,6721,6725,6730],{"type":23,"tag":103,"props":6718,"children":6719},{"style":122},[6720],{"type":28,"value":3881},{"type":23,"tag":103,"props":6722,"children":6723},{"style":363},[6724],{"type":28,"value":3886},{"type":23,"tag":103,"props":6726,"children":6727},{"style":110},[6728],{"type":28,"value":6729}," (options) ",{"type":23,"tag":103,"props":6731,"children":6732},{"style":363},[6733],{"type":28,"value":3947},{"type":23,"tag":103,"props":6735,"children":6736},{"class":105,"line":247},[6737,6742,6746],{"type":23,"tag":103,"props":6738,"children":6739},{"style":110},[6740],{"type":28,"value":6741},"      @inputQueue ",{"type":23,"tag":103,"props":6743,"children":6744},{"style":363},[6745],{"type":28,"value":130},{"type":23,"tag":103,"props":6747,"children":6748},{"style":110},[6749],{"type":28,"value":4166},{"type":23,"tag":103,"props":6751,"children":6752},{"class":105,"line":290},[6753],{"type":23,"tag":103,"props":6754,"children":6755},{"emptyLinePlaceholder":1321},[6756],{"type":28,"value":1324},{"type":23,"tag":103,"props":6758,"children":6759},{"class":105,"line":466},[6760,6765,6769],{"type":23,"tag":103,"props":6761,"children":6762},{"style":110},[6763],{"type":28,"value":6764},"      @communicationLine ",{"type":23,"tag":103,"props":6766,"children":6767},{"style":363},[6768],{"type":28,"value":130},{"type":23,"tag":103,"props":6770,"children":6771},{"style":110},[6772],{"type":28,"value":4277},{"type":23,"tag":103,"props":6774,"children":6775},{"class":105,"line":485},[6776,6781,6785,6789,6793,6797,6801,6805,6809,6813,6817,6821,6825,6829,6833,6837,6841,6845,6849,6853,6857],{"type":23,"tag":103,"props":6777,"children":6778},{"style":110},[6779],{"type":28,"value":6780},"       [",{"type":23,"tag":103,"props":6782,"children":6783},{"style":133},[6784],{"type":28,"value":1086},{"type":23,"tag":103,"props":6786,"children":6787},{"style":110},[6788],{"type":28,"value":360},{"type":23,"tag":103,"props":6790,"children":6791},{"style":133},[6792],{"type":28,"value":1086},{"type":23,"tag":103,"props":6794,"children":6795},{"style":110},[6796],{"type":28,"value":360},{"type":23,"tag":103,"props":6798,"children":6799},{"style":133},[6800],{"type":28,"value":1086},{"type":23,"tag":103,"props":6802,"children":6803},{"style":110},[6804],{"type":28,"value":360},{"type":23,"tag":103,"props":6806,"children":6807},{"style":133},[6808],{"type":28,"value":1086},{"type":23,"tag":103,"props":6810,"children":6811},{"style":110},[6812],{"type":28,"value":360},{"type":23,"tag":103,"props":6814,"children":6815},{"style":133},[6816],{"type":28,"value":1086},{"type":23,"tag":103,"props":6818,"children":6819},{"style":110},[6820],{"type":28,"value":360},{"type":23,"tag":103,"props":6822,"children":6823},{"style":133},[6824],{"type":28,"value":1086},{"type":23,"tag":103,"props":6826,"children":6827},{"style":110},[6828],{"type":28,"value":360},{"type":23,"tag":103,"props":6830,"children":6831},{"style":133},[6832],{"type":28,"value":1086},{"type":23,"tag":103,"props":6834,"children":6835},{"style":110},[6836],{"type":28,"value":360},{"type":23,"tag":103,"props":6838,"children":6839},{"style":133},[6840],{"type":28,"value":1086},{"type":23,"tag":103,"props":6842,"children":6843},{"style":110},[6844],{"type":28,"value":360},{"type":23,"tag":103,"props":6846,"children":6847},{"style":133},[6848],{"type":28,"value":1086},{"type":23,"tag":103,"props":6850,"children":6851},{"style":110},[6852],{"type":28,"value":360},{"type":23,"tag":103,"props":6854,"children":6855},{"style":133},[6856],{"type":28,"value":1086},{"type":23,"tag":103,"props":6858,"children":6859},{"style":110},[6860],{"type":28,"value":6861},"]\n",{"type":23,"tag":103,"props":6863,"children":6864},{"class":105,"line":514},[6865],{"type":23,"tag":103,"props":6866,"children":6867},{"emptyLinePlaceholder":1321},[6868],{"type":28,"value":1324},{"type":23,"tag":103,"props":6870,"children":6871},{"class":105,"line":533},[6872,6877,6881],{"type":23,"tag":103,"props":6873,"children":6874},{"style":110},[6875],{"type":28,"value":6876},"      @decoder ",{"type":23,"tag":103,"props":6878,"children":6879},{"style":363},[6880],{"type":28,"value":130},{"type":23,"tag":103,"props":6882,"children":6883},{"style":110},[6884],{"type":28,"value":6885}," options.decoder\n",{"type":23,"tag":103,"props":6887,"children":6888},{"class":105,"line":552},[6889,6894,6899,6904],{"type":23,"tag":103,"props":6890,"children":6891},{"style":414},[6892],{"type":28,"value":6893},"      setInterval",{"type":23,"tag":103,"props":6895,"children":6896},{"style":110},[6897],{"type":28,"value":6898},"(@moveDataOneStep, ",{"type":23,"tag":103,"props":6900,"children":6901},{"style":414},[6902],{"type":28,"value":6903},"100",{"type":23,"tag":103,"props":6905,"children":6906},{"style":110},[6907],{"type":28,"value":455},{"type":23,"tag":103,"props":6909,"children":6910},{"class":105,"line":566},[6911],{"type":23,"tag":103,"props":6912,"children":6913},{"emptyLinePlaceholder":1321},[6914],{"type":28,"value":1324},{"type":23,"tag":103,"props":6916,"children":6917},{"class":105,"line":601},[6918,6923,6927,6931],{"type":23,"tag":103,"props":6919,"children":6920},{"style":122},[6921],{"type":28,"value":6922},"   addToken",{"type":23,"tag":103,"props":6924,"children":6925},{"style":363},[6926],{"type":28,"value":3886},{"type":23,"tag":103,"props":6928,"children":6929},{"style":110},[6930],{"type":28,"value":3942},{"type":23,"tag":103,"props":6932,"children":6933},{"style":363},[6934],{"type":28,"value":3947},{"type":23,"tag":103,"props":6936,"children":6937},{"class":105,"line":610},[6938,6943,6947],{"type":23,"tag":103,"props":6939,"children":6940},{"style":110},[6941],{"type":28,"value":6942},"      @inputQueue.",{"type":23,"tag":103,"props":6944,"children":6945},{"style":414},[6946],{"type":28,"value":4412},{"type":23,"tag":103,"props":6948,"children":6949},{"style":110},[6950],{"type":28,"value":4417},{"type":23,"tag":103,"props":6952,"children":6953},{"class":105,"line":629},[6954],{"type":23,"tag":103,"props":6955,"children":6956},{"emptyLinePlaceholder":1321},[6957],{"type":28,"value":1324},{"type":23,"tag":103,"props":6959,"children":6960},{"class":105,"line":663},[6961,6966,6970],{"type":23,"tag":103,"props":6962,"children":6963},{"style":122},[6964],{"type":28,"value":6965},"   moveDataOneStep",{"type":23,"tag":103,"props":6967,"children":6968},{"style":363},[6969],{"type":28,"value":3886},{"type":23,"tag":103,"props":6971,"children":6972},{"style":363},[6973],{"type":28,"value":4096},{"type":23,"tag":103,"props":6975,"children":6976},{"class":105,"line":672},[6977,6982,6986,6991,6996],{"type":23,"tag":103,"props":6978,"children":6979},{"style":110},[6980],{"type":28,"value":6981},"      @decoder.",{"type":23,"tag":103,"props":6983,"children":6984},{"style":122},[6985],{"type":28,"value":4600},{"type":23,"tag":103,"props":6987,"children":6988},{"style":110},[6989],{"type":28,"value":6990},"(@communicationLine.",{"type":23,"tag":103,"props":6992,"children":6993},{"style":414},[6994],{"type":28,"value":6995},"pop",{"type":23,"tag":103,"props":6997,"children":6998},{"style":110},[6999],{"type":28,"value":7000},"())\n",{"type":23,"tag":103,"props":7002,"children":7003},{"class":105,"line":689},[7004,7009,7013,7018,7023],{"type":23,"tag":103,"props":7005,"children":7006},{"style":373},[7007],{"type":28,"value":7008},"      nextToken",{"type":23,"tag":103,"props":7010,"children":7011},{"style":363},[7012],{"type":28,"value":1124},{"type":23,"tag":103,"props":7014,"children":7015},{"style":110},[7016],{"type":28,"value":7017}," @inputQueue.",{"type":23,"tag":103,"props":7019,"children":7020},{"style":414},[7021],{"type":28,"value":7022},"shift",{"type":23,"tag":103,"props":7024,"children":7025},{"style":110},[7026],{"type":28,"value":4201},{"type":23,"tag":103,"props":7028,"children":7029},{"class":105,"line":698},[7030],{"type":23,"tag":103,"props":7031,"children":7032},{"emptyLinePlaceholder":1321},[7033],{"type":28,"value":1324},{"type":23,"tag":103,"props":7035,"children":7036},{"class":105,"line":707},[7037,7042,7047],{"type":23,"tag":103,"props":7038,"children":7039},{"style":110},[7040],{"type":28,"value":7041},"      @communicationLine.",{"type":23,"tag":103,"props":7043,"children":7044},{"style":414},[7045],{"type":28,"value":7046},"unshift",{"type":23,"tag":103,"props":7048,"children":7049},{"style":110},[7050],{"type":28,"value":4744},{"type":23,"tag":103,"props":7052,"children":7053},{"class":105,"line":1723},[7054,7059,7063,7068,7073,7078,7083,7088],{"type":23,"tag":103,"props":7055,"children":7056},{"style":363},[7057],{"type":28,"value":7058},"       if",{"type":23,"tag":103,"props":7060,"children":7061},{"style":414},[7062],{"type":28,"value":450},{"type":23,"tag":103,"props":7064,"children":7065},{"style":363},[7066],{"type":28,"value":7067}," ==",{"type":23,"tag":103,"props":7069,"children":7070},{"style":110},[7071],{"type":28,"value":7072}," nextToken ",{"type":23,"tag":103,"props":7074,"children":7075},{"style":363},[7076],{"type":28,"value":7077},"then",{"type":23,"tag":103,"props":7079,"children":7080},{"style":133},[7081],{"type":28,"value":7082}," ''",{"type":23,"tag":103,"props":7084,"children":7085},{"style":363},[7086],{"type":28,"value":7087}," else",{"type":23,"tag":103,"props":7089,"children":7090},{"style":110},[7091],{"type":28,"value":7092}," nextToken)\n",{"type":23,"tag":103,"props":7094,"children":7095},{"class":105,"line":1737},[7096],{"type":23,"tag":103,"props":7097,"children":7098},{"emptyLinePlaceholder":1321},[7099],{"type":28,"value":1324},{"type":23,"tag":103,"props":7101,"children":7102},{"class":105,"line":1745},[7103,7107,7111,7115,7119],{"type":23,"tag":103,"props":7104,"children":7105},{"style":110},[7106],{"type":28,"value":4191},{"type":23,"tag":103,"props":7108,"children":7109},{"style":122},[7110],{"type":28,"value":4370},{"type":23,"tag":103,"props":7112,"children":7113},{"style":110},[7114],{"type":28,"value":331},{"type":23,"tag":103,"props":7116,"children":7117},{"style":133},[7118],{"type":28,"value":4682},{"type":23,"tag":103,"props":7120,"children":7121},{"style":110},[7122],{"type":28,"value":7123},", @communicationLine)\n",{"type":23,"tag":24,"props":7125,"children":7126},{},[7127],{"type":28,"value":7128},"The CommunicationLine class is a Backbone model class that represents the tokens currently moving across the telegraph line. It also contains a queue that holds the input tokens generated by the user. The class also holds a reference to the object responsible for decoding the user input (more on that tomorrow).",{"type":23,"tag":24,"props":7130,"children":7131},{},[7132],{"type":28,"value":7133},"Every 100 milliseconds, the communication line shifts its tokens over one spot. The token popped off the line is passed to the decoder. The model then checks the input queue to determine if a user-generated token is available to be pushed onto the line. If not, the model pushes a default token (an empty string). The model then triggers an event to indicate the communication line state has changed and that the object representing the communication line view needs to be re-rendered (more on that tomorrow).",{"type":23,"tag":3641,"props":7135,"children":7136},{},[7137],{"type":28,"value":3645},{"title":8,"searchDepth":247,"depth":247,"links":7139},[],"content:rbrubaker:2012-06:coffe-backbone-1.md","rbrubaker/2012-06/coffe-backbone-1.md","rbrubaker/2012-06/coffe-backbone-1",{"user":3792,"name":3793},1780330272570]